Skip to content

Commit 1d74f6f

Browse files
committed
add tests for new functionality
1 parent 9546170 commit 1d74f6f

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

test/mtk_integration.jl

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,31 @@ end
159159
prob = ODEProblem(roessler_model)
160160
roessler = CoupledODEs(prob)
161161

162-
@test roessler isa CoupledODEs
162+
@test roessler isa CoupledODEs
163+
164+
# %% Trajectory with mixed and time dependent indexing
165+
η2 = 1.0
166+
η3 = 0.3
167+
@variables η1(t)
168+
@variables DT(t) = 1.2 DS(t) = 1.5
169+
170+
@parameters η1_0 = 2.0 # starting value for η1 parameter
171+
@parameters r_η = 0.01 # the rate that η1 changes
172+
173+
eqs = [
174+
Differential(t)(DT) ~ η1 - DT - abs(DT - DS)*DT,
175+
Differential(t)(DS) ~ η2 - η3*DS - abs(DT - DS)*DS,
176+
η1 ~ η1_0 + r_η*t, # this symbolic variable has its own equation!
177+
]
178+
179+
sys = ODESystem(eqs, t; name = :stommel)
180+
sys = structural_simplify(sys; split = false)
181+
182+
prob = ODEProblem(sys)
183+
ds = CoupledODEs(prob)
184+
185+
X, tvec = trajectory(ds, 10.0; Δt = 0.1, save_idxs = [1, 2, η1])
186+
187+
@test all(diff(X[:, 1]) .> 0.001)
188+
@test all(diff(X[:, 3]) .≈ 0.001)
189+

0 commit comments

Comments
 (0)