Path: blob/main/examples/dgmulti_2d/elixir_euler_shockcapturing.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the compressible Euler equations56equations = CompressibleEulerEquations2D(1.4)78initial_condition = initial_condition_weak_blast_wave910# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of11# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.12# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.13# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.14# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.15# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the16# `StepsizeCallback` (CFL-Condition) and less diffusion.17surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)18volume_flux = flux_ranocha1920polydeg = 321basis = DGMultiBasis(Quad(), polydeg, approximation_type = GaussSBP())2223indicator_sc = IndicatorHennemannGassner(equations, basis,24alpha_max = 0.5,25alpha_min = 0.001,26alpha_smooth = true,27variable = density_pressure)28volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;29volume_flux_dg = volume_flux,30volume_flux_fv = surface_flux)31dg = DGMulti(basis,32surface_integral = SurfaceIntegralWeakForm(surface_flux),33volume_integral = volume_integral)3435cells_per_dimension = (8, 8)36mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true)3738semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg)3940tspan = (0.0, 0.15)41ode = semidiscretize(semi, tspan)4243summary_callback = SummaryCallback()44alive_callback = AliveCallback(alive_interval = 10)45analysis_interval = 10046analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))47save_solution = SaveSolutionCallback(interval = analysis_interval,48solution_variables = cons2prim)49callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback, save_solution)5051###############################################################################52# run the simulation5354sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,55ode_default_options()..., callback = callbacks);565758