9 #include <sll/view.hpp>
11 #include "coordinate_converter.hpp"
12 #include "curvilinear2d_to_cartesian.hpp"
13 #include "mapping_tools.hpp"
14 #include "pseudo_cartesian_compatible_mapping.hpp"
40 template <
class X,
class Y,
class R,
class Theta>
110 KOKKOS_FUNCTION ddc::Coordinate<X, Y>
operator()(ddc::Coordinate<R, Theta>
const& coord)
const
112 const double r = ddc::get<R>(coord);
113 const double theta = ddc::get<Theta>(coord);
114 const double x = r * Kokkos::cos(theta);
115 const double y = r * Kokkos::sin(theta);
116 return ddc::Coordinate<X, Y>(x, y);
127 ddc::Coordinate<X, Y>
const& coord)
const final
129 const double x = ddc::get<X>(coord);
130 const double y = ddc::get<Y>(coord);
131 const double r = Kokkos::sqrt(x * x + y * y);
132 const double theta = Kokkos::atan2(y, x);
133 return ddc::Coordinate<R, Theta>(r, theta);
144 KOKKOS_FUNCTION
double jacobian(ddc::Coordinate<R, Theta>
const& coord)
const
146 double r = ddc::get<R>(coord);
167 const double r = ddc::get<R>(coord);
168 const double theta = ddc::get<Theta>(coord);
169 matrix[0][0] = Kokkos::cos(theta);
170 matrix[0][1] = -r * Kokkos::sin(theta);
171 matrix[1][0] = Kokkos::sin(theta);
172 matrix[1][1] = r * Kokkos::cos(theta);
186 KOKKOS_FUNCTION
double jacobian_11(ddc::Coordinate<R, Theta>
const& coord)
const
188 const double theta = ddc::get<Theta>(coord);
189 return Kokkos::cos(theta);
203 KOKKOS_FUNCTION
double jacobian_12(ddc::Coordinate<R, Theta>
const& coord)
const
205 const double r = ddc::get<R>(coord);
206 const double theta = ddc::get<Theta>(coord);
207 return -r * Kokkos::sin(theta);
221 KOKKOS_FUNCTION
double jacobian_21(ddc::Coordinate<R, Theta>
const& coord)
const
223 const double theta = ddc::get<Theta>(coord);
224 return Kokkos::sin(theta);
238 KOKKOS_FUNCTION
double jacobian_22(ddc::Coordinate<R, Theta>
const& coord)
const
240 const double r = ddc::get<R>(coord);
241 const double theta = ddc::get<Theta>(coord);
242 return r * Kokkos::cos(theta);
266 ddc::Coordinate<R, Theta>
const& coord,
269 const double r = ddc::get<R>(coord);
270 const double theta = ddc::get<Theta>(coord);
271 assert(fabs(r) >= 1e-15);
272 matrix[0][0] = Kokkos::cos(theta);
273 matrix[0][1] = Kokkos::sin(theta);
274 matrix[1][0] = -1 / r * Kokkos::sin(theta);
275 matrix[1][1] = 1 / r * Kokkos::cos(theta);
290 const double theta = ddc::get<Theta>(coord);
291 return Kokkos::cos(theta);
306 const double theta = ddc::get<Theta>(coord);
307 return Kokkos::sin(theta);
322 const double r = ddc::get<R>(coord);
323 const double theta = ddc::get<Theta>(coord);
324 assert(fabs(r) >= 1e-15);
325 return -1 / r * Kokkos::sin(theta);
340 const double r = ddc::get<R>(coord);
341 const double theta = ddc::get<Theta>(coord);
342 assert(fabs(r) >= 1e-15);
343 return 1 / r * Kokkos::cos(theta);
435 namespace mapping_detail {
436 template <
class X,
class Y,
class R,
class Theta,
class ExecSpace>
A class for describing the circular 2D mapping.
Definition: circular_to_cartesian.hpp:45
KOKKOS_FUNCTION double jacobian_21(ddc::Coordinate< R, Theta > const &coord) const
Compute the (2,1) coefficient of the Jacobian matrix.
Definition: circular_to_cartesian.hpp:221
CircularToCartesian & operator=(CircularToCartesian const &x)=default
Assign a CircularToCartesian from another CircularToCartesian (lvalue).
typename Curvilinear2DToCartesian< X, Y, R, Theta >::cartesian_tag_y cartesian_tag_y
Indicate the second physical coordinate.
Definition: circular_to_cartesian.hpp:50
KOKKOS_FUNCTION double jacobian_22(ddc::Coordinate< R, Theta > const &coord) const
Compute the (2,2) coefficient of the Jacobian matrix.
Definition: circular_to_cartesian.hpp:238
KOKKOS_FUNCTION void jacobian_matrix(ddc::Coordinate< R, Theta > const &coord, Matrix_2x2 &matrix) const
Compute full Jacobian matrix.
Definition: circular_to_cartesian.hpp:164
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.
Definition: circular_to_cartesian.hpp:400
KOKKOS_FUNCTION double inv_jacobian_11(ddc::Coordinate< R, Theta > const &coord) const
Compute the (1,1) coefficient of the inverse Jacobian matrix.
Definition: circular_to_cartesian.hpp:288
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.
Definition: circular_to_cartesian.hpp:428
typename Curvilinear2DToCartesian< X, Y, R, Theta >::curvilinear_tag_r curvilinear_tag_r
Indicate the first logical coordinate.
Definition: circular_to_cartesian.hpp:52
ddc::Coordinate< R, Theta > CoordArg
The type of the argument of the function described by this mapping.
Definition: circular_to_cartesian.hpp:58
ddc::Coordinate< X, Y > CoordResult
The type of the result of the function described by this mapping.
Definition: circular_to_cartesian.hpp:60
KOKKOS_FUNCTION CircularToCartesian(CircularToCartesian const &other)
Instantiate a CircularToCartesian from another CircularToCartesian (lvalue).
Definition: circular_to_cartesian.hpp:71
KOKKOS_FUNCTION double inv_jacobian_12(ddc::Coordinate< R, Theta > const &coord) const
Compute the (1,2) coefficient of the inverse Jacobian matrix.
Definition: circular_to_cartesian.hpp:304
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 poin...
Definition: circular_to_cartesian.hpp:369
KOKKOS_FUNCTION double jacobian_11(ddc::Coordinate< R, Theta > const &coord) const
Compute the (1,1) coefficient of the Jacobian matrix.
Definition: circular_to_cartesian.hpp:186
CircularToCartesian & operator=(CircularToCartesian &&x)=default
Assign a CircularToCartesian from another temporary CircularToCartesian (rvalue).
KOKKOS_FUNCTION double jacobian_12(ddc::Coordinate< R, Theta > const &coord) const
Compute the (1,2) coefficient of the Jacobian matrix.
Definition: circular_to_cartesian.hpp:203
KOKKOS_FUNCTION double inv_jacobian_22(ddc::Coordinate< R, Theta > const &coord) const
Compute the (2,2) coefficient of the inverse Jacobian matrix.
Definition: circular_to_cartesian.hpp:338
CircularToCartesian(CircularToCartesian &&x)=default
Instantiate a Curvilinear2DToCartesian from another temporary CircularToCartesian (rvalue).
typename Curvilinear2DToCartesian< X, Y, R, Theta >::cartesian_tag_x cartesian_tag_x
Indicate the first physical coordinate.
Definition: circular_to_cartesian.hpp:48
KOKKOS_FUNCTION ddc::Coordinate< R, Theta > operator()(ddc::Coordinate< X, Y > const &coord) const final
Convert the coordinate (x,y) to the equivalent coordinate.
Definition: circular_to_cartesian.hpp:126
KOKKOS_FUNCTION void inv_jacobian_matrix(ddc::Coordinate< R, Theta > const &coord, Matrix_2x2 &matrix) const
Compute full inverse Jacobian matrix.
Definition: circular_to_cartesian.hpp:265
KOKKOS_FUNCTION ddc::Coordinate< X, Y > operator()(ddc::Coordinate< R, Theta > const &coord) const
Convert the coordinate to the equivalent (x,y) coordinate.
Definition: circular_to_cartesian.hpp:110
typename Curvilinear2DToCartesian< X, Y, R, Theta >::curvilinear_tag_theta curvilinear_tag_theta
Indicate the second logical coordinate.
Definition: circular_to_cartesian.hpp:55
KOKKOS_FUNCTION double inv_jacobian_21(ddc::Coordinate< R, Theta > const &coord) const
Compute the (2,1) coefficient of the inverse Jacobian matrix.
Definition: circular_to_cartesian.hpp:320
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.
Definition: circular_to_cartesian.hpp:414
KOKKOS_FUNCTION double jacobian(ddc::Coordinate< R, Theta > const &coord) const
Compute the Jacobian, the determinant of the Jacobian matrix of the mapping.
Definition: circular_to_cartesian.hpp:144
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.
Definition: circular_to_cartesian.hpp:386
An operator to convert from the start coordinate type to the end coordinate type.
Definition: coordinate_converter.hpp:13
A class for describing curvilinear 2D mappings from the logical domain to the physical domain.
Definition: curvilinear2d_to_cartesian.hpp:9
An operator to calculate the Jacobian matrix of the mapping from the physical domain to the pseudo-Ca...
Definition: pseudo_cartesian_compatible_mapping.hpp:42
std::array< std::array< double, 2 >, 2 > Matrix_2x2
The type of the pseudo-Cartesian Jacobian matrix and its inverse.
Definition: pseudo_cartesian_compatible_mapping.hpp:45
Define non periodic real R dimension.
Definition: geometry.hpp:31
Define periodic real Theta dimension.
Definition: geometry.hpp:42
Define non periodic real X dimension.
Definition: geometry.hpp:278
Define non periodic real Y dimension.
Definition: geometry.hpp:289