Skip to content

Commit ea9b83d

Browse files
committed
check that simulations run
1 parent 72438a5 commit ea9b83d

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

src/StochasticDiffEq.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ using DocStringExtensions
165165

166166
export RandomEM
167167

168-
export IteratedIntegralApprox, IICommutative, IIWiktorsson
168+
export IteratedIntegralApprox, IICommutative, IILevyArea
169169

170170
#General Functions
171171
export solve, init, solve!, step!

src/iterated_integrals.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ function get_Jalg(ΔW, dt, prob, alg)
115115
end
116116
end
117117
else
118-
return alg.ii_approx
118+
if isinplace(prob)
119+
IteratedIntegralAlgorithm_iip(ΔW, alg.ii_approx)
120+
else
121+
return alg.ii_approx
122+
end
119123
end
120124
end
121125

test/levy_areas.jl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,34 @@ end
133133
@time test_compare_sample_mean_and_var(alg, 1.0, 2)
134134
end
135135
end
136+
137+
@testset "Simulate non-com. SDEs tests" begin
138+
u₀ = [0.0,0.0,0.0]
139+
f(u,p,t) = [0.0,0.0,0.0]
140+
g(u,p,t) = [1.0 0.0;0.0 1.0;0.0 u[1]]
141+
f!(du,u,p,t) = du .*= false
142+
function g!(du,u,p,t)
143+
du[1,1] = 1.0
144+
du[2,2] = 1.0
145+
du[3,2] = u[1]
146+
return nothing
147+
end
148+
dt = 1//2^8
149+
tspan = (0.0,1.0)
150+
prob = SDEProblem(f,g,u₀,(0.0,1.0); noise_rate_prototype=zeros(3,2))
151+
prob! = SDEProblem(f!,g!,u₀,(0.0,1.0); noise_rate_prototype=zeros(3,2))
152+
153+
sol = solve(prob, RKMilGeneral(;ii_approx=IICommutative()), dt=dt, adaptive=false)
154+
@test sol.retcode == :Success
155+
sol = solve(prob, RKMilGeneral(;ii_approx=IILevyArea()), dt=dt, adaptive=false)
156+
@test sol.retcode == :Success
157+
sol = solve(prob, RKMilGeneral(ii_approx=Fourier()), dt=dt, adaptive=false)
158+
@test sol.retcode == :Success
159+
160+
sol = solve(prob!, RKMilGeneral(;ii_approx=IICommutative()), dt=dt, adaptive=false)
161+
@test sol.retcode == :Success
162+
sol = solve(prob!, RKMilGeneral(;ii_approx=IILevyArea()), dt=dt, adaptive=false)
163+
@test sol.retcode == :Success
164+
sol = solve(prob!, RKMilGeneral(ii_approx=Fourier()), dt=dt, adaptive=false)
165+
@test sol.retcode == :Success
166+
end

0 commit comments

Comments
 (0)