Discontinuous Galerkin Library
#include "dg/algorithm.h"
dg::Poisson< Geometry, Matrix, Container > Struct Template Reference

Direct discretization of Poisson bracket \( \{ f,g\} \). 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

 Poisson ()=default
 
 Poisson (const Geometry &g)
 Create Poisson on a grid. More...
 
 Poisson (const Geometry &g, bc bcx, bc bcy)
 Create Poisson on a grid using different boundary conditions. More...
 
 Poisson (const Geometry &g, bc bcxlhs, bc bcylhs, bc bcxrhs, bc bcyrhs)
 Create Poisson on a grid using different boundary conditions. More...
 
template<class ContainerType0 , class ContainerType1 , class ContainerType2 >
void operator() (const ContainerType0 &lhs, const ContainerType1 &rhs, ContainerType2 &result)
 Compute poisson's bracket. More...
 
template<class ContainerType0 >
void set_chi (const ContainerType0 &new_chi)
 Change Chi. More...
 
const Matrix & dxlhs () const
 Return internally used x - derivative. More...
 
const Matrix & dylhs () const
 Return internally used y - derivative. More...
 
const Matrix & dxrhs () const
 Return internally used x - derivative. More...
 
const Matrix & dyrhs ()
 Return internally used y - derivative. More...
 

Detailed Description

template<class Geometry, class Matrix, class Container>
struct dg::Poisson< Geometry, Matrix, Container >

Direct discretization of Poisson bracket \( \{ f,g\} \).

Computes

\[ \{f,g\} := \chi/\sqrt{g_{2d}}\left(\partial_x f\partial_y g - \partial_y f\partial_x g\right) \]

where \( g_{2d} = g/g_{zz}\) is the two-dimensional volume element of the plane in 2x1 product space and \( \chi\) is an optional factor. Has the possitility to use mixed boundary conditions

const dg::CartesianGrid2d grid( 0, lx, 0, ly, n, Nx, Ny);
const dg::DVec lhs = dg::evaluate( left, grid);
const dg::DVec rhs = dg::evaluate( right, grid);
dg::DVec jac(lhs);
dg::Poisson<dg::aGeometry2d, dg::DMatrix, dg::DVec> poisson( grid, bcxlhs, bcylhs,bcxrhs, bcyrhs );
poisson( lhs, rhs, jac);
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
thrust::device_vector< double > DVec
Device Vector. The device can be an OpenMP parallelized cpu or a gpu. This depends on the value of th...
Definition: typedefs.h:23
Direct discretization of Poisson bracket .
Definition: poisson.h:34
two-dimensional Grid with Cartesian metric
Definition: base_geometry.h:215
See also
A discussion of this and other advection schemes can also be found here https://mwiesenberger.github.io/advection
Template Parameters
GeometryA type that is or derives from one of the abstract geometry base classes ( aGeometry2d, aGeometry3d, aMPIGeometry2d, ...). Geometry determines which Matrix and Container types can be used:
MatrixA class for which the dg::blas2::symv functions are callable in connection with the Container class and to which the return type of dg::create::dx() can be converted using dg::blas2::transfer. The Matrix type can be one of:
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::assign. We assume that Container is copyable/assignable and has a swap member function. In connection with Geometry this is one of

Member Typedef Documentation

◆ container_type

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

◆ geometry_type

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

◆ matrix_type

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

◆ value_type

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

Constructor & Destructor Documentation

◆ Poisson() [1/4]

template<class Geometry , class Matrix , class Container >
dg::Poisson< Geometry, Matrix, Container >::Poisson ( )
default

◆ Poisson() [2/4]

template<class Geometry , class Matrix , class Container >
dg::Poisson< Geometry, Matrix, Container >::Poisson ( const Geometry &  g)

Create Poisson on a grid.

Parameters
gThe grid
Note
chi defaults to 1

◆ Poisson() [3/4]

template<class Geometry , class Matrix , class Container >
dg::Poisson< Geometry, Matrix, Container >::Poisson ( const Geometry &  g,
bc  bcx,
bc  bcy 
)

Create Poisson on a grid using different boundary conditions.

Parameters
gThe grid
bcxThe boundary condition in x
bcyThe boundary condition in y
Note
chi defaults to 1

◆ Poisson() [4/4]

template<class Geometry , class Matrix , class Container >
dg::Poisson< Geometry, Matrix, Container >::Poisson ( const Geometry &  g,
bc  bcxlhs,
bc  bcylhs,
bc  bcxrhs,
bc  bcyrhs 
)

Create Poisson on a grid using different boundary conditions.

Parameters
gThe grid
bcxlhsThe lhs boundary condition in x
bcxrhsThe rhs boundary condition in x
bcylhsThe lhs boundary condition in y
bcyrhsThe rhs boundary condition in y
Note
chi defaults to 1

Member Function Documentation

◆ dxlhs()

template<class Geometry , class Matrix , class Container >
const Matrix & dg::Poisson< Geometry, Matrix, Container >::dxlhs ( ) const
inline

Return internally used x - derivative.

The same as a call to dg::create::dx( g, bcxlhs)

Returns
derivative

◆ dxrhs()

template<class Geometry , class Matrix , class Container >
const Matrix & dg::Poisson< Geometry, Matrix, Container >::dxrhs ( ) const
inline

Return internally used x - derivative.

The same as a call to dg::create::dx( g, bcxrhs)

Returns
derivative

◆ dylhs()

template<class Geometry , class Matrix , class Container >
const Matrix & dg::Poisson< Geometry, Matrix, Container >::dylhs ( ) const
inline

Return internally used y - derivative.

The same as a call to dg::create::dy( g, bcylhs)

Returns
derivative

◆ dyrhs()

template<class Geometry , class Matrix , class Container >
const Matrix & dg::Poisson< Geometry, Matrix, Container >::dyrhs ( )
inline

Return internally used y - derivative.

The same as a call to dg::create::dy( g, bcyrhs)

Returns
derivative

◆ operator()()

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 , class ContainerType1 , class ContainerType2 >
void dg::Poisson< Geometry, Matrix, Container >::operator() ( const ContainerType0 &  lhs,
const ContainerType1 &  rhs,
ContainerType2 &  result 
)

Compute poisson's bracket.

Computes

\[ [f,g] := 1/\sqrt{g_{2d}}\left(\partial_x f\partial_y g - \partial_y f\partial_x g\right) \]

where \( g_{2d} = g/g_{zz}\) is the two-dimensional volume element of the plane in 2x1 product space.

Parameters
lhsleft hand side in x-space
rhsrights hand side in x-space
resultPoisson's bracket in x-space
Template Parameters
ContainerTypesmust be usable with Container in The dg dispatch system

◆ set_chi()

template<class Geometry , class Matrix , class Container >
template<class ContainerType0 >
void dg::Poisson< Geometry, Matrix, Container >::set_chi ( const ContainerType0 &  new_chi)
inline

Change Chi.

Parameters
new_chiThe new chi
Template Parameters
ContainerTypesmust be usable with Container in The dg dispatch system

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