Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/DDEProblemLibrary/src/qs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ Cultures of Pseudomonas Putida IsoF By Use of ELISA and UHPLC/qTOF-MS-derived Me
and Mathematical Models, Analytical and Bioanalytical Chemistry.
"""
const prob_dde_qs = let S₀ = 1, τ = 2, D = 0.1, γₛ = 1.3e-12, Kₘ = 0.38, nₛ = 1.3, a = 0.66,
αₐ = 2.3e-19,
βₐ = 2.3e-18, C₁ = 70e-9, n₁ = 2.3, γₐ = 0.05, αC = 4e4, R = 5e-7, γ₃ = 0.08,
Kₑ = 1.5e-4, αₗ = 1.1e-8, C₂ = 70e-9, n₂ = 2.5, γₗ = 0.005
αₐ = 2.3e-19, βₐ = 2.3e-18, C₁ = 70e-9, n₁ = 2.3, γₐ = 0.05, αC = 4e4, R = 5e-7,
γ₃ = 0.08, Kₑ = 1.5e-4, αₗ = 1.1e-8, C₂ = 70e-9, n₂ = 2.5, γₗ = 0.005

function hill_growth(x, K, n)
if x > K
Expand Down
9 changes: 7 additions & 2 deletions lib/JumpProblemLibrary/src/JumpProblemLibrary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,13 @@ rs = @reaction_network begin
kAdp, S8 --> S5
kAdp, S9 --> S3
end
rates = [:kon, :kAon, :koff, :kAoff, :kAp, :kAdp] .=>
params[[rsi[:kon], rsi[:kAon], rsi[:koff], rsi[:kAoff], rsi[:kAp], rsi[:kAdp]]]
rates = [:kon,
:kAon,
:koff,
:kAoff,
:kAp,
:kAdp] .=> params[[
rsi[:kon], rsi[:kAon], rsi[:koff], rsi[:kAoff], rsi[:kAp], rsi[:kAdp]]]
u0 = [:S1 => params[1], :S2 => params[2], :S3 => params[3], :S4 => 0, :S5 => 0,
:S6 => 0, :S7 => 0, :S8 => 0, :S9 => 0]
tf = 100.0
Expand Down
2 changes: 1 addition & 1 deletion lib/NonlinearProblemLibrary/src/NonlinearProblemLibrary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ p12_dict = Dict("n" => n, "start" => x_start, "sol" => x_sol,

@inbounds function p13_f!(out, x, p = nothing)
n = length(x)
out[1] = broyden_tridiag_kernel(x[1]) -2.0 * x[2]
out[1] = broyden_tridiag_kernel(x[1]) - 2.0 * x[2]
for k in 2:(n - 1)
out[k] = broyden_tridiag_kernel(x[k]) - x[k - 1] - 2.0 * x[k + 1]
end
Expand Down
1 change: 0 additions & 1 deletion lib/ODEProblemLibrary/src/ODEProblemLibrary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export prob_ode_linear, prob_ode_bigfloatlinear, prob_ode_2Dlinear,
end
end


include("ode_linear_prob.jl")
include("ode_simple_nonlinear_prob.jl")
include("brusselator_prob.jl")
Expand Down
28 changes: 17 additions & 11 deletions lib/ODEProblemLibrary/src/brusselator_prob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ function brusselator_2d_loop(du, u, p, t)
im1 = limit(i - 1, N)
jp1 = limit(j + 1, N)
jm1 = limit(j - 1, N)
du[i, j, 1] = α * (u[im1, j, 1] + u[ip1, j, 1] + u[i, jp1, 1] + u[i, jm1, 1] -
4u[i, j, 1]) +
B + u[i, j, 1]^2 * u[i, j, 2] - (A + 1) * u[i, j, 1] +
brusselator_f(x, y, t)
du[i,
j,
1] = α * (u[im1, j, 1] + u[ip1, j, 1] + u[i, jp1, 1] + u[i, jm1, 1] -
4u[i, j, 1]) +
B + u[i, j, 1]^2 * u[i, j, 2] - (A + 1) * u[i, j, 1] +
brusselator_f(x, y, t)
end
for I in CartesianIndices((N, N))
i = I[1]
Expand All @@ -36,9 +38,11 @@ function brusselator_2d_loop(du, u, p, t)
im1 = limit(i - 1, N)
jp1 = limit(j + 1, N)
jm1 = limit(j - 1, N)
du[i, j, 2] = α * (u[im1, j, 2] + u[ip1, j, 2] + u[i, jp1, 2] + u[i, jm1, 2] -
4u[i, j, 2]) +
A * u[i, j, 1] - u[i, j, 1]^2 * u[i, j, 2]
du[i,
j,
2] = α * (u[im1, j, 2] + u[ip1, j, 2] + u[i, jp1, 2] + u[i, jm1, 2] -
4u[i, j, 2]) +
A * u[i, j, 1] - u[i, j, 1]^2 * u[i, j, 2]
end
end
end
Expand Down Expand Up @@ -104,10 +108,12 @@ function brusselator_1d_loop(du, u, p, t)
@inbounds for i in 2:(N - 1)
x = xyd_brusselator[i]
ip1, im1 = i + 1, i - 1
du[i, 1] = alpha * (u[im1, 1] + u[ip1, 1] - 2u[i, 1]) +
A + u[i, 1]^2 * u[i, 2] - (B + 1) * u[i, 1]
du[i, 2] = alpha * (u[im1, 2] + u[ip1, 2] - 2u[i, 2]) +
B * u[i, 1] - u[i, 1]^2 * u[i, 2]
du[i,
1] = alpha * (u[im1, 1] + u[ip1, 1] - 2u[i, 1]) +
A + u[i, 1]^2 * u[i, 2] - (B + 1) * u[i, 1]
du[i,
2] = alpha * (u[im1, 2] + u[ip1, 2] - 2u[i, 2]) +
B * u[i, 1] - u[i, 1]^2 * u[i, 2]
end
end

Expand Down
32 changes: 23 additions & 9 deletions lib/ODEProblemLibrary/src/ode_simple_nonlinear_prob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ with ``μ=1.0`` and ``u_0=[x => \\sqrt{3}, y => 0]``

Non-stiff parameters.
"""
prob_ode_vanderpol = ODEProblem(van, [y => 0, x => sqrt(3), μ => 1.0], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_vanderpol = ODEProblem(van, [y => 0, x => sqrt(3), μ => 1.0], (0.0, 1.0),
jac = true, eval_module = @__MODULE__)

"""
Van der Pol Equations
Expand All @@ -86,7 +87,8 @@ with ``μ=10^6`` and ``u_0=[x => \\sqrt{3}, y => 0]``

Stiff parameters.
"""
prob_ode_vanderpol_stiff = ODEProblem(van, [y => 0, x => sqrt(3), μ => 1e6], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_vanderpol_stiff = ODEProblem(van, [y => 0, x => sqrt(3), μ => 1e6], (0.0, 1.0),
jac = true, eval_module = @__MODULE__)

# ROBER
@parameters k₁ k₂ k₃
Expand Down Expand Up @@ -116,13 +118,18 @@ Hairer Norsett Wanner Solving Ordinary Differential Equations I - Nonstiff Probl

Usually solved on ``[0,1e11]``
"""
prob_ode_rober = ODEProblem(rober, [[y₁, y₂, y₃] .=> [1.0; 0.0; 0.0]; [k₁, k₂, k₃] .=> (0.04, 3e7, 1e4)], (0.0, 1e11), jac = true, eval_module = @__MODULE__)
prob_ode_rober = ODEProblem(
rober, [[y₁, y₂, y₃] .=> [1.0; 0.0; 0.0]; [k₁, k₂, k₃] .=> (0.04, 3e7, 1e4)],
(0.0, 1e11), jac = true, eval_module = @__MODULE__)

# Three Body
const threebody_μ = big(0.012277471);
const threebody_μ′ = 1 - threebody_μ;

threebody = (du, u, p, t) -> begin
threebody = (du,
u,
p,
t) -> begin
# 1 = y₁
# 2 = y₂
# 3 = y₁'
Expand Down Expand Up @@ -200,8 +207,10 @@ or Hairer Norsett Wanner Solving Ordinary Differential Equations I - Nonstiff Pr

Usually solved from 0 to 20.
"""
prob_ode_rigidbody = ODEProblem(rigid, [[y₁, y₂, y₃] .=> [1.0, 0.0, 0.9]; [I₁, I₂, I₃] .=> (-2.0, 1.25, -0.5)], (0.0, 20.0),
jac = true, eval_module = @__MODULE__)
prob_ode_rigidbody = ODEProblem(
rigid, [[y₁, y₂, y₃] .=> [1.0, 0.0, 0.9]; [I₁, I₂, I₃] .=> (-2.0, 1.25, -0.5)],
(0.0, 20.0),
jac = true, eval_module = @__MODULE__)

# Pleiades Problem

Expand All @@ -216,6 +225,7 @@ pleiades = (du, u, p, t) -> begin
du[i] = zero(eltype(u))
end
for i in 1:7, j in 1:7

if i != j
r = ((x[i] - x[j])^2 + (y[i] - y[j])^2)^(3 / 2)
du[14 + i] += j * (x[j] - x[i]) / r
Expand Down Expand Up @@ -365,7 +375,8 @@ u0[1] = 1
u0[8] = 0.0057

u0 = [y1, y2, y3, y4, y5, y6, y7, y8] .=> u0
p = [p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12] .=> (1.71, 0.43, 8.32, 0.0007, 8.75,
p = [p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11,
p12] .=> (1.71, 0.43, 8.32, 0.0007, 8.75,
10.03, 0.035, 1.12, 1.745, 280.0, 0.69, 1.81)

"""
Expand All @@ -390,7 +401,8 @@ where ``f`` is defined by
Reference: [demohires.pdf](http://www.radford.edu/~thompson/vodef90web/problems/demosnodislin/Demos_Pitagora/DemoHires/demohires.pdf)
Notebook: [Hires.ipynb](http://nbviewer.jupyter.org/github/JuliaDiffEq/DiffEqBenchmarks.jl/blob/master/StiffODE/Hires.ipynb)
"""
prob_ode_hires = ODEProblem(hires, [u0; p], (0.0, 321.8122), jac = true, eval_module = @__MODULE__)
prob_ode_hires = ODEProblem(
hires, [u0; p], (0.0, 321.8122), jac = true, eval_module = @__MODULE__)

@parameters p1 p2 p3
@variables y1(t) y2(t) y3(t)
Expand Down Expand Up @@ -418,4 +430,6 @@ where ``s=77.27``, ``w=0.161`` and ``q=8.375⋅10^{-6}``.
Reference: [demoorego.pdf](http://www.radford.edu/~thompson/vodef90web/problems/demosnodislin/Demos_Pitagora/DemoOrego/demoorego.pdf)
Notebook: [Orego.ipynb](http://nbviewer.jupyter.org/github/JuliaDiffEq/DiffEqBenchmarks.jl/blob/master/StiffODE/Orego.ipynb)
"""
prob_ode_orego = ODEProblem(orego, [[y1, y2, y3] .=> [1.0, 2.0, 3.0]; [p1, p2, p3] .=> [77.27, 8.375e-6, 0.161]], (0.0, 30.0), jac = true, eval_module = @__MODULE__)
prob_ode_orego = ODEProblem(
orego, [[y1, y2, y3] .=> [1.0, 2.0, 3.0]; [p1, p2, p3] .=> [77.27, 8.375e-6, 0.161]],
(0.0, 30.0), jac = true, eval_module = @__MODULE__)
25 changes: 14 additions & 11 deletions lib/ODEProblemLibrary/src/strange_attractors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ $(latexify(thomas))

[Wikipedia](https://en.wikipedia.org/wiki/Thomas%27_cyclically_symmetric_attractor)
"""
prob_ode_thomas = ODEProblem(thomas, [], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_thomas = ODEProblem(thomas, [], (0.0, 1.0), jac = true, eval_module = @__MODULE__)

# Lorenz
@parameters σ=10 ρ=28 β=8 / 3
@parameters σ=10 ρ=28 β=8/3
@variables x(t)=1 y(t)=0 z(t)=0

eqs = [D(x) ~ σ * (y - x),
Expand All @@ -46,7 +46,7 @@ $(latexify(lorenz))

[Wikipedia](https://en.wikipedia.org/wiki/Lorenz_system)
"""
prob_ode_lorenz = ODEProblem(lorenz, [], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_lorenz = ODEProblem(lorenz, [], (0.0, 1.0), jac = true, eval_module = @__MODULE__)

# Aizawa
@parameters a=0.95 b=0.7 c=0.6 d=3.5 e=0.25 f=0.1
Expand All @@ -68,7 +68,7 @@ $(latexify(aizawa))
[Reference](https://journals.ametsoc.org/view/journals/atsc/20/2/1520-0469_1963_020_0130_dnf_2_0_co_2.xml)

"""
prob_ode_aizawa = ODEProblem(aizawa, [], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_aizawa = ODEProblem(aizawa, [], (0.0, 1.0), jac = true, eval_module = @__MODULE__)

# Dadras
@parameters a=3 b=2.7 c=1.7 d=2 e=9
Expand All @@ -90,7 +90,7 @@ $(latexify(dadras))
[Reference](https://www.sciencedirect.com/science/article/abs/pii/S0375960109009591)

"""
prob_ode_dadras = ODEProblem(dadras, [], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_dadras = ODEProblem(dadras, [], (0.0, 1.0), jac = true, eval_module = @__MODULE__)

# chen
@parameters a=35 b=3 c=28
Expand All @@ -112,7 +112,7 @@ $(latexify(chen))
[Reference](https://www.worldscientific.com/doi/abs/10.1142/S0218127499001024)

"""
prob_ode_chen = ODEProblem(chen, [], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_chen = ODEProblem(chen, [], (0.0, 1.0), jac = true, eval_module = @__MODULE__)

# rossler
@parameters a=0.2 b=0.2 c=5.7
Expand All @@ -135,7 +135,8 @@ $(latexify(rossler))
[Wikipedia](https://en.wikipedia.org/wiki/R%C3%B6ssler_attractor)

"""
prob_ode_rossler = ODEProblem(rossler, [], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_rossler = ODEProblem(
rossler, [], (0.0, 1.0), jac = true, eval_module = @__MODULE__)

# rabinovich_fabrikant
@parameters a=0.14 b=0.10
Expand All @@ -157,7 +158,8 @@ $(latexify(rabinovich_fabrikant))
[Reference](https://en.wikipedia.org/wiki/Rabinovich%E2%80%93Fabrikant_equations)

"""
prob_ode_rabinovich_fabrikant = ODEProblem(rabinovich_fabrikant, [], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_rabinovich_fabrikant = ODEProblem(
rabinovich_fabrikant, [], (0.0, 1.0), jac = true, eval_module = @__MODULE__)

# sprott
@parameters a=2.07 b=1.79
Expand All @@ -179,10 +181,10 @@ $(latexify(sprott))
[Reference](https://sprott.physics.wisc.edu/pubs/paper423.pdf)

"""
prob_ode_sprott = ODEProblem(sprott, [], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_sprott = ODEProblem(sprott, [], (0.0, 1.0), jac = true, eval_module = @__MODULE__)

# hindmarsh_rose
@parameters a=1 b=3 c=1 d=5 r=1e-2 s=4 xr=-8 / 5 i=5
@parameters a=1 b=3 c=1 d=5 r=1e-2 s=4 xr=-8/5 i=5
@variables x(t)=1 y(t)=0 z(t)=0

eqs = [D(x) ~ y - a * x^3 + b * x^2 - z + i,
Expand All @@ -201,4 +203,5 @@ $(latexify(hindmarsh_rose))
[Reference](https://en.wikipedia.org/wiki/Hindmarsh%E2%80%93Rose_model)

"""
prob_ode_hindmarsh_rose = ODEProblem(hindmarsh_rose, [], (0.0, 1.0), jac=true, eval_module = @__MODULE__)
prob_ode_hindmarsh_rose = ODEProblem(
hindmarsh_rose, [], (0.0, 1.0), jac = true, eval_module = @__MODULE__)
Loading