Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cmath> 7 : #include <cstddef> 8 : #include <cstdint> 9 : #include <utility> 10 : 11 : #include "DataStructures/DataBox/Prefixes.hpp" 12 : #include "DataStructures/DataBox/Tag.hpp" 13 : #include "DataStructures/Tensor/EagerMath/DeterminantAndInverse.hpp" 14 : #include "DataStructures/Tensor/Tensor.hpp" 15 : #include "DataStructures/VariablesTag.hpp" 16 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp" 17 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 18 : #include "Utilities/ContainerHelpers.hpp" 19 : #include "Utilities/Gsl.hpp" 20 : #include "Utilities/TMPL.hpp" 21 : #include "Utilities/TaggedTuple.hpp" 22 : 23 : /// \ingroup GeneralRelativityGroup 24 : /// Holds functions related to general relativity. 25 : namespace gr { 26 : /// @{ 27 : /*! 28 : * \ingroup GeneralRelativityGroup 29 : * \brief Compute lapse from shift and spacetime metric 30 : * 31 : * \details Computes 32 : * \f{align} 33 : * \alpha &= \sqrt{\beta^i g_{it}-g_{tt}} 34 : * \f} 35 : * where \f$ \alpha \f$, \f$ \beta^i\f$, and \f$g_{ab}\f$ are the lapse, shift, 36 : * and spacetime metric. 37 : * This can be derived, e.g., from Eqs. 2.121--2.122 of Baumgarte & Shapiro. 38 : */ 39 : template <typename DataType, size_t SpatialDim, typename Frame> 40 1 : Scalar<DataType> lapse( 41 : const tnsr::I<DataType, SpatialDim, Frame>& shift, 42 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric); 43 : 44 : template <typename DataType, size_t SpatialDim, typename Frame> 45 1 : void lapse(gsl::not_null<Scalar<DataType>*> lapse, 46 : const tnsr::I<DataType, SpatialDim, Frame>& shift, 47 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric); 48 : /// @} 49 : 50 : namespace Tags { 51 : /*! 52 : * \brief Compute item for lapse \f$\alpha\f$ from the spacetime metric 53 : * \f$g_{ab}\f$ and the shift \f$\beta^i\f$. 54 : * 55 : * \details Can be retrieved using `gr::Tags::Lapse`. 56 : */ 57 : template <typename DataType, size_t SpatialDim, typename Frame> 58 1 : struct LapseCompute : Lapse<DataType>, db::ComputeTag { 59 0 : using argument_tags = 60 : tmpl::list<Shift<DataType, SpatialDim, Frame>, 61 : SpacetimeMetric<DataType, SpatialDim, Frame>>; 62 : 63 0 : using return_type = Scalar<DataType>; 64 : 65 0 : static constexpr auto function = 66 : static_cast<void (*)(const gsl::not_null<Scalar<DataType>*> lapse, 67 : const tnsr::I<DataType, SpatialDim, Frame>&, 68 : const tnsr::aa<DataType, SpatialDim, Frame>&)>( 69 : &lapse<DataType, SpatialDim, Frame>); 70 : 71 0 : using base = Lapse<DataType>; 72 : }; 73 : } // namespace Tags 74 : } // namespace gr