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