Extension: Matrix functions
#include "dg/matrix/matrix.h"
dg::mat::TensorElliptic< Geometry, Matrix, Container > Struct Template Reference

Matrix class that represents the arbitrary polarization operator. More...

Public Types

using container_type = Container
 
using geometry_type = Geometry
 
using matrix_type = Matrix
 
using value_type = get_value_type< Container >
 

Public Member Functions

 TensorElliptic ()
 empty object ( no memory allocation) More...
 
 TensorElliptic (const Geometry &g, direction dir=dg::centered, value_type jfactor=1.)
 Construct TensorElliptic operator. More...
 
 TensorElliptic (const Geometry &g, bc bcx, bc bcy, direction dir=dg::centered, value_type jfactor=1.)
 Construct TensorElliptic operator. More...
 
template<class ... Params>
void construct (Params &&...ps)
 Perfect forward parameters to one of the constructors. More...
 
const Container & weights () const
 
const Container & precond () const
 Preconditioner to use in conjugate gradient solvers. More...
 
template<class ContainerType0 >
void set_chi (const ContainerType0 &chi)
 Set Chi in the above formula. More...
 
template<class ContainerType0 >
void set_iota (const ContainerType0 &iota)
 Set Iota in the above formula. More...
 
void variation (const Container &phi, const value_type &alpha, const Container &chi, Container &varphi)
 compute the variational of the operator (psi_2 in gf theory): More...
 
template<class ContainerType0 , class ContainerType1 >
void operator() (const ContainerType0 &x, ContainerType1 &y)
 
template<class ContainerType0 , class ContainerType1 >
void symv (const ContainerType0 &x, ContainerType1 &y)
 
template<class ContainerType0 , class ContainerType1 >
void symv (value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y)
 apply operator More...
 

Detailed Description

template<class Geometry, class Matrix, class Container>
struct dg::mat::TensorElliptic< Geometry, Matrix, Container >

Matrix class that represents the arbitrary polarization operator.

Discretization of

\[ (-\nabla \cdot \chi \nabla - \Delta \iota \Delta + \nabla \cdot\nabla \cdot 2\iota \nabla \nabla ) x \]

in two dimensions where \( \chi\) and \(\iota\) are functions

Member Typedef Documentation

◆ container_type

template<class Geometry , class Matrix , class Container >
using dg::mat::TensorElliptic< Geometry, Matrix, Container >::container_type = Container

◆ geometry_type

template<class Geometry , class Matrix , class Container >
using dg::mat::TensorElliptic< Geometry, Matrix, Container >::geometry_type = Geometry

◆ matrix_type

template<class Geometry , class Matrix , class Container >
using dg::mat::TensorElliptic< Geometry, Matrix, Container >::matrix_type = Matrix

◆ value_type

template<class Geometry , class Matrix , class Container >
using dg::mat::TensorElliptic< Geometry, Matrix, Container >::value_type = get_value_type<Container>

Constructor & Destructor Documentation

◆ TensorElliptic() [1/3]

template<class Geometry , class Matrix , class Container >
dg::mat::TensorElliptic< Geometry, Matrix, Container >::TensorElliptic ( )
inline

empty object ( no memory allocation)

◆ TensorElliptic() [2/3]

template<class Geometry , class Matrix , class Container >
dg::mat::TensorElliptic< Geometry, Matrix, Container >::TensorElliptic ( const Geometry &  g,
direction  dir = dg::centered,
value_type  jfactor = 1. 
)
inline

Construct TensorElliptic operator.

Parameters
gThe grid to use
dirDirection of the Laplace operator (Note: only dg::centered tested)
jfactorThe jfactor used in the Laplace operator (probably 1 is always the best factor but one never knows...)
Note
The default value of \(\chi\) and \(\iota\) is one

◆ TensorElliptic() [3/3]

template<class Geometry , class Matrix , class Container >
dg::mat::TensorElliptic< Geometry, Matrix, Container >::TensorElliptic ( const Geometry &  g,
bc  bcx,
bc  bcy,
direction  dir = dg::centered,
value_type  jfactor = 1. 
)
inline

Construct TensorElliptic operator.

Parameters
gThe grid to use
bcxboundary condition in x
bcyboundary contition in y
dirDirection of the Laplace operator (Note: only dg::centered tested)
jfactorThe jfactor used in the Laplace operator (probably 1 is always the best factor but one never knows...)
Note
The default value of \(\chi\) and \(\iota\) is one

Member Function Documentation

◆ construct()

template<class Geometry , class Matrix , class Container >
template<class ... Params>
void dg::mat::TensorElliptic< Geometry, Matrix, Container >::construct ( Params &&...  ps)
inline

Perfect forward parameters to one of the constructors.

Template Parameters
Paramsdeduced by the compiler
Parameters
psparameters forwarded to constructors

◆ operator()()

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 , class ContainerType1 >
void dg::mat::TensorElliptic< Geometry, Matrix, Container >::operator() ( const ContainerType0 &  x,
ContainerType1 &  y 
)
inline

◆ precond()

template<class Geometry , class Matrix , class Container >
const Container & dg::mat::TensorElliptic< Geometry, Matrix, Container >::precond ( ) const
inline

Preconditioner to use in conjugate gradient solvers.

Returns
1

◆ set_chi()

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 >
void dg::mat::TensorElliptic< Geometry, Matrix, Container >::set_chi ( const ContainerType0 &  chi)
inline

Set Chi in the above formula.

Parameters
chinew container

◆ set_iota()

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 >
void dg::mat::TensorElliptic< Geometry, Matrix, Container >::set_iota ( const ContainerType0 &  iota)
inline

Set Iota in the above formula.

Parameters
iotanew container

◆ symv() [1/2]

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 , class ContainerType1 >
void dg::mat::TensorElliptic< Geometry, Matrix, Container >::symv ( const ContainerType0 &  x,
ContainerType1 &  y 
)
inline

◆ symv() [2/2]

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 , class ContainerType1 >
void dg::mat::TensorElliptic< Geometry, Matrix, Container >::symv ( value_type  alpha,
const ContainerType0 &  x,
value_type  beta,
ContainerType1 &  y 
)
inline

apply operator

Computes

\[ y = W\left[-\nabla \cdot \chi \nabla_\perp - \Delta_\perp \iota \Delta_\perp + 2\nabla \cdot\nabla \cdot \iota \nabla_\perp \nabla_\perp \right] x \]

to make the matrix symmetric

Parameters
alpha
xlhs (is constant up to changes in ghost cells)
beta
yrhs contains solution
Note
Note that for Cartesian and Cylindrical coordinate systems (with the straight field line approximation) the following relation holds

\[\nabla \cdot\nabla \cdot (\chi \nabla_\perp^2 f) = \frac{1}{\sqrt{g}} \partial_j \left\{\partial_i \left[\sqrt{g} \chi P^{ni} \left( \partial_n ( P^{jm} \partial_m f)\right) \right]\right\} \]

where P is the projection tensor

◆ variation()

template<class Geometry , class Matrix , class Container >
void dg::mat::TensorElliptic< Geometry, Matrix, Container >::variation ( const Container &  phi,
const value_type alpha,
const Container &  chi,
Container &  varphi 
)
inline

compute the variational of the operator (psi_2 in gf theory):

\[ - \frac{\chi}{2} \left\{|\nabla \phi|^2 + \alpha \chi ( | \nabla^2 \phi |^2 - (\Delta \phi)^2 / 2) \right\}\]

Parameters
phi(e.g. Gamma phi)
alpha(e.g. tau/2)
chi(e.g. 1/B^2)
varphiequals psi_2 in gf theory if phi = gamma_phi

◆ weights()

template<class Geometry , class Matrix , class Container >
const Container & dg::mat::TensorElliptic< Geometry, Matrix, Container >::weights ( ) const
inline


The documentation for this struct was generated from the following file: