Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <cstddef>
7 :
8 : #include "DataStructures/DataVector.hpp"
9 : #include "DataStructures/Tensor/Tensor.hpp"
10 : #include "Domain/Structure/Direction.hpp"
11 : #include "Utilities/Gsl.hpp"
12 :
13 : /// @{
14 : /*!
15 : * \brief Compute the Euclidean area element from the inverse jacobian.
16 : *
17 : * \details The Euclidean area element of a surface \f$\Sigma\f$ with
18 : * constant logical coordinate \f$\xi^i\f$ is given by:
19 : *
20 : * \f{equation}
21 : * J^\Sigma = J \sqrt{\delta^{jk} (J^{-1})^i_j (J^{-1})^i_k}
22 : * \f}
23 : *
24 : * where \f$J^i_j = \partial x^i / \xi^j\f$ is the volume Jacobian with
25 : * determinant \f$J\f$ and inverse \f$(J^{-1})^i_j = \partial \xi^i / \partial
26 : * x^j\f$. The determinant of the inverse Jacobian can be passed as an argument
27 : * as an overload, otherwise it will be calculated.
28 : *
29 : * \note Time dependent maps are not implemented yet but can be added on
30 : * demand.
31 : *
32 : * \param inverse_jacobian_face The inverse Jacobian from the ElementLogical
33 : * frame to the Target frame sliced to the surface.
34 : * \param inverse_jacobian_determinant_face The determinant of the inverse
35 : * Jacobian sliced onto the surface. If not availabe, there exists an overload
36 : * that will calculate it from the inverse Jacobian.
37 : * \param direction The direction of the surface in the element.
38 : * */
39 : template <size_t VolumeDim, typename TargetFrame>
40 1 : void euclidean_area_element(
41 : const gsl::not_null<Scalar<DataVector>*> result,
42 : const InverseJacobian<DataVector, VolumeDim, Frame::ElementLogical,
43 : TargetFrame>& inverse_jacobian_face,
44 : const Scalar<DataVector>& inverse_jacobian_determinant_face,
45 : const Direction<VolumeDim>& direction);
46 :
47 : template <size_t VolumeDim, typename TargetFrame>
48 1 : void euclidean_area_element(
49 : const gsl::not_null<Scalar<DataVector>*> result,
50 : const InverseJacobian<DataVector, VolumeDim, Frame::ElementLogical,
51 : TargetFrame>& inverse_jacobian_face,
52 : const Direction<VolumeDim>& direction);
53 :
54 : template <size_t VolumeDim, typename TargetFrame>
55 1 : Scalar<DataVector> euclidean_area_element(
56 : const InverseJacobian<DataVector, VolumeDim, Frame::ElementLogical,
57 : TargetFrame>& inverse_jacobian_face,
58 : const Scalar<DataVector>& inverse_jacobian_determinant_face,
59 : const Direction<VolumeDim>& direction);
60 :
61 : template <size_t VolumeDim, typename TargetFrame>
62 1 : Scalar<DataVector> euclidean_area_element(
63 : const InverseJacobian<DataVector, VolumeDim, Frame::ElementLogical,
64 : TargetFrame>& inverse_jacobian_face,
65 : const Direction<VolumeDim>& direction);
66 : /// @}
67 :
68 : /// @{
69 : /*!
70 : * \brief Compute the curved area element from the inverse jacobian.
71 : *
72 : * \details The area element of a surface \f$\Sigma\f$ with
73 : * constant logical coordinate \f$\xi^i\f$ is given by:
74 : *
75 : * \f{equation}
76 : * J^\Sigma = J \sqrt{\gamma} \sqrt{\gamma^{jk} (J^{-1})^i_j (J^{-1})^i_k}
77 : * \f}
78 : *
79 : * where \f$\sqrt{\gamma}\f$ is the determinant of the spatial metric and
80 : * \f$J^i_j = \partial x^i / \xi^j\f$ is the volume Jacobian with determinant
81 : * \f$J\f$ and inverse \f$(J^{-1})^i_j = \partial \xi^i / \partial x^j\f$. Note
82 : * that the square root in the expression above is the magnitude of the
83 : * unnormalized face normal, where \f$\gamma^{jk}\f$ is the inverse spatial
84 : * metric. The determinant of the inverse Jacobian can be passed as an argument
85 : * as an overload, otherwise it will be calculated.
86 : *
87 : * \param inverse_jacobian_face The inverse Jacobian from the ElementLogical
88 : * frame to the Target frame sliced to the surface.
89 : * \param inverse_jacobian_determinant_face The determinant of the inverse
90 : * Jacobian sliced onto the surface. If not availabe, there exists an overload
91 : * that will calculate it from the inverse Jacobian.
92 : * \param direction The direction of the surface in the element.
93 : * \param inverse_spatial_metric The inverse spatial metric sliced to the
94 : * surface.
95 : * \param sqrt_det_spatial_metric The square root of the determinant of the
96 : * spatial metric, see \ref gr::Tags::SqrtDetSpatialMetric.
97 : */
98 : template <size_t VolumeDim, typename TargetFrame>
99 1 : void area_element(
100 : const gsl::not_null<Scalar<DataVector>*> result,
101 : const InverseJacobian<DataVector, VolumeDim, Frame::ElementLogical,
102 : TargetFrame>& inverse_jacobian_face,
103 : const Scalar<DataVector>& inverse_jacobian_determinant_face,
104 : const Direction<VolumeDim>& direction,
105 : const tnsr::II<DataVector, VolumeDim, TargetFrame>& inverse_spatial_metric,
106 : const Scalar<DataVector>& sqrt_det_spatial_metric);
107 :
108 : template <size_t VolumeDim, typename TargetFrame>
109 1 : void area_element(
110 : const gsl::not_null<Scalar<DataVector>*> result,
111 : const InverseJacobian<DataVector, VolumeDim, Frame::ElementLogical,
112 : TargetFrame>& inverse_jacobian_face,
113 : const Direction<VolumeDim>& direction,
114 : const tnsr::II<DataVector, VolumeDim, TargetFrame>& inverse_spatial_metric,
115 : const Scalar<DataVector>& sqrt_det_spatial_metric);
116 :
117 : template <size_t VolumeDim, typename TargetFrame>
118 1 : Scalar<DataVector> area_element(
119 : const InverseJacobian<DataVector, VolumeDim, Frame::ElementLogical,
120 : TargetFrame>& inverse_jacobian_face,
121 : const Scalar<DataVector>& inverse_jacobian_determinant_face,
122 : const Direction<VolumeDim>& direction,
123 : const tnsr::II<DataVector, VolumeDim, TargetFrame>& inverse_spatial_metric,
124 : const Scalar<DataVector>& sqrt_det_spatial_metric);
125 :
126 : template <size_t VolumeDim, typename TargetFrame>
127 1 : Scalar<DataVector> area_element(
128 : const InverseJacobian<DataVector, VolumeDim, Frame::ElementLogical,
129 : TargetFrame>& inverse_jacobian_face,
130 : const Direction<VolumeDim>& direction,
131 : const tnsr::II<DataVector, VolumeDim, TargetFrame>& inverse_spatial_metric,
132 : const Scalar<DataVector>& sqrt_det_spatial_metric);
133 : /// @}
|