Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/examples/unstructured_2d_dgsem/elixir_euler_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_euler_basic.jl"))
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_000000050.h5")
17
mesh = load_mesh(restart_filename)
18
19
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,
20
source_terms = source_terms,
21
boundary_conditions = boundary_conditions)
22
23
tspan = (load_time(restart_filename), 1.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
@reset save_solution.condition.save_initial_solution = false
29
30
integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);
31
dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback
32
ode_default_options()..., callback = callbacks, maxiters = 100_000);
33
34
# Get the last time index and work with that.
35
load_timestep!(integrator, restart_filename)
36
37
###############################################################################
38
# run the simulation
39
40
sol = solve!(integrator)
41
42