diff --git a/lib/DDEProblemLibrary/Project.toml b/lib/DDEProblemLibrary/Project.toml index d83632f..c34849c 100644 --- a/lib/DDEProblemLibrary/Project.toml +++ b/lib/DDEProblemLibrary/Project.toml @@ -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" diff --git a/lib/DDEProblemLibrary/src/radar5.jl b/lib/DDEProblemLibrary/src/radar5.jl index 985fff6..4c45c84 100644 --- a/lib/DDEProblemLibrary/src/radar5.jl +++ b/lib/DDEProblemLibrary/src/radar5.jl @@ -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*} ``` @@ -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 diff --git a/lib/DDEProblemLibrary/test/radar5.jl b/lib/DDEProblemLibrary/test/radar5.jl new file mode 100644 index 0000000..3f8b8e3 --- /dev/null +++ b/lib/DDEProblemLibrary/test/radar5.jl @@ -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 diff --git a/lib/DDEProblemLibrary/test/runtests.jl b/lib/DDEProblemLibrary/test/runtests.jl index d57e012..47dad9e 100644 --- a/lib/DDEProblemLibrary/test/runtests.jl +++ b/lib/DDEProblemLibrary/test/runtests.jl @@ -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.