从 Julia 中的 SDE 求解器获取更新

问题描述 投票:0回答:1

我正在 Julia 中求解随机微分方程组:

#define drift fuction
F!(du,u,t,p)=...
#define noise function 
G!(du,u,t,p)=...

#constructing and solving the problem

u_0=zeros(100,100)#initial condition
tspan=(0.0,10.0)
problem=SDEProblem(F!,G!,u_0,tspan,p)

solution=solve(problem,SOSRA(),reltol=1e-3,abstol=1e-3,save_everystep = false) 

现在,我在here读到,您可以使用关键字参数“progress”来获取完成运行的剩余秒数的更新,并且您可以通过参数“progress_steps”设置的频率来获取此信息:

solution=solve(problem,SOSRA(),reltol=1e-3,abstol=1e-3,save_everystep = false,progress=true,progress_steps=1000) 

但是,我有兴趣从求解器获取更详细的更新,例如当前选择的 $dt$ (用于自适应算法)、当前时间 $t$ 以及解的当前最大值 $u_{max}$。我在here读到,至少对于 ODE 来说,这应该可以通过“progress_message”实现。但是我不知道使其工作的精确语法。 另外,我希望可能将这些更新打印到 .txt 文件中,而不是将它们放在终端中。有没有办法做到这一点? 谢谢!

我已经尝试过了

solution=solve(problem,SOSRA(),reltol=1e-3,abstol=1e-3,save_everystep = false, progress=true,progress_message=true) 

但它给出了一个错误

julia differential-equations stochastic-process differentialequations.jl
1个回答
0
投票

您可能想使用较低级别的

init
step!
界面。

具体来说,

integrator = init(problem,SOSRA(),reltol=1e-3,abstol=1e-3)
step!(integrator) # takes 1 timestep
step!(integrator, .4) # steps until t==0.4
© www.soinside.com 2019 - 2024. All rights reserved.