34template<
class Geometry,
class Matrix,
class Container >
63 template<
class ...Params>
67 *
this =
ArakawaX( std::forward<Params>( ps)...);
81 template<
class ContainerType0,
class ContainerType1,
class ContainerType2>
82 void operator()(
const ContainerType0& lhs,
const ContainerType1& rhs, ContainerType2& result){
83 return this->
operator()( 1., lhs, rhs, 0., result);
85 template<
class ContainerType0,
class ContainerType1,
class ContainerType2>
93 template<
class ContainerType0>
94 void set_chi(
const ContainerType0& new_chi) {
104 const Matrix&
dx()
const {
113 const Matrix&
dy()
const {
118 Container m_dxlhs, m_dxrhs, m_dylhs, m_dyrhs, m_helper;
119 Matrix m_bdxf, m_bdyf;
120 Container m_chi, m_perp_vol;
123template<
class Geometry,
class Matrix,
class Container>
125 ArakawaX( g, g.bcx(), g.bcy()) { }
127template<
class Geometry,
class Matrix,
class Container>
129 m_dxlhs(
dg::
construct<Container>(
dg::
evaluate(
one, g)) ), m_dxrhs(m_dxlhs), m_dylhs(m_dxlhs), m_dyrhs( m_dxlhs), m_helper( m_dxlhs),
141 void operator()(T lhs, T rhs, T dxlhs, T& dylhs, T& dxrhs, T& dyrhs)
const
144 result = DG_FMA( (1./3.)*dxlhs, dyrhs, result);
145 result = DG_FMA( -(1./3.)*dylhs, dxrhs, result);
147 temp = DG_FMA( (1./3.)*lhs, dyrhs, temp);
149 temp = DG_FMA( -(1./3.)*dylhs, rhs, temp);
152 temp = DG_FMA( (1./3.)*dxlhs, rhs, temp);
153 temp = DG_FMA( -(1./3.)*lhs, dxrhs, temp);
158template<
class Geometry,
class Matrix,
class Container>
159template<
class ContainerType0,
class ContainerType1,
class ContainerType2>
167 blas1::subroutine( ArakawaFunctor<get_value_type<Container>>(), lhs, rhs, m_dxlhs, m_dylhs, m_dxrhs, m_dyrhs);
Convenience functions to create 2D derivatives.
Function discretization routines.
#define DG_DEVICE
Expands to __host__ __device__ if compiled with nvcc else is empty.
Definition: functions.h:9
ContainerType construct(const from_ContainerType &from, Params &&... ps)
Generic way to construct an object of ContainerType given a from_ContainerType object and optional ad...
Definition: blas1.h:696
static DG_DEVICE double one(double x)
Definition: functions.h:20
void subroutine(Subroutine f, ContainerType &&x, ContainerTypes &&... xs)
; Customizable and generic blas1 function
Definition: blas1.h:618
void pointwiseDivide(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:428
void pointwiseDot(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:336
void symv(MatrixType &&M, const ContainerType1 &x, ContainerType2 &y)
Definition: blas2.h:287
EllSparseBlockMat< real_type > dx(const aRealTopology2d< real_type > &g, bc bcx, direction dir=centered)
Create 2d derivative in x-direction.
Definition: derivatives.h:33
bc
Switch between boundary conditions.
Definition: enums.h:15
EllSparseBlockMat< real_type > dy(const aRealTopology2d< real_type > &g, bc bcy, direction dir=centered)
Create 2d derivative in y-direction.
Definition: derivatives.h:65
@ centered
centered derivative (cell to the left and right and current cell)
Definition: enums.h:100
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
ContainerType volume2d(const SparseTensor< ContainerType > &t)
Definition: multiply.h:379
typename TensorTraits< std::decay_t< Vector > >::value_type get_value_type
Definition: tensor_traits.h:38
Function discretization routines for mpi vectors.
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Arakawa's scheme for Poisson bracket .
Definition: arakawa.h:36
void set_chi(const ContainerType0 &new_chi)
Change Chi.
Definition: arakawa.h:94
ArakawaX(const Geometry &g)
Create Arakawa on a grid.
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition: arakawa.h:64
ArakawaX(const Geometry &g, bc bcx, bc bcy)
Create Arakawa on a grid using different boundary conditions.
const Matrix & dy() const
Return internally used y - derivative.
Definition: arakawa.h:113
Matrix matrix_type
Definition: arakawa.h:38
Container container_type
Definition: arakawa.h:39
void operator()(const ContainerType0 &lhs, const ContainerType1 &rhs, ContainerType2 &result)
Compute Poisson bracket.
Definition: arakawa.h:82
const Matrix & dx() const
Return internally used x - derivative.
Definition: arakawa.h:104
void operator()(value_type alpha, const ContainerType0 &lhs, const ContainerType1 &rhs, value_type beta, ContainerType2 &result)
Geometry geometry_type
Definition: arakawa.h:37
get_value_type< Container > value_type
Definition: arakawa.h:40