Skip to content

Commit f2e8c71

Browse files
Trim incrementing components in test problems
1 parent 66e0ca8 commit f2e8c71

File tree

1 file changed

+2
-28
lines changed

1 file changed

+2
-28
lines changed

test/problems.jl

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,13 @@ end
249249

250250
reverse_problem(prob, analytic_sol) = ODEProblem(prob.f, analytic_sol(prob.tspan[2]), reverse(prob.tspan), prob.p)
251251

252-
struct IntegratorTestCase{FT, A, P, IP, SP, SIP}
252+
struct IntegratorTestCase{FT, A, P, SP}
253253
test_name::String
254254
linear_implicit::Bool
255255
t_end::FT
256256
analytic_sol::A
257257
prob::P
258-
increment_prob::IP
259258
split_prob::SP
260-
split_increment_prob::SIP
261259
end
262260

263261
function IntegratorTestCase(;
@@ -267,30 +265,20 @@ function IntegratorTestCase(;
267265
Y₀,
268266
analytic_sol,
269267
tendency!,
270-
increment!,
271268
implicit_tendency! = nothing,
272269
explicit_tendency! = nothing,
273-
implicit_increment! = nothing,
274-
explicit_increment! = nothing,
275270
Wfact!,
276271
tgrad! = nothing,
277272
)
278273
FT = typeof(t_end)
279274
jac_prototype = Matrix{FT}(undef, length(Y₀), length(Y₀))
280275
func_args = (; jac_prototype, Wfact = Wfact!, tgrad = tgrad!)
281276
tendency_func = ODEFunction(tendency!; func_args...)
282-
increment_func = ForwardEulerODEFunction(increment!; func_args...)
283277
if isnothing(implicit_tendency!) # assume that related args are also nothing
284-
no_tendency!(Yₜ, Y, _, t) = Yₜ .= FT(0)
285-
no_increment!(Y⁺, Y, _, t, Δt) = Y⁺
278+
no_tendency!(Yₜ, Y, _, t) = Yₜ .= 0
286279
split_tendency_func = SplitFunction(tendency_func, no_tendency!)
287-
split_increment_func = SplitFunction(increment_func, ForwardEulerODEFunction(no_increment!))
288280
else
289281
split_tendency_func = SplitFunction(ODEFunction(implicit_tendency!; func_args...), explicit_tendency!)
290-
split_increment_func = SplitFunction(
291-
ForwardEulerODEFunction(implicit_increment!; func_args...),
292-
ForwardEulerODEFunction(explicit_increment!),
293-
)
294282
end
295283
make_prob(func) = ODEProblem(func, Y₀, (FT(0), t_end), nothing)
296284
IntegratorTestCase(
@@ -299,9 +287,7 @@ function IntegratorTestCase(;
299287
t_end,
300288
analytic_sol,
301289
make_prob(tendency_func),
302-
make_prob(increment_func),
303290
make_prob(split_tendency_func),
304-
make_prob(split_increment_func),
305291
)
306292
end
307293

@@ -312,11 +298,8 @@ function ClimaIntegratorTestCase(;
312298
Y₀,
313299
analytic_sol,
314300
tendency!,
315-
increment!,
316301
implicit_tendency! = nothing,
317302
explicit_tendency! = nothing,
318-
implicit_increment! = nothing,
319-
explicit_increment! = nothing,
320303
Wfact!,
321304
tgrad! = nothing,
322305
)
@@ -337,9 +320,7 @@ function ClimaIntegratorTestCase(;
337320
t_end,
338321
analytic_sol,
339322
make_prob(tendency_func),
340-
nothing,
341323
make_prob(split_tendency_func),
342-
nothing,
343324
)
344325
end
345326

@@ -353,7 +334,6 @@ function constant_tendency_test(::Type{FT}) where {FT}
353334
Y₀ = FT[0, 0, 0],
354335
analytic_sol = (t) -> tendency .* t,
355336
tendency! = (Yₜ, Y, _, t) -> Yₜ .= tendency,
356-
increment! = (Y⁺, Y, _, t, Δt) -> Y⁺ .+= Δt .* tendency,
357337
Wfact! = (W, Y, _, Δt, t) -> W .= -1,
358338
)
359339
end
@@ -367,7 +347,6 @@ function clima_constant_tendency_test(::Type{FT}) where {FT}
367347
Y₀ = FT[0, 0, 0],
368348
analytic_sol = (t) -> tendency .* t,
369349
tendency! = (Yₜ, Y, _, t) -> Yₜ .= tendency,
370-
increment! = (Y⁺, Y, _, t, Δt) -> Y⁺ .+= Δt .* tendency,
371350
Wfact! = (W, Y, _, Δt, t) -> W .= -1,
372351
)
373352
end
@@ -383,11 +362,8 @@ function ark_analytic_test_cts(::Type{FT}) where {FT}
383362
Y₀ = FT[0],
384363
analytic_sol = (t) -> [atan(t)],
385364
tendency! = (Yₜ, Y, _, t) -> Yₜ .= λ .* Y .+ source(t),
386-
increment! = (Y⁺, Y, _, t, Δt) -> Y⁺ .+= Δt .*.* Y .+ source(t)),
387365
implicit_tendency! = (Yₜ, Y, _, t) -> Yₜ .= λ .* Y,
388366
explicit_tendency! = (Yₜ, Y, _, t) -> Yₜ .= source(t),
389-
implicit_increment! = (Y⁺, Y, _, t, Δt) -> Y⁺ .+= (Δt * λ) .* Y,
390-
explicit_increment! = (Y⁺, Y, _, t, Δt) -> Y⁺ .+= Δt * source(t),
391367
Wfact! = (W, Y, _, Δt, t) -> W .= Δt * λ - 1,
392368
tgrad! = (∂Y∂t, Y, _, t) -> ∂Y∂t .= -+ 2 * t + λ * t^2) / (1 + t^2)^2,
393369
)
@@ -402,7 +378,6 @@ function ark_analytic_nonlin_test_cts(::Type{FT}) where {FT}
402378
Y₀ = FT[0],
403379
analytic_sol = (t) -> [log(t^2 / 2 + t + 1)],
404380
tendency! = (Yₜ, Y, _, t) -> Yₜ .= (t + 1) .* exp.(.-Y),
405-
increment! = (Y⁺, Y, _, t, Δt) -> Y⁺ .+= Δt .* ((t + 1) .* exp.(.-Y)),
406381
Wfact! = (W, Y, _, Δt, t) -> W .= (-Δt * (t + 1) .* exp.(.-Y) .- 1),
407382
tgrad! = (∂Y∂t, Y, _, t) -> ∂Y∂t .= exp.(.-Y),
408383
)
@@ -424,7 +399,6 @@ function ark_analytic_sys_test_cts(::Type{FT}) where {FT}
424399
Y₀,
425400
analytic_sol = (t) -> V * exp(D * t) * V⁻¹ * Y₀,
426401
tendency! = (Yₜ, Y, _, t) -> mul!(Yₜ, A, Y),
427-
increment! = (Y⁺, Y, _, t, Δt) -> mul!(Y⁺, A, Y, Δt, 1),
428402
Wfact! = (W, Y, _, Δt, t) -> W .= Δt .* A .- I,
429403
)
430404
end

0 commit comments

Comments
 (0)