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_shockcapturing.jl
5586 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_weak_blast_wave
10
surface_flux = flux_lax_friedrichs
11
volume_flux = flux_ranocha
12
13
polydeg = 3
14
basis = DGMultiBasis(Hex(), polydeg, approximation_type = GaussSBP())
15
16
indicator_sc = IndicatorHennemannGassner(equations, basis,
17
alpha_max = 0.5,
18
alpha_min = 0.001,
19
alpha_smooth = true,
20
variable = density_pressure)
21
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
22
volume_flux_dg = volume_flux,
23
volume_flux_fv = surface_flux)
24
dg = DGMulti(basis,
25
surface_integral = SurfaceIntegralWeakForm(surface_flux),
26
volume_integral = volume_integral)
27
28
cells_per_dimension = (4, 4, 4)
29
mesh = DGMultiMesh(dg, cells_per_dimension;
30
coordinates_min = (-2.0, -2.0, -2.0),
31
coordinates_max = (2.0, 2.0, 2.0),
32
periodicity = true)
33
34
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg;
35
boundary_conditions = boundary_condition_periodic)
36
37
tspan = (0.0, 0.4)
38
ode = semidiscretize(semi, tspan)
39
40
summary_callback = SummaryCallback()
41
alive_callback = AliveCallback(alive_interval = 10)
42
analysis_interval = 100
43
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
44
save_solution = SaveSolutionCallback(interval = analysis_interval,
45
solution_variables = cons2prim)
46
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback, save_solution)
47
48
###############################################################################
49
# run the simulation
50
51
sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-6, reltol = 1.0e-6,
52
ode_default_options()..., callback = callbacks);
53
54