Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/examples/tree_2d_dgsem/elixir_advection_restart.jl
2055 views
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3
4
###############################################################################
5
# Define time integration algorithm
6
alg = CarpenterKennedy2N54(williamson_condition = false)
7
# Create a restart file
8
base_elixir = "elixir_advection_extended.jl"
9
trixi_include(@__MODULE__, joinpath(@__DIR__, base_elixir), alg = alg,
10
tspan = (0.0, 10.0))
11
12
###############################################################################
13
# adapt the parameters that have changed compared to "elixir_advection_extended.jl"
14
15
# Note: If you get a restart file from somewhere else, you need to provide
16
# appropriate setups in the elixir loading a restart file
17
18
restart_filename = joinpath("out", "restart_000000040.h5")
19
mesh = load_mesh(restart_filename)
20
21
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
22
23
tspan = (load_time(restart_filename), 10.0)
24
dt = load_dt(restart_filename)
25
ode = semidiscretize(semi, tspan, restart_filename)
26
27
# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.
28
save_solution.condition.save_initial_solution = false
29
30
integrator = init(ode, alg;
31
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
32
callback = callbacks,
33
ode_default_options()...); # default options because an adaptive time stepping method is used in test_mpi_tree.jl
34
35
# Load saved context for adaptive time integrator
36
if integrator.opts.adaptive
37
load_adaptive_time_integrator!(integrator, restart_filename)
38
end
39
40
# Get the last time index and work with that.
41
load_timestep!(integrator, restart_filename)
42
43
###############################################################################
44
# run the simulation
45
46
sol = solve!(integrator)
47
48