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_hohqmesh.jl
2055 views
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3
4
# This is a DGMulti version of the UnstructuredMesh2D elixir `elixir_euler_basic.jl`,
5
# which can be found at `examples/unstructured_2d_dgsem/elixir_euler_basic.jl`.
6
7
###############################################################################
8
# semidiscretization of the compressible Euler equations
9
10
equations = CompressibleEulerEquations2D(1.4)
11
12
initial_condition = initial_condition_convergence_test
13
source_terms = source_terms_convergence_test
14
15
boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
16
boundary_conditions = (; :Slant => boundary_condition_convergence_test,
17
:Bezier => boundary_condition_convergence_test,
18
:Right => boundary_condition_convergence_test,
19
:Bottom => boundary_condition_convergence_test,
20
:Top => boundary_condition_convergence_test)
21
22
###############################################################################
23
# Get the DG approximation space
24
25
# Up to version 0.13.0, `max_abs_speed_naive` was used as the default wave speed estimate of
26
# `const flux_lax_friedrichs = FluxLaxFriedrichs(), i.e., `FluxLaxFriedrichs(max_abs_speed = max_abs_speed_naive)`.
27
# In the `StepsizeCallback`, though, the less diffusive `max_abs_speeds` is employed which is consistent with `max_abs_speed`.
28
# Thus, we exchanged in PR#2458 the default wave speed used in the LLF flux to `max_abs_speed`.
29
# To ensure that every example still runs we specify explicitly `FluxLaxFriedrichs(max_abs_speed_naive)`.
30
# We remark, however, that the now default `max_abs_speed` is in general recommended due to compliance with the
31
# `StepsizeCallback` (CFL-Condition) and less diffusion.
32
dg = DGMulti(polydeg = 8, element_type = Quad(), approximation_type = SBP(),
33
surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs(max_abs_speed_naive)),
34
volume_integral = VolumeIntegralFluxDifferencing(flux_ranocha))
35
36
###############################################################################
37
# Get the curved quad mesh from a file (downloads the file if not available locally)
38
mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/52056f1487853fab63b7f4ed7f171c80/raw/9d573387dfdbb8bce2a55db7246f4207663ac07f/mesh_trixi_unstructured_mesh_docs.mesh",
39
joinpath(@__DIR__, "mesh_trixi_unstructured_mesh_docs.mesh"))
40
41
mesh = DGMultiMesh(dg, mesh_file)
42
43
###############################################################################
44
# create the semi discretization object
45
46
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
47
source_terms = source_terms,
48
boundary_conditions = boundary_conditions)
49
50
###############################################################################
51
# ODE solvers, callbacks etc.
52
53
tspan = (0.0, 3.0)
54
ode = semidiscretize(semi, tspan)
55
56
summary_callback = SummaryCallback()
57
58
analysis_interval = 100
59
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
60
61
alive_callback = AliveCallback(analysis_interval = analysis_interval)
62
63
save_solution = SaveSolutionCallback(interval = analysis_interval,
64
solution_variables = cons2prim)
65
66
callbacks = CallbackSet(summary_callback,
67
analysis_callback,
68
alive_callback, save_solution)
69
70
###############################################################################
71
# run the simulation
72
73
time_int_tol = 1e-8
74
sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
75
dt = time_int_tol, ode_default_options()..., callback = callbacks)
76
77