Path: blob/main/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the compressible ideal GLM-MHD equations56equations = IdealGlmMhdEquations3D(1.4)78initial_condition = initial_condition_weak_blast_wave910surface_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)11volume_flux = (flux_hindenlang_gassner, flux_nonconservative_powell)12polydeg = 413basis = LobattoLegendreBasis(polydeg)14indicator_sc = IndicatorHennemannGassner(equations, basis,15alpha_max = 0.5,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)2526coordinates_min = (-2.0, -2.0, -2.0)27coordinates_max = (2.0, 2.0, 2.0)28mesh = TreeMesh(coordinates_min, coordinates_max,29initial_refinement_level = 3,30n_cells_max = 10_000)3132# create the semi discretization object33semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)3435###############################################################################36# ODE solvers, callbacks etc.3738tspan = (0.0, 1.0)39ode = semidiscretize(semi, tspan)4041summary_callback = SummaryCallback()4243analysis_interval = 10044analysis_callback = AnalysisCallback(semi, interval = analysis_interval)4546alive_callback = AliveCallback(analysis_interval = analysis_interval)4748cfl = 1.449stepsize_callback = StepsizeCallback(cfl = cfl)5051glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)5253callbacks = CallbackSet(summary_callback,54analysis_callback, alive_callback,55stepsize_callback,56glm_speed_callback)5758###############################################################################59# run the simulation6061sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);62dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback63ode_default_options()..., callback = callbacks);646566