Skip to content

Commit f3bfa18

Browse files
add stiff problems
1 parent f406dc3 commit f3bfa18

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

src/sde_premade_problems.jl

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,73 @@ function oval2ModelExample(;largeFluctuations=false,useBigs=false,noiseLevel=1)
316316
#u0 = [0.1701;1.6758;0.0027;0.0025;0.0141;0.0811;0.1642;0.0009;0.0001;0.0000;0.0000;0.0000;0.0697;1.2586;0.0478;194.2496;140.0758;1.5407;1.5407] #Fig 9A
317317
SDEProblem(f,σ,u0,(0.0,500.0))
318318
end
319+
320+
321+
"""
322+
The composite Euler method for stiff stochastic
323+
differential equations
324+
325+
Kevin Burrage, Tianhai Tian
326+
327+
And
328+
329+
S-ROCK: CHEBYSHEV METHODS FOR STIFF STOCHASTIC
330+
DIFFERENTIAL EQUATIONS
331+
332+
ASSYR ABDULLE AND STEPHANE CIRILLI
333+
334+
Stiffness of Euler is determined by α+β²<1
335+
Higher α or β is stiff, with α being deterministic stiffness and
336+
β being noise stiffness (and grows by square).
337+
"""
338+
function generate_stiff_quad(α,β;ito=true)
339+
if ito
340+
f = function (t,u)
341+
-+^2)*u)*(1-u^2)
342+
end
343+
else
344+
f = function (t,u)
345+
-α*(1-u^2)
346+
end
347+
end
348+
349+
function g(t,u)
350+
β*(1-u^2)
351+
end
352+
353+
function (::typeof(f))(::Type{Val{:analytic}},t,u0,W)
354+
exp_tmp = exp(-2*α*t+2*β*W)
355+
tmp = 1 + u0
356+
(tmp*exp_tmp + u0 - 1)/(tmp*exp_tmp - u0 + 1)
357+
end
358+
359+
SDEProblem(f,g,0.5,(0.0,3.0))
360+
end
361+
362+
"""
363+
Stochastic Heat Equation with scalar multiplicative noise
364+
365+
S-ROCK: CHEBYSHEV METHODS FOR STIFF STOCHASTIC
366+
DIFFERENTIAL EQUATIONS
367+
368+
ASSYR ABDULLE AND STEPHANE CIRILLI
369+
370+
Raising D or k increases stiffness
371+
"""
372+
function generate_stiff_stoch_heat(D=1,k=1;N = 100)
373+
A = full(Tridiagonal([1.0 for i in 1:N-1],[-2.0 for i in 1:N],[1.0 for i in 1:N-1]))
374+
dx = 1/N
375+
A = D/(dx^2) * A
376+
function f(t,u,du)
377+
A_mul_B!(du,A,u)
378+
end
379+
#=
380+
function f(::Type{Val{:analytic}},t,u0,W)
381+
expm(A*t+W*I)*u0
382+
end
383+
=#
384+
function g(t,u,du)
385+
@. du = k*u
386+
end
387+
SDEProblem(f,g,ones(N),(0.0,3.0),noise=WienerProcess(0.0,0.0,0.0,rswm=RSWM(adaptivealg=:RSwM3)))
388+
end

0 commit comments

Comments
 (0)