Path: blob/main/examples/tree_3d_dgsem/elixir_euler_shockcapturing.jl
5586 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the compressible Euler equations56equations = CompressibleEulerEquations3D(1.4)78initial_condition = initial_condition_weak_blast_wave910surface_flux = flux_ranocha # OBS! Using a non-dissipative flux is only sensible to test EC,11# but not for real shock simulations12volume_flux = flux_ranocha13polydeg = 314basis = LobattoLegendreBasis(polydeg)15indicator_sc = IndicatorHennemannGassner(equations, basis,16alpha_max = 0.5,17alpha_min = 0.001,18alpha_smooth = true,19variable = density_pressure)20volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;21volume_flux_dg = volume_flux,22volume_flux_fv = surface_flux)23solver = DGSEM(basis, surface_flux, volume_integral)2425coordinates_min = (-2.0, -2.0, -2.0)26coordinates_max = (2.0, 2.0, 2.0)27mesh = TreeMesh(coordinates_min, coordinates_max,28initial_refinement_level = 3,29n_cells_max = 100_000, periodicity = true)3031semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;32boundary_conditions = boundary_condition_periodic)3334###############################################################################35# ODE solvers, callbacks etc.3637tspan = (0.0, 0.4)38ode = semidiscretize(semi, tspan)3940summary_callback = SummaryCallback()4142analysis_interval = 10043analysis_callback = AnalysisCallback(semi, interval = analysis_interval)4445alive_callback = AliveCallback(analysis_interval = analysis_interval)4647save_solution = SaveSolutionCallback(interval = 100,48save_initial_solution = true,49save_final_solution = true,50solution_variables = cons2prim)5152stepsize_callback = StepsizeCallback(cfl = 1.4)5354callbacks = CallbackSet(summary_callback,55analysis_callback, alive_callback,56save_solution,57stepsize_callback)5859###############################################################################60# run the simulation6162sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);63dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback64ode_default_options()..., callback = callbacks);656667