Path: blob/main/examples/structured_3d_dgsem/elixir_euler_source_terms.jl
5585 views
# The same setup as tree_3d_dgsem/elixir_euler_source_terms.jl1# to verify the StructuredMesh implementation against TreeMesh23using OrdinaryDiffEqLowStorageRK4using Trixi56###############################################################################7# semidiscretization of the compressible Euler equations89equations = CompressibleEulerEquations3D(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),21volume_integral = VolumeIntegralWeakForm())2223# coordinates_min = (0.0, 0.0, 0.0)24# coordinates_max = (2.0, 2.0, 2.0)25f1(s, t) = SVector(0.0, s + 1.0, t + 1.0)26f2(s, t) = SVector(2.0, s + 1.0, t + 1.0)27f3(s, t) = SVector(s + 1.0, 0.0, t + 1.0)28f4(s, t) = SVector(s + 1.0, 2.0, t + 1.0)29f5(s, t) = SVector(s + 1.0, t + 1.0, 0.0)30f6(s, t) = SVector(s + 1.0, t + 1.0, 2.0)3132cells_per_dimension = (4, 4, 4)3334mesh = StructuredMesh(cells_per_dimension, (f1, f2, f3, f4, f5, f6), periodicity = true)3536semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;37source_terms = source_terms_convergence_test,38boundary_conditions = boundary_condition_periodic)3940###############################################################################41# ODE solvers, callbacks etc.4243tspan = (0.0, 5.0)44ode = semidiscretize(semi, tspan)4546summary_callback = SummaryCallback()4748analysis_interval = 10049analysis_callback = AnalysisCallback(semi, interval = analysis_interval)5051alive_callback = AliveCallback(analysis_interval = analysis_interval)5253save_solution = SaveSolutionCallback(interval = 100,54save_initial_solution = true,55save_final_solution = true,56solution_variables = cons2prim)5758stepsize_callback = StepsizeCallback(cfl = 0.6)5960callbacks = CallbackSet(summary_callback,61analysis_callback, alive_callback,62save_solution,63stepsize_callback)6465###############################################################################66# run the simulation6768sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);69dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback70ode_default_options()..., callback = callbacks);717273