Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/examples/tree_3d_dgsem/elixir_advection_convergence_fvO2.jl
5586 views
1
using OrdinaryDiffEqLowStorageRK
2
using Trixi
3
4
###############################################################################
5
# semidiscretization of the linear advection equation
6
7
advection_velocity = (0.2, -0.7, 0.5)
8
equations = LinearScalarAdvectionEquation3D(advection_velocity)
9
10
polydeg = 4 # Governs in this case only the number of subcells
11
basis = LobattoLegendreBasis(polydeg)
12
surface_flux = flux_godunov
13
volume_integral = VolumeIntegralPureLGLFiniteVolumeO2(basis,
14
volume_flux_fv = surface_flux,
15
reconstruction_mode = reconstruction_O2_full,
16
slope_limiter = monotonized_central)
17
solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
18
volume_integral = volume_integral)
19
20
coordinates_min = (-1.0, -1.0, -1.0)
21
coordinates_max = (1.0, 1.0, 1.0)
22
23
mesh = TreeMesh(coordinates_min, coordinates_max,
24
initial_refinement_level = 2,
25
n_cells_max = 100_000, periodicity = true)
26
27
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test,
28
solver;
29
boundary_conditions = boundary_condition_periodic)
30
31
###############################################################################
32
# ODE solvers, callbacks etc.
33
34
ode = semidiscretize(semi, (0.0, 1.0))
35
36
summary_callback = SummaryCallback()
37
38
analysis_callback = AnalysisCallback(semi, interval = 100)
39
40
stepsize_callback = StepsizeCallback(cfl = 1.2)
41
42
callbacks = CallbackSet(summary_callback, analysis_callback,
43
stepsize_callback)
44
45
###############################################################################
46
# run the simulation
47
48
sol = solve(ode, ParsaniKetchesonDeconinck3S82(); dt = 1.0,
49
ode_default_options()..., callback = callbacks);
50
51