Discontinuous Galerkin Library
#include "dg/algorithm.h"
Loading...
Searching...
No Matches

\( D_x\), \( D_y\) and \( D_z \) More...

Collaboration diagram for Create derivatives:

Enumerations

enum  dg::bc {
  dg::PER = 0 , dg::DIR = 1 , dg::DIR_NEU = 2 , dg::NEU_DIR = 3 ,
  dg::NEU = 4
}
 Switch between boundary conditions. More...
 
enum  dg::direction { dg::forward , dg::backward , dg::centered }
 Direction of a discrete derivative. More...
 
enum  dg::space { dg::lspace , dg::xspace }
 Space of DG coefficients. More...
 
enum class  dg::coo2d : char { dg::coo2d::x = 'x' , dg::coo2d::y = 'y' }
 2d coordinates More...
 
enum class  dg::coo3d : char { dg::coo3d::x = 'x' , dg::coo3d::y = 'y' , dg::coo3d::z = 'z' }
 3d coordinates More...
 

Functions

template<class real_type , size_t Nd>
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::derivative (unsigned coord, const aRealTopology< real_type, Nd > &g, dg::bc bc, direction dir=centered)
 Create a derivative along given coordinate.
 
template<class real_type , size_t Nd>
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::jump (unsigned coord, const aRealTopology< real_type, Nd > &g, dg::bc bc)
 Create a jump matrix along given coordinate.
 
template<class Topology >
auto dg::create::dx (const Topology &g, dg::bc bc, dg::direction dir=centered)
 
template<class Topology >
auto dg::create::dy (const Topology &g, dg::bc bc, dg::direction dir=centered)
 Short for dg::create::derivative( 1, g, bc, dir);
 
template<class Topology >
auto dg::create::dz (const Topology &g, dg::bc bc, dg::direction dir=centered)
 Short for dg::create::derivative( 2, g, bc, dir);
 
template<class Topology >
auto dg::create::jumpX (const Topology &g, bc bc)
 Short for dg::create::jump( 0, g, bc);
 
template<class Topology >
auto dg::create::jumpY (const Topology &g, bc bc)
 Short for dg::create::jump( 1, g, bc);
 
template<class Topology >
auto dg::create::jumpZ (const Topology &g, bc bc)
 Short for dg::create::jump( 2, g, bc);
 
template<class Topology >
auto dg::create::derivative (unsigned coord, const Topology &g, direction dir=centered)
 Short for dg::create::derivative( coord, g, g.bcx(), dir);
 
template<class Topology >
auto dg::create::jump (unsigned coord, const Topology &g)
 Short for dg::create::jump( coord, g, g.bcx());
 
template<class Topology >
auto dg::create::dx (const Topology &g, dg::direction dir=centered)
 Short for dg::create::derivative( 0, g, g.bcx() dir);
 
template<class Topology >
auto dg::create::dy (const Topology &g, dg::direction dir=centered)
 Short for dg::create::derivative( 1, g, g.bcy(), dir);
 
template<class Topology >
auto dg::create::dz (const Topology &g, dg::direction dir=centered)
 Short for dg::create::derivative( 2, g, g.bcz(), dir);
 
template<class Topology >
auto dg::create::jumpX (const Topology &g)
 Short for dg::create::jump( 0, g, g.bcx());
 
template<class Topology >
auto dg::create::jumpY (const Topology &g)
 Short for dg::create::jump( 1, g, g.bcy());
 
template<class Topology >
auto dg::create::jumpZ (const Topology &g)
 Short for dg::create::jump( 2, g, g.bcz());
 
template<class real_type >
Composite< EllSparseBlockMat< real_type, thrust::host_vector > > dg::create::derivative (unsigned coord, const aRealTopologyX2d< real_type > &g, dg::bc bc, direction dir=centered)
 Create 2d derivative in x-direction.
 
template<class real_type >
Composite< EllSparseBlockMat< real_type, thrust::host_vector > > dg::create::jump (unsigned coord, const aRealTopologyX2d< real_type > &g, bc bc)
 Matrix that contains 2d jump terms in X direction.
 
template<class real_type >
Composite< EllSparseBlockMat< real_type, thrust::host_vector > > dg::create::jump (unsigned coord, const aRealTopologyX3d< real_type > &g, bc bc)
 Matrix that contains jump terms in X direction in 3D.
 
template<class real_type >
Composite< EllSparseBlockMat< real_type, thrust::host_vector > > dg::create::derivative (unsigned coord, const aRealTopologyX3d< real_type > &g, bc bc, direction dir=centered)
 Create 3d derivative in x-direction.
 
template<class real_type >
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::dx (const RealGridX1d< real_type > &g, bc bcx, direction dir=centered)
 Create and assemble a host Matrix for the derivative in 1d.
 
template<class real_type >
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::dx (const RealGridX1d< real_type > &g, direction dir=centered)
 Create and assemble a host Matrix for the derivative in 1d.
 
template<class real_type >
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::jump (const RealGridX1d< real_type > &g, bc bcx)
 Create and assemble a host Matrix for the jump in 1d.
 
template<class real_type >
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::jump (const RealGridX1d< real_type > &g)
 Create and assemble a host Matrix for the jump in 1d.
 
template<class real_type , size_t Nd>
dg::MHMatrix_t< real_type > dg::create::derivative (unsigned coord, const aRealMPITopology< real_type, Nd > &g, dg::bc bc, direction dir=centered)
 Create a derivative along the given coordinate for mpi.
 
template<class real_type , size_t Nd>
dg::MHMatrix_t< real_type > dg::create::jump (unsigned coord, const aRealMPITopology< real_type, Nd > &g, dg::bc bc)
 Create a jump matrix along given coordinate for mpi.
 
std::string dg::bc2str (bc bcx)
 write a string describing boundary condition to an output stream
 
bc dg::str2bc (std::string s)
 convert a string to a bc
 
bc dg::inverse (bc bound)
 invert boundary condition
 
direction dg::str2direction (std::string s)
 convert a string to a direction
 
std::string dg::direction2str (enum direction dir)
 convert a direciton to string
 
direction dg::inverse (direction dir)
 invert direction
 

Detailed Description

\( D_x\), \( D_y\) and \( D_z \)

High level matrix creation functions

Enumeration Type Documentation

◆ bc

enum dg::bc

Switch between boundary conditions.

Enumerator
PER 

periodic boundaries

DIR 

homogeneous dirichlet boundaries

DIR_NEU 

Dirichlet on left, Neumann on right boundary.

NEU_DIR 

Neumann on left, Dirichlet on right boundary.

NEU 

Neumann on both boundaries.

◆ coo2d

enum class dg::coo2d : char
strong

2d coordinates

Enumerator

x direction

y direction

◆ coo3d

enum class dg::coo3d : char
strong

3d coordinates

Enumerator

x direction

y direction

z direction

◆ direction

Direction of a discrete derivative.

Enumerator
forward 

forward derivative (cell to the right and current cell)

backward 

backward derivative (cell to the left and current cell)

centered 

centered derivative (cell to the left and right and current cell)

◆ space

enum dg::space

Space of DG coefficients.

Enumerator
lspace 

DG Polynomial space "modal values".

xspace 

Configuration space "nodal values".

Function Documentation

◆ bc2str()

std::string dg::bc2str ( bc bcx)
inline

write a string describing boundary condition to an output stream

converts

◆ derivative() [1/5]

template<class real_type , size_t Nd>
dg::MHMatrix_t< real_type > dg::create::derivative ( unsigned coord,
const aRealMPITopology< real_type, Nd > & g,
dg::bc bc,
direction dir = centered )

Create a derivative along the given coordinate for mpi.

Parameters
coordthe coordinate along which to derive
gA mpi grid
bcboundary condition
dircentered, forward or backward
Returns
A mpi matrix

◆ derivative() [2/5]

template<class real_type , size_t Nd>
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::derivative ( unsigned coord,
const aRealTopology< real_type, Nd > & g,
dg::bc bc,
direction dir = centered )

Create a derivative along given coordinate.

Parameters
coordthe coordinate along which to derive
gThe grid on which to create derivative
bcThe boundary condition
dircentered, forward or backward
Returns
A host matrix

◆ derivative() [3/5]

template<class real_type >
Composite< EllSparseBlockMat< real_type, thrust::host_vector > > dg::create::derivative ( unsigned coord,
const aRealTopologyX2d< real_type > & g,
dg::bc bc,
direction dir = centered )

Create 2d derivative in x-direction.

Parameters
coordEither 0 (for x derivative) or 1 (for y derivative)
gThe grid on which to create dx
bcThe boundary condition
dirThe direction of the first derivative
Returns
A host matrix

◆ derivative() [4/5]

template<class real_type >
Composite< EllSparseBlockMat< real_type, thrust::host_vector > > dg::create::derivative ( unsigned coord,
const aRealTopologyX3d< real_type > & g,
bc bc,
direction dir = centered )

Create 3d derivative in x-direction.

Parameters
coordEither 0 (for x derivative) or 1 (for y derivative) or 2 (for z derivative)
gThe grid on which to create dx
bcThe boundary condition
dirThe direction of the first derivative
Returns
A host matrix

◆ derivative() [5/5]

template<class Topology >
auto dg::create::derivative ( unsigned coord,
const Topology & g,
direction dir = centered )

Short for dg::create::derivative( coord, g, g.bcx(), dir);

◆ direction2str()

std::string dg::direction2str ( enum direction dir)
inline

convert a direciton to string

converts

  • forward to "forward"
  • backward to "backward"
  • centered to "centered"
Parameters
dirthe input direction
Returns
a string

◆ dx() [1/4]

template<class real_type >
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::dx ( const RealGridX1d< real_type > & g,
bc bcx,
direction dir = centered )

Create and assemble a host Matrix for the derivative in 1d.

Parameters
g1D grid with X-point topology
bcxboundary condition
dirThe direction of the first derivative
Returns
Host Matrix

◆ dx() [2/4]

template<class real_type >
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::dx ( const RealGridX1d< real_type > & g,
direction dir = centered )

Create and assemble a host Matrix for the derivative in 1d.

Take the boundary condition from the grid

Parameters
g1D grid with X-point topology
dirThe direction of the first derivative
Returns
Host Matrix

◆ dx() [3/4]

template<class Topology >
auto dg::create::dx ( const Topology & g,
dg::bc bc,
dg::direction dir = centered )

Short for dg::create::derivative( 0, g, bc, dir);

◆ dx() [4/4]

template<class Topology >
auto dg::create::dx ( const Topology & g,
dg::direction dir = centered )

Short for dg::create::derivative( 0, g, g.bcx() dir);

◆ dy() [1/2]

template<class Topology >
auto dg::create::dy ( const Topology & g,
dg::bc bc,
dg::direction dir = centered )

Short for dg::create::derivative( 1, g, bc, dir);

◆ dy() [2/2]

template<class Topology >
auto dg::create::dy ( const Topology & g,
dg::direction dir = centered )

Short for dg::create::derivative( 1, g, g.bcy(), dir);

◆ dz() [1/2]

template<class Topology >
auto dg::create::dz ( const Topology & g,
dg::bc bc,
dg::direction dir = centered )

Short for dg::create::derivative( 2, g, bc, dir);

◆ dz() [2/2]

template<class Topology >
auto dg::create::dz ( const Topology & g,
dg::direction dir = centered )

Short for dg::create::derivative( 2, g, g.bcz(), dir);

◆ inverse() [1/2]

bc dg::inverse ( bc bound)
inline

invert boundary condition

Parameters
boundboundary condition to invert
Returns
NEU for DIR, DIR for NEU, NEU_DIR for DIR_NEU, DIR_NEU for NEU_DIR and PER for PER

◆ inverse() [2/2]

direction dg::inverse ( direction dir)
inline

invert direction

Parameters
dirdirection to invert
Returns
backward for forward, forward for backward, centered for centered

◆ jump() [1/7]

template<class real_type >
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::jump ( const RealGridX1d< real_type > & g)

Create and assemble a host Matrix for the jump in 1d.

Take the boundary condition from the grid

Parameters
g1D grid with X-point topology
Returns
Host Matrix

◆ jump() [2/7]

template<class real_type >
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::jump ( const RealGridX1d< real_type > & g,
bc bcx )

Create and assemble a host Matrix for the jump in 1d.

Parameters
g1D grid with X-point topology
bcxboundary condition
Returns
Host Matrix

◆ jump() [3/7]

template<class real_type , size_t Nd>
dg::MHMatrix_t< real_type > dg::create::jump ( unsigned coord,
const aRealMPITopology< real_type, Nd > & g,
dg::bc bc )

Create a jump matrix along given coordinate for mpi.

Parameters
coordthe coordinate along which to jump
gThe mpi grid on which to create jump
bcThe boundary condition
Returns
A mpi matrix

◆ jump() [4/7]

template<class real_type , size_t Nd>
EllSparseBlockMat< real_type, thrust::host_vector > dg::create::jump ( unsigned coord,
const aRealTopology< real_type, Nd > & g,
dg::bc bc )

Create a jump matrix along given coordinate.

Parameters
coordthe coordinate along which to jump
gThe grid on which to create jump
bcThe boundary condition
Returns
A host matrix

◆ jump() [5/7]

template<class real_type >
Composite< EllSparseBlockMat< real_type, thrust::host_vector > > dg::create::jump ( unsigned coord,
const aRealTopologyX2d< real_type > & g,
bc bc )

Matrix that contains 2d jump terms in X direction.

Parameters
coordEither 0 (for x derivative) or 1 (for y derivative)
ggrid
bcboundary condition in x
Returns
A host matrix

◆ jump() [6/7]

template<class real_type >
Composite< EllSparseBlockMat< real_type, thrust::host_vector > > dg::create::jump ( unsigned coord,
const aRealTopologyX3d< real_type > & g,
bc bc )

Matrix that contains jump terms in X direction in 3D.

Parameters
coordEither 0 (for x derivative) or 1 (for y derivative) or 2 (for z derivative)
gThe 3D grid
bcboundary condition
Returns
A host matrix

◆ jump() [7/7]

template<class Topology >
auto dg::create::jump ( unsigned coord,
const Topology & g )

Short for dg::create::jump( coord, g, g.bcx());

◆ jumpX() [1/2]

template<class Topology >
auto dg::create::jumpX ( const Topology & g)

Short for dg::create::jump( 0, g, g.bcx());

◆ jumpX() [2/2]

template<class Topology >
auto dg::create::jumpX ( const Topology & g,
bc bc )

Short for dg::create::jump( 0, g, bc);

◆ jumpY() [1/2]

template<class Topology >
auto dg::create::jumpY ( const Topology & g)

Short for dg::create::jump( 1, g, g.bcy());

◆ jumpY() [2/2]

template<class Topology >
auto dg::create::jumpY ( const Topology & g,
bc bc )

Short for dg::create::jump( 1, g, bc);

◆ jumpZ() [1/2]

template<class Topology >
auto dg::create::jumpZ ( const Topology & g)

Short for dg::create::jump( 2, g, g.bcz());

◆ jumpZ() [2/2]

template<class Topology >
auto dg::create::jumpZ ( const Topology & g,
bc bc )

Short for dg::create::jump( 2, g, bc);

◆ str2bc()

bc dg::str2bc ( std::string s)
inline

convert a string to a bc

converts

  • PER, per, periodic, PERIODIC and Periodic to dg::PER
  • DIR, dir, dirichlet, DIRICHLET and Dirichlet to dg::DIR
  • NEU, neu, neumann, NEUMANN and Neumann to dg::NEU
  • NEU_DIR and neu_dir to dg::NEU_DIR
  • DIR_NEU and dir_neu to dg::DIR_NEU
Parameters
sthe input string
Returns
a valid boundary condition
Exceptions
std::runtime_errorif string doesn't match any of the above

◆ str2direction()

direction dg::str2direction ( std::string s)
inline

convert a string to a direction

converts

  • "forward" to forward
  • "backward" to backward
  • "centered" to centered
Parameters
sthe input string
Returns
a valid direction
Exceptions
std::runtime_errorif string doesn't match any of the above