| Discontinuous Galerkin Library
    #include "dg/algorithm.h" | 
Elliptic \( -\nabla\cdot (\chi \nabla f)\) and Helmholtz \( (\chi + \alpha \Delta) f\). More...
| Classes | |
| class | dg::Elliptic1d< Geometry, Matrix, Container > | 
| A 1d negative elliptic differential operator \( -\partial_x ( \chi \partial_x ) \).  More... | |
| class | dg::Elliptic2d< Geometry, Matrix, Container > | 
| A 2d negative elliptic differential operator \( -\nabla \cdot ( \mathbf{\chi}\cdot \nabla ) \).  More... | |
| class | dg::Elliptic3d< Geometry, Matrix, Container > | 
| A 3d negative elliptic differential operator \( -\nabla \cdot ( \mathbf{\chi}\cdot \nabla ) \).  More... | |
| struct | dg::GeneralHelmholtz< Matrix, Container > | 
| A general Helmholtz-type operator \( (\chi-\alpha F) \).  More... | |
| struct | dg::Helmholtz2< Geometry, Matrix, Container > | 
| DEPRECATED, Matrix class that represents a more general Helmholtz-type operator.  More... | |
| class | dg::RefinedElliptic< Geometry, IMatrix, Matrix, Container > | 
| The refined version of Elliptic.  More... | |
| Typedefs | |
| template<class Geometry , class Matrix , class Container > | |
| using | dg::Elliptic = Elliptic2d<Geometry, Matrix, Container> | 
| A 2d negative elliptic differential operator \( -\nabla \cdot ( \mathbf{\chi}\cdot \nabla ) \). | |
| template<class Geometry , class Matrix , class Container > | |
| using | dg::Helmholtz = GeneralHelmholtz<dg::Elliptic2d<Geometry,Matrix,Container>, Container> | 
| a 2d Helmholtz opereator \( (\chi - \alpha F)\) with \( F = -\Delta\) | |
| template<class Geometry , class Matrix , class Container > | |
| using | dg::Helmholtz1d = GeneralHelmholtz<dg::Elliptic1d<Geometry,Matrix,Container>, Container> | 
| a 1d Helmholtz opereator \( (\chi - \alpha F)\) with \( F = -\partial_x^2\) | |
| template<class Geometry , class Matrix , class Container > | |
| using | dg::Helmholtz2d = GeneralHelmholtz<dg::Elliptic2d<Geometry,Matrix,Container>, Container> | 
| a 2d Helmholtz opereator \( (\chi - \alpha F)\) with \( F = -\Delta\) | |
| template<class Geometry , class Matrix , class Container > | |
| using | dg::Helmholtz3d = GeneralHelmholtz<dg::Elliptic3d<Geometry,Matrix,Container>, Container> | 
| a 3d Helmholtz opereator \( (\chi - \alpha F)\) with \( F = -\Delta\) | |
Elliptic \( -\nabla\cdot (\chi \nabla f)\) and Helmholtz \( (\chi + \alpha \Delta) f\).
| using dg::Elliptic = Elliptic2d<Geometry, Matrix, Container> | 
A 2d negative elliptic differential operator \( -\nabla \cdot ( \mathbf{\chi}\cdot \nabla ) \).
The term discretized is
\[ -\nabla \cdot ( \mathbf{\chi} \cdot \nabla ) \]
where \( \nabla \) is the two-dimensional nabla and \(\chi = \sigma \mathbf{\tau}\) is a (possibly spatially dependent) tensor with scalar part \( \sigma\) (usually the volume form) and tensor part \( \tau\) (usually the inverse metric). In general coordinates that means
\[ -\frac{1}{\sqrt{g}}\left( \partial_x\left(\sqrt{g}\left(\chi^{xx}\partial_x + \chi^{xy}\partial_y \right)\right) + \partial_y\left(\sqrt{g} \left(\chi^{yx}\partial_x + \chi^{yy}\partial_y \right)\right) \right)\]
is discretized. Per default, \( \chi = \sqrt{g} g^{-1}\) but you can set it to any tensor you like (in order for the operator to be invertible \(\chi\) should be symmetric and positive definite though).
Note that the local discontinuous Galerkin discretization adds so-called jump terms
\[ D^\dagger \chi D + \alpha\chi_{on/off} J \]
where \(\alpha\) is a scale factor ( = jfactor), \( D \) contains the discretizations of the above derivatives, and \( J\) is a self-adjoint matrix. ( \(J\) is added before the volume element is divided). The adjoint of a matrix is defined with respect to the volume element including dG weights. Usually the default \( \alpha=1 \) is a good choice. However, in some cases, e.g. when \( \sigma \) exhibits very large variations \( \alpha=0.1\) or \( \alpha=0.01\) might be better values. In a time dependent problem the value of \(\alpha\) determines the numerical diffusion, i.e. for too low values numerical oscillations may appear. The \( \chi_{on/off} \) in the jump term serves to weight the jump term with \( \chi \). This can be switched either on or off with off being the default. Also note that a forward discretization has more diffusion than a centered discretization.
The following code snippet demonstrates the use of Elliptic in an inversion problem 
| Geometry | A type that is or derives from one of the abstract geometry base classes ( aGeometry2d,aGeometry3d,aMPIGeometry2d, ...).Geometrydetermines whichMatrixandContainertypes can be used: | 
| Matrix | A class for which the dg::blas2::symvfunctions are callable in connection with theContainerclass and to which the return type ofdg::create::dx()can be converted usingdg::blas2::transfer. TheMatrixtype can be one of:
 | 
| Container | A data container class for which the blas1functionality is overloaded and to which the return type ofblas1::subroutine()can be converted usingdg::assign. We assume thatContaineris copyable/assignable and has a swap member function. In connection withGeometrythis is one of
 | 
| using dg::Helmholtz = GeneralHelmholtz<dg::Elliptic2d<Geometry,Matrix,Container>, Container> | 
a 2d Helmholtz opereator \( (\chi - \alpha F)\) with \( F = -\Delta\)
where \( \chi\) is a vector and \(\alpha\) a scalar and \(F\) is an operator.
Elliptic operator then the Laplacian in this formula becomes positive as opposed to the negative sign in the Elliptic operatorCan be used by the dg::PCG class. The following example shows how the class can be used to act as a Helmholtz2 operator: 
| Geometry | A type that is or derives from one of the abstract geometry base classes ( aGeometry2d,aGeometry3d,aMPIGeometry2d, ...).Geometrydetermines whichMatrixandContainertypes can be used: | 
| Matrix | A class for which the dg::blas2::symvfunctions are callable in connection with theContainerclass and to which the return type ofdg::create::dx()can be converted usingdg::blas2::transfer. TheMatrixtype can be one of:
 | 
| Container | A data container class for which the blas1functionality is overloaded and to which the return type ofblas1::subroutine()can be converted usingdg::assign. We assume thatContaineris copyable/assignable and has a swap member function. In connection withGeometrythis is one of | 
weights() and precond() methods defined. If Matrix is to be an arbitrary functor then it is more convenient to simply directly use a lambda function to achieve the computation of \( y = (\chi - \alpha F)x\)    | using dg::Helmholtz1d = GeneralHelmholtz<dg::Elliptic1d<Geometry,Matrix,Container>, Container> | 
a 1d Helmholtz opereator \( (\chi - \alpha F)\) with \( F = -\partial_x^2\)
where \( \chi\) is a vector and \(\alpha\) a scalar and \(F\) is an operator.
Elliptic operator then the Laplacian in this formula becomes positive as opposed to the negative sign in the Elliptic operatorCan be used by the dg::PCG class. The following example shows how the class can be used to act as a Helmholtz2 operator: 
| Geometry | A type that is or derives from one of the abstract geometry base classes ( aGeometry2d,aGeometry3d,aMPIGeometry2d, ...).Geometrydetermines whichMatrixandContainertypes can be used: | 
| Matrix | A class for which the dg::blas2::symvfunctions are callable in connection with theContainerclass and to which the return type ofdg::create::dx()can be converted usingdg::blas2::transfer. TheMatrixtype can be one of:
 | 
| Container | A data container class for which the blas1functionality is overloaded and to which the return type ofblas1::subroutine()can be converted usingdg::assign. We assume thatContaineris copyable/assignable and has a swap member function. In connection withGeometrythis is one of | 
weights() and precond() methods defined. If Matrix is to be an arbitrary functor then it is more convenient to simply directly use a lambda function to achieve the computation of \( y = (\chi - \alpha F)x\)    | using dg::Helmholtz2d = GeneralHelmholtz<dg::Elliptic2d<Geometry,Matrix,Container>, Container> | 
a 2d Helmholtz opereator \( (\chi - \alpha F)\) with \( F = -\Delta\)
where \( \chi\) is a vector and \(\alpha\) a scalar and \(F\) is an operator.
Elliptic operator then the Laplacian in this formula becomes positive as opposed to the negative sign in the Elliptic operatorCan be used by the dg::PCG class. The following example shows how the class can be used to act as a Helmholtz2 operator: 
| Geometry | A type that is or derives from one of the abstract geometry base classes ( aGeometry2d,aGeometry3d,aMPIGeometry2d, ...).Geometrydetermines whichMatrixandContainertypes can be used: | 
| Matrix | A class for which the dg::blas2::symvfunctions are callable in connection with theContainerclass and to which the return type ofdg::create::dx()can be converted usingdg::blas2::transfer. TheMatrixtype can be one of:
 | 
| Container | A data container class for which the blas1functionality is overloaded and to which the return type ofblas1::subroutine()can be converted usingdg::assign. We assume thatContaineris copyable/assignable and has a swap member function. In connection withGeometrythis is one of | 
weights() and precond() methods defined. If Matrix is to be an arbitrary functor then it is more convenient to simply directly use a lambda function to achieve the computation of \( y = (\chi - \alpha F)x\)    | using dg::Helmholtz3d = GeneralHelmholtz<dg::Elliptic3d<Geometry,Matrix,Container>, Container> | 
a 3d Helmholtz opereator \( (\chi - \alpha F)\) with \( F = -\Delta\)
where \( \chi\) is a vector and \(\alpha\) a scalar and \(F\) is an operator.
Elliptic operator then the Laplacian in this formula becomes positive as opposed to the negative sign in the Elliptic operatorCan be used by the dg::PCG class. The following example shows how the class can be used to act as a Helmholtz2 operator: 
| Geometry | A type that is or derives from one of the abstract geometry base classes ( aGeometry2d,aGeometry3d,aMPIGeometry2d, ...).Geometrydetermines whichMatrixandContainertypes can be used: | 
| Matrix | A class for which the dg::blas2::symvfunctions are callable in connection with theContainerclass and to which the return type ofdg::create::dx()can be converted usingdg::blas2::transfer. TheMatrixtype can be one of:
 | 
| Container | A data container class for which the blas1functionality is overloaded and to which the return type ofblas1::subroutine()can be converted usingdg::assign. We assume thatContaineris copyable/assignable and has a swap member function. In connection withGeometrythis is one of | 
weights() and precond() methods defined. If Matrix is to be an arbitrary functor then it is more convenient to simply directly use a lambda function to achieve the computation of \( y = (\chi - \alpha F)x\)