Path: blob/main/examples/t8code_2d_dgsem/elixir_euler_shockcapturing_ec.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# Semidiscretization of the compressible Euler equations.56equations = CompressibleEulerEquations2D(1.4)78initial_condition = initial_condition_weak_blast_wave910surface_flux = flux_ranocha11volume_flux = flux_ranocha12polydeg = 413basis = LobattoLegendreBasis(polydeg)14indicator_sc = IndicatorHennemannGassner(equations, basis,15alpha_max = 1.0,16alpha_min = 0.001,17alpha_smooth = true,18variable = density_pressure)19volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;20volume_flux_dg = volume_flux,21volume_flux_fv = surface_flux)2223solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,24volume_integral = volume_integral)2526###############################################################################2728coordinates_min = (-1.0, -1.0)29coordinates_max = (1.0, 1.0)3031trees_per_dimension = (4, 4)3233mesh = T8codeMesh(trees_per_dimension, polydeg = 4,34coordinates_min = coordinates_min, coordinates_max = coordinates_max,35initial_refinement_level = 2, periodicity = true)3637semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)3839###############################################################################40# ODE solvers, callbacks etc.4142tspan = (0.0, 2.0)43ode = semidiscretize(semi, tspan)4445summary_callback = SummaryCallback()4647analysis_interval = 10048analysis_callback = AnalysisCallback(semi, interval = analysis_interval)4950alive_callback = AliveCallback(analysis_interval = analysis_interval)5152save_solution = SaveSolutionCallback(interval = 100,53save_initial_solution = true,54save_final_solution = true,55solution_variables = cons2prim)5657stepsize_callback = StepsizeCallback(cfl = 1.0)5859callbacks = CallbackSet(summary_callback,60analysis_callback,61alive_callback,62save_solution,63stepsize_callback)6465###############################################################################66# run the simulation6768sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);69dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback70ode_default_options()..., callback = callbacks);717273