Path: blob/main/examples/structured_2d_dgsem/elixir_euler_source_terms.jl
2055 views
# The same setup as tree_2d_dgsem/elixir_euler_source_terms.jl1# to verify the StructuredMesh implementation against TreeMesh23using OrdinaryDiffEqLowStorageRK4using Trixi56###############################################################################7# semidiscretization of the compressible Euler equations89equations = CompressibleEulerEquations2D(1.4)1011initial_condition = initial_condition_convergence_test1213# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of14# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.15# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.16# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.17# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.18# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the19# `StepsizeCallback` (CFL-Condition) and less diffusion.20solver = DGSEM(polydeg = 3, surface_flux = FluxLaxFriedrichs(max_abs_speed_naive))2122coordinates_min = (0.0, 0.0)23coordinates_max = (2.0, 2.0)2425cells_per_dimension = (16, 16)2627mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)2829semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,30source_terms = source_terms_convergence_test)3132###############################################################################33# ODE solvers, callbacks etc.3435tspan = (0.0, 2.0)36ode = semidiscretize(semi, tspan)3738summary_callback = SummaryCallback()3940analysis_interval = 10041analysis_callback = AnalysisCallback(semi, interval = analysis_interval)4243alive_callback = AliveCallback(analysis_interval = analysis_interval)4445save_solution = SaveSolutionCallback(interval = 100,46save_initial_solution = true,47save_final_solution = true,48solution_variables = cons2prim)4950stepsize_callback = StepsizeCallback(cfl = 1.0)5152callbacks = CallbackSet(summary_callback,53analysis_callback, alive_callback,54save_solution,55stepsize_callback)5657###############################################################################58# run the simulation5960sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);61dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback62ode_default_options()..., callback = callbacks);636465