Path: blob/main/examples/p4est_2d_dgsem/elixir_mhd_alfven_wave.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the compressible ideal GLM-MHD equations56gamma = 5 / 37equations = IdealGlmMhdEquations2D(gamma)89initial_condition = initial_condition_convergence_test1011# Get the DG approximation space12volume_flux = (flux_central, flux_nonconservative_powell)13solver = DGSEM(polydeg = 4,14surface_flux = (flux_hlle,15flux_nonconservative_powell),16volume_integral = VolumeIntegralFluxDifferencing(volume_flux))1718coordinates_min = (0.0, 0.0)19coordinates_max = (sqrt(2.0), sqrt(2.0))2021trees_per_dimension = (8, 8)22mesh = P4estMesh(trees_per_dimension,23polydeg = 3, initial_refinement_level = 0,24coordinates_min = coordinates_min, coordinates_max = coordinates_max,25periodicity = true)2627semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)2829###############################################################################30# ODE solvers, callbacks etc.3132tspan = (0.0, 1.0)33ode = semidiscretize(semi, tspan)3435summary_callback = SummaryCallback()3637analysis_interval = 10038analysis_callback = AnalysisCallback(semi, interval = analysis_interval)3940alive_callback = AliveCallback(analysis_interval = analysis_interval)4142cfl = 0.943stepsize_callback = StepsizeCallback(cfl = cfl)4445glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)4647callbacks = CallbackSet(summary_callback,48analysis_callback,49alive_callback,50stepsize_callback,51glm_speed_callback)5253###############################################################################54# run the simulation5556sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);57dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback58ode_default_options()..., callback = callbacks);596061