4 #include <sll/view.hpp>
6 #include "mapping_tools.hpp"
13 template <
class Mapping,
class PositionCoordinate>
16 static_assert(is_2d_mapping_v<Mapping>);
17 static_assert(has_2d_jacobian_v<Mapping, PositionCoordinate>);
52 matrix[0][0] = (J_11 * J_11 + J_21 * J_21);
53 matrix[0][1] = (J_11 * J_12 + J_21 * J_22);
54 matrix[1][0] = (J_11 * J_12 + J_21 * J_22);
55 matrix[1][1] = (J_12 * J_12 + J_22 * J_22);
72 const double jacob_2 = m_mapping.
jacobian(coord) * m_mapping.
jacobian(coord);
73 matrix[0][0] = (J_12 * J_12 + J_22 * J_22) / jacob_2;
74 matrix[0][1] = (-J_11 * J_12 - J_21 * J_22) / jacob_2;
75 matrix[1][0] = (-J_11 * J_12 - J_21 * J_22) / jacob_2;
76 matrix[1][1] = (J_11 * J_11 + J_21 * J_21) / jacob_2;
90 std::array<double, 2>
const& contravariant_vector,
91 PositionCoordinate
const& coord)
const
94 inverse(inv_metric_tensor, coord);
95 std::array<double, 2> covariant_vector;
96 covariant_vector[0] = inv_metric_tensor[0][0] * contravariant_vector[0]
97 + inv_metric_tensor[0][1] * contravariant_vector[1];
98 covariant_vector[1] = inv_metric_tensor[1][0] * contravariant_vector[0]
99 + inv_metric_tensor[1][1] * contravariant_vector[1];
100 return covariant_vector;
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
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 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
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 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
An operator for calculating the metric tensor.
Definition: metric_tensor.hpp:15
KOKKOS_FUNCTION std::array< double, 2 > to_covariant(std::array< double, 2 > const &contravariant_vector, PositionCoordinate const &coord) const
Compute the covariant vector from the contravariant vector.
Definition: metric_tensor.hpp:89
KOKKOS_FUNCTION MetricTensor(Mapping mapping)
A constructor for the metric tensor operator.
Definition: metric_tensor.hpp:32
std::array< std::array< double, 2 >, 2 > Matrix_2x2
The type of the Jacobian matrix and its inverse.
Definition: metric_tensor.hpp:21
KOKKOS_FUNCTION void inverse(Matrix_2x2 &matrix, PositionCoordinate const &coord) const
Compute the inverse metric tensor associated to the mapping.
Definition: metric_tensor.hpp:66
KOKKOS_FUNCTION void operator()(Matrix_2x2 &matrix, PositionCoordinate const &coord) const
Compute the metric tensor assignd to the mapping.
Definition: metric_tensor.hpp:46