Path: blob/main/examples/tree_2d_dgsem/elixir_advection_restart.jl
5586 views
using OrdinaryDiffEqLowStorageRK1using Trixi2using Accessors: @reset34###############################################################################5# Define time integration algorithm6alg = CarpenterKennedy2N54(williamson_condition = false)7# Create a restart file8base_elixir = "elixir_advection_extended.jl"9trixi_include(@__MODULE__, joinpath(@__DIR__, base_elixir), alg = alg,10tspan = (0.0, 10.0))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_000000040.h5")19mesh = load_mesh(restart_filename)2021semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;22boundary_conditions = boundary_condition_periodic)2324tspan = (load_time(restart_filename), 10.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, alg;32dt = dt, # solve needs some value here but it will be overwritten by the stepsize_callback33callback = callbacks,34ode_default_options()...); # default options because an adaptive time stepping method is used in test_mpi_tree.jl3536# Load saved context for adaptive time integrator37if integrator.opts.adaptive38load_adaptive_time_integrator!(integrator, restart_filename)39end4041# Get the last time index and work with that.42load_timestep!(integrator, restart_filename)4344###############################################################################45# run the simulation4647sol = solve!(integrator)484950