Path: blob/main/examples/unstructured_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 = 650basis = 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 file64mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",65joinpath(@__DIR__, "mesh_periodic_square_with_twist.mesh"))6667mesh = UnstructuredMesh2D(mesh_file, periodicity = true)6869# create the semidiscretization70semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)7172###############################################################################73# ODE solvers, callbacks etc.7475tspan = (0.0, 12.5)76ode = semidiscretize(semi, tspan)7778summary_callback = SummaryCallback()7980analysis_interval = 30081analysis_callback = AnalysisCallback(semi, interval = analysis_interval)8283alive_callback = AliveCallback(analysis_interval = analysis_interval)8485save_solution = SaveSolutionCallback(interval = 300,86save_initial_solution = true,87save_final_solution = true)8889stepsize_callback = StepsizeCallback(cfl = 0.5)9091callbacks = CallbackSet(summary_callback,92analysis_callback,93alive_callback,94save_solution,95stepsize_callback)9697###############################################################################98# run the simulation99100sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);101dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback102ode_default_options()..., callback = callbacks);103104105