A 2d negative elliptic differential operator \( -\nabla \cdot ( \mathbf{\chi}\cdot \nabla ) \).
More...
|
| Elliptic2d ()=default |
| empty object ( no memory allocation) More...
|
|
| Elliptic2d (const Geometry &g, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false) |
| Construct from Grid. More...
|
|
| Elliptic2d (const Geometry &g, bc bcx, bc bcy, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false) |
| Construct from grid and boundary conditions. More...
|
|
template<class ... Params> |
void | construct (Params &&...ps) |
| Perfect forward parameters to one of the constructors. More...
|
|
template<class ContainerType0 > |
void | set_chi (const ContainerType0 &sigma) |
| Change scalar part in Chi tensor. More...
|
|
template<class ContainerType0 > |
void | set_chi (const SparseTensor< ContainerType0 > &tau) |
| Change tensor part in Chi tensor. More...
|
|
const Container & | weights () const |
| Return the weights making the operator self-adjoint. More...
|
|
const Container & | precond () const |
| Return the default preconditioner to use in conjugate gradient. More...
|
|
void | set_jfactor (value_type new_jfactor) |
| Set the currently used jfactor ( \( \alpha \)) More...
|
|
value_type | get_jfactor () const |
| Get the currently used jfactor ( \( \alpha \)) More...
|
|
void | set_jump_weighting (bool jump_weighting) |
| Set the chi weighting of jump terms. More...
|
|
bool | get_jump_weighting () const |
| Get the current state of chi weighted jump terms. More...
|
|
template<class ContainerType0 , class ContainerType1 > |
void | operator() (const ContainerType0 &x, ContainerType1 &y) |
| Compute elliptic term and store in output. More...
|
|
template<class ContainerType0 , class ContainerType1 > |
void | symv (const ContainerType0 &x, ContainerType1 &y) |
| Compute elliptic term and store in output. More...
|
|
template<class ContainerType0 , class ContainerType1 > |
void | symv (value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y) |
| Compute elliptic term and add to output. More...
|
|
template<class ContainerType0 , class ContainerType1 > |
void | variation (const ContainerType0 &phi, ContainerType1 &sigma) |
| \( \sigma = (\nabla\phi\cdot\tau\cdot\nabla \phi) \) More...
|
|
template<class ContainerTypeL , class ContainerType0 , class ContainerType1 > |
void | variation (const ContainerTypeL &lambda, const ContainerType0 &phi, ContainerType1 &sigma) |
| \( \sigma = \lambda^2(\nabla\phi\cdot\tau\cdot\nabla \phi) \) More...
|
|
template<class ContainerTypeL , class ContainerType0 , class ContainerType1 > |
void | variation (value_type alpha, const ContainerTypeL &lambda, const ContainerType0 &phi, value_type beta, ContainerType1 &sigma) |
| \( \sigma = \alpha \lambda^2 (\nabla\phi\cdot\tau\cdot\nabla \phi) + \beta \sigma\) More...
|
|
template<class Geometry, class Matrix, class Container>
class dg::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).
- See also
- Our theory guide Introduction to dg methods on overleaf holds a detailed derivation
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
pol_forward.set_chi( chi);
pcg.solve( pol_forward, x, b, chi_inv, w2d, eps);
std::cout << " "<<sqrt( err/norm) << "\n";
A 2d negative elliptic differential operator .
Definition: elliptic.h:231
Preconditioned conjugate gradient method to solve .
Definition: pcg.h:57
void axpby(get_value_type< ContainerType > alpha, const ContainerType1 &x, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:231
get_value_type< MatrixType > dot(const ContainerType1 &x, const MatrixType &m, const ContainerType2 &y)
; Binary reproducible general dot product
Definition: blas2.h:85
@ forward
forward derivative (cell to the right and current cell)
Definition: enums.h:98
- Template Parameters
-
Geometry | A type that is or derives from one of the abstract geometry base classes ( aGeometry2d , aGeometry3d , aMPIGeometry2d , ...). Geometry determines which Matrix and Container types can be used: |
Matrix | A class for which the dg::blas2::symv functions are callable in connection with the Container class and to which the return type of dg::create::dx() can be converted using dg::blas2::transfer . The Matrix type can be one of:
|
Container | A data container class for which the blas1 functionality is overloaded and to which the return type of blas1::subroutine() can be converted using dg::assign . We assume that Container is copyable/assignable and has a swap member function. In connection with Geometry this is one of
|
- Note
- The constructors initialize \( \chi=\sqrt{g}g^{-1}\) so that a negative laplacian operator results
-
The inverse of \( \sigma\) makes a good general purpose preconditioner
-
Since the pattern arises quite often (because of the ExB velocity \( u_E^2\) in the ion gyro-centre potential) this class also can compute the variation integrand \( \lambda^2\nabla \phi\cdot \tau\cdot\nabla\phi\)
- Attention
- Pay attention to the negative sign which is necessary to make the matrix positive definite