Path: blob/main/examples/p4est_2d_dgsem/elixir_advection_restart.jl
2802 views
using OrdinaryDiffEqLowStorageRK1using Trixi2using Accessors: @reset34###############################################################################5# create a restart file67elixir_file = "elixir_advection_extended.jl"8restart_file = "restart_000000021.h5"910trixi_include(@__MODULE__, joinpath(@__DIR__, elixir_file))1112###############################################################################13# adapt the parameters that have changed compared to "elixir_advection_extended.jl"1415# Note: If you get a restart file from somewhere else, you need to provide16# appropriate setups in the elixir loading a restart file1718restart_filename = joinpath("out", restart_file)19mesh = load_mesh(restart_filename)2021semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;22boundary_conditions = boundary_conditions)2324tspan = (load_time(restart_filename), 2.0)25dt = load_dt(restart_filename)26ode = semidiscretize(semi, tspan, restart_filename)2728# Do not overwrite the initial snapshot written by elixir_advection_extended.jl.29@reset save_solution.condition.save_initial_solution = false3031integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false);32dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback33ode_default_options()..., callback = callbacks, maxiters = 100_000);3435# Get the last time index and work with that.36load_timestep!(integrator, restart_filename)3738###############################################################################39# run the simulation4041sol = solve!(integrator)424344