Skip to content

Commit 501d314

Browse files
Add non-diagonal SDE problems
1 parent fd1fb86 commit 501d314

File tree

3 files changed

+62
-10
lines changed

3 files changed

+62
-10
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
julia 0.6
22
ParameterizedFunctions 2.0.0
33
DiffEqBase 3.0.3
4-
DiffEqPDEBase
54
DiffEqOperators
5+
DiffEqBiological

src/DiffEqProblemLibrary.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ __precompile__()
22

33
module DiffEqProblemLibrary
44

5-
using DiffEqBase, ParameterizedFunctions, DiffEqPDEBase, DiffEqOperators
5+
using DiffEqBase, ParameterizedFunctions, DiffEqOperators, DiffEqBiological
66

77
include("ode/ode_premade_problems.jl")
88
include("dae_premade_problems.jl")
@@ -19,8 +19,10 @@ export prob_ode_linear, prob_ode_bigfloatlinear, prob_ode_2Dlinear,
1919
SolverDiffEq, filament_prob
2020

2121
#SDE Example Problems
22-
export prob_sde_wave, prob_sde_linear, prob_sde_cubic, prob_sde_2Dlinear, prob_sde_lorenz,
23-
prob_sde_2Dlinear, prob_sde_additive, prob_sde_additivesystem, oval2ModelExample
22+
export prob_sde_wave, prob_sde_linear, prob_sde_cubic, prob_sde_2Dlinear,
23+
prob_sde_lorenz, prob_sde_2Dlinear, prob_sde_additive,
24+
prob_sde_additivesystem, oval2ModelExample, prob_sde_bistable,
25+
prob_sde_bruss, prob_sde_oscilreact
2426

2527
#SDE Stratonovich Example Problems
2628
export prob_sde_linear_stratonovich, prob_sde_2Dlinear_stratonovich

src/sde_premade_problems.jl

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,10 @@ u(u0,p,t,W_t)=\\arctan(\\frac{W_t}{10} + \\tan(u0))
9191
"""
9292
prob_sde_wave = SDEProblem(f,σ,1.,(0.0,1.0))
9393

94-
const sde_wave_α = 0.1
95-
const sde_wave_β = 0.05
96-
f = (u,p,t) -> sde_wave_β./sqrt.(1+t) - u./(2*(1+t))
97-
σ = (u,p,t) -> sde_wave_α*sde_wave_β./sqrt.(1+t)
98-
(ff::typeof(f))(::Type{Val{:analytic}},u0,p,t,W) = u0./sqrt.(1+t) + sde_wave_β*(t+sde_wave_α*W)./sqrt.(1+t)
94+
f = (u,p,t) -> p[2]./sqrt.(1+t) - u./(2*(1+t))
95+
σ = (u,p,t) -> p[1]*p[2]./sqrt.(1+t)
96+
p = (0.1,0.05)
97+
(ff::typeof(f))(::Type{Val{:analytic}},u0,p,t,W) = u0./sqrt.(1+t) + p[2]*(t+p[1]*W)./sqrt.(1+t)
9998

10099
"""
101100
Additive noise problem
@@ -110,7 +109,7 @@ and initial condition u0=1.0 with α=0.1 and β=0.05, with solution
110109
u(u0,p,t,W_t)=\\frac{u0}{\\sqrt{1+t}} + \\frac{β(t+αW_t)}{\\sqrt{1+t}}
111110
```
112111
"""
113-
prob_sde_additive = SDEProblem(f,σ,1.,(0.0,1.0))
112+
prob_sde_additive = SDEProblem(f,σ,1.,(0.0,1.0),p)
114113

115114
const sde_wave_αvec = [0.1;0.1;0.1;0.1]
116115
const sde_wave_βvec = [0.5;0.25;0.125;0.1115]
@@ -386,3 +385,54 @@ function generate_stiff_stoch_heat(D=1,k=1;N = 100)
386385
end
387386
SDEProblem(f,g,ones(N),(0.0,3.0),noise=WienerProcess(0.0,0.0,0.0,rswm=RSWM(adaptivealg=:RSwM3)))
388387
end
388+
389+
bistable_f(du,u,p,t) = du[1] = p[1] + p[2]*u[1]^4/(u[1]^4+11.9^4) - p[3]*u[1]
390+
function bistable_g(du,u,p,t)
391+
du[1,1] = .1*sqrt(p[1] + p[2]*u[1]^4/(u[1]^4+11.9^4))
392+
du[1,2] = -.1*sqrt(p[3]*u[1])
393+
end
394+
p = (5.0,18.0,1.0)
395+
"""
396+
Bistable chemical reaction network with a semi-stable lower state.
397+
"""
398+
prob_sde_bistable = SDEProblem(bistable_f,bistable_g,[3.],(0.,300.),p,
399+
noise_rate_prototype=zeros(1,2))
400+
401+
function bruss_f(du,u,p,t)
402+
du[1] = p[1] + p[2]*u[1]*u[1]*u[2] - p[3]*u[1]-p[4]*u[1]
403+
du[2] = p[3]*u[1] - p[2]*u[1]*u[1]*u[2]
404+
end
405+
function bruss_g(du,u,p,t)
406+
du[1,1] = 0.15*sqrt(p[1])
407+
du[1,2] = 0.15*sqrt(p[2]*u[1]*u[1]*u[2])
408+
du[1,3] = -0.15*sqrt(p[3]*u[1])
409+
du[1,4] = -0.15*sqrt(p[4]*u[1])
410+
du[2,1] = 0
411+
du[2,2] = -0.15*sqrt(p[2]*u[1]*u[1]*u[2])
412+
du[2,3] = 0.15*sqrt(p[3]*2.5*u[1])
413+
du[2,4] = 0
414+
end
415+
p = (1.0,1.0,2.5,1.0)
416+
"""
417+
Stochastic Brusselator
418+
"""
419+
prob_sde_bruss = SDEProblem(bruss_f,bruss_g,[3.,2.],(0.,100.),p,
420+
noise_rate_prototype=zeros(2,4))
421+
422+
network = @reaction_network rnType begin
423+
p1, (X,Y,Z) --> 0
424+
hill(X,p2,100.,-4), 0 --> Y
425+
hill(Y,p3,100.,-4), 0 --> Z
426+
hill(Z,p4,100.,-4), 0 --> X
427+
hill(X,p5,100.,6), 0 --> R
428+
hill(Y,p6,100.,4)*0.002, R --> 0
429+
p7, 0 --> S
430+
R*p8, S --> SP
431+
p9, SP + SP --> SP2
432+
p10, SP2 --> 0
433+
end p1 p2 p3 p4 p5 p6 p7 p8 p9 p10
434+
p = (0.01,3.0,3.0,4.5,2.,15.,20.0,0.005,0.01,0.05)
435+
"""
436+
An oscillatory chemical reaction system
437+
"""
438+
prob_sde_oscilreact = SDEProblem(network, [200.,60.,120.,100.,50.,50.,50.], (0.,4000.),p)

0 commit comments

Comments
 (0)