Skip to content
Draft
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
2 changes: 1 addition & 1 deletion lib/DDEProblemLibrary/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DDEProblemLibrary"
uuid = "f42792ee-6ffc-4e2a-ae83-8ee2f22de800"
version = "0.1.9"
version = "0.1.10"

[deps]
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
Expand Down
9 changes: 5 additions & 4 deletions lib/DDEProblemLibrary/src/radar5.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Delay differential equation model from chemical kinetics, given by

```math
\\begin{align*}
u_1'(t) &= - k_1 A u_2(t) - k_2 u_1(t) u_2(t - τ) + k_3 B u_1(t) - 2 k_4 u_1(t)^2, \\\\
u_1'(t) &= k_1 A u_2(t) - k_2 u_1(t) u_2(t - τ) + k_3 B u_1(t) - 2 k_4 u_1(t)^2, \\\\
u_2'(t) &= - k_1 A u_2(t) - k_2 u_1(t) u_2(t - τ) + f k_3 B u_1(t),
\\end{align*}
```
Expand Down Expand Up @@ -84,11 +84,12 @@ const prob_dde_RADAR5_oregonator = let k₁ = 1.34, k₂ = 1.6e9, k₃ = 8_000,
v = h(p, t - τ; idxs = 2)

# precalculations
a = -k₁ * A * u[2] - k₂ * u[1] * v
a = k₁ * A * u[2]
c = k₂ * u[1] * v
b = k₃ * B * u[1]

du[1] = a + b - 2 * k₄ * u[1]^2
du[2] = a + f * b
du[1] = a - c + b - 2 * k₄ * u[1]^2
du[2] = -a - c + f * b

return nothing
end
Expand Down
17 changes: 17 additions & 0 deletions lib/DDEProblemLibrary/test/radar5.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using DDEProblemLibrary, Test

@testset "RADAR5 Oregonator right-hand side" begin
# F(1), F(2) of FCN in RADAR5-V2.1/OREGONATOR/dr-oregon.f
k₁, k₂, k₃, k₄, f, A, B = 1.34, 1.6e9, 8.0e3, 4.0e7, 1.0, 6.0e-2, 6.0e-2
y2_lag = 3.0e-6
h(p, t; idxs = nothing) = idxs == 2 ? y2_lag : [0.0, y2_lag]
u = [2.0e-8, 7.0e-6]
expected = [
k₁ * A * u[2] - k₂ * u[1] * y2_lag + k₃ * B * u[1] - 2 * k₄ * u[1]^2,
-k₁ * A * u[2] - k₂ * u[1] * y2_lag + f * k₃ * B * u[1],
]
prob = DDEProblemLibrary.prob_dde_RADAR5_oregonator
du = zeros(2)
prob.f(du, u, h, prob.p, 1.0)
@test du ≈ expected rtol = 1.0e-12
end
1 change: 1 addition & 0 deletions lib/DDEProblemLibrary/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ if TEST_GROUP == "Core" || TEST_GROUP == "All"
@time @testset "Load Tests" begin
@test DDEProblemLibrary isa Module
end
@time @safetestset "RADAR5" include("radar5.jl")
end

# Quality assurance: no undefined exports, stale dependencies, etc.
Expand Down
Loading