Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add load_timestep! for restart setup #1614

Merged
merged 8 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 1 addition & 2 deletions examples/tree_2d_dgsem/elixir_advection_restart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ integrator = init(ode, alg,
save_everystep=false, callback=callbacks)

# Get the last time index and work with that.
integrator.iter = load_timestep(restart_filename)
integrator.stats.naccept = integrator.iter
load_timestep!(integrator, restart_filename)
sloede marked this conversation as resolved.
Show resolved Hide resolved

###############################################################################
# run the simulation
Expand Down
2 changes: 1 addition & 1 deletion src/Trixi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export SummaryCallback, SteadyStateCallback, AnalysisCallback, AliveCallback,
GlmSpeedCallback, LBMCollisionCallback, EulerAcousticsCouplingCallback,
TrivialCallback, AnalysisCallbackCoupled

export load_mesh, load_time, load_timestep, load_dt
export load_mesh, load_time, load_timestep, load_timestep!, load_dt

export ControllerThreeLevel, ControllerThreeLevelCombined,
IndicatorLöhner, IndicatorLoehner, IndicatorMax,
Expand Down
11 changes: 11 additions & 0 deletions src/callbacks_step/save_restart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ function load_timestep(restart_file::AbstractString)
end
end

"""
load_timestep!(integrator, restart_file::AbstractString)

Load the time step number (`iter` in OrdinaryDiffEq.jl) saved in a `restart_file`. And set
the number of accepted steps (`stats.naccept` in OrdinaryDiffEq.jl) equal to the time step number.
ArseniyKholod marked this conversation as resolved.
Show resolved Hide resolved
"""
function load_timestep!(integrator, restart_file::AbstractString)
integrator.iter = load_timestep(restart_file)
integrator.stats.naccept = integrator.iter
end

"""
load_dt(restart_file::AbstractString)

Expand Down