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

EXPERIMENTAL polarization solver class for N. More...

Public Types

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

Public Member Functions

 PolChargeN ()
 empty object ( no memory allocation) More...
 
 PolChargeN (const Geometry &g, direction dir=forward, value_type jfactor=1.)
 Construct from Grid. More...
 
 PolChargeN (const Geometry &g, bc bcx, bc bcy, direction dir=forward, value_type jfactor=1.)
 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_phi (const ContainerType0 &phi)
 
template<class ContainerType0 >
void set_dxphi (const ContainerType0 &dxphi)
 
template<class ContainerType0 >
void set_dyphi (const ContainerType0 &dyphi)
 
template<class ContainerType0 >
void set_lapphi (const ContainerType0 &lapphi)
 
const Container & weights () const
 Return the vector making the matrix symmetric. More...
 
const Container & precond () const
 Return the default preconditioner to use in conjugate gradient. 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...
 

Detailed Description

template<class Geometry, class Matrix, class Container>
class dg::mat::PolChargeN< Geometry, Matrix, Container >

EXPERIMENTAL polarization solver class for N.

Try to solve N \( -\nabla \cdot ( N \nabla \phi) = \rho\) for given phi and rho

Attention
Converges very slowly if at all

Member Typedef Documentation

◆ container_type

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

◆ geometry_type

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

◆ matrix_type

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

◆ value_type

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

Constructor & Destructor Documentation

◆ PolChargeN() [1/3]

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

empty object ( no memory allocation)

◆ PolChargeN() [2/3]

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

Construct from Grid.

Parameters
gThe Grid, boundary conditions are taken from here
dirDirection of the right first derivative in x and y (i.e. dg::forward, dg::backward or dg::centered),
jfactor( \( = \alpha \) ) scale jump terms (1 is a good value but in some cases 0.1 or 0.01 might be better)
Note
chi is assumed 1 per default

◆ PolChargeN() [3/3]

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

Construct from grid and boundary conditions.

Parameters
gThe Grid
bcxboundary condition in x
bcyboundary contition in y
dirDirection of the right first derivative in x and y (i.e. dg::forward, dg::backward or dg::centered),
jfactor( \( = \alpha \) ) scale jump terms (1 is a good value but in some cases 0.1 or 0.01 might be better)
Note
chi is assumed 1 per default

Member Function Documentation

◆ construct()

template<class Geometry , class Matrix , class Container >
template<class ... Params>
void dg::mat::PolChargeN< 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::PolChargeN< Geometry, Matrix, Container >::operator() ( const ContainerType0 &  x,
ContainerType1 &  y 
)
inline

Compute elliptic term and store in output.

i.e. \( y=f(x) = - \nabla \cdot (x \nabla_\perp \phi) \) or \( y=f(x) = x + (1+ \alpha \Delta_\perp )\nabla \cdot (x \nabla_\perp \phi) \)

Parameters
xleft-hand-side
yresult
Template Parameters
ContainerTypesmust be usable with Container in The dg dispatch system

◆ precond()

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

Return the default preconditioner to use in conjugate gradient.

Currently returns the inverse weights without volume elment divided by the scalar part of \( \chi\). This is especially good when \( \chi\) exhibits large amplitudes or variations

Returns
the inverse of \(\chi\).

◆ set_dxphi()

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 >
void dg::mat::PolChargeN< Geometry, Matrix, Container >::set_dxphi ( const ContainerType0 &  dxphi)
inline

◆ set_dyphi()

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 >
void dg::mat::PolChargeN< Geometry, Matrix, Container >::set_dyphi ( const ContainerType0 &  dyphi)
inline

◆ set_lapphi()

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 >
void dg::mat::PolChargeN< Geometry, Matrix, Container >::set_lapphi ( const ContainerType0 &  lapphi)
inline

◆ set_phi()

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 >
void dg::mat::PolChargeN< Geometry, Matrix, Container >::set_phi ( const ContainerType0 &  phi)
inline

◆ symv() [1/2]

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

Compute elliptic term and store in output.

i.e. \( y=M(phi) x \)

Parameters
xleft-hand-side
yresult
Template Parameters
ContainerTypesmust be usable with Container in The dg dispatch system

◆ symv() [2/2]

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

Compute elliptic term and add to output.

i.e. \( y=alpha*M(phi) x +beta*y \)

Parameters
alphaa scalar
xthe chi term
betaa scalar
yresult
Template Parameters
ContainerTypesmust be usable with Container in The dg dispatch system

◆ weights()

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

Return the vector making the matrix symmetric.

i.e. the volume form

Returns
volume form including weights

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