Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/examples/unstructured_2d_dgsem/elixir_euler_ec.jl
2055 views
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3
4
###############################################################################
5
# semidiscretization of the compressible Euler equations
6
7
equations = CompressibleEulerEquations2D(5 / 3)
8
9
initial_condition = initial_condition_weak_blast_wave
10
11
###############################################################################
12
# Get the DG approximation space
13
14
volume_flux = flux_ranocha
15
solver = DGSEM(polydeg = 6, surface_flux = flux_ranocha,
16
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
17
18
###############################################################################
19
# Get the curved quad mesh from a file
20
mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh",
21
joinpath(@__DIR__, "mesh_periodic_square_with_twist.mesh"))
22
23
mesh = UnstructuredMesh2D(mesh_file, periodicity = true)
24
25
###############################################################################
26
# create the semi discretization object
27
28
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
29
30
###############################################################################
31
# ODE solvers, callbacks etc.
32
33
tspan = (0.0, 2.0)
34
ode = semidiscretize(semi, tspan)
35
36
summary_callback = SummaryCallback()
37
38
analysis_interval = 100
39
analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
40
41
alive_callback = AliveCallback(analysis_interval = analysis_interval)
42
43
save_solution = SaveSolutionCallback(interval = 100,
44
save_initial_solution = true,
45
save_final_solution = true)
46
47
stepsize_callback = StepsizeCallback(cfl = 1.0)
48
49
callbacks = CallbackSet(summary_callback,
50
analysis_callback,
51
alive_callback,
52
save_solution,
53
stepsize_callback)
54
55
###############################################################################
56
# run the simulation
57
58
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);
59
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
60
ode_default_options()..., callback = callbacks);
61
62