Path: blob/main/examples/dgmulti_2d/elixir_euler_shockcapturing_curved.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)3435function mapping(xi, eta)36x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)37y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)38return SVector(x, y)39end40cells_per_dimension = (16, 16)41mesh = DGMultiMesh(dg, cells_per_dimension, mapping)4243semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg)4445tspan = (0.0, 0.15)46ode = semidiscretize(semi, tspan)4748summary_callback = SummaryCallback()49alive_callback = AliveCallback(alive_interval = 10)50analysis_interval = 10051analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))52save_solution = SaveSolutionCallback(interval = analysis_interval,53solution_variables = cons2prim)54callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback, save_solution)5556###############################################################################57# run the simulation5859sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,60ode_default_options()..., callback = callbacks);616263