Discontinuous Galerkin Library
#include "dg/algorithm.h"

\( f_i = f( x (\zeta_i,\eta_i), y(\zeta_i,\eta_i)) \) More...

Collaboration diagram for pullback and pushforward:

Functions

template<class Functor , class real_type >
thrust::host_vector< real_type > dg::pullback (const Functor &f, const aRealGeometryX2d< real_type > &g)
 \( f_i = f( x(\zeta_i, \eta_i), y(\zeta_i, \eta_i))\) More...
 
template<class Functor , class real_type >
thrust::host_vector< real_type > dg::pullback (const Functor &f, const aRealGeometryX3d< real_type > &g)
 \( f_i = f( x(\zeta_i, \eta_i, \nu_i), y(\zeta_i, \eta_i, \nu_i), z(\zeta_i,\eta_i,\nu_i))\) More...
 
template<class Functor , class real_type >
thrust::host_vector< real_type > dg::pullback (const Functor &f, const aRealGeometry2d< real_type > &g)
 \( f_i = f( x(\zeta_i, \eta_i), y(\zeta_i, \eta_i))\) More...
 
template<class Functor , class real_type >
thrust::host_vector< real_type > dg::pullback (const Functor &f, const aRealGeometry3d< real_type > &g)
 \( f_i = f( x(\zeta_i, \eta_i, \nu_i), y(\zeta_i, \eta_i, \nu_i), z(\zeta_i,\eta_i,\nu_i))\) More...
 
template<class Functor , class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::pullback (const Functor &f, const aRealMPIGeometry2d< real_type > &g)
 \( f_i = f( x(\zeta_i, \eta_i), y(\zeta_i, \eta_i))\) More...
 
template<class Functor , class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::pullback (const Functor &f, const aRealMPIGeometry3d< real_type > &g)
 \( f_i = f( x(\zeta_i, \eta_i, \nu_i), y(\zeta_i, \eta_i, \nu_i), z(\zeta_i,\eta_i,\nu_i))\) More...
 
template<class Functor1 , class Functor2 , class container , class Geometry >
void dg::pushForwardPerp (const Functor1 &vR, const Functor2 &vZ, container &vx, container &vy, const Geometry &g)
 \( \bar v = J v\) More...
 
template<class Functor1 , class Functor2 , class Functor3 , class container , class Geometry >
void dg::pushForward (const Functor1 &vR, const Functor2 &vZ, const Functor3 &vPhi, container &vx, container &vy, container &vz, const Geometry &g)
 \( {\bar v} = J v\) More...
 
template<class FunctorRR , class FunctorRZ , class FunctorZZ , class container , class Geometry >
void dg::pushForwardPerp (const FunctorRR &chiRR, const FunctorRZ &chiRZ, const FunctorZZ &chiZZ, SparseTensor< container > &chi, const Geometry &g)
 \( \bar \chi = J \chi J^T\) More...
 

Detailed Description

\( f_i = f( x (\zeta_i,\eta_i), y(\zeta_i,\eta_i)) \)

Function Documentation

◆ pullback() [1/6]

template<class Functor , class real_type >
thrust::host_vector< real_type > dg::pullback ( const Functor &  f,
const aRealGeometry2d< real_type > &  g 
)

\( f_i = f( x(\zeta_i, \eta_i), y(\zeta_i, \eta_i))\)

Pull back a function defined in physical coordinates to the curvilinear (computational) coordinate system. The pullback is equivalent to the following:

  1. generate the list of physical space coordinates (e.g. in 2d \( x_i = x(\zeta_i, \eta_i),\ y_i = y(\zeta_i, \eta_i)\) for all i) using the map member of the grid e.g. aRealGeometry2d::map()
  2. evaluate the given function or functor at these coordinates and store the result in the output vector (e.g. in 2d \( v_i = f(x_i,y_i)\) for all i)
Note
the grid defines what its physical coordinates are, i.e. it could be either Cartesian or Cylindrical coordinates
Template Parameters
FunctorThe binary (for 2d grids) or ternary (for 3d grids) function or functor with signature: real_type ( real_type x, real_type y) ; real_type ( real_type x, real_type y, real_type z)
Parameters
fThe function defined in physical coordinates
ga two- or three dimensional Geometry (g.map() is used to evaluate f)
Note
Template deduction for the Functor will fail if you overload functions with different dimensionality (e.g. real_type sine( real_type x) and real_type sine(real_type x, real_type y) ) You will want to rename those uniquely
Returns
The output vector v as a host vector
See also
If the function is defined in computational space coordinates, then use dg::evaluate

◆ pullback() [2/6]

template<class Functor , class real_type >
thrust::host_vector< real_type > dg::pullback ( const Functor &  f,
const aRealGeometry3d< real_type > &  g 
)

\( f_i = f( x(\zeta_i, \eta_i, \nu_i), y(\zeta_i, \eta_i, \nu_i), z(\zeta_i,\eta_i,\nu_i))\)

Pull back a function defined in physical coordinates to the curvilinear (computational) coordinate system. The pullback is equivalent to the following:

  1. generate the list of physical space coordinates (e.g. in 2d \( x_i = x(\zeta_i, \eta_i),\ y_i = y(\zeta_i, \eta_i)\) for all i) using the map member of the grid e.g. aRealGeometry2d::map()
  2. evaluate the given function or functor at these coordinates and store the result in the output vector (e.g. in 2d \( v_i = f(x_i,y_i)\) for all i)
Note
the grid defines what its physical coordinates are, i.e. it could be either Cartesian or Cylindrical coordinates
Template Parameters
FunctorThe binary (for 2d grids) or ternary (for 3d grids) function or functor with signature: real_type ( real_type x, real_type y) ; real_type ( real_type x, real_type y, real_type z)
Parameters
fThe function defined in physical coordinates
ga two- or three dimensional Geometry (g.map() is used to evaluate f)
Note
Template deduction for the Functor will fail if you overload functions with different dimensionality (e.g. real_type sine( real_type x) and real_type sine(real_type x, real_type y) ) You will want to rename those uniquely
Returns
The output vector v as a host vector
See also
If the function is defined in computational space coordinates, then use dg::evaluate

◆ pullback() [3/6]

template<class Functor , class real_type >
thrust::host_vector< real_type > dg::pullback ( const Functor &  f,
const aRealGeometryX2d< real_type > &  g 
)

\( f_i = f( x(\zeta_i, \eta_i), y(\zeta_i, \eta_i))\)

Pull back a function defined in physical coordinates to the curvilinear (computational) coordinate system. The pullback is equivalent to the following:

  1. generate the list of physical space coordinates (e.g. in 2d \( x_i = x(\zeta_i, \eta_i),\ y_i = y(\zeta_i, \eta_i)\) for all i) using the map member of the grid e.g. aRealGeometry2d::map()
  2. evaluate the given function or functor at these coordinates and store the result in the output vector (e.g. in 2d \( v_i = f(x_i,y_i)\) for all i)
Note
the grid defines what its physical coordinates are, i.e. it could be either Cartesian or Cylindrical coordinates
Template Parameters
FunctorThe binary (for 2d grids) or ternary (for 3d grids) function or functor with signature: real_type ( real_type x, real_type y) ; real_type ( real_type x, real_type y, real_type z)
Parameters
fThe function defined in physical coordinates
ga two- or three dimensional Geometry (g.map() is used to evaluate f)
Note
Template deduction for the Functor will fail if you overload functions with different dimensionality (e.g. real_type sine( real_type x) and real_type sine(real_type x, real_type y) ) You will want to rename those uniquely
Returns
The output vector v as a host vector
See also
If the function is defined in computational space coordinates, then use dg::evaluate

◆ pullback() [4/6]

template<class Functor , class real_type >
thrust::host_vector< real_type > dg::pullback ( const Functor &  f,
const aRealGeometryX3d< real_type > &  g 
)

\( f_i = f( x(\zeta_i, \eta_i, \nu_i), y(\zeta_i, \eta_i, \nu_i), z(\zeta_i,\eta_i,\nu_i))\)

Pull back a function defined in physical coordinates to the curvilinear (computational) coordinate system. The pullback is equivalent to the following:

  1. generate the list of physical space coordinates (e.g. in 2d \( x_i = x(\zeta_i, \eta_i),\ y_i = y(\zeta_i, \eta_i)\) for all i) using the map member of the grid e.g. aRealGeometry2d::map()
  2. evaluate the given function or functor at these coordinates and store the result in the output vector (e.g. in 2d \( v_i = f(x_i,y_i)\) for all i)
Note
the grid defines what its physical coordinates are, i.e. it could be either Cartesian or Cylindrical coordinates
Template Parameters
FunctorThe binary (for 2d grids) or ternary (for 3d grids) function or functor with signature: real_type ( real_type x, real_type y) ; real_type ( real_type x, real_type y, real_type z)
Parameters
fThe function defined in physical coordinates
ga two- or three dimensional Geometry (g.map() is used to evaluate f)
Note
Template deduction for the Functor will fail if you overload functions with different dimensionality (e.g. real_type sine( real_type x) and real_type sine(real_type x, real_type y) ) You will want to rename those uniquely
Returns
The output vector v as a host vector
See also
If the function is defined in computational space coordinates, then use dg::evaluate

◆ pullback() [5/6]

template<class Functor , class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::pullback ( const Functor &  f,
const aRealMPIGeometry2d< real_type > &  g 
)

\( f_i = f( x(\zeta_i, \eta_i), y(\zeta_i, \eta_i))\)

Pull back a function defined in physical coordinates to the curvilinear (computational) coordinate system. The pullback is equivalent to the following:

  1. generate the list of physical space coordinates (e.g. in 2d \( x_i = x(\zeta_i, \eta_i),\ y_i = y(\zeta_i, \eta_i)\) for all i) using the map member of the grid e.g. aRealGeometry2d::map()
  2. evaluate the given function or functor at these coordinates and store the result in the output vector (e.g. in 2d \( v_i = f(x_i,y_i)\) for all i)
Note
the grid defines what its physical coordinates are, i.e. it could be either Cartesian or Cylindrical coordinates
Template Parameters
FunctorThe binary (for 2d grids) or ternary (for 3d grids) function or functor with signature: real_type ( real_type x, real_type y) ; real_type ( real_type x, real_type y, real_type z)
Parameters
fThe function defined in physical coordinates
ga two- or three dimensional Geometry (g.map() is used to evaluate f)
Note
Template deduction for the Functor will fail if you overload functions with different dimensionality (e.g. real_type sine( real_type x) and real_type sine(real_type x, real_type y) ) You will want to rename those uniquely
Returns
The output vector v as a host vector
See also
If the function is defined in computational space coordinates, then use dg::evaluate

◆ pullback() [6/6]

template<class Functor , class real_type >
MPI_Vector< thrust::host_vector< real_type > > dg::pullback ( const Functor &  f,
const aRealMPIGeometry3d< real_type > &  g 
)

\( f_i = f( x(\zeta_i, \eta_i, \nu_i), y(\zeta_i, \eta_i, \nu_i), z(\zeta_i,\eta_i,\nu_i))\)

Pull back a function defined in physical coordinates to the curvilinear (computational) coordinate system. The pullback is equivalent to the following:

  1. generate the list of physical space coordinates (e.g. in 2d \( x_i = x(\zeta_i, \eta_i),\ y_i = y(\zeta_i, \eta_i)\) for all i) using the map member of the grid e.g. aRealGeometry2d::map()
  2. evaluate the given function or functor at these coordinates and store the result in the output vector (e.g. in 2d \( v_i = f(x_i,y_i)\) for all i)
Note
the grid defines what its physical coordinates are, i.e. it could be either Cartesian or Cylindrical coordinates
Template Parameters
FunctorThe binary (for 2d grids) or ternary (for 3d grids) function or functor with signature: real_type ( real_type x, real_type y) ; real_type ( real_type x, real_type y, real_type z)
Parameters
fThe function defined in physical coordinates
ga two- or three dimensional Geometry (g.map() is used to evaluate f)
Note
Template deduction for the Functor will fail if you overload functions with different dimensionality (e.g. real_type sine( real_type x) and real_type sine(real_type x, real_type y) ) You will want to rename those uniquely
Returns
The output vector v as a host vector
See also
If the function is defined in computational space coordinates, then use dg::evaluate

◆ pushForward()

template<class Functor1 , class Functor2 , class Functor3 , class container , class Geometry >
void dg::pushForward ( const Functor1 &  vR,
const Functor2 &  vZ,
const Functor3 &  vPhi,
container &  vx,
container &  vy,
container &  vz,
const Geometry &  g 
)

\( {\bar v} = J v\)

Push forward a vector from cylindrical or Cartesian to a new coordinate system. Applies the Jacobian matrix \( {\bar v} = J v\):

\[ v^x(x,y) = x_R (x,y) v^R(R(x,y), Z(x,y)) + x_Z v^Z(R(x,y), Z(x,y)) \\ v^y(x,y) = y_R (x,y) v^R(R(x,y), Z(x,y)) + y_Z v^Z(R(x,y), Z(x,y)) \]

where \( x_R = \frac{\partial x}{\partial R}\), ...

Template Parameters
Functor1Binary or Ternary functor
Functor2Binary or Ternary functor
Functor3Binary or Ternary functor
ContainerA data container class for which the blas1 functionality is overloaded and to which the return type of blas1::subroutine() can be converted using dg::construct. We assume that Container is copyable/assignable and has a swap member function. In connection with Geometry this is one of
GeometryA type that is or derives from one of the abstract geometry base classes ( aGeometry2d, aGeometry3d, aMPIGeometry2d, ...). Geometry determines which Container type can be used.
Parameters
vRinput R-component in cartesian or cylindrical coordinates
vZinput Z-component in cartesian or cylindrical coordinates
vPhiinput Z-component in cartesian or cylindrical coordinates
vxx-component of vector (gets properly resized)
vyy-component of vector (gets properly resized)
vzz-component of vector (gets properly resized)
gThe geometry object

◆ pushForwardPerp() [1/2]

template<class Functor1 , class Functor2 , class container , class Geometry >
void dg::pushForwardPerp ( const Functor1 &  vR,
const Functor2 &  vZ,
container &  vx,
container &  vy,
const Geometry &  g 
)

\( \bar v = J v\)

Push forward a vector from cylindrical or Cartesian to a new coordinate system. Applies the Jacobian matrix \( {\bar v} = J v\):

\[ v^x(x,y) = x_R (x,y) v^R(R(x,y), Z(x,y)) + x_Z v^Z(R(x,y), Z(x,y)) \\ v^y(x,y) = y_R (x,y) v^R(R(x,y), Z(x,y)) + y_Z v^Z(R(x,y), Z(x,y)) \]

where \( x_R = \frac{\partial x}{\partial R}\), ...

Template Parameters
Functor1Binary or Ternary functor
Functor2Binary or Ternary functor
ContainerA data container class for which the blas1 functionality is overloaded and to which the return type of blas1::subroutine() can be converted using dg::construct. We assume that Container is copyable/assignable and has a swap member function. In connection with Geometry this is one of
GeometryA type that is or derives from one of the abstract geometry base classes ( aGeometry2d, aGeometry3d, aMPIGeometry2d, ...). Geometry determines which Container type can be used.
Parameters
vRinput R-component in cylindrical coordinates
vZinput Z-component in cylindrical coordinates
vxx-component of vector (gets properly resized)
vyy-component of vector (gets properly resized)
gThe geometry object

◆ pushForwardPerp() [2/2]

template<class FunctorRR , class FunctorRZ , class FunctorZZ , class container , class Geometry >
void dg::pushForwardPerp ( const FunctorRR &  chiRR,
const FunctorRZ &  chiRZ,
const FunctorZZ &  chiZZ,
SparseTensor< container > &  chi,
const Geometry &  g 
)

\( \bar \chi = J \chi J^T\)

Push forward a symmetric 2d tensor from cylindrical or Cartesian to a new coordinate system. Applies the Jacobian matrix \( \bar \chi = J \chi J^T\):

\[ \chi^{xx}(x,y) = x_R^2 \chi^{RR} + 2x_Rx_Z \chi^{RZ} + x_Z^2\chi^{ZZ} \\ \chi^{xy}(x,y) = x_Ry_R \chi^{RR} + (x_Ry_Z+y_Rx_Z) \chi^{RZ} + x_Zy_Z\chi^{ZZ} \\ \chi^{yy}(x,y) = y_R^2 \chi^{RR} + 2y_Ry_Z \chi^{RZ} + y_Z^2\chi^{ZZ} \\ \]

where \( x_R = \frac{\partial x}{\partial R}\), ...

Template Parameters
FunctorRRBinary or Ternary functor
FunctorRZBinary or Ternary functor
FunctorZZBinary or Ternary functor
ContainerA data container class for which the blas1 functionality is overloaded and to which the return type of blas1::subroutine() can be converted using dg::construct. We assume that Container is copyable/assignable and has a swap member function. In connection with Geometry this is one of
GeometryA type that is or derives from one of the abstract geometry base classes ( aGeometry2d, aGeometry3d, aMPIGeometry2d, ...). Geometry determines which Container type can be used.
Parameters
chiRRinput RR-component in cylindrical coordinates
chiRZinput RZ-component in cylindrical coordinates
chiZZinput ZZ-component in cylindrical coordinates
chitensor (gets properly resized)
gThe geometry object