diff --git a/src/ODE.jl b/src/ODE.jl index 8fb1642a6..893a7f1be 100644 --- a/src/ODE.jl +++ b/src/ODE.jl @@ -18,6 +18,10 @@ export ode4s, ode4ms, ode4 # oderosenbrock, ode4s, ode4s_kr, ode4s_s, # ode4ms, ode_ms +############################################################################### +## HELPER FUNCTIONS +############################################################################### + # estimator for initial step based on book # "Solving Ordinary Differential Equations I" by Hairer et al., p.169 function hinit(F, x0, t0, p, reltol, abstol) @@ -44,6 +48,11 @@ function hinit(F, x0, t0, p, reltol, abstol) h = min(100.0*h0, h1) end +############################################################################### +## NON-STIFF SOLVERS +############################################################################### + +# NOTE: in the near future ode23 will be replaced by ode23_bs #ODE23 Solve non-stiff differential equations. # @@ -301,6 +310,7 @@ function oderkf(F, x0, tspan, p, a, bs, bp; reltol = 1.0e-5, abstol = 1.0e-8, return tout, xout end + # Bogacki–Shampine coefficients const bs_coefficients = (3, [ 0 0 0 0 @@ -336,6 +346,7 @@ const dp_coefficients = (5, ) ode45_dp(F, x0, tspan; kwargs...) = oderkf(F, x0, tspan, dp_coefficients...; kwargs...) + # Fehlberg coefficients const fb_coefficients = (5, [ 0 0 0 0 0 @@ -351,6 +362,7 @@ const fb_coefficients = (5, ) ode45_fb(F, x0, tspan; kwargs...) = oderkf(F, x0, tspan, fb_coefficients...; kwargs...) + # Cash-Karp coefficients # Numerical Recipes in Fortran 77 const ck_coefficients = (5, @@ -398,7 +410,7 @@ const ode78 = ode78_fb # Use Dormand Prince version of ode45 by default const ode45 = ode45_dp -# some higher-order embedded methods can be found in: +# more higher-order embedded methods can be found in: # P.J. Prince and J.R.Dormand: High order embedded Runge-Kutta formulae, Journal of Computational and Applied Mathematics 7(1), 1981. @@ -461,7 +473,7 @@ function fdjacobian(F, x, t) end # ODE23S Solve stiff systems based on a modified Rosenbrock triple -# (also used by MATLABS ODE23s); see Sec. 4.1 in +# (also used by MATLAB's ODE23s); see Sec. 4.1 in # # [SR97] L.F. Shampine and M.W. Reichelt: "The MATLAB ODE Suite," SIAM Journal on Scientific Computing, Vol. 18, 1997, pp. 1–22 #