Path: blob/main/examples/tree_3d_dgsem/elixir_mhd_ec_shockcapturing.jl
5586 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, periodicity = true)3132# create the semi discretization object33semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;34boundary_conditions = boundary_condition_periodic)3536###############################################################################37# ODE solvers, callbacks etc.3839tspan = (0.0, 1.0)40ode = semidiscretize(semi, tspan)4142summary_callback = SummaryCallback()4344analysis_interval = 10045analysis_callback = AnalysisCallback(semi, interval = analysis_interval)4647alive_callback = AliveCallback(analysis_interval = analysis_interval)4849cfl = 1.450stepsize_callback = StepsizeCallback(cfl = cfl)5152glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)5354callbacks = CallbackSet(summary_callback,55analysis_callback, alive_callback,56stepsize_callback,57glm_speed_callback)5859###############################################################################60# run the simulation6162sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);63dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback64ode_default_options()..., callback = callbacks);656667