Skip to content

Commit

Permalink
Merge pull request #1048 from prbzrg/new-AlgorithmInterpretation
Browse files Browse the repository at this point in the history
update for new `AlgorithmInterpretation`
  • Loading branch information
ChrisRackauckas authored Sep 2, 2024
2 parents 4baff6b + aed8d48 commit fdafa9c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ NonlinearSolve = "3"
OrdinaryDiffEq = "6.53"
RecursiveArrayTools = "3"
Reexport = "1.0"
SciMLBase = "2"
SciMLBase = "2.51"
SteadyStateDiffEq = "2"
StochasticDiffEq = "6.61"
StochasticDiffEq = "6.69"
Sundials = "4.19"
julia = "1.9"

Expand Down
1 change: 1 addition & 0 deletions src/DifferentialEquations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ using LinearAlgebra
import DiffEqBase: solve
@reexport using LinearSolve
using NonlinearSolve
import SciMLBase

include("default_solve.jl")
include("default_arg_parsing.jl")
Expand Down
7 changes: 4 additions & 3 deletions src/sde_default_alg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ function default_algorithm(
end

is_stiff = :stiff alg_hints
is_stratonovich = :Stratonovich alg_hints
is_stratonovich = :stratonovich alg_hints
if is_stiff || prob.f.mass_matrix !== I
alg = ImplicitRKMil(autodiff = false)
end

if is_stratonovich
if is_stiff || prob.f.mass_matrix !== I
alg = ImplicitRKMil(autodiff = false, interpretation = :Stratonovich)
alg = ImplicitRKMil(autodiff = false,
interpretation = SciMLBase.AlgorithmInterpretation.Stratonovich)
else
alg = RKMil(interpretation = :Stratonovich)
alg = RKMil(interpretation = SciMLBase.AlgorithmInterpretation.Stratonovich)
end
end

Expand Down
8 changes: 5 additions & 3 deletions test/default_sde_alg_test.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DifferentialEquations, Test
import SciMLBase

f_additive(u, p, t) = @. p[2] / sqrt(1 + t) - u / (2 * (1 + t))
σ_additive(u, p, t) = @. p[1] * p[2] / sqrt(1 + t)
Expand All @@ -17,8 +18,9 @@ sol = solve(prob, dt = 1 / 2^(3))
sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:additive])
@test sol.alg isa SOSRA

sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:Stratonovich])
@test StochasticDiffEq.alg_interpretation(sol.alg) == :Stratonovich
sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:stratonovich])
@test SciMLBase.alg_interpretation(sol.alg) ==
SciMLBase.AlgorithmInterpretation.Stratonovich
@test sol.alg isa RKMil

f = (du, u, p, t) -> du .= 1.01u
Expand All @@ -43,5 +45,5 @@ sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:stiff])
sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:additive])
@test sol.alg isa SOSRA

sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:Stratonovich])
sol = solve(prob, dt = 1 / 2^(3), alg_hints = [:stratonovich])
@test sol.alg isa LambaEulerHeun

0 comments on commit fdafa9c

Please sign in to comment.