9: Other SBP schemes (FD, CGSEM) via DGMulti solver

For a tutorial about DG schemes via the DGMulti solver please visit the previous tutorial. The DGMulti solver also supports other methods than DG. The important property a method has to fulfill is the summation-by-parts (SBP) property. The package SummationByPartsOperators.jl provides such methods, like a finite difference SBP (FD SBP) scheme. To do this, you need to create an SBP derivative operator and pass that as approximation_type to the DGMulti constructor. For example, the classical second-order FD SBP operator can be created as

using Trixi.SummationByPartsOperators # or add SummationByPartsOperators to your project and use it directly
D = derivative_operator(MattssonNordström2004(), derivative_order = 1, accuracy_order = 2,
                        xmin = 0.0, xmax = 1.0, N = 11)
SBP first-derivative operator of order 2 on a grid in [0.0, 1.0] using 11 nodes 
and coefficients of Mattsson, Nordström (2004) 
  Summation by parts operators for finite difference approximations of second 
    derivatives. 
  Journal of Computational Physics 199, pp. 503-540.

Here, the arguments xmin and xmax do not matter beyond setting the real type used for the operator - they just set a reference element and are rescaled on the physical elements. The parameter N determines the number of finite difference nodes. Then, D can be used as approximation_type like SBP() in a multi-block fashion. In multiple dimensions, such a 1D SBP operator will be used in a tensor product fashion, i.e., in each coordinate direction. In particular, you can use them only on 1D, 2D Quad(), and 3D Hex() elements.

You can also use fully periodic single-block FD methods by creating a periodic SBP operator. For example, a fully periodic FD operator can be constructed as

D = periodic_derivative_operator(derivative_order = 1, accuracy_order = 2,
                                 xmin = 0.0, xmax = 1.0, N = 11)
Periodic first-derivative operator of order 2 on a grid in [0.0, 1.0] using 11 nodes, 
stencils with 1 nodes to the left, 1 nodes to the right, and coefficients of Fornberg (1998) 
  Calculation of Weights in Finite Difference Formulas. 
  SIAM Rev. 40.3, pp. 685-691.

An example using such an FD method is implemented in elixir_euler_fdsbp_periodic.jl. For all parameters and other calling options, please have a look in the documentation of SummationByPartsOperators.jl.

Another possible method is for instance a continuous Galerkin (CGSEM) method. You can use such a method with polynomial degree of 3 (N=4 Legendre Lobatto nodes on [0, 1]) coupled continuously on a uniform mesh with Nx=10 elements by setting approximation_type to

using Trixi.SummationByPartsOperators # or add SummationByPartsOperators to your project and use it directly
D = couple_continuously(legendre_derivative_operator(xmin = 0.0, xmax = 1.0, N = 4),
                        UniformPeriodicMesh1D(xmin = -1.0, xmax = 1.0, Nx = 10))
First derivative operator {T=Float64} on 4 Lobatto Legendre nodes in [0.0, 1.0]
coupled continuously on SummationByPartsOperators.UniformPeriodicMesh1D{Float64} with 10 cells in (-1.0, 1.0)

To choose a discontinuous coupling (DGSEM), use couple_discontinuously() instead of couple_continuously().

For more information and other SBP operators, see the documentations of StartUpDG.jl and SummationByPartsOperators.jl.

Package versions

These results were obtained using the following versions.

using InteractiveUtils
versioninfo()

using Pkg
Pkg.status(["Trixi", "StartUpDG", "SummationByPartsOperators"],
           mode = PKGMODE_MANIFEST)
Julia Version 1.10.6
Commit 67dffc4a8ae (2024-10-28 12:23 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 4 × AMD EPYC 7763 64-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
Environment:
  JULIA_PKG_SERVER_REGISTRY_PREFERENCE = eager
Status `~/work/Trixi.jl/Trixi.jl/docs/Manifest.toml`
  [472ebc20] StartUpDG v1.1.5
  [9f78cca6] SummationByPartsOperators v0.5.70
  [a7f1ee26] Trixi v0.9.6 `~/work/Trixi.jl/Trixi.jl`

This page was generated using Literate.jl.