Path: blob/main/examples/structured_2d_dgsem/elixir_euler_sedov.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the compressible Euler equations56equations = CompressibleEulerEquations2D(1.4)78"""9initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)1011The Sedov blast wave setup based on Flash12- https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION01011400000000000000013"""14function initial_condition_sedov_blast_wave(x, t, equations::CompressibleEulerEquations2D)15# Set up polar coordinates16inicenter = SVector(0.0, 0.0)17x_norm = x[1] - inicenter[1]18y_norm = x[2] - inicenter[2]19r = sqrt(x_norm^2 + y_norm^2)2021# Setup based on https://flash.rochester.edu/site/flashcode/user_support/flash_ug_devel/node187.html#SECTION01011400000000000000022r0 = 0.21875 # = 3.5 * smallest dx (for domain length=4 and max-ref=6)23E = 1.024p0_inner = 3 * (equations.gamma - 1) * E / (3 * pi * r0^2)25p0_outer = 1.0e-5 # = true Sedov setup2627# Calculate primitive variables28rho = 1.029v1 = 0.030v2 = 0.031p = r > r0 ? p0_outer : p0_inner3233return prim2cons(SVector(rho, v1, v2, p), equations)34end3536initial_condition = initial_condition_sedov_blast_wave3738# Get the DG approximation space3940# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of41# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.42# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.43# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.44# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.45# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the46# `StepsizeCallback` (CFL-Condition) and less diffusion.47surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)48volume_flux = flux_ranocha49polydeg = 450basis = LobattoLegendreBasis(polydeg)51indicator_sc = IndicatorHennemannGassner(equations, basis,52alpha_max = 1.0,53alpha_min = 0.001,54alpha_smooth = true,55variable = density_pressure)56volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;57volume_flux_dg = volume_flux,58volume_flux_fv = surface_flux)5960solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,61volume_integral = volume_integral)6263# Get the curved quad mesh from a mapping function64# Mapping as described in https://arxiv.org/abs/2012.1204065function mapping(xi, eta)66y = eta + 0.125 * (cos(1.5 * pi * xi) * cos(0.5 * pi * eta))6768x = xi + 0.125 * (cos(0.5 * pi * xi) * cos(2 * pi * y))6970return SVector(x, y)71end7273cells_per_dimension = (16, 16)7475mesh = StructuredMesh(cells_per_dimension, mapping, periodicity = true)7677# create the semidiscretization78semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)7980###############################################################################81# ODE solvers, callbacks etc.8283tspan = (0.0, 12.5)84ode = semidiscretize(semi, tspan)8586summary_callback = SummaryCallback()8788analysis_interval = 30089analysis_callback = AnalysisCallback(semi, interval = analysis_interval)9091alive_callback = AliveCallback(analysis_interval = analysis_interval)9293save_solution = SaveSolutionCallback(interval = 300,94save_initial_solution = true,95save_final_solution = true)9697stepsize_callback = StepsizeCallback(cfl = 0.5)9899callbacks = CallbackSet(summary_callback,100analysis_callback,101alive_callback,102save_solution,103stepsize_callback)104105###############################################################################106# run the simulation107108sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);109dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback110ode_default_options()..., callback = callbacks);111112113