Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/examples/dgmulti_3d/elixir_advection_tensor_wedge.jl
2055 views
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3
using LinearAlgebra
4
5
###############################################################################
6
equations = LinearScalarAdvectionEquation3D(1.0, 1.0, 1.0)
7
8
initial_condition = initial_condition_convergence_test
9
10
# Define the polynomial degrees for the polynoms of the triangular base and the line
11
# of the tensor-prism
12
tensor_polydeg = (3, 4)
13
14
dg = DGMulti(element_type = Wedge(),
15
approximation_type = Polynomial(),
16
surface_flux = flux_lax_friedrichs,
17
polydeg = tensor_polydeg)
18
19
cells_per_dimension = (8, 8, 8)
20
mesh = DGMultiMesh(dg,
21
cells_per_dimension,
22
coordinates_min = (-1.0, -1.0, -1.0),
23
coordinates_max = (1.0, 1.0, 1.0),
24
periodicity = true)
25
26
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
27
boundary_conditions = boundary_condition_periodic)
28
29
###############################################################################
30
# ODE solvers, callbacks etc.
31
32
tspan = (0.0, 5.0)
33
ode = semidiscretize(semi, tspan)
34
35
summary_callback = SummaryCallback()
36
37
analysis_interval = 100
38
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg))
39
40
alive_callback = AliveCallback(analysis_interval = analysis_interval)
41
42
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step
43
stepsize_callback = StepsizeCallback(cfl = 1.0)
44
45
save_solution = SaveSolutionCallback(interval = analysis_interval,
46
solution_variables = cons2prim)
47
48
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback,
49
stepsize_callback, save_solution)
50
51
###############################################################################
52
# run the simulation
53
54
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 1.0;
55
ode_default_options()..., callback = callbacks);
56
57