Path: blob/main/examples/structured_3d_dgsem/elixir_euler_source_terms.jl
2055 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))3536semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,37source_terms = source_terms_convergence_test)3839###############################################################################40# ODE solvers, callbacks etc.4142tspan = (0.0, 5.0)43ode = semidiscretize(semi, tspan)4445summary_callback = SummaryCallback()4647analysis_interval = 10048analysis_callback = AnalysisCallback(semi, interval = analysis_interval)4950alive_callback = AliveCallback(analysis_interval = analysis_interval)5152save_solution = SaveSolutionCallback(interval = 100,53save_initial_solution = true,54save_final_solution = true,55solution_variables = cons2prim)5657stepsize_callback = StepsizeCallback(cfl = 0.6)5859callbacks = CallbackSet(summary_callback,60analysis_callback, alive_callback,61save_solution,62stepsize_callback)6364###############################################################################65# run the simulation6667sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);68dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback69ode_default_options()..., callback = callbacks);707172