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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Trixi
using OrdinaryDiffEqCore: NewIController

###############################################################################
# create a restart file
Expand All @@ -22,8 +23,15 @@ ode_jac_sparse = semidiscretize(semi_float_type, tspan,
###############################################################################
# run the simulation

sol = solve(ode_jac_sparse,
# Default `AutoForwardDiff()` is not yet working, see
# https://github.com/trixi-framework/Trixi.jl/issues/2369
TRBDF2(; autodiff = AutoFiniteDiff());
adaptive = true, dt = dt_restart, save_everystep = false, callback = callbacks);
# Use an IController to ensure reproducible restart behavior.
# Unlike PIController, IController has no memory of previous error estimates,
# so restarting from a checkpoint produces deterministic step size selection.
# Setting qmax_first_step = qmax avoids first-step acceleration that would
# cause the restarted solve to diverge from a continuous run.
# See https://github.com/SciML/OrdinaryDiffEq.jl/issues/3101
alg = TRBDF2(; autodiff = AutoFiniteDiff())
controller = NewIController(alg, qmax = 10, qmax_first_step = 10)

sol = solve(ode_jac_sparse, alg;
adaptive = true, dt = dt_restart, save_everystep = false,
callback = callbacks, controller = controller);
6 changes: 4 additions & 2 deletions test/test_tree_2d_advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ end
@trixi_testset "elixir_advection_implicit_sparse_jacobian_restart.jl" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_advection_implicit_sparse_jacobian_restart.jl"),
l2=[0.007964280656552015], linf=[0.011267546271397588])
l2=[0.009816221102379877],
linf=[0.013884832250496304])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi_float_type, sol, 1000)
Expand All @@ -52,7 +53,8 @@ end
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_advection_implicit_sparse_jacobian_restart.jl"),
colorvec=nothing,
l2=[0.007964280656552015], linf=[0.011267546271397588])
l2=[0.009816221102379877],
linf=[0.013884832250496304])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
@test_allocations(Trixi.rhs!, semi_float_type, sol, 1000)
Expand Down
Loading