SummationByPartsOperators.jl

A Julia library of summation-by-parts (SBP) operators used in finite difference, Fourier pseudospectral, continuous Galerkin, and discontinuous Galerkin methods to get provably stable semidiscretizations, paying special attention to boundary conditions.
Author ranocha
Popularity
11 Stars
Updated Last
2 Years Ago
Started In
December 2017

SummationByPartsOperators.jl: A Julia library of provably stable semidiscretization techniques with mimetic properties

Docs-stable Docs-dev Build Status Codecov Coveralls License: MIT DOI GitHub commits since tagged version

SummationByPartsOperators.jl is a Julia library of summation-by-parts (SBP) operators, which are discrete derivative operators developed to get provably stable semidiscretizations, paying special attention to boundary conditions. Discretizations included in this framework are finite difference, Fourier pseudospectral, continuous Galerkin, and discontinuous Galerkin methods. The main aim of SummationByPartsOperators.jl is to be useful for researchers and students to learn the basic concepts by providing a unified framework of all of these seemingly different discretizations. At the same time, the implementation is optimized to achieve good performance without sacrificing flexibility.

Basic Operators

The following derivative operators are implemented as "lazy"/matrix-free operators, i.e. no large (size of the computational grid) matrix is formed explicitly.

Periodic Domains

  • periodic_derivative_operator(derivative_order, accuracy_order, xmin, xmax, N)

    These are classical central finite difference operators using N nodes on the interval [xmin, xmax].

  • periodic_derivative_operator(Holoborodko2008(), derivative_order, accuracy_order, xmin, xmax, N)

    These are central finite difference operators using N nodes on the interval [xmin, xmax] and the coefficients of Pavel Holoborodko.

  • fourier_derivative_operator(xmin, xmax, N)

    Fourier derivative operators are implemented using the fast Fourier transform of FFTW.jl.

Finite/Nonperiodic Domains

  • derivative_operator(source_of_coefficients, derivative_order, accuracy_order, xmin, xmax, N)

    Finite difference SBP operators for first and second derivatives can be obained by using MattssonNordström2004() as source_of_coefficients. Other sources of coefficients are implemented as well. To obtain a full list for all operators, use subtypes(SourceOfCoefficients).

  • legendre_derivative_operator(xmin, xmax, N)

    Use Lobatto Legendre polynomial collocation schemes on N, i.e. polynomials of degree N-1, implemented via PolynomialBases.jl.

Dissipation Operators

Additionally, some artificial dissipation/viscosity operators are implemented. The most basic usage is Di = dissipation_operator(D), where D can be a (periodic, Fourier, Legendre, SBP FD) derivative operator. Use ?dissipation_operator for more details.

Conversion to Other Forms

Sometimes, it can be convenient to obtain an explicit (sparse, banded) matrix form of the operators. Therefore, some conversion functions are supplied, e.g.

julia> using SummationByPartsOperators

julia> D = derivative_operator(MattssonNordström2004(), 1, 2, 0., 1., 5)
SBP 1st derivative operator of order 2 {T=Float64, Parallel=Val{:serial}}
on a grid in [0.0, 1.0] using 5 nodes
and coefficients given in
  Mattsson, Nordström (2004)
  Summation by parts operators for finite difference approximations of second
    derivaties.
  Journal of Computational Physics 199, pp.503-540.


julia> Matrix(D)
5×5 Array{Float64,2}:
 -4.0   4.0   0.0   0.0  0.0
 -2.0   0.0   2.0   0.0  0.0
  0.0  -2.0   0.0   2.0  0.0
  0.0   0.0  -2.0   0.0  2.0
  0.0   0.0   0.0  -4.0  4.0

julia> using SparseArrays

julia> sparse(D)
5×5 SparseMatrixCSC{Float64,Int64} with 10 stored entries:
  [1, 1]  =  -4.0
  [2, 1]  =  -2.0
  [1, 2]  =  4.0
  [3, 2]  =  -2.0
  [2, 3]  =  2.0
  [4, 3]  =  -2.0
  [3, 4]  =  2.0
  [5, 4]  =  -4.0
  [4, 5]  =  2.0
  [5, 5]  =  4.0

julia> using BandedMatrices

julia> BandedMatrix(D)
5×5 BandedMatrix{Float64,Array{Float64,2},Base.OneTo{Int64}}:
 -4.0   4.0             
 -2.0   0.0   2.0        
      -2.0   0.0   2.0   
           -2.0   0.0  2.0
                -4.0  4.0

Documentation

Examples can be found in the directory notebooks. In particular, examples of complete discretisations of the linear advection equation, the heat equation, and the wave equation are supplied. Further examples are supplied as tests.