Extension: Geometries
#include "dg/geometries/geometries.h"
dg::geo::DS< ProductGeometry, IMatrix, Matrix, container > Struct Template Reference

Class for the evaluation of parallel derivatives. More...

Public Types

typedef dg::geo::Fieldaligned< ProductGeometry, IMatrix, container > FA
 

Public Member Functions

 DS ()
 No memory allocation; all member calls except construct are invalid. More...
 
template<class Limiter >
 DS (const dg::geo::TokamakMagneticField &vec, const ProductGeometry &grid, dg::bc bcx=dg::NEU, dg::bc bcy=dg::NEU, Limiter limit=FullLimiter(), double eps=1e-5, unsigned mx=10, unsigned my=10, double deltaPhi=-1, std::string interpolation_method="dg", bool benchmark=true)
 Create the magnetic unit vector field and construct. More...
 
template<class Limiter >
 DS (const dg::geo::CylindricalVectorLvl1 &vec, const ProductGeometry &grid, dg::bc bcx=dg::NEU, dg::bc bcy=dg::NEU, Limiter limit=FullLimiter(), double eps=1e-5, unsigned mx=10, unsigned my=10, double deltaPhi=-1, std::string interpolation_method="dg", bool benchmark=true)
 Use the given vector field to construct. More...
 
 DS (FA fieldaligned)
 Re-construct from a given Fieldaligned object. More...
 
template<class ... Params>
void construct (Params &&...ps)
 Perfect forward parameters to one of the constructors. More...
 
void set_boundaries (dg::bc bcz, double left, double right)
 Set boundary conditions in the limiter region. More...
 
void set_boundaries (dg::bc bcz, const container &left, const container &right)
 Set boundary conditions in the limiter region. More...
 
void set_boundaries (dg::bc bcz, const container &global, double scal_left, double scal_right)
 Set boundary conditions in the limiter region. More...
 
void forward (double alpha, const container &f, double beta, container &g)
 forward derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\) More...
 
void forward2 (double alpha, const container &f, double beta, container &g)
 2nd order forward derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\) More...
 
void backward (double alpha, const container &f, double beta, container &g)
 backward derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\) More...
 
void backward2 (double alpha, const container &f, double beta, container &g)
 2nd order backward derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\) More...
 
void centered (double alpha, const container &f, double beta, container &g)
 centered derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\) More...
 
void centered_bc_along_field (double alpha, const container &f, double beta, container &g, dg::bc bound, std::array< double, 2 > boundary_value={0, 0})
 Same as dg::geo::ds_centered after dg::geo::ds_assign_bc_along_field_2nd. More...
 
void backward (const container &f, container &g)
 backward derivative \( g = \vec v \cdot \nabla f \) More...
 
void forward (const container &f, container &g)
 forward derivative \( g = \vec v \cdot \nabla f \) More...
 
void centered (const container &f, container &g)
 centered derivative \( g = \vec v \cdot \nabla f \) More...
 
void divForward (double alpha, const container &f, double beta, container &g)
 forward divergence \( g = \alpha \nabla\cdot(\vec v f) + \beta g\) More...
 
void divBackward (double alpha, const container &f, double beta, container &g)
 backward divergence \( g = \alpha \nabla\cdot(\vec v f) + \beta g\) More...
 
void divCentered (double alpha, const container &f, double beta, container &g)
 centered divergence \( g = \alpha \nabla\cdot(\vec v f) + \beta g\) More...
 
void divForward (const container &f, container &g)
 forward divergence \( g = \nabla\cdot(\vec v f)\) More...
 
void divBackward (const container &f, container &g)
 backward divergence \( g = \nabla\cdot(\vec v f)\) More...
 
void divCentered (const container &f, container &g)
 centered divergence \( g = \nabla\cdot(\vec v f)\) More...
 
void ds (dg::direction dir, const container &f, container &g)
 Discretizes \( g = \vec v\cdot \nabla f \). More...
 
void ds (dg::direction dir, double alpha, const container &f, double beta, container &g)
 Discretizes \( g = \alpha \vec v\cdot \nabla f + \beta g \). More...
 
void div (dg::direction dir, const container &f, container &g)
 Discretizes \( g = \nabla \cdot ( \vec v f) \). More...
 
void div (dg::direction dir, double alpha, const container &f, double beta, container &g)
 Discretizes \( g = \alpha \nabla \cdot( \vec v f) + \beta g \). More...
 
void symv (const container &f, container &g)
 Discretizes \( g = \nabla\cdot ( \vec v \vec v \cdot \nabla f )\). More...
 
void symv (double alpha, const container &f, double beta, container &g)
 Discretizes \( g = \alpha \nabla\cdot ( \vec v \vec v \cdot \nabla f ) + \beta g\) as a symmetric matrix. More...
 
void dss (const container &f, container &g)
 Discretizes \( g = (\vec v\cdot \nabla)^2 f \). More...
 
void dss (double alpha, const container &f, double beta, container &g)
 Discretizes \( g = \alpha (\vec v\cdot \nabla)^2 f + \beta g \). More...
 
void dss_bc_along_field (double alpha, const container &f, double beta, container &g, dg::bc bound, std::array< double, 2 > boundary_value={0, 0})
 Same as dg::geo::dss_centered after dg::geo::ds_assign_bc_along_field_2nd. More...
 
void dssd (double alpha, const container &f, double beta, container &g)
 Same as dg::geo::dssd_centered. More...
 
void dssd_bc_along_field (double alpha, const container &f, double beta, container &g, dg::bc bound, std::array< double, 2 > boundary_value={0, 0})
 Same as dg::geo::dssd_centered after dg::geo::ds_assign_bc_along_field_2nd. More...
 
void set_jfactor (double new_jfactor)
 Set the currently used jfactor ( \( \alpha \)) More...
 
double get_jfactor () const
 Get the currently used jfactor ( \( \alpha \)) More...
 
const container & weights () const
 The volume form with dG weights. More...
 
FAfieldaligned ()
 access the underlying Fieldaligned object More...
 
const FAfieldaligned () const
 

Detailed Description

template<class ProductGeometry, class IMatrix, class Matrix, class container>
struct dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >

Class for the evaluation of parallel derivatives.

This class discretizes the operators \( \nabla_\parallel = \vec{v}\cdot \nabla = v^\zeta\partial_\zeta + v^\eta\partial_\eta + v^\varphi\partial_\varphi \), \(\nabla_\parallel^\dagger = -\nabla\cdot(\vec v .)\) and \(\Delta_\parallel=-\nabla_\parallel^\dagger\cdot\nabla_\parallel\) in arbitrary coordinates

const dg::CylindricalGrid3d g3d( R_0-a, R_0+a, -a, a, 0, 2.*M_PI, n, Nx, Ny, Nz, dg::NEU, dg::NEU, dg::PER);
//create magnetic field
auto bhat = dg::geo::createBHat(mag);
//create Fieldaligned object and construct DS from it
bhat, g3d, dg::NEU, dg::NEU, dg::geo::NoLimiter(), 1e-8, mx[0], mx[1],
-1, method);
ds( dsFA );
static dg::geo::TokamakMagneticField createCircularField(double R0, double I0, double a=1, double b=1)
Definition: toroidal.h:136
CylindricalVectorLvl1 createBHat(const TokamakMagneticField &mag)
Contravariant components of the magnetic unit vector field and its Divergence and derivative in cylin...
Definition: magnetic_field.h:931
Class for the evaluation of parallel derivatives.
Definition: ds.h:349
void ds(dg::direction dir, const container &f, container &g)
Discretizes .
Definition: ds.h:574
Create and manage interpolation matrices from fieldline integration.
Definition: fieldaligned.h:433
A tokamak field as given by R0, Psi and Ipol plus Meta-data like shape and equilibrium.
Definition: magnetic_field.h:162
Note
The parallel Laplacian cannot be inverted as long as there are closed fieldlines somewhere in the domain (which is virtually always true). There is therefore no norm parameter in the class.
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)
Template Parameters
ProductGeometrymust be either dg::aProductGeometry3d or dg::aProductMPIGeometry3d or any derivative
IMatrixThe type of the interpolation matrix
MatrixThe matrix class of the jump matrix
containerThe container-class on which the interpolation matrix operates on
See also
The pdf parallel derivative writeup

Member Typedef Documentation

◆ FA

template<class ProductGeometry , class IMatrix , class Matrix , class container >
typedef dg::geo::Fieldaligned<ProductGeometry, IMatrix, container> dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::FA

conveniently abbreviates underlying Fieldaligned type

Constructor & Destructor Documentation

◆ DS() [1/4]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::DS ( )
inline

No memory allocation; all member calls except construct are invalid.

◆ DS() [2/4]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
template<class Limiter >
dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::DS ( const dg::geo::TokamakMagneticField vec,
const ProductGeometry &  grid,
dg::bc  bcx = dg::NEU,
dg::bc  bcy = dg::NEU,
Limiter  limit = FullLimiter(),
double  eps = 1e-5,
unsigned  mx = 10,
unsigned  my = 10,
double  deltaPhi = -1,
std::string  interpolation_method = "dg",
bool  benchmark = true 
)
inline

Create the magnetic unit vector field and construct.

Template Parameters
LimiterClass that can be evaluated on a 2d grid, returns 1 if there is a limiter and 0 if there isn't. If a field line crosses the limiter in the plane \( \phi=0\) then the limiter boundary conditions apply.
Parameters
vecThe vector field to integrate. Note that you can control how the boundary conditions are represented by changing vec outside the grid domain using e.g. the periodify function.
gridThe grid on which to integrate fieldlines.
bcxThis parameter is passed on to dg::create::interpolation(const thrust::host_vector<real_type>&,const thrust::host_vector<real_type>&,const aRealTopology2d<real_type>&,dg::bc,dg::bc,std::string) (see there for more details) function and deterimens what happens when the endpoint of the fieldline integration leaves the domain boundaries of grid. Note that bcx and grid.bcx() have to be either both periodic or both not periodic.
bcyanalogous to bcx, applies to y direction
limitInstance of the limiter class (Note that if grid.bcz()==dg::PER this parameter is ignored, Default is a limiter everywhere)
epsDesired accuracy of the fieldline integrator
mxrefinement factor in X of the fine grid relative to grid (Set to 1, if the x-component of vec vanishes, else as high as possible, 12 is a good start) If the projection method (parsed from interpolation_method) is not "dg" then mx must be a multiple of nx
myanalogous to mx, applies to y direction
deltaPhiThe angular distance that the fieldline-integrator will integrate. Per default this is the distance between planes, which is chosen automatically if you set it <=0, i.e. if deltaPhi <=0 then it will be overwritten to deltaPhi = grid.hz(). Sometimes however, you may want to set it to a different value from grid.hz() for example for 2d problems or for a staggered grid.
Note
deltaPhi influences the interpolation matrices and the parallel modulation in the evaluate() member function.
If there is a limiter, the boundary condition on the first/last plane is set by the grid.bcz() variable and can be changed by the set_boundaries function. If there is no limiter, the boundary condition is periodic.
Parameters
interpolation_methodparsed according to
interpolation_method interpolation projection
"dg" "dg" "dg"
"linear" "linear" "dg"
"cubic" "cubic" "dg"
"nearest" "nearest" "dg"
"linear-nearest" (##) "linear" "nearest"
"cubic-nearest" "cubic" "nearest"
"nearest-nearest" "nearest" "nearest"
"dg-linear" "dg" "linear"
"linear-linear" "linear" "linear"
"cubic-linear" "cubic" "linear"
"nearest-linear" "nearest" "linear"

(##) Use "linear-nearest" if in doubt. The table yields one parameter passed to create::interpolation (from the given grid to the fine grid) and one parameter to create::projection (from the fine grid to the given grid)

Parameters
benchmarkIf true write construction timings to std::cout
epsDesired accuracy of the fieldline integrator
mxrefinement factor in X of the fine grid relative to grid (Set to 1, if the x-component of vec vanishes, else as high as possible, 10 is a good start)
myanalogous to mx, applies to y direction
deltaPhiThe angular distance that the fieldline-integrator will integrate. Per default this is the distance between planes, which is chosen automatically if you set it <=0, i.e. if deltaPhi <=0 then it will be overwritten to deltaPhi = grid.hz(). Sometimes however, you may want to set it to a different value from grid.hz() for example for 2d problems or for a staggered grid.
Note
deltaPhi influences the interpolation matrices and the parallel modulation in the evaluate() member function.
If there is a limiter, the boundary condition on the first/last plane is set by the grid.bcz() variable and can be changed by the set_boundaries function. If there is no limiter, the boundary condition is periodic.
Parameters
interpolation_methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial
benchmarkIf true write construction timings to std::cout
See also
Fieldaligned

◆ DS() [3/4]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
template<class Limiter >
dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::DS ( const dg::geo::CylindricalVectorLvl1 vec,
const ProductGeometry &  grid,
dg::bc  bcx = dg::NEU,
dg::bc  bcy = dg::NEU,
Limiter  limit = FullLimiter(),
double  eps = 1e-5,
unsigned  mx = 10,
unsigned  my = 10,
double  deltaPhi = -1,
std::string  interpolation_method = "dg",
bool  benchmark = true 
)
inline

Use the given vector field to construct.

Template Parameters
LimiterClass that can be evaluated on a 2d grid, returns 1 if there is a limiter and 0 if there isn't. If a field line crosses the limiter in the plane \( \phi=0\) then the limiter boundary conditions apply.
Parameters
vecThe vector field to integrate. Note that you can control how the boundary conditions are represented by changing vec outside the grid domain using e.g. the periodify function.
gridThe grid on which to integrate fieldlines.
bcxThis parameter is passed on to dg::create::interpolation(const thrust::host_vector<real_type>&,const thrust::host_vector<real_type>&,const aRealTopology2d<real_type>&,dg::bc,dg::bc,std::string) (see there for more details) function and deterimens what happens when the endpoint of the fieldline integration leaves the domain boundaries of grid. Note that bcx and grid.bcx() have to be either both periodic or both not periodic.
bcyanalogous to bcx, applies to y direction
limitInstance of the limiter class (Note that if grid.bcz()==dg::PER this parameter is ignored, Default is a limiter everywhere)
epsDesired accuracy of the fieldline integrator
mxrefinement factor in X of the fine grid relative to grid (Set to 1, if the x-component of vec vanishes, else as high as possible, 12 is a good start) If the projection method (parsed from interpolation_method) is not "dg" then mx must be a multiple of nx
myanalogous to mx, applies to y direction
deltaPhiThe angular distance that the fieldline-integrator will integrate. Per default this is the distance between planes, which is chosen automatically if you set it <=0, i.e. if deltaPhi <=0 then it will be overwritten to deltaPhi = grid.hz(). Sometimes however, you may want to set it to a different value from grid.hz() for example for 2d problems or for a staggered grid.
Note
deltaPhi influences the interpolation matrices and the parallel modulation in the evaluate() member function.
If there is a limiter, the boundary condition on the first/last plane is set by the grid.bcz() variable and can be changed by the set_boundaries function. If there is no limiter, the boundary condition is periodic.
Parameters
interpolation_methodparsed according to
interpolation_method interpolation projection
"dg" "dg" "dg"
"linear" "linear" "dg"
"cubic" "cubic" "dg"
"nearest" "nearest" "dg"
"linear-nearest" (##) "linear" "nearest"
"cubic-nearest" "cubic" "nearest"
"nearest-nearest" "nearest" "nearest"
"dg-linear" "dg" "linear"
"linear-linear" "linear" "linear"
"cubic-linear" "cubic" "linear"
"nearest-linear" "nearest" "linear"

(##) Use "linear-nearest" if in doubt. The table yields one parameter passed to create::interpolation (from the given grid to the fine grid) and one parameter to create::projection (from the fine grid to the given grid)

Parameters
benchmarkIf true write construction timings to std::cout
epsDesired accuracy of the fieldline integrator
mxrefinement factor in X of the fine grid relative to grid (Set to 1, if the x-component of vec vanishes, else as high as possible, 10 is a good start)
myanalogous to mx, applies to y direction
deltaPhiThe angular distance that the fieldline-integrator will integrate. Per default this is the distance between planes, which is chosen automatically if you set it <=0, i.e. if deltaPhi <=0 then it will be overwritten to deltaPhi = grid.hz(). Sometimes however, you may want to set it to a different value from grid.hz() for example for 2d problems or for a staggered grid.
Note
deltaPhi influences the interpolation matrices and the parallel modulation in the evaluate() member function.
If there is a limiter, the boundary condition on the first/last plane is set by the grid.bcz() variable and can be changed by the set_boundaries function. If there is no limiter, the boundary condition is periodic.
Parameters
interpolation_methodSeveral interpolation methods are available: dg uses the native dG interpolation scheme given by the grid, nearest searches for the nearest point and copies its value, linear searches for the two (in 2d four, etc.) closest points and linearly interpolates their values, cubic searches for the four (in 2d 16, etc) closest points and interpolates a cubic polynomial
benchmarkIf true write construction timings to std::cout
See also
Fieldaligned

◆ DS() [4/4]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::DS ( FA  fieldaligned)

Re-construct from a given Fieldaligned object.

Parameters
fieldalignedthis object will be used in all further member calls

Member Function Documentation

◆ backward() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::backward ( const container &  f,
container &  g 
)
inline

backward derivative \( g = \vec v \cdot \nabla f \)

backward derivative \( g_i = \frac{v^\varphi}{\Delta\varphi}(f_{i} - f_{i-1}) \)

Parameters
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ backward() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::backward ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

backward derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\)

backward derivative \( g_i = \alpha \frac{1}{h_z^-}(f_{i} - f_{i-1}) + \beta g_i \)

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ backward2()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::backward2 ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

2nd order backward derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\)

backward derivative \( g_i = \alpha \frac{1}{2h_z^-}(3f_{i} - 4f_{i-1} + f_{i-2}) + \beta g_i \)

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ centered() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::centered ( const container &  f,
container &  g 
)
inline

centered derivative \( g = \vec v \cdot \nabla f \)

centered derivative \( g_i = \frac{v^\varphi}{2\Delta\varphi}(f_{i+1} - f_{i-1})\)

Parameters
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ centered() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::centered ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

centered derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\)

The centered derivative is constructed by fitting a polynomial through the plus point the minus point and the center point and evaluating its derivative at the center point. For the exact resulting formula consult the parallel derivative writeup

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ centered_bc_along_field()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::centered_bc_along_field ( double  alpha,
const container &  f,
double  beta,
container &  g,
dg::bc  bound,
std::array< double, 2 >  boundary_value = {0,0} 
)
inline

Same as dg::geo::ds_centered after dg::geo::ds_assign_bc_along_field_2nd.

◆ construct()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
template<class ... Params>
void dg::geo::DS< ProductGeometry, IMatrix, 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

◆ div() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::div ( dg::direction  dir,
const container &  f,
container &  g 
)
inline

Discretizes \( g = \nabla \cdot ( \vec v f) \).

Parameters
dirredirects to either divForward(), divBackward() or divCentered()
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ div() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::div ( dg::direction  dir,
double  alpha,
const container &  f,
double  beta,
container &  g 
)

Discretizes \( g = \alpha \nabla \cdot( \vec v f) + \beta g \).

Parameters
dirredirects to either divForward(), divBackward() or divCentered()
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ divBackward() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::divBackward ( const container &  f,
container &  g 
)
inline

backward divergence \( g = \nabla\cdot(\vec v f)\)

Parameters
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ divBackward() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::divBackward ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

backward divergence \( g = \alpha \nabla\cdot(\vec v f) + \beta g\)

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ divCentered() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::divCentered ( const container &  f,
container &  g 
)
inline

centered divergence \( g = \nabla\cdot(\vec v f)\)

Parameters
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ divCentered() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::divCentered ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

centered divergence \( g = \alpha \nabla\cdot(\vec v f) + \beta g\)

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ divForward() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::divForward ( const container &  f,
container &  g 
)
inline

forward divergence \( g = \nabla\cdot(\vec v f)\)

Parameters
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ divForward() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::divForward ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

forward divergence \( g = \alpha \nabla\cdot(\vec v f) + \beta g\)

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ ds() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::ds ( dg::direction  dir,
const container &  f,
container &  g 
)
inline

Discretizes \( g = \vec v\cdot \nabla f \).

Parameters
dirredirects to either forward(), backward() or centered()
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ ds() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::ds ( dg::direction  dir,
double  alpha,
const container &  f,
double  beta,
container &  g 
)

Discretizes \( g = \alpha \vec v\cdot \nabla f + \beta g \).

Parameters
dirredirects to either forward(), backward() or centered()
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ dss() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::dss ( const container &  f,
container &  g 
)
inline

Discretizes \( g = (\vec v\cdot \nabla)^2 f \).

The formula used is

\[ \nabla_\parallel^2 f = 2\left(\frac{f^+}{h_z^+ h_z^0} - \frac{f^0}{h_z^- h_z^+} + \frac{f^-}{h_z^-h_z^0}\right) \]

which is the second derivative of a 2nd order polynomial fitted through the plus, minus and centre points

Parameters
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ dss() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::dss ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

Discretizes \( g = \alpha (\vec v\cdot \nabla)^2 f + \beta g \).

The formula used is

\[ \nabla_\parallel^2 f = 2\left(\frac{f^+}{h_z^+ h_z^0} - \frac{f^0}{h_z^- h_z^+} + \frac{f^-}{h_z^-h_z^0}\right) \]

which is the second derivative of a 2nd order polynomial fitted through the plus, minus and centre points

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ dss_bc_along_field()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::dss_bc_along_field ( double  alpha,
const container &  f,
double  beta,
container &  g,
dg::bc  bound,
std::array< double, 2 >  boundary_value = {0,0} 
)
inline

Same as dg::geo::dss_centered after dg::geo::ds_assign_bc_along_field_2nd.

◆ dssd()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::dssd ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

◆ dssd_bc_along_field()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::dssd_bc_along_field ( double  alpha,
const container &  f,
double  beta,
container &  g,
dg::bc  bound,
std::array< double, 2 >  boundary_value = {0,0} 
)
inline

Same as dg::geo::dssd_centered after dg::geo::ds_assign_bc_along_field_2nd.

◆ fieldaligned() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
FA & dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::fieldaligned ( )
inline

access the underlying Fieldaligned object

Returns
acces to Fieldaligned object

◆ fieldaligned() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
const FA & dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::fieldaligned ( ) const
inline

◆ forward() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::forward ( const container &  f,
container &  g 
)
inline

forward derivative \( g = \vec v \cdot \nabla f \)

forward derivative \( g_i = \frac{v^\varphi}{\Delta\varphi}(f_{i+1} - f_{i})\)

Parameters
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ forward() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::forward ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

forward derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\)

forward derivative \( g_i = \alpha \frac{1}{h_z^+}(f_{i+1} - f_{i}) + \beta g_i\)

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ forward2()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::forward2 ( double  alpha,
const container &  f,
double  beta,
container &  g 
)
inline

2nd order forward derivative \( g = \alpha \vec v \cdot \nabla f + \beta g\)

forward derivative \( g_i = \alpha \frac{1}{2h_z^+}(-f_{i+2} + 4f_{i+1} - 3f_{i}) + \beta g_i\)

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor

◆ get_jfactor()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
double dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::get_jfactor ( ) const
inline

Get the currently used jfactor ( \( \alpha \))

Returns
The current scale factor for jump terms

◆ set_boundaries() [1/3]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::set_boundaries ( dg::bc  bcz,
const container &  global,
double  scal_left,
double  scal_right 
)
inline

Set boundary conditions in the limiter region.

if Dirichlet boundaries are used the left value is the left function value, if Neumann boundaries are used the left value is the left derivative value

Parameters
bczboundary condition
global3D vector containing boundary values
scal_leftleft scaling factor
scal_rightright scaling factor

◆ set_boundaries() [2/3]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::set_boundaries ( dg::bc  bcz,
const container &  left,
const container &  right 
)
inline

Set boundary conditions in the limiter region.

if Dirichlet boundaries are used the left value is the left function value, if Neumann boundaries are used the left value is the left derivative value

Parameters
bczboundary condition
leftspatially variable left boundary value (2d size)
rightspatially variable right boundary value (2d size)

◆ set_boundaries() [3/3]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::set_boundaries ( dg::bc  bcz,
double  left,
double  right 
)
inline

Set boundary conditions in the limiter region.

if Dirichlet boundaries are used the left value is the left function value, if Neumann boundaries are used the left value is the left derivative value

Parameters
bczboundary condition
leftconstant left boundary value
rightconstant right boundary value

◆ set_jfactor()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::set_jfactor ( double  new_jfactor)
inline

Set the currently used jfactor ( \( \alpha \))

Parameters
new_jfactorThe new scale factor for jump terms

◆ symv() [1/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::symv ( const container &  f,
container &  g 
)
inline

Discretizes \( g = \nabla\cdot ( \vec v \vec v \cdot \nabla f )\).

Parameters
fThe vector to derive
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ symv() [2/2]

template<class ProductGeometry , class IMatrix , class Matrix , class container >
void dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::symv ( double  alpha,
const container &  f,
double  beta,
container &  g 
)

Discretizes \( g = \alpha \nabla\cdot ( \vec v \vec v \cdot \nabla f ) + \beta g\) as a symmetric matrix.

Parameters
alphaScalar
fThe vector to derive
betaScalar
gcontains result on output (may alias input vectors)
Note
the vector sizes need to equal the grid size in the constructor
The div and symv member functions are close to but not exactly volume conserving (at least if not the linear interpolation is chosen in Fieldaligned)

◆ weights()

template<class ProductGeometry , class IMatrix , class Matrix , class container >
const container & dg::geo::DS< ProductGeometry, IMatrix, Matrix, container >::weights ( ) const
inline

The volume form with dG weights.


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