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/DataBox/Tag.hpp" 9 : #include "DataStructures/DataVector.hpp" 10 : #include "DataStructures/Tensor/Tensor.hpp" 11 : #include "Domain/Tags.hpp" 12 : #include "Utilities/Gsl.hpp" 13 : 14 : namespace domain { 15 : 16 : /*! 17 : * \brief The "flat logical metric" $\sum_k \frac{\partial x^k}{\partial 18 : * \xi^\hat{i}} \frac{\partial x^k}{\partial \xi^\hat{j}}$, which is the flat 19 : * spatial metric in element-logical coordinates. 20 : * 21 : * We define the "flat logical metric" to be the matrix of inner products of the 22 : * $\hat{i}$-th logical coordinate basis vector $\partial_{\xi^\hat{i}}$ with 23 : * the $\hat{j}$-th logical coordinate basis vector $\partial_{\xi^\hat{j}}$, 24 : * where the inner product is taken assuming a flat spatial metric. When 25 : * expressed in the ("inertial") $x$-coordinate system, each basis vector is a 26 : * column of the Jacobian. 27 : */ 28 : template <size_t Dim> 29 1 : void flat_logical_metric( 30 : const gsl::not_null<tnsr::ii<DataVector, Dim, Frame::ElementLogical>*> 31 : result, 32 : const Jacobian<DataVector, Dim, Frame::ElementLogical, Frame::Inertial>& 33 : jacobian); 34 : 35 : namespace Tags { 36 : /// The flat metric in element-logical coordinates 37 : /// 38 : /// \see domain::flat_logical_metric 39 : template <size_t Dim> 40 1 : struct FlatLogicalMetric : db::SimpleTag { 41 0 : using type = tnsr::ii<DataVector, Dim, Frame::ElementLogical>; 42 : }; 43 : 44 : /// Compute the flat metric in element-logical coordinates from the inverse 45 : /// Jacobian. 46 : /// 47 : /// \see domain::flat_logical_metric 48 : template <size_t Dim> 49 1 : struct FlatLogicalMetricCompute : FlatLogicalMetric<Dim>, db::ComputeTag { 50 0 : using base = FlatLogicalMetric<Dim>; 51 0 : using return_type = typename base::type; 52 0 : using argument_tags = 53 : tmpl::list<domain::Tags::InverseJacobian<Dim, Frame::ElementLogical, 54 : Frame::Inertial>>; 55 0 : static void function( 56 : const gsl::not_null<tnsr::ii<DataVector, Dim, Frame::ElementLogical>*> 57 : result, 58 : const ::InverseJacobian<DataVector, Dim, Frame::ElementLogical, 59 : Frame::Inertial>& inv_jacobian); 60 : }; 61 : 62 : } // namespace Tags 63 : } // namespace domain