Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/examples/dgmulti_2d/elixir_euler_shockcapturing.jl
5586 views
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3
4
###############################################################################
5
# semidiscretization of the compressible Euler equations
6
7
equations = CompressibleEulerEquations2D(1.4)
8
9
initial_condition = initial_condition_weak_blast_wave
10
11
# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of
12
# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.
13
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
14
# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.
15
# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.
16
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
17
# `StepsizeCallback` (CFL-Condition) and less diffusion.
18
surface_flux = FluxLaxFriedrichs(max_abs_speed_naive)
19
volume_flux = flux_ranocha
20
21
polydeg = 3
22
basis = DGMultiBasis(Quad(), polydeg, approximation_type = GaussSBP())
23
24
indicator_sc = IndicatorHennemannGassner(equations, basis,
25
alpha_max = 0.5,
26
alpha_min = 0.001,
27
alpha_smooth = true,
28
variable = density_pressure)
29
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
30
volume_flux_dg = volume_flux,
31
volume_flux_fv = surface_flux)
32
dg = DGMulti(basis,
33
surface_integral = SurfaceIntegralWeakForm(surface_flux),
34
volume_integral = volume_integral)
35
36
cells_per_dimension = (8, 8)
37
mesh = DGMultiMesh(dg, cells_per_dimension, periodicity = true)
38
39
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg;
40
boundary_conditions = boundary_condition_periodic)
41
42
tspan = (0.0, 0.15)
43
ode = semidiscretize(semi, tspan)
44
45
summary_callback = SummaryCallback()
46
alive_callback = AliveCallback(alive_interval = 10)
47
analysis_interval = 100
48
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
49
save_solution = SaveSolutionCallback(interval = analysis_interval,
50
solution_variables = cons2prim)
51
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback, save_solution)
52
53
###############################################################################
54
# run the simulation
55
56
sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
57
ode_default_options()..., callback = callbacks);
58
59