Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/examples/dgmulti_1d/elixir_euler_flux_diff.jl
2055 views
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3
4
# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of
5
# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.
6
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
7
# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.
8
# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.
9
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
10
# `StepsizeCallback` (CFL-Condition) and less diffusion.
11
surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)
12
volume_flux = flux_ranocha
13
dg = DGMulti(polydeg = 3, element_type = Line(), approximation_type = Polynomial(),
14
surface_integral = SurfaceIntegralWeakForm(surface_flux),
15
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
16
17
equations = CompressibleEulerEquations1D(1.4)
18
19
initial_condition = initial_condition_convergence_test
20
source_terms = source_terms_convergence_test
21
22
cells_per_dimension = (8,)
23
mesh = DGMultiMesh(dg, cells_per_dimension,
24
coordinates_min = (-1.0,), coordinates_max = (1.0,), periodicity = true)
25
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg;
26
source_terms = source_terms)
27
28
tspan = (0.0, 1.1)
29
ode = semidiscretize(semi, tspan)
30
31
summary_callback = SummaryCallback()
32
alive_callback = AliveCallback(alive_interval = 10)
33
analysis_interval = 100
34
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
35
save_solution = SaveSolutionCallback(interval = 100,
36
solution_variables = cons2prim)
37
callbacks = CallbackSet(summary_callback,
38
analysis_callback,
39
alive_callback, save_solution)
40
41
###############################################################################
42
# run the simulation
43
44
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);
45
dt = 0.5 * estimate_dt(mesh, dg),
46
ode_default_options()...,
47
callback = callbacks);
48
49