A class for describing discrete 2D mappings from the logical domain to the physical domain. More...
Public Types | |
using | BSplineR = typename SplineEvaluator::bsplines_type1 |
Indicate the bspline type of the first logical dimension. | |
using | BSplineTheta = typename SplineEvaluator::bsplines_type2 |
Indicate the bspline type of the second logical dimension. | |
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, typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 > | |
using | cartesian_tag_x = X |
Indicate the first physical coordinate. | |
using | cartesian_tag_y = Y |
Indicate the second physical coordinate. | |
using | curvilinear_tag_r = typename SplineEvaluator::continuous_dimension_type1 |
Indicate the first logical coordinate. | |
using | curvilinear_tag_theta = typename SplineEvaluator::continuous_dimension_type2 |
Indicate the second logical coordinate. | |
Public Member Functions | |
KOKKOS_FUNCTION | DiscreteToCartesian (SplineType curvilinear_to_x, SplineType curvilinear_to_y, SplineEvaluator const &evaluator, IdxRangeTheta idx_range_theta) |
Instantiate a DiscreteToCartesian from the coefficients of 2D splines approximating the mapping. More... | |
KOKKOS_FUNCTION ddc::Coordinate< X, Y > | operator() (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const final |
Compute the physical coordinates from the logical coordinates. More... | |
KOKKOS_FUNCTION void | jacobian_matrix (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord, Matrix_2x2 &matrix) const final |
Compute full Jacobian matrix. More... | |
KOKKOS_FUNCTION double | jacobian_11 (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const final |
Compute the (1,1) coefficient of the Jacobian matrix. More... | |
KOKKOS_FUNCTION double | jacobian_12 (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const final |
Compute the (1,2) coefficient of the Jacobian matrix. More... | |
KOKKOS_FUNCTION double | jacobian_21 (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const final |
Compute the (2,1) coefficient of the Jacobian matrix. More... | |
KOKKOS_FUNCTION double | jacobian_22 (ddc::Coordinate< curvilinear_tag_r, curvilinear_tag_theta > const &coord) const final |
Compute the (2,2) coefficient of the 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... | |
KOKKOS_INLINE_FUNCTION const ddc::Coordinate< X, Y > | control_point (ddc::DiscreteElement< BSplineR, BSplineTheta > const &el) const |
Get a control point of the mapping on B-splines. More... | |
Public Member Functions inherited from CoordinateConverter< ddc::Coordinate< typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 >, ddc::Coordinate< X, Y > > | |
virtual KOKKOS_FUNCTION ddc::Coordinate< X, Y > | operator() (ddc::Coordinate< typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 > const &coord) const=0 |
Convert the coordinate to the equivalent coordinate in a different coordinate system. More... | |
Public Member Functions inherited from NonAnalyticalJacobian< ddc::Coordinate< typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 > > | |
KOKKOS_FUNCTION double | jacobian (ddc::Coordinate< typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 > const &coord) const final |
Compute the Jacobian, the determinant of the Jacobian matrix of the mapping. More... | |
KOKKOS_FUNCTION void | inv_jacobian_matrix (ddc::Coordinate< typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 > const &coord, Matrix_2x2 &matrix) const final |
Compute full inverse Jacobian matrix. More... | |
KOKKOS_FUNCTION double | inv_jacobian_11 (ddc::Coordinate< typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 > const &coord) const final |
Compute the (1,1) coefficient of the inverse Jacobian matrix. More... | |
KOKKOS_FUNCTION double | inv_jacobian_12 (ddc::Coordinate< typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 > const &coord) const final |
Compute the (1,2) coefficient of the inverse Jacobian matrix. More... | |
KOKKOS_FUNCTION double | inv_jacobian_21 (ddc::Coordinate< typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 > const &coord) const final |
Compute the (2,1) coefficient of the inverse Jacobian matrix. More... | |
KOKKOS_FUNCTION double | inv_jacobian_22 (ddc::Coordinate< typename SplineEvaluator::continuous_dimension_type1, typename SplineEvaluator::continuous_dimension_type2 > const &coord) const final |
Compute the (2,2) coefficient of the inverse Jacobian matrix. More... | |
Public Member Functions inherited from Jacobian< PositionCoordinate > | |
virtual KOKKOS_FUNCTION double | jacobian (PositionCoordinate const &coord) const =0 |
Compute the Jacobian, the determinant of the Jacobian matrix of the mapping. More... | |
virtual KOKKOS_FUNCTION void | jacobian_matrix (PositionCoordinate const &coord, Matrix_2x2 &matrix) const =0 |
Compute full Jacobian matrix. More... | |
virtual KOKKOS_FUNCTION double | jacobian_11 (PositionCoordinate const &coord) const =0 |
Compute the (1,1) coefficient of the Jacobian matrix. More... | |
virtual KOKKOS_FUNCTION double | jacobian_12 (PositionCoordinate const &coord) const =0 |
Compute the (1,2) coefficient of the Jacobian matrix. More... | |
virtual KOKKOS_FUNCTION double | jacobian_21 (PositionCoordinate const &coord) const =0 |
Compute the (2,1) coefficient of the Jacobian matrix. More... | |
virtual KOKKOS_FUNCTION double | jacobian_22 (PositionCoordinate const &coord) const =0 |
Compute the (2,2) coefficient of the Jacobian matrix. More... | |
virtual KOKKOS_FUNCTION void | inv_jacobian_matrix (PositionCoordinate const &coord, Matrix_2x2 &matrix) const =0 |
Compute full inverse Jacobian matrix. More... | |
virtual KOKKOS_FUNCTION double | inv_jacobian_11 (PositionCoordinate const &coord) const =0 |
Compute the (1,1) coefficient of the inverse Jacobian matrix. More... | |
virtual KOKKOS_FUNCTION double | inv_jacobian_12 (PositionCoordinate const &coord) const =0 |
Compute the (1,2) coefficient of the inverse Jacobian matrix. More... | |
virtual KOKKOS_FUNCTION double | inv_jacobian_21 (PositionCoordinate const &coord) const =0 |
Compute the (2,1) coefficient of the inverse Jacobian matrix. More... | |
virtual KOKKOS_FUNCTION double | inv_jacobian_22 (PositionCoordinate const &coord) const =0 |
Compute the (2,2) coefficient of the inverse Jacobian matrix. More... | |
A class for describing discrete 2D mappings from the logical domain to the physical domain.
The mapping describe here is only defined on a grid. The DiscreteToCartesian class decomposes the mapping on B-splines to evaluate it on the physical domain.
\( x(r,\theta) = \sum_k c_{x,k} B_k(r,\theta),\)
\( y(r,\theta) = \sum_k c_{y,k} B_k(r,\theta).\)
This mapping could be costly to inverse.
|
inline |
Instantiate a DiscreteToCartesian from the coefficients of 2D splines approximating the mapping.
A discrete mapping is a mapping whose values are known only at the mesh points of the grid. To interpolate the mapping, we use B-splines. The DiscreteToCartesian mapping is initialized from the coefficients in front of the basis splines which arise when we approximate the functions \( x(r,\theta) \), and \( y(r,\theta) \) (with \( x \) and \( y \) the physical dimensions in the logical domain) with Splines (using SplineBuilder2D). Then to interpolate the mapping, we will evaluate the decomposed functions on B-splines (see DiscreteToCartesian::operator()).
Here, the evaluator is given as input.
[in] | curvilinear_to_x | Bsplines coefficients of the first physical dimension in the logical domain. |
[in] | curvilinear_to_y | Bsplines coefficients of the second physical dimension in the logical domain. |
[in] | evaluator | The evaluator used to evaluate the mapping. |
[in] | idx_range_theta | The index range describing the poloidal points which should be used to average the derivatives of the pseudo-Cartesian matrix at the central point. |
|
inlinefinal |
Compute the physical coordinates from the logical coordinates.
It evaluates the decomposed mapping on B-splines at the coordinate point with a SplineEvaluator2D.
[in] | coord | The coordinates in the logical domain. |
|
inlinefinal |
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.
[in] | coord | The coordinate where we evaluate the Jacobian matrix. |
[out] | matrix | The Jacobian matrix returned. |
|
inlinefinal |
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} \). As the mapping is decomposed on B-splines, it means it computes the derivatives of B-splines \( \frac{\partial x}{\partial r} (r,\theta)= \sum_k c_{x,k} \frac{\partial B_k}{\partial r}(r,\theta)\) (the derivatives are implemented in SplineEvaluator2D).
[in] | coord | The coordinate where we evaluate the Jacobian matrix. |
|
inlinefinal |
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} \). As the mapping is decomposed on B-splines, it means it computes \( \frac{\partial x}{\partial \theta}(r,\theta) = \sum_k c_{x,k} \frac{\partial B_k}{\partial \theta}(r,\theta) \) (the derivatives of B-splines are implemented in SplineEvaluator2D).
[in] | coord | The coordinate where we evaluate the Jacobian matrix. |
|
inlinefinal |
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} \). As the mapping is decomposed on B-splines, it means it computes \( \frac{\partial y}{\partial r}(r,\theta) = \sum_k c_{y,k} \frac{\partial B_k}{\partial r}(r,\theta)\) (the derivatives of B-splines are implemented in SplineEvaluator2D).
[in] | coord | The coordinate where we evaluate the Jacobian matrix. . |
|
inlinefinal |
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} \). As the mapping is decomposed on B-splines, it means it computes \( \frac{\partial y}{\partial \theta} (r,\theta) = \sum_k c_{y,k} \frac{\partial B_k}{\partial \theta}(r,\theta) \) (the derivatives of B-splines are implemented in SplineEvaluator2D).
[in] | coord | The coordinate where we evaluate the Jacobian matrix. |
|
inlinefinalvirtual |
Compute the full Jacobian matrix from the mapping to the pseudo-Cartesian mapping at the central point.
The discrete mappings can be difficult to inverse especially at the central point. In case of non analytical invertible mapping, we can work in another domain called pseudo-Cartesian domain. In this domain, it is easier to inverse the Jacobian matrix. The idea is detailed in Edoardo Zoni's article (Solving hyperbolic-elliptic problems on singular mapped disk-like domains with the method of characteristics and spline finite elements, https://doi.org/10.1016/j.jcp.2019.108889)
The current mapping maps from the logical domain to the physical domain \( \mathcal{F}: (r,\theta) \mapsto (x, y)\). The pseudo-Cartesian domain is built with \( \mathcal{F} \) and using the circular mapping \( \mathcal{G} \):
The pseudo-Cartesian domain is obtained by the composition of both mappings: \( (\mathcal{F} \circ \mathcal{G}^{-1})^{-1} \). This new mapping is invertible and its inverse at the central point is given by
So the pseudo-Cartesian Jacobian matrix at the central point, \( (J_{\mathcal{F}}J_{\mathcal{G}}^{-1})^{-1}(0, \theta) \), is obtained by inversing this matrix.
[out] | matrix | The pseudo-Cartesian matrix evaluated at the central point. |
Implements PseudoCartesianCompatibleMapping.
|
inlinefinalvirtual |
Compute the (1,1) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.
Implements PseudoCartesianCompatibleMapping.
|
inlinefinalvirtual |
Compute the (1,2) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.
Implements PseudoCartesianCompatibleMapping.
|
inlinefinalvirtual |
Compute the (2,1) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.
Implements PseudoCartesianCompatibleMapping.
|
inlinefinalvirtual |
Compute the (2,2) coefficient of the pseudo-Cartesian Jacobian matrix at the central point.
Implements PseudoCartesianCompatibleMapping.
|
inline |
Get a control point of the mapping on B-splines.
The mapping \( (r,\theta) \mapsto (x,y) \) decomposed on B-splines can be identified by its control points \( \{(c_{x,k}, c_{y,k})\}_{k} \) where \( c_{x,k} \) and \( c_{y,k} \) are the B-splines coefficients:
\( x(r,\theta) = \sum_{k=0}^{N_r\times N_{\theta}-1} c_{x, k} B_k{r,\theta} \),
\( y(r,\theta) = \sum_{k=0}^{N_r\times N_{\theta}-1} c_{y, k} B_k{r,\theta} \),
where \( N_r\times N_{\theta} \) is the number of B-splines.
The control points can be obtained by interpolating the mapping on interpolation points (see GrevilleInterpolationPoints or KnotsAsInterpolationPoints). We can also note that the first control points \( \{(c_{x,k}, c_{y,k})\}_{k=0}^{N_{\theta}} \) are equal to the pole \( (c_{x,k}, c_{y,k}) = (x_0,y_0) \), \( \forall k = 0, ..., N_{\theta}-1 \) where \( x(0,\theta), y(0,\theta) = (x_0,y_0) \) \( \forall \theta \).
[in] | el | The number of the control point. |