-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stiff ode integrator gives wrong result #1370
Comments
This is probably down to the estimation of the Jacobian. The implementation is a straight MATLAB port of some code I wrote in a simulation class, and I'm not surprised it's not good enough. See also #615; I actually never figured out how to make the API work for providing a different Jacobian function. Maybe after a few months not working on it I'll be able to sort it out. Better algorithms for estimating the Jacobian are also welcome. |
I've just gone back to take a look at ode4s_kr(F, G, tspan, x0) = oderosenbrock(F, G, tspan, x0, kr4_coefficients...) Where G is a function of the form |
It doesn't seem to work even when the jacobian is provided. Below is the jacobian for the above example - function jac(t, y)
no_osc = int (size(y,1) / 2 )
jy = zeros(no_osc*2, no_osc*2)
for ii = 1 : no_osc
jy[ii,no_osc+ii] = 1
jy[no_osc+ii,ii] = -1 - 2000. * y[ii] * y[no_osc+ii]
jy[no_osc+ii,no_osc+ii] = -1000. * ( y[ii] * y[ii] - 1.0 )
end
return jy
end |
Just noticed your timesteps are pretty large. The stiff solver we have is not adaptive, unlike MATLAB's |
ode45_fb is also not working. i get the following error - Step size grew too small. t=0.0, h=7.52026195675261e-29, x=[0.302402, 0.936122, 0.264298, 0.60962] I was getting the same error in ode45 also. I can not crank down the timesteps for ode4s etc because the period of the system is very large and it will make the output a very large array which would be a problem as my system of interest is already a very large one. |
For the sake of understanding whether the stiff method is implemented correctly, could you run a smaller timestep over a shorter period of time to see if it draws the solution closer? The It's sounding likely that none of the current algorithms are suitable for your problem, which makes this similar to #75. As I said before, more or improved solvers are certainly a welcome contribution. |
housekeeping: see SciML/ODE.jl#1 for continuation. |
The stiff ode integrator ode4s_kr gives wrong answers instead of failing. The code given below is an example of this behavior
[pao: formatting]
The text was updated successfully, but these errors were encountered: