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