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_curved.jl
2055 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
function mapping(xi, eta)
37
x = xi + 0.1 * sin(pi * xi) * sin(pi * eta)
38
y = eta + 0.1 * sin(pi * xi) * sin(pi * eta)
39
return SVector(x, y)
40
end
41
cells_per_dimension = (16, 16)
42
mesh = DGMultiMesh(dg, cells_per_dimension, mapping)
43
44
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg)
45
46
tspan = (0.0, 0.15)
47
ode = semidiscretize(semi, tspan)
48
49
summary_callback = SummaryCallback()
50
alive_callback = AliveCallback(alive_interval = 10)
51
analysis_interval = 100
52
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
53
save_solution = SaveSolutionCallback(interval = analysis_interval,
54
solution_variables = cons2prim)
55
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback, save_solution)
56
57
###############################################################################
58
# run the simulation
59
60
sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
61
ode_default_options()..., callback = callbacks);
62
63