Path: blob/main/docs/literate/src/files/upwind_fdsbp.jl
5591 views
#src # Upwind FD SBP schemes12# General tensor product SBP methods are supported via the `DGMulti` solver3# in a reasonably complete way, see [the previous tutorial](@ref DGMulti_2).4# Nevertheless, there is also experimental support for SBP methods with5# other solver and mesh types.67# The first step is to set up an SBP operator. A classical (central) SBP8# operator can be created as follows.9using Trixi10D_SBP = derivative_operator(SummationByPartsOperators.MattssonNordström2004(),11derivative_order = 1, accuracy_order = 2,12xmin = 0.0, xmax = 1.0, N = 11)13# Instead of prefixing the source of coefficients `MattssonNordström2004()`,14# you can also load the package SummationByPartsOperators.jl. Either way,15# this yields an object representing the operator efficiently. If you want to16# compare it to coefficients presented in the literature, you can convert it17# to a matrix.18Matrix(D_SBP)1920# Upwind SBP operators are a concept introduced in 2017 by Ken Mattsson. You can21# create them as follows.22D_upw = upwind_operators(SummationByPartsOperators.Mattsson2017,23derivative_order = 1, accuracy_order = 2,24xmin = 0.0, xmax = 1.0, N = 11)25# Upwind operators are derivative operators biased towards one direction.26# The "minus" variants has a bias towards the left side, i.e., it uses values27# from more nodes to the left than from the right to compute the discrete28# derivative approximation at a given node (in the interior of the domain).29# In matrix form, this means more non-zero entries are left from the diagonal.30Matrix(D_upw.minus)31# Analogously, the "plus" variant has a bias towards the right side.32Matrix(D_upw.plus)33# For more information on upwind SBP operators, please refer to the documentation34# of [SummationByPartsOperators.jl](https://github.com/ranocha/SummationByPartsOperators.jl)35# and references cited there.3637# The basic idea of upwind SBP schemes is to apply a flux vector splitting and38# use appropriate upwind operators for both parts of the flux. In 1D, this means39# to split the flux40# ```math41# f(u) = f^-(u) + f^+(u)42# ```43# such that $f^-(u)$ is associated with left-going waves and $f^+(u)$ with44# right-going waves. Then, we apply upwind SBP operators $D^-, D^+$ with an45# appropriate upwind bias, resulting in46# ```math47# \partial_x f(u) \approx D^+ f^-(u) + D^- f^+(u)48# ```49# Note that the established notations of upwind operators $D^\pm$ and flux50# splittings $f^\pm$ clash. The right-going waves from $f^+$ need an operator51# biased towards their upwind side, i.e., the left side. This upwind bias is52# provided by the operator $D^-$.5354# Many classical flux vector splittings have been developed for finite volume55# methods and are described in the book "Riemann Solvers and Numerical Methods56# for Fluid Dynamics: A Practical Introduction" of Eleuterio F. Toro (2009),57# [DOI: 10.1007/b79761](https://doi.org/10.1007/b79761). One such a well-known58# splitting provided by Trixi.jl is [`splitting_steger_warming`](@ref).5960# Trixi.jl comes with several example setups using upwind SBP methods with61# flux vector splitting, e.g.,62# - [`elixir_euler_vortex.jl`](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_2d_fdsbp/elixir_euler_vortex.jl)63# - [`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)6465# ## Package versions6667# These results were obtained using the following versions.6869using InteractiveUtils70versioninfo()7172using Pkg73Pkg.status(["Trixi", "SummationByPartsOperators"],74mode = PKGMODE_MANIFEST)757677