Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/docs/literate/src/files/DGMulti_2.jl
5591 views
1
#src # Other SBP schemes (FD, CGSEM) via `DGMulti` solver
2
3
# For a tutorial about DG schemes via the [`DGMulti`](@ref) solver please visit the [previous tutorial](@ref DGMulti_1).
4
# The `DGMulti` solver also supports other methods than DG. The important property a method has to
5
# fulfill is the summation-by-parts (SBP) property. The package [SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl)
6
# provides such methods, like a finite difference SBP (FD SBP) scheme. To do this,
7
# you need to create an SBP derivative operator and pass that as `approximation_type`
8
# to the `DGMulti` constructor. For example, the classical second-order FD SBP operator
9
# can be created as
10
using Trixi.SummationByPartsOperators # or add SummationByPartsOperators to your project and use it directly
11
D = derivative_operator(MattssonNordström2004(), derivative_order = 1, accuracy_order = 2,
12
xmin = 0.0, xmax = 1.0, N = 11)
13
# Here, the arguments `xmin` and `xmax` do not matter beyond setting the real type
14
# used for the operator - they just set a reference element and are rescaled on the
15
# physical elements. The parameter `N` determines the number of finite difference nodes.
16
# Then, `D` can be used as `approximation_type` like `SBP()` in a multi-block fashion.
17
# In multiple dimensions, such a 1D SBP operator will be used in a tensor product fashion,
18
# i.e., in each coordinate direction. In particular, you can use them only on 1D, 2D `Quad()`,
19
# and 3D `Hex()` elements.
20
#
21
# You can also use fully periodic single-block FD methods by creating a periodic SBP
22
# operator. For example, a fully periodic FD operator can be constructed as
23
D = periodic_derivative_operator(derivative_order = 1, accuracy_order = 2,
24
xmin = 0.0, xmax = 1.0, N = 11)
25
# An example using such an FD method is implemented in
26
# [`elixir_euler_fdsbp_periodic.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/dgmulti_2d/elixir_euler_fdsbp_periodic.jl).
27
# For all parameters and other calling options, please have a look in the
28
# [documentation of SummationByPartsOperators.jl](https://ranocha.de/SummationByPartsOperators.jl/stable/).
29
30
# Another possible method is for instance a continuous Galerkin (CGSEM) method. You can use such a
31
# method with polynomial degree of `3` (`N=4` Legendre Lobatto nodes on `[0, 1]`) coupled continuously
32
# on a uniform mesh with `Nx=10` elements by setting `approximation_type` to
33
using Trixi.SummationByPartsOperators # or add SummationByPartsOperators to your project and use it directly
34
D = couple_continuously(legendre_derivative_operator(xmin = 0.0, xmax = 1.0, N = 4),
35
UniformPeriodicMesh1D(xmin = -1.0, xmax = 1.0, Nx = 10))
36
37
# To choose a discontinuous coupling (DGSEM), use `couple_discontinuously()` instead of `couple_continuously()`.
38
39
# For more information and other SBP operators, see the documentations of [StartUpDG.jl](https://jlchan.github.io/StartUpDG.jl/dev/)
40
# and [SummationByPartsOperators.jl](https://ranocha.de/SummationByPartsOperators.jl/stable/).
41
42
# ## Package versions
43
44
# These results were obtained using the following versions.
45
46
using InteractiveUtils
47
versioninfo()
48
49
using Pkg
50
Pkg.status(["Trixi", "StartUpDG", "SummationByPartsOperators"],
51
mode = PKGMODE_MANIFEST)
52
53