Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/docs/literate/src/files/upwind_fdsbp.jl
5591 views
1
#src # Upwind FD SBP schemes
2
3
# General tensor product SBP methods are supported via the `DGMulti` solver
4
# in a reasonably complete way, see [the previous tutorial](@ref DGMulti_2).
5
# Nevertheless, there is also experimental support for SBP methods with
6
# other solver and mesh types.
7
8
# The first step is to set up an SBP operator. A classical (central) SBP
9
# operator can be created as follows.
10
using Trixi
11
D_SBP = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),
12
derivative_order = 1, accuracy_order = 2,
13
xmin = 0.0, xmax = 1.0, N = 11)
14
# Instead of prefixing the source of coefficients `MattssonNordström2004()`,
15
# you can also load the package SummationByPartsOperators.jl. Either way,
16
# this yields an object representing the operator efficiently. If you want to
17
# compare it to coefficients presented in the literature, you can convert it
18
# to a matrix.
19
Matrix(D_SBP)
20
21
# Upwind SBP operators are a concept introduced in 2017 by Ken Mattsson. You can
22
# create them as follows.
23
D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,
24
derivative_order = 1, accuracy_order = 2,
25
xmin = 0.0, xmax = 1.0, N = 11)
26
# Upwind operators are derivative operators biased towards one direction.
27
# The "minus" variants has a bias towards the left side, i.e., it uses values
28
# from more nodes to the left than from the right to compute the discrete
29
# derivative approximation at a given node (in the interior of the domain).
30
# In matrix form, this means more non-zero entries are left from the diagonal.
31
Matrix(D_upw.minus)
32
# Analogously, the "plus" variant has a bias towards the right side.
33
Matrix(D_upw.plus)
34
# For more information on upwind SBP operators, please refer to the documentation
35
# of [SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl)
36
# and references cited there.
37
38
# The basic idea of upwind SBP schemes is to apply a flux vector splitting and
39
# use appropriate upwind operators for both parts of the flux. In 1D, this means
40
# to split the flux
41
# ```math
42
# f(u) = f^-(u) + f^+(u)
43
# ```
44
# such that $f^-(u)$ is associated with left-going waves and $f^+(u)$ with
45
# right-going waves. Then, we apply upwind SBP operators $D^-, D^+$ with an
46
# appropriate upwind bias, resulting in
47
# ```math
48
# \partial_x f(u) \approx D^+ f^-(u) + D^- f^+(u)
49
# ```
50
# Note that the established notations of upwind operators $D^\pm$ and flux
51
# splittings $f^\pm$ clash. The right-going waves from $f^+$ need an operator
52
# biased towards their upwind side, i.e., the left side. This upwind bias is
53
# provided by the operator $D^-$.
54
55
# Many classical flux vector splittings have been developed for finite volume
56
# methods and are described in the book "Riemann Solvers and Numerical Methods
57
# for Fluid Dynamics: A Practical Introduction" of Eleuterio F. Toro (2009),
58
# [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761). One such a well-known
59
# splitting provided by Trixi.jl is [`splitting_steger_warming`](@ref).
60
61
# Trixi.jl comes with several example setups using upwind SBP methods with
62
# flux vector splitting, e.g.,
63
# - [`elixir_euler_vortex.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_fdsbp/elixir_euler_vortex.jl)
64
# - [`elixir_euler_taylor_green_vortex.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_3d_fdsbp/elixir_euler_taylor_green_vortex.jl)
65
66
# ## Package versions
67
68
# These results were obtained using the following versions.
69
70
using InteractiveUtils
71
versioninfo()
72
73
using Pkg
74
Pkg.status(["Trixi", "SummationByPartsOperators"],
75
mode = PKGMODE_MANIFEST)
76
77