SummationByPartsOperators.jl
SummationByPartsOperators.jl: A Julia library of provably stable discretization techniques with mimetic properties - Published in JOSS (2021)
Science Score: 100.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 5 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
✓Committers with academic emails
1 of 10 committers (10.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Keywords from Contributors
Repository
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.
Basic Info
- Host: GitHub
- Owner: ranocha
- License: mit
- Language: Julia
- Default Branch: main
- Homepage: https://ranocha.github.io/SummationByPartsOperators.jl
- Size: 7.4 MB
Statistics
- Stars: 104
- Watchers: 4
- Forks: 17
- Open Issues: 42
- Releases: 101
Topics
Metadata Files
README.md
SummationByPartsOperators.jl: A Julia library of provably stable discretization techniques with mimetic properties
The Julia library SummationByPartsOperators.jl provides a unified interface of different discretization approaches including finite difference, Fourier pseudospectral, continuous Galerkin, and discontinuous Galerkin methods. This unified interface is based on the notion of summation-by-parts (SBP) operators. Originally developed for finite difference methods, SBP operators are discrete derivative operators designed specifically to get provably stable (semi-) discretizations, mimicking energy/entropy estimates from the continuous level discretely and paying special attention to boundary conditions.
SummationByPartsOperators.jl is mainly written to be useful for both students learning the basic concepts and researchers developing new numerical algorithms based on SBP operators. Thus, this package uses Julia's multiple dispatch and strong type system to provide a unified framework of all of these seemingly different discretizations while being reasonably optimized at the same time, achieving good performance without sacrificing flexibility.
Installation
SummationByPartsOperators.jl
is a registered Julia package. Thus, you can install it from the Julia REPL via
julia
julia> using Pkg; Pkg.add("SummationByPartsOperators")
If you want to update SummationByPartsOperators.jl, you can use
julia
julia> using Pkg; Pkg.update("SummationByPartsOperators")
As usual, if you want to update SummationByPartsOperators.jl and all other
packages in your current project, you can execute
julia
julia> using Pkg; Pkg.update()
A brief list of notable changes is available in NEWS.md.
Basic examples
Compute the derivative on a periodic domain using a central finite difference operator. ```julia julia> using SummationByPartsOperators
julia> using Plots: plot, plot!
julia> D = periodicderivativeoperator(derivativeorder=1, accuracyorder=2, xmin=0.0, xmax=2.0, N=20) Periodic first-derivative operator of order 2 on a grid in [0.0, 2.0] using 20 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.
julia> x = grid(D); u = sinpi.(x);
julia> plot(x, D * u, label="numerical")
julia> plot!(x, π .* cospi.(x), label="analytical") ``` You should see a plot like the following.
Compute the derivative on a bounded domain using an SBP finite difference operator. ```julia julia> using SummationByPartsOperators
julia> using Plots: plot, plot!
julia> D = derivativeoperator(MattssonNordström2004(), derivativeorder=1, accuracy_order=2, xmin=0.0, xmax=1.0, N=21) SBP first-derivative operator of order 2 on a grid in [0.0, 1.0] using 21 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.
julia> x = grid(D); u = exp.(x);
julia> plot(x, D * u, label="numerical")
julia> plot!(x, exp.(x), label="analytical") ``` You should see a plot like the following.
Brief overview
The following derivative operators are implemented as "lazy"/matrix-free
operators, i.e. no large (size of the computational grid) matrix is formed
explicitly. They are linear operators and implement the same interface as
matrices in Julia (at least partially). In particular, * and mul! are
supported.
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.
All of these periodic derivative operators support multiplication and addition
such that polynomials and rational functions of them can be represented efficiently,
e.g. to solve elliptic problems of the form u = (D^2 + I) \ f.
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 obtained
by using MattssonNordström2004() as source_of_coefficients.
Other sources of coefficients are implemented as well. To obtain a full list
of 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.
Continuous and discontinuous Galerkin methods
SBP operators on bounded domains can be coupled continuously or discontinuously
to obtain CG//DG-type methods. You need to create an appropriate mesh and
a basic operator D that should be used on each element.
Then, global CG/DG operators are constructed lazily/matrix-free by calling
couple_continuously(D, mesh) or
couple_discontinuously(D, mesh, coupling::Union{Val{:plus}, Val{:central}, Val{:minus}}=Val(:central)).
Choosing coupling=Val(:central) yields a classical SBP operator; the other two
coupling types result in upwind SBP operators. Currently, only uniform meshes
UniformMesh1D(xmin::Real, xmax::Real, Nx::Integer)UniformPeriodicMesh1D(xmin::Real, xmax::Real, Nx::Integer)
are implemented.
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 julia> using SummationByPartsOperators
julia> D = derivativeoperator(MattssonNordström2004(), derivativeorder=1, accuracy_order=2, xmin=0.0, xmax=1.0, N=5) SBP first-derivative operator of order 2 on a grid in [0.0, 1.0] using 5 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.
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: -4.0 4.0 ⋅ ⋅ ⋅ -2.0 ⋅ 2.0 ⋅ ⋅ ⋅ -2.0 ⋅ 2.0 ⋅ ⋅ ⋅ -2.0 ⋅ 2.0 ⋅ ⋅ ⋅ -4.0 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
The latest documentation is available
online
and under docs/src.
Some additional examples can be found in the directory
notebooks.
In particular, examples of complete discretizations of
the linear advection equation,
the heat equation,
and the wave equation are available.
Further examples are supplied as
tests.
Referencing
If you use
SummationByPartsOperators.jl
for your research, please cite it using the bibtex entry
bibtex
@article{ranocha2021sbp,
title={{SummationByPartsOperators.jl}: {A} {J}ulia library of provably stable
semidiscretization techniques with mimetic properties},
author={Ranocha, Hendrik},
journal={Journal of Open Source Software},
year={2021},
month={08},
doi={10.21105/joss.03454},
volume={6},
number={64},
pages={3454},
publisher={The Open Journal},
url={https://github.com/ranocha/SummationByPartsOperators.jl}
}
License and contributing
This project is licensed under the MIT license (see LICENSE.md). Since it is an open-source project, we are very happy to accept contributions from the community. Please refer to CONTRIBUTING.md for more details.
Owner
- Name: Hendrik Ranocha
- Login: ranocha
- Kind: user
- Location: Hamburg, Germany
- Company: University of Hamburg
- Website: https://ranocha.de
- Repositories: 13
- Profile: https://github.com/ranocha
Assistant Professor analyzing & developing numerical methods for differential equations, focusing on stability, mimetic properties & structure preservation
JOSS Publication
SummationByPartsOperators.jl: A Julia library of provably stable discretization techniques with mimetic properties
Tags
numerical analysis differential equations summation-by-parts energy stability finite differences discontinuous Galerkin methods Fourier collocation methodsCitation (CITATION.bib)
@article{ranocha2021sbp,
title={{SummationByPartsOperators.jl}: {A} {J}ulia library of provably stable
semidiscretization techniques with mimetic properties},
author={Ranocha, Hendrik},
journal={Journal of Open Source Software},
year={2021},
month={08},
doi={10.21105/joss.03454},
volume={6},
number={64},
pages={3454},
publisher={The Open Journal},
url={https://github.com/ranocha/SummationByPartsOperators.jl}
}
GitHub Events
Total
- Create event: 43
- Commit comment event: 20
- Release event: 8
- Issues event: 10
- Watch event: 7
- Delete event: 35
- Issue comment event: 99
- Push event: 196
- Pull request review comment event: 62
- Pull request review event: 85
- Pull request event: 85
- Fork event: 2
Last Year
- Create event: 43
- Commit comment event: 20
- Release event: 8
- Issues event: 10
- Watch event: 7
- Delete event: 35
- Issue comment event: 99
- Push event: 196
- Pull request review comment event: 62
- Pull request review event: 85
- Pull request event: 85
- Fork event: 2
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Hendrik Ranocha | h****a@t****e | 536 |
| dependabot[bot] | 4****] | 75 |
| github-actions[bot] | 4****] | 27 |
| Joshua Lampert | 5****t | 14 |
| Dougal-s | d****i@g****m | 2 |
| Julia TagBot | 5****t | 1 |
| Jesse Chan | 1****n | 1 |
| Erik Schnetter | s****r@g****m | 1 |
| Christopher Rackauckas | a****s@c****m | 1 |
| Alexander Seiler | s****x@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 36
- Total pull requests: 315
- Average time to close issues: 9 days
- Average time to close pull requests: 4 days
- Total issue authors: 12
- Total pull request authors: 11
- Average comments per issue: 3.86
- Average comments per pull request: 1.99
- Merged pull requests: 278
- Bot issues: 0
- Bot pull requests: 169
Past Year
- Issues: 7
- Pull requests: 103
- Average time to close issues: 5 days
- Average time to close pull requests: 5 days
- Issue authors: 3
- Pull request authors: 4
- Average comments per issue: 0.14
- Average comments per pull request: 1.65
- Merged pull requests: 83
- Bot issues: 0
- Bot pull requests: 72
Top Authors
Issue Authors
- ranocha (20)
- JoshuaLampert (4)
- jlchan (3)
- appelo (1)
- jbiffl (1)
- ChrisRackauckas (1)
- kellertuer (1)
- andrewwinters5000 (1)
- chrisstolk (1)
- svretina (1)
- JuliaTagBot (1)
- xtalax (1)
Pull Request Authors
- dependabot[bot] (123)
- ranocha (110)
- github-actions[bot] (46)
- JoshuaLampert (23)
- Dougal-s (4)
- jlchan (3)
- reula (2)
- ChrisRackauckas (1)
- goggle (1)
- xlxs4 (1)
- eschnett (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v2 composite
- actions/checkout v2 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/setup-julia latest composite
- actions/checkout v3 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/julia-invalidations v1 composite
- julia-actions/setup-julia v1 composite
- JuliaRegistries/TagBot v1 composite
- actions/checkout v3 composite
- actions/download-artifact v3 composite
- actions/upload-artifact v3 composite
- codecov/codecov-action v1 composite
- coverallsapp/github-action master composite
- julia-actions/cache v1 composite
- julia-actions/julia-buildpkg v1 composite
- julia-actions/julia-processcoverage v1 composite
- julia-actions/julia-runtest v1 composite
- julia-actions/setup-julia v1 composite
- actions/checkout v4 composite
- crate-ci/typos v1.16.21 composite
