Path: blob/main/examples/structured_2d_dgsem/elixir_euler_source_terms.jl
5586 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,28periodicity = true)2930semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;31source_terms = source_terms_convergence_test,32boundary_conditions = boundary_condition_periodic)3334###############################################################################35# ODE solvers, callbacks etc.3637tspan = (0.0, 2.0)38ode = semidiscretize(semi, tspan)3940summary_callback = SummaryCallback()4142analysis_interval = 10043analysis_callback = AnalysisCallback(semi, interval = analysis_interval)4445alive_callback = AliveCallback(analysis_interval = analysis_interval)4647save_solution = SaveSolutionCallback(interval = 100,48save_initial_solution = true,49save_final_solution = true,50solution_variables = cons2prim)5152stepsize_callback = StepsizeCallback(cfl = 1.0)5354callbacks = CallbackSet(summary_callback,55analysis_callback, alive_callback,56save_solution,57stepsize_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