Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/examples/dgmulti_3d/elixir_euler_fdsbp_periodic.jl
2055 views
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3
4
###############################################################################
5
# semidiscretization of the compressible Euler equations
6
7
equations = CompressibleEulerEquations3D(1.4)
8
9
initial_condition = initial_condition_convergence_test
10
source_terms = source_terms_convergence_test
11
12
volume_flux = flux_ranocha
13
# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of
14
# `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 the
19
# `StepsizeCallback` (CFL-Condition) and less diffusion.
20
solver = DGMulti(element_type = Hex(),
21
approximation_type = periodic_derivative_operator(derivative_order = 1,
22
accuracy_order = 4,
23
xmin = 0.0, xmax = 1.0,
24
N = 20),
25
surface_flux = FluxLaxFriedrichs(max_abs_speed_naive),
26
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
27
28
mesh = DGMultiMesh(solver, coordinates_min = (-1.0, -1.0, -1.0),
29
coordinates_max = (1.0, 1.0, 1.0))
30
31
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
32
source_terms = source_terms)
33
34
###############################################################################
35
# ODE solvers, callbacks etc.
36
37
tspan = (0.0, 0.4)
38
ode = semidiscretize(semi, tspan)
39
40
summary_callback = SummaryCallback()
41
42
analysis_interval = 100
43
analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
44
uEltype = real(solver))
45
46
alive_callback = AliveCallback(analysis_interval = analysis_interval)
47
48
callbacks = CallbackSet(summary_callback,
49
analysis_callback, alive_callback)
50
51
###############################################################################
52
# run the simulation
53
54
sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-7, reltol = 1.0e-7,
55
ode_default_options()..., callback = callbacks)
56
57