Path: blob/main/examples/t8code_2d_dgsem/elixir_mhd_alfven_wave.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# Semidiscretization of the compressible ideal GLM-MHD equations.56gamma = 5 / 37equations = IdealGlmMhdEquations2D(gamma)89initial_condition = initial_condition_convergence_test1011# Get the DG approximation space12volume_flux = (flux_central, flux_nonconservative_powell)1314solver = DGSEM(polydeg = 4, surface_flux = (flux_hlle, flux_nonconservative_powell),15volume_integral = VolumeIntegralFluxDifferencing(volume_flux))1617coordinates_min = (0.0, 0.0)18coordinates_max = (sqrt(2.0), sqrt(2.0))1920trees_per_dimension = (8, 8)2122mesh = T8codeMesh(trees_per_dimension, polydeg = 3,23coordinates_min = coordinates_min, coordinates_max = coordinates_max,24initial_refinement_level = 0, periodicity = true)2526semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)2728###############################################################################29# ODE solvers, callbacks etc.3031tspan = (0.0, 1.0)32ode = semidiscretize(semi, tspan)3334summary_callback = SummaryCallback()3536analysis_interval = 10037analysis_callback = AnalysisCallback(semi, interval = analysis_interval)3839alive_callback = AliveCallback(analysis_interval = analysis_interval)4041cfl = 0.942stepsize_callback = StepsizeCallback(cfl = cfl)4344glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl)4546callbacks = CallbackSet(summary_callback,47analysis_callback,48alive_callback,49stepsize_callback,50glm_speed_callback)5152###############################################################################53# run the simulation5455sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);56dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback57ode_default_options()..., callback = callbacks);585960