Gyselalib++
CzarnyToCartesian< X, Y, R, Theta > Class Template Reference

A class for describing the Czarny 2D mapping. More...

Inheritance diagram for CzarnyToCartesian< X, Y, R, Theta >:
CoordinateConverter< ddc::Coordinate< X, Y >, ddc::Coordinate< R, Theta > > PseudoCartesianCompatibleMapping Curvilinear2DToCartesian< X, Y, R, Theta >

Public Types

using cartesian_tag_x = typename Curvilinear2DToCartesian< X, Y, R, Theta >::cartesian_tag_x
 Indicate the first physical coordinate.
 
using cartesian_tag_y = typename Curvilinear2DToCartesian< X, Y, R, Theta >::cartesian_tag_y
 Indicate the second physical coordinate.
 
using curvilinear_tag_r = typename Curvilinear2DToCartesian< X, Y, R, Theta >::curvilinear_tag_r
 Indicate the first logical coordinate.
 
using curvilinear_tag_theta = typename Curvilinear2DToCartesian< X, Y, R, Theta >::curvilinear_tag_theta
 Indicate the second logical coordinate.
 
using CoordArg = ddc::Coordinate< R, Theta >
 The type of the argument of the function described by this mapping.
 
using CoordResult = ddc::Coordinate< X, Y >
 The type of the result of the function described by this mapping.
 
- Public Types inherited from PseudoCartesianCompatibleMapping
using Matrix_2x2 = std::array< std::array< double, 2 >, 2 >
 The type of the pseudo-Cartesian Jacobian matrix and its inverse.
 
- Public Types inherited from Curvilinear2DToCartesian< X, Y, R, Theta >
using cartesian_tag_x = X
 Indicate the first physical coordinate.
 
using cartesian_tag_y = Y
 Indicate the second physical coordinate.
 
using curvilinear_tag_r = R
 Indicate the first logical coordinate.
 
using curvilinear_tag_theta = Theta
 Indicate the second logical coordinate.
 

Public Member Functions

 CzarnyToCartesian (double epsilon, double e)
 Instantiate a CzarnyToCartesian from parameters. More...
 
KOKKOS_FUNCTION CzarnyToCartesian (CzarnyToCartesian const &other)
 Instantiate a CzarnyToCartesian from another CzarnyToCartesian (lvalue). More...
 
 CzarnyToCartesian (CzarnyToCartesian &&x)=default
 Instantiate a CzarnyToCartesian from another temporary CzarnyToCartesian (rvalue). More...
 
CzarnyToCartesianoperator= (CzarnyToCartesian const &x)=default
 Assign a CzarnyToCartesian from another CzarnyToCartesian (lvalue). More...
 
CzarnyToCartesianoperator= (CzarnyToCartesian &&x)=default
 Assign a CzarnyToCartesian from another temporary CzarnyToCartesian (rvalue). More...
 
KOKKOS_FUNCTION double epsilon () const
 Return the \( \epsilon \) parameter. More...
 
KOKKOS_FUNCTION double e () const
 Return the \( e \) parameter. More...
 
KOKKOS_FUNCTION ddc::Coordinate< X, Yoperator() (ddc::Coordinate< R, Theta > const &coord) const
 Convert the \( (r, \theta) \) coordinate to the equivalent (x,y) coordinate. More...
 
KOKKOS_FUNCTION ddc::Coordinate< R, Thetaoperator() (ddc::Coordinate< X, Y > const &coord) const final
 Convert the coordinate (x,y) to the equivalent \( (r, \theta) \) coordinate. More...
 
KOKKOS_FUNCTION double jacobian (ddc::Coordinate< R, Theta > const &coord) const
 Compute the Jacobian, the determinant of the Jacobian matrix of the mapping. More...
 
KOKKOS_FUNCTION void jacobian_matrix (ddc::Coordinate< R, Theta > const &coord, Matrix_2x2 &matrix) const
 Compute full Jacobian matrix. More...
 
KOKKOS_FUNCTION double jacobian_11 (ddc::Coordinate< R, Theta > const &coord) const
 Compute the (1,1) coefficient of the Jacobian matrix. More...
 
KOKKOS_FUNCTION double jacobian_12 (ddc::Coordinate< R, Theta > const &coord) const
 Compute the (1,2) coefficient of the Jacobian matrix. More...
 
KOKKOS_FUNCTION double jacobian_21 (ddc::Coordinate< R, Theta > const &coord) const
 Compute the (2,1) coefficient of the Jacobian matrix. More...
 
KOKKOS_FUNCTION double jacobian_22 (ddc::Coordinate< R, Theta > const &coord) const
 Compute the (2,2) coefficient of the Jacobian matrix. More...
 
KOKKOS_FUNCTION void inv_jacobian_matrix (ddc::Coordinate< R, Theta > const &coord, Matrix_2x2 &matrix) const
 Compute full inverse Jacobian matrix. More...
 
KOKKOS_FUNCTION double inv_jacobian_11 (ddc::Coordinate< R, Theta > const &coord) const
 Compute the (1,1) coefficient of the inverse Jacobian matrix. More...
 
KOKKOS_FUNCTION double inv_jacobian_12 (ddc::Coordinate< R, Theta > const &coord) const
 Compute the (1,2) coefficient of the inverse Jacobian matrix. More...
 
KOKKOS_FUNCTION double inv_jacobian_21 (ddc::Coordinate< R, Theta > const &coord) const
 Compute the (2,1) coefficient of the inverse Jacobian matrix. More...
 
KOKKOS_FUNCTION double inv_jacobian_22 (ddc::Coordinate< R, Theta > const &coord) const
 Compute the (2,2) coefficient of the inverse Jacobian matrix. More...
 
KOKKOS_FUNCTION void to_pseudo_cartesian_jacobian_center_matrix (Matrix_2x2 &matrix) const final
 Compute the full Jacobian matrix from the mapping to the pseudo-Cartesian mapping at the central point. More...
 
KOKKOS_FUNCTION double to_pseudo_cartesian_jacobian_11_center () const final
 Compute the (1,1) coefficient of the pseudo-Cartesian Jacobian matrix at the central point. More...
 
KOKKOS_FUNCTION double to_pseudo_cartesian_jacobian_12_center () const final
 Compute the (1,2) coefficient of the pseudo-Cartesian Jacobian matrix at the central point. More...
 
KOKKOS_FUNCTION double to_pseudo_cartesian_jacobian_21_center () const final
 Compute the (2,1) coefficient of the pseudo-Cartesian Jacobian matrix at the central point. More...
 
KOKKOS_FUNCTION double to_pseudo_cartesian_jacobian_22_center () const final
 Compute the (2,2) coefficient of the pseudo-Cartesian Jacobian matrix at the central point. More...
 

Detailed Description

template<class X, class Y, class R, class Theta>
class CzarnyToCartesian< X, Y, R, Theta >

A class for describing the Czarny 2D mapping.

The mapping \( (r,\theta)\mapsto (x,y) \) is defined by

\( x(r,\theta) = \frac{1}{\epsilon} \left( 1 - \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} \right),\)

\( y(r,\theta) = \frac{e\xi r \sin(\theta)}{2 -\sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} },\)

with \( \xi = 1/\sqrt{1 - \epsilon^2 /4} \) and \( e \) and \( \epsilon \) given as parameters. It and its Jacobian matrix are invertible everywhere except for \( r = 0 \).

Its Jacobian coefficients are defined as follow

\( J_{11}(r,\theta) = - \cos(\theta)\frac{1}{ \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} } \)

\( J_{12}(r,\theta) = r\sin(\theta)\frac{1}{ \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} } \)

\( J_{21}(r,\theta) = \cos(\theta)\frac{e\epsilon \xi r\sin(\theta)}{ \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} \left( 2 - \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} \right)^2 } + \sin(\theta)\frac{e\xi }{ 2- \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} }\)

\( J_{22}(r,\theta) = r \sin(\theta)\frac{- e\epsilon \xi r \sin(\theta)}{ \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} \left( 2 - \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} \right)^2 } + r\cos(\theta)\frac{e\xi }{ 2 -\sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))} }\).

and \( \det(J(r, \theta)) = \frac{- r}{ \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))}} \frac{e\xi}{2 - \sqrt{1 + \epsilon(\epsilon + 2 r \cos(\theta))}}. \)

Constructor & Destructor Documentation

◆ CzarnyToCartesian() [1/3]

template<class X , class Y , class R , class Theta >
CzarnyToCartesian< X, Y, R, Theta >::CzarnyToCartesian ( double  epsilon,
double  e 
)
inline

Instantiate a CzarnyToCartesian from parameters.

Parameters
[in]epsilonThe \( \epsilon \) parameter in the definition of the mapping CzarnyToCartesian.
[in]eThe \( e \) parameter in the definition of the mapping CzarnyToCartesian.
See also
CzarnyToCartesian

◆ CzarnyToCartesian() [2/3]

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION CzarnyToCartesian< X, Y, R, Theta >::CzarnyToCartesian ( CzarnyToCartesian< X, Y, R, Theta > const &  other)
inline

Instantiate a CzarnyToCartesian from another CzarnyToCartesian (lvalue).

Parameters
[in]otherCzarnyToCartesian mapping used to instantiate the new one.

◆ CzarnyToCartesian() [3/3]

template<class X , class Y , class R , class Theta >
CzarnyToCartesian< X, Y, R, Theta >::CzarnyToCartesian ( CzarnyToCartesian< X, Y, R, Theta > &&  x)
default

Instantiate a CzarnyToCartesian from another temporary CzarnyToCartesian (rvalue).

Parameters
[in]xCzarnyToCartesian mapping used to instantiate the new one.

Member Function Documentation

◆ operator=() [1/2]

template<class X , class Y , class R , class Theta >
CzarnyToCartesian& CzarnyToCartesian< X, Y, R, Theta >::operator= ( CzarnyToCartesian< X, Y, R, Theta > const &  x)
default

Assign a CzarnyToCartesian from another CzarnyToCartesian (lvalue).

Parameters
[in]xCzarnyToCartesian mapping used to assign.
Returns
The CzarnyToCartesian assigned.

◆ operator=() [2/2]

template<class X , class Y , class R , class Theta >
CzarnyToCartesian& CzarnyToCartesian< X, Y, R, Theta >::operator= ( CzarnyToCartesian< X, Y, R, Theta > &&  x)
default

Assign a CzarnyToCartesian from another temporary CzarnyToCartesian (rvalue).

Parameters
[in]xCzarnyToCartesian mapping used to assign.
Returns
The CzarnyToCartesian assigned.

◆ epsilon()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::epsilon ( ) const
inline

Return the \( \epsilon \) parameter.

Returns
The value of \( \epsilon \).
See also
CzarnyToCartesian

◆ e()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::e ( ) const
inline

Return the \( e \) parameter.

Returns
The value of \( e \).
See also
CzarnyToCartesian

◆ operator()() [1/2]

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION ddc::Coordinate<X, Y> CzarnyToCartesian< X, Y, R, Theta >::operator() ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Convert the \( (r, \theta) \) coordinate to the equivalent (x,y) coordinate.

Parameters
[in]coordThe coordinate to be converted.
Returns
The equivalent coordinate.

◆ operator()() [2/2]

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION ddc::Coordinate<R, Theta> CzarnyToCartesian< X, Y, R, Theta >::operator() ( ddc::Coordinate< X, Y > const &  coord) const
inlinefinalvirtual

Convert the coordinate (x,y) to the equivalent \( (r, \theta) \) coordinate.

Parameters
[in]coordThe coordinate to be converted.
Returns
The equivalent coordinate.

Implements CoordinateConverter< ddc::Coordinate< X, Y >, ddc::Coordinate< R, Theta > >.

◆ jacobian()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::jacobian ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Compute the Jacobian, the determinant of the Jacobian matrix of the mapping.

Parameters
[in]coordThe coordinate where we evaluate the Jacobian.
Returns
A double with the value of the determinant of the Jacobian matrix.

◆ jacobian_matrix()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION void CzarnyToCartesian< X, Y, R, Theta >::jacobian_matrix ( ddc::Coordinate< R, Theta > const &  coord,
Matrix_2x2 matrix 
) const
inline

Compute full Jacobian matrix.

For some computations, we need the complete Jacobian matrix or just the coefficients. The coefficients can be given indendently with the functions jacobian_11, jacobian_12, jacobian_21 and jacobian_22.

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix.
[out]matrixThe Jacobian matrix returned.
See also
Jacobian::jacobian_11
Jacobian::jacobian_12
Jacobian::jacobian_21
Jacobian::jacobian_22

◆ jacobian_11()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::jacobian_11 ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Compute the (1,1) coefficient of the Jacobian matrix.

For a mapping given by \( \mathcal{F} : (r,\theta)\mapsto (x,y) \), the (1,1) coefficient of the Jacobian matrix is given by \( \frac{\partial x}{\partial r} \).

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix.
Returns
A double with the value of the (1,1) coefficient of the Jacobian matrix.

◆ jacobian_12()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::jacobian_12 ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Compute the (1,2) coefficient of the Jacobian matrix.

For a mapping given by \( \mathcal{F} : (r,\theta)\mapsto (x,y) \), the (1,2) coefficient of the Jacobian matrix is given by \( \frac{\partial x}{\partial \theta} \).

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix.
Returns
A double with the value of the (1,2) coefficient of the Jacobian matrix.

◆ jacobian_21()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::jacobian_21 ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Compute the (2,1) coefficient of the Jacobian matrix.

For a mapping given by \( \mathcal{F} : (r,\theta)\mapsto (x,y) \), the (2,1) coefficient of the Jacobian matrix is given by \( \frac{\partial y}{\partial r} \).

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix. .
Returns
A double with the value of the (2,1) coefficient of the Jacobian matrix.

◆ jacobian_22()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::jacobian_22 ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Compute the (2,2) coefficient of the Jacobian matrix.

For a mapping given by \( \mathcal{F} : (r,\theta)\mapsto (x,y) \), the (2,2) coefficient of the Jacobian matrix is given by \( \frac{\partial y}{\partial \theta} \).

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix.
Returns
A double with the value of the (2,2) coefficient of the Jacobian matrix.

◆ inv_jacobian_matrix()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION void CzarnyToCartesian< X, Y, R, Theta >::inv_jacobian_matrix ( ddc::Coordinate< R, Theta > const &  coord,
Matrix_2x2 matrix 
) const
inline

Compute full inverse Jacobian matrix.

For some computations, we need the complete inverse Jacobian matrix or just the coefficients. The coefficients can be given indendently with the functions inv_jacobian_11, inv_jacobian_12, inv_jacobian_21 and inv_jacobian_22.

Parameters
[in]coordThe coordinate where we evaluate the Jacobian matrix.
[out]matrixThe inverse Jacobian matrix returned.
See also
Jacobian::inv_jacobian_11
Jacobian::inv_jacobian_12
Jacobian::inv_jacobian_21
Jacobian::inv_jacobian_22

◆ inv_jacobian_11()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::inv_jacobian_11 ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Compute the (1,1) coefficient of the inverse Jacobian matrix.

Be careful because not all mappings are invertible, especially at the center point.

Parameters
[in]coordThe coordinate where we evaluate the inverse Jacobian matrix.
Returns
A double with the value of the (1,1) coefficient of the inverse Jacobian matrix.

◆ inv_jacobian_12()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::inv_jacobian_12 ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Compute the (1,2) coefficient of the inverse Jacobian matrix.

Be careful because not all mappings are invertible, especially at the center point.

Parameters
[in]coordThe coordinate where we evaluate the inverse Jacobian matrix.
Returns
A double with the value of the (1,2) coefficient of the inverse Jacobian matrix.

◆ inv_jacobian_21()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::inv_jacobian_21 ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Compute the (2,1) coefficient of the inverse Jacobian matrix.

Be careful because not all mappings are invertible, especially at the center point.

Parameters
[in]coordThe coordinate where we evaluate the inverse Jacobian matrix.
Returns
A double with the value of the (2,1) coefficient of the inverse Jacobian matrix.

◆ inv_jacobian_22()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::inv_jacobian_22 ( ddc::Coordinate< R, Theta > const &  coord) const
inline

Compute the (2,2) coefficient of the inverse Jacobian matrix.

Be careful because not all mappings are invertible, especially at the center point.

Parameters
[in]coordThe coordinate where we evaluate the inverse Jacobian matrix.
Returns
A double with the value of the (2,2) coefficient of the inverse Jacobian matrix.

◆ to_pseudo_cartesian_jacobian_center_matrix()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION void CzarnyToCartesian< X, Y, R, Theta >::to_pseudo_cartesian_jacobian_center_matrix ( Matrix_2x2 matrix) const
inlinefinalvirtual

Compute the full Jacobian matrix from the mapping to the pseudo-Cartesian mapping at the central point.

The pseudo-Cartesian Jacobian matrix for a Czarny mapping is given by :

  • \( (J_{\mathcal{F}}J_{\mathcal{G}}^{-1})^{-1}_{11}(0, \theta) = - \sqrt{1 + \varepsilon^2}, \)
  • \( (J_{\mathcal{F}}J_{\mathcal{G}}^{-1})^{-1}_{12}(0, \theta) = 0, \)
  • \( (J_{\mathcal{F}}J_{\mathcal{G}}^{-1})^{-1}_{21}(0, \theta) = 0, \)
  • \( (J_{\mathcal{F}}J_{\mathcal{G}}^{-1})^{-1}_{22}(0, \theta) = \frac{2 - \sqrt{1 + \varepsilon^2}}{e \xi}. \)
Parameters
[out]matrixThe pseudo-Cartesian matrix at the central point evaluated.
See also
DiscreteToCartesian
BslAdvection
AdvectionDomain

Implements PseudoCartesianCompatibleMapping.

◆ to_pseudo_cartesian_jacobian_11_center()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::to_pseudo_cartesian_jacobian_11_center ( ) const
inlinefinalvirtual

Compute the (1,1) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.

\( (J_{\mathcal{F}}J_{\mathcal{G}}^{-1})^{-1}_{11}(0, \theta) = - \sqrt{1 + \varepsilon^2}. \)

Returns
A double with the (1,1) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.
See also
to_pseudo_cartesian_jacobian_center_matrix

Implements PseudoCartesianCompatibleMapping.

◆ to_pseudo_cartesian_jacobian_12_center()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::to_pseudo_cartesian_jacobian_12_center ( ) const
inlinefinalvirtual

Compute the (1,2) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.

\( (J_{\mathcal{F}}J_{\mathcal{G}}^{-1})^{-1}_{12}(0, \theta) = 0. \)

Returns
A double with the (1,2) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.
See also
to_pseudo_cartesian_jacobian_center_matrix

Implements PseudoCartesianCompatibleMapping.

◆ to_pseudo_cartesian_jacobian_21_center()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::to_pseudo_cartesian_jacobian_21_center ( ) const
inlinefinalvirtual

Compute the (2,1) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.

\( (J_{\mathcal{F}}J_{\mathcal{G}}^{-1})^{-1}_{21}(0, \theta) = 0. \)

Returns
A double with the (2,1) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.
See also
to_pseudo_cartesian_jacobian_center_matrix

Implements PseudoCartesianCompatibleMapping.

◆ to_pseudo_cartesian_jacobian_22_center()

template<class X , class Y , class R , class Theta >
KOKKOS_FUNCTION double CzarnyToCartesian< X, Y, R, Theta >::to_pseudo_cartesian_jacobian_22_center ( ) const
inlinefinalvirtual

Compute the (2,2) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.

\( (J_{\mathcal{F}}J_{\mathcal{G}}^{-1})^{-1}_{22}(0, \theta) = \frac{2 - \sqrt{1 + \varepsilon^2}}{e \xi}. \)

Returns
A double with the (2,2) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.
See also
to_pseudo_cartesian_jacobian_center_matrix

Implements PseudoCartesianCompatibleMapping.


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