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/Tensor/TypeAliases.hpp" 10 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 11 : #include "Utilities/Gsl.hpp" 12 : #include "Utilities/TMPL.hpp" 13 : 14 : /// \ingroup GeneralRelativityGroup 15 : /// Holds functions related to general relativity. 16 : namespace gr { 17 : /// @{ 18 : /*! 19 : * \ingroup GeneralRelativityGroup 20 : * \brief Compute lapse from shift and spacetime metric 21 : * 22 : * \details Computes 23 : * \f{align} 24 : * \alpha &= \sqrt{\beta^i g_{it}-g_{tt}} 25 : * \f} 26 : * where \f$ \alpha \f$, \f$ \beta^i\f$, and \f$g_{ab}\f$ are the lapse, shift, 27 : * and spacetime metric. 28 : * This can be derived, e.g., from Eqs. 2.121--2.122 of Baumgarte & Shapiro. 29 : */ 30 : template <typename DataType, size_t SpatialDim, typename Frame> 31 1 : Scalar<DataType> lapse( 32 : const tnsr::I<DataType, SpatialDim, Frame>& shift, 33 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric); 34 : 35 : template <typename DataType, size_t SpatialDim, typename Frame> 36 1 : void lapse(gsl::not_null<Scalar<DataType>*> lapse, 37 : const tnsr::I<DataType, SpatialDim, Frame>& shift, 38 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric); 39 : /// @} 40 : 41 : namespace Tags { 42 : /*! 43 : * \brief Compute item for lapse \f$\alpha\f$ from the spacetime metric 44 : * \f$g_{ab}\f$ and the shift \f$\beta^i\f$. 45 : * 46 : * \details Can be retrieved using `gr::Tags::Lapse`. 47 : */ 48 : template <typename DataType, size_t SpatialDim, typename Frame> 49 1 : struct LapseCompute : Lapse<DataType>, db::ComputeTag { 50 0 : using argument_tags = 51 : tmpl::list<Shift<DataType, SpatialDim, Frame>, 52 : SpacetimeMetric<DataType, SpatialDim, Frame>>; 53 : 54 0 : using return_type = Scalar<DataType>; 55 : 56 0 : static constexpr auto function = 57 : static_cast<void (*)(const gsl::not_null<Scalar<DataType>*> lapse, 58 : const tnsr::I<DataType, SpatialDim, Frame>&, 59 : const tnsr::aa<DataType, SpatialDim, Frame>&)>( 60 : &lapse<DataType, SpatialDim, Frame>); 61 : 62 0 : using base = Lapse<DataType>; 63 : }; 64 : } // namespace Tags 65 : } // namespace gr