Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/examples/p4est_2d_dgsem/elixir_advection_restart.jl
2802 views
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3
using Accessors: @reset
4
5
###############################################################################
6
# create a restart file
7
8
elixir_file = "elixir_advection_extended.jl"
9
restart_file = "restart_000000021.h5"
10
11
trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file))
12
13
###############################################################################
14
# adapt the parameters that have changed compared to "elixir_advection_extended.jl"
15
16
# Note: If you get a restart file from somewhere else, you need to provide
17
# appropriate setups in the elixir loading a restart file
18
19
restart_filename = joinpath("out", restart_file)
20
mesh = load_mesh(restart_filename)
21
22
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
23
boundary_conditions = boundary_conditions)
24
25
tspan = (load_time(restart_filename), 2.0)
26
dt = load_dt(restart_filename)
27
ode = semidiscretize(semi, tspan, restart_filename)
28
29
# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
30
@reset save_solution.condition.save_initial_solution = false
31
32
integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
33
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
34
ode_default_options()..., callback = callbacks, maxiters = 100_000);
35
36
# Get the last time index and work with that.
37
load_timestep!(integrator, restart_filename)
38
39
###############################################################################
40
# run the simulation
41
42
sol = solve!(integrator)
43
44