SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/AnalyticSolutions/GeneralRelativity - KerrSchild.hpp Hit Total Coverage
Commit: 2db722c93a8e9b106e406b439b79c8e05c2057fb Lines: 2 104 1.9 %
Date: 2021-03-03 22:01:00
Legend: Lines: hit not hit

          Line data    Source code
       1           0 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : #pragma once
       5             : 
       6             : #include <array>
       7             : #include <cstddef>
       8             : #include <pup.h>
       9             : 
      10             : #include "DataStructures/CachedTempBuffer.hpp"
      11             : #include "DataStructures/Tags/TempTensor.hpp"
      12             : #include "DataStructures/Tensor/TypeAliases.hpp"
      13             : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"
      14             : #include "Options/Options.hpp"
      15             : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
      16             : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
      17             : #include "Utilities/ForceInline.hpp"
      18             : #include "Utilities/TMPL.hpp"
      19             : #include "Utilities/TaggedTuple.hpp"
      20             : 
      21             : /// \cond
      22             : namespace Tags {
      23             : template <typename Tag>
      24             : struct dt;
      25             : }  // namespace Tags
      26             : namespace gsl {
      27             : template <class T>
      28             : class not_null;
      29             : }  // namespace gsl
      30             : /// \endcond
      31             : 
      32             : namespace gr {
      33             : namespace Solutions {
      34             : 
      35             : /*!
      36             :  * \brief Kerr black hole in Kerr-Schild coordinates
      37             :  *
      38             :  * \details
      39             :  * The metric is \f$g_{\mu\nu} = \eta_{\mu\nu} + 2 H l_\mu l_\nu\f$,
      40             :  * where \f$\eta_{\mu\nu}\f$ is the Minkowski metric, \f$H\f$ is a scalar
      41             :  * function, and \f$l_\mu\f$ is the outgoing null vector.
      42             :  * \f$H\f$ and \f$l_\mu\f$ are known functions of the coordinates
      43             :  * and of the mass and spin vector.
      44             :  *
      45             :  * The following are input file options that can be specified:
      46             :  *  - Mass (default: 1.)
      47             :  *  - Center (default: {0,0,0})
      48             :  *  - Spin (default: {0,0,0})
      49             :  *
      50             :  * ## Kerr-Schild Coordinates
      51             :  *
      52             :  *
      53             :  * A Kerr-Schild coordinate system is defined by
      54             :  * \f{equation}{
      55             :  * g_{\mu\nu}  \equiv \eta_{\mu\nu} + 2 H l_\mu l_\nu,
      56             :  * \f}
      57             :  * where \f$H\f$ is a scalar function of the coordinates, \f$\eta_{\mu\nu}\f$
      58             :  * is the Minkowski metric, and \f$l^\mu\f$ is a null vector. Note that the
      59             :  * form of the metric along with the nullness of \f$l^\mu\f$ allows one to
      60             :  * raise and lower indices of \f$l^\mu\f$ using \f$\eta_{\mu\nu}\f$, and
      61             :  * that \f$l^t l^t = l_t l_t = l^i l_i\f$.
      62             :  * Note also that
      63             :  * \f{equation}{
      64             :  * g^{\mu\nu}  \equiv \eta^{\mu\nu} - 2 H l^\mu l^\nu,
      65             :  * \f}
      66             :  * and that \f$\sqrt{-g}=1\f$.
      67             :  * Also, \f$l_\mu\f$ is a geodesic with respect to both the physical metric
      68             :  * and the Minkowski metric:
      69             :  * \f{equation}{
      70             :  * l^\mu \partial_\mu l_\nu = l^\mu\nabla_\mu l_\nu = 0.
      71             :  * \f}
      72             :  *
      73             :  *
      74             :  * The corresponding 3+1 quantities are
      75             :  * \f{eqnarray}{
      76             :  * g_{i j}     &=& \delta_{i j} + 2 H l_i l_j,\\
      77             :  * g^{i j}  &=& \delta^{i j} - {2 H l^i l^j \over 1+2H l^t l^t},\\
      78             :  * {\rm det} g_{i j}&=& 1+2H l^t l^t,\\
      79             :  * \beta^i       &=& - {2 H l^t l^i \over 1+2H l^t l^t},\\
      80             :  * N        &=& \left(1+2 H l^t l^t\right)^{-1/2},\quad\hbox{(lapse)}\\
      81             :  * \alpha     &=& \left(1+2 H l^t l^t\right)^{-1},
      82             :  *                \quad\hbox{(densitized lapse)}\\
      83             :  * K_{i j}  &=& - \left(1+2 H l^t l^t\right)^{1/2}
      84             :  *       \left[l_i l_j \partial_{t} H + 2 H l_{(i} \partial_{t} l_{j)}\right]
      85             :  *                 \nonumber \\
      86             :  *                 &&-2\left(1+2 H l^t l^t\right)^{-1/2}
      87             :  *                \left[H l^t \partial_{(i}l_{j)} + H l_{(i}\partial_{j)}l^t
      88             :  *          + l^t l_{(i}\partial_{j)} H + 2H^2 l^t l_{(i} l^k\partial_{k}l_{j)}
      89             :  *          + H l^t l_i l_j l^k \partial_{k} H\right],\\
      90             :  * \partial_{k}g_{i j}&=& 2 l_i l_j\partial_{k} H +
      91             :  *    4 H l_{(i} \partial_{k}l_{j)},\\
      92             :  * \partial_{k}N   &=& -\left(1+2 H l^t l^t\right)^{-3/2}
      93             :  *                    \left(l^tl^t\partial_{k}H+2Hl^t\partial_{k}l^t\right),\\
      94             :  * \partial_{k}\beta^i  &=& - 2\left(1+2H l^t l^t\right)^{-1}
      95             :  *    \left(l^tl^i\partial_{k}H+Hl^t\partial_{k}l^i+Hl^i\partial_{k}l^t\right)
      96             :  *                   + 4 H l^t l^i \left(1+2H l^t l^t\right)^{-2}
      97             :  *                     \left(l^tl^t\partial_{k}H+2Hl^t\partial_{k}l^t\right),\\
      98             :  * \Gamma^k{}_{i j}&=& -\delta^{k m}\left(l_i l_j \partial_{m}H
      99             :  *                                    + 2l_{(i} \partial_{m}l_{j)} \right)
     100             :  *                   + 2 H l_{(i}\partial_{j)} l^k
     101             :  *          \nonumber \\
     102             :  *                  &&+\left(1+2 H l^t l^t\right)^{-1}
     103             :  *                     \left[2 l^k l_{(i}\partial_{j)} H
     104             :  *                          +2 H l_i l_j l^k l^m \partial_{m}H
     105             :  *                          +2 H l^k \partial_{(i}l_{j)}
     106             :  *                          +4 H^2 l^k l_{(i} (l^m \partial_{m}l_{j)}
     107             :  *                                      -\partial_{j)} l^t)
     108             :  *                     \right].
     109             :  * \f}
     110             :  * Note that \f$l^i\f$ is **not** equal to \f$g^{i j} l_j\f$; it is equal
     111             :  * to \f${}^{(4)}g^{i \mu} l_\mu\f$.
     112             :  *
     113             :  * ## Kerr Spacetime
     114             :  *
     115             :  * ### Spin in the z direction
     116             :  *
     117             :  * Assume Cartesian coordinates \f$(t,x,y,z)\f$. Then for stationary Kerr
     118             :  * spacetime with mass \f$M\f$ and angular momentum \f$a M\f$
     119             :  * in the \f$z\f$ direction,
     120             :  * \f{eqnarray}{
     121             :  * H     &=& {M r^3 \over r^4 + a^2 z^2},\\
     122             :  * l_\mu &=&
     123             :  * \left(1,{rx+ay\over r^2+a^2},{ry-ax\over r^2+a^2},{z\over r}\right),
     124             :  * \f}
     125             :  * where \f$r\f$ is defined by
     126             :  * \f{equation}{
     127             :  * \label{eq:rdefinition1}
     128             :  * {x^2+y^2\over a^2+r^2} + {z^2\over r^2} = 1,
     129             :  * \f}
     130             :  * or equivalently,
     131             :  * \f{equation}{
     132             :  * r^2 = {1\over 2}(x^2 + y^2 + z^2 - a^2)
     133             :  *      + \left({1\over 4}(x^2 + y^2 + z^2 - a^2)^2 + a^2 z^2\right)^{1/2}.
     134             :  * \f}
     135             :  *
     136             :  * Possibly useful formula:
     137             :  * \f{equation}{
     138             :  * \partial_{i} r = {x_i + z \delta_{i z} \displaystyle {a^2\over r^2} \over
     139             :  *   2 r\left(1 - \displaystyle {x^2 + y^2 + z^2 - a^2\over 2 r^2}\right)}.
     140             :  * \f}
     141             :  *
     142             :  * ### Spin in an arbitrary direction
     143             :  *
     144             :  * For arbitrary spin direction, let \f$\vec{x}\equiv (x,y,z)\f$ and
     145             :  * \f$\vec{a}\f$ be a flat-space three-vector with magnitude-squared
     146             :  * (\f$\delta_{ij}\f$ norm) equal to \f$a^2\f$.
     147             :  * Then the Kerr-Schild quantities for Kerr spacetime are:
     148             :  * \f{eqnarray}{
     149             :  * H       &=& {M r^3 \over r^4 + (\vec{a}\cdot\vec{x})^2},\\
     150             :  * \vec{l} &=& {r\vec{x}-\vec{a}\times\vec{x}+(\vec{a}\cdot\vec{x})\vec{a}/r
     151             :  *              \over r^2+a^2 },\\
     152             :  * l_t     &=& 1,\\
     153             :  * \label{eq:rdefinition2}
     154             :  * r^2     &=& {1\over 2}(\vec{x}\cdot\vec{x}-a^2)
     155             :  *      + \left({1\over 4}(\vec{x}\cdot\vec{x}-a^2)^2
     156             :  *              + (\vec{a}\cdot\vec{x})^2\right)^{1/2},
     157             :  * \f}
     158             :  * where \f$\vec{l}\equiv (l_x,l_y,l_z)\f$, and
     159             :  * all dot and cross products are evaluated as flat-space 3-vector operations.
     160             :  *
     161             :  * Possibly useful formulae:
     162             :  * \f{equation}{
     163             :  * \partial_{i} r = {x_i + (\vec{a}\cdot\vec{x})a_i/r^2 \over
     164             :  *   2 r\left(1 - \displaystyle {\vec{x}\cdot\vec{x}-a^2\over 2 r^2}\right)},
     165             :  * \f}
     166             :  * \f{equation}{
     167             :  * {\partial_{i} H \over H} =
     168             :  *  {3\partial_{i}r\over r} - {4 r^3 \partial_{i}r +
     169             :  *                     2(\vec{a}\cdot\vec{x})\vec{a}
     170             :  *                     \over r^4 + (\vec{a}\cdot\vec{x})^2},
     171             :  * \f}
     172             :  * \f{equation}{
     173             :  * (r^2+a^2)\partial_{j} l_i =
     174             :  *                 (x_i-2 r l_i-(\vec{a}\cdot\vec{x})a_i/r^2)\partial_{j}r
     175             :  *                 + r\delta_{ij} + a_i a_j/r + \epsilon^{ijk} a_k.
     176             :  * \f}
     177             :  *
     178             :  * ## Cartesian and Spherical Coordinates for Kerr
     179             :  *
     180             :  * The Kerr-Schild coordinates are defined in terms of the Cartesian
     181             :  * coordinates \f$(x,y,z)\f$.  If one wishes to express Kerr-Schild
     182             :  * coordinates in terms of the spherical polar coordinates
     183             :  * \f$(\tilde{r},\theta,\phi)\f$ then one can make the obvious and
     184             :  * usual transformation
     185             :  * \f{equation}{
     186             :  * \label{eq:sphertocartsimple}
     187             :  * x=\tilde{r}\sin\theta\cos\phi,\quad
     188             :  * y=\tilde{r}\sin\theta\sin\phi,\quad
     189             :  * z=\tilde{r}\cos\theta.
     190             :  * \f}
     191             :  *
     192             :  * This is simple, and has the advantage that in this coordinate system
     193             :  * for \f$M\to0\f$, Kerr spacetime becomes Minkowski space in spherical
     194             :  * coordinates \f$(\tilde{r},\theta,\phi)\f$. However, the disadvantage is
     195             :  * that the horizon of a Kerr hole is **not** located at constant
     196             :  * \f$\tilde{r}\f$, but is located instead at constant \f$r\f$,
     197             :  * where \f$r\f$ is the radial
     198             :  * Boyer-Lindquist coordinate defined in (\f$\ref{eq:rdefinition2}\f$).
     199             :  *
     200             :  * For spin in the \f$z\f$ direction, one could use the transformation
     201             :  * \f{equation}{
     202             :  * x=\sqrt{r^2+a^2}\sin\theta\cos\phi,\quad
     203             :  * y=\sqrt{r^2+a^2}\sin\theta\sin\phi,\quad
     204             :  * z=r\cos\theta.
     205             :  * \f}
     206             :  * In this case, for \f$M\to0\f$, Kerr spacetime becomes Minkowski space in
     207             :  * spheroidal coordinates, but now the horizon is on a constant-coordinate
     208             :  * surface.
     209             :  *
     210             :  * Right now we use (\f$\ref{eq:sphertocartsimple}\f$), but we may
     211             :  * wish to use the other transformation in the future.
     212             :  */
     213           1 : class KerrSchild : public MarkAsAnalyticSolution {
     214             :  public:
     215           0 :   static constexpr size_t volume_dim = 3;
     216           0 :   struct Mass {
     217           0 :     using type = double;
     218           0 :     static constexpr Options::String help = {"Mass of the black hole"};
     219           0 :     static type lower_bound() noexcept { return 0.; }
     220             :   };
     221           0 :   struct Spin {
     222           0 :     using type = std::array<double, volume_dim>;
     223           0 :     static constexpr Options::String help = {
     224             :         "The [x,y,z] dimensionless spin of the black hole"};
     225             :   };
     226           0 :   struct Center {
     227           0 :     using type = std::array<double, volume_dim>;
     228           0 :     static constexpr Options::String help = {
     229             :         "The [x,y,z] center of the black hole"};
     230             :   };
     231           0 :   using options = tmpl::list<Mass, Spin, Center>;
     232           0 :   static constexpr Options::String help{
     233             :       "Black hole in Kerr-Schild coordinates"};
     234             : 
     235           0 :   KerrSchild(double mass, Spin::type dimensionless_spin, Center::type center,
     236             :              const Options::Context& context = {});
     237             : 
     238           0 :   explicit KerrSchild(CkMigrateMessage* /*unused*/) noexcept {}
     239             : 
     240           0 :   KerrSchild() = default;
     241           0 :   KerrSchild(const KerrSchild& /*rhs*/) = default;
     242           0 :   KerrSchild& operator=(const KerrSchild& /*rhs*/) = default;
     243           0 :   KerrSchild(KerrSchild&& /*rhs*/) noexcept = default;
     244           0 :   KerrSchild& operator=(KerrSchild&& /*rhs*/) noexcept = default;
     245           0 :   ~KerrSchild() = default;
     246             : 
     247             :   template <typename DataType>
     248           0 :   using DerivLapse = ::Tags::deriv<gr::Tags::Lapse<DataType>,
     249             :                                    tmpl::size_t<volume_dim>, Frame::Inertial>;
     250             :   template <typename DataType>
     251           0 :   using DerivShift =
     252             :       ::Tags::deriv<gr::Tags::Shift<volume_dim, Frame::Inertial, DataType>,
     253             :                     tmpl::size_t<volume_dim>, Frame::Inertial>;
     254             :   template <typename DataType>
     255           0 :   using DerivSpatialMetric = ::Tags::deriv<
     256             :       gr::Tags::SpatialMetric<volume_dim, Frame::Inertial, DataType>,
     257             :       tmpl::size_t<volume_dim>, Frame::Inertial>;
     258             :   template <typename DataType>
     259           0 :   using tags = tmpl::list<
     260             :       gr::Tags::Lapse<DataType>, ::Tags::dt<gr::Tags::Lapse<DataType>>,
     261             :       DerivLapse<DataType>,
     262             :       gr::Tags::Shift<volume_dim, Frame::Inertial, DataType>,
     263             :       ::Tags::dt<gr::Tags::Shift<volume_dim, Frame::Inertial, DataType>>,
     264             :       DerivShift<DataType>,
     265             :       gr::Tags::SpatialMetric<volume_dim, Frame::Inertial, DataType>,
     266             :       ::Tags::dt<
     267             :           gr::Tags::SpatialMetric<volume_dim, Frame::Inertial, DataType>>,
     268             :       DerivSpatialMetric<DataType>, gr::Tags::SqrtDetSpatialMetric<DataType>,
     269             :       gr::Tags::ExtrinsicCurvature<volume_dim, Frame::Inertial, DataType>,
     270             :       gr::Tags::InverseSpatialMetric<volume_dim, Frame::Inertial, DataType>>;
     271             : 
     272             :   template <typename DataType, typename... Tags>
     273           0 :   tuples::TaggedTuple<Tags...> variables(const tnsr::I<DataType, volume_dim>& x,
     274             :                                          double /*t*/,
     275             :                                          tmpl::list<Tags...> /*meta*/) const
     276             :       noexcept {
     277             :     static_assert(
     278             :         tmpl2::flat_all_v<tmpl::list_contains_v<tags<DataType>, Tags>...>,
     279             :         "At least one of the requested tags is not supported. The requested "
     280             :         "tags are listed as template parameters of the `variables` function.");
     281             :     IntermediateVars<DataType> intermediate(*this, x);
     282             :     return {intermediate.get_var(Tags{})...};
     283             :   }
     284             : 
     285             :   // clang-tidy: no runtime references
     286           0 :   void pup(PUP::er& p) noexcept;  // NOLINT
     287             : 
     288           0 :   SPECTRE_ALWAYS_INLINE double mass() const noexcept { return mass_; }
     289           0 :   SPECTRE_ALWAYS_INLINE const std::array<double, volume_dim>& center() const
     290             :       noexcept {
     291             :     return center_;
     292             :   }
     293             :   SPECTRE_ALWAYS_INLINE const std::array<double, volume_dim>&
     294           0 :   dimensionless_spin() const noexcept {
     295             :     return dimensionless_spin_;
     296             :   }
     297             : 
     298             :  private:
     299           0 :   struct internal_tags {
     300             :     template <typename DataType>
     301           0 :     using x_minus_center = ::Tags::TempI<0, 3, Frame::Inertial, DataType>;
     302             :     template <typename DataType>
     303           0 :     using a_dot_x = ::Tags::TempScalar<1, DataType>;
     304             :     template <typename DataType>
     305           0 :     using a_dot_x_squared = ::Tags::TempScalar<2, DataType>;
     306             :     template <typename DataType>
     307           0 :     using half_xsq_minus_asq = ::Tags::TempScalar<3, DataType>;
     308             :     template <typename DataType>
     309           0 :     using r_squared = ::Tags::TempScalar<4, DataType>;
     310             :     template <typename DataType>
     311           0 :     using r = ::Tags::TempScalar<5, DataType>;
     312             :     template <typename DataType>
     313           0 :     using a_dot_x_over_rsquared = ::Tags::TempScalar<6, DataType>;
     314             :     template <typename DataType>
     315           0 :     using deriv_log_r_denom = ::Tags::TempScalar<7, DataType>;
     316             :     template <typename DataType>
     317           0 :     using deriv_log_r = ::Tags::Tempi<8, 3, Frame::Inertial, DataType>;
     318             :     template <typename DataType>
     319           0 :     using H_denom = ::Tags::TempScalar<9, DataType>;
     320             :     template <typename DataType>
     321           0 :     using H = ::Tags::TempScalar<10, DataType>;
     322             :     template <typename DataType>
     323           0 :     using deriv_H_temp1 = ::Tags::TempScalar<11, DataType>;
     324             :     template <typename DataType>
     325           0 :     using deriv_H_temp2 = ::Tags::TempScalar<12, DataType>;
     326             :     template <typename DataType>
     327           0 :     using deriv_H = ::Tags::Tempi<13, 3, Frame::Inertial, DataType>;
     328             :     template <typename DataType>
     329           0 :     using denom = ::Tags::TempScalar<14, DataType>;
     330             :     template <typename DataType>
     331           0 :     using a_dot_x_over_r = ::Tags::TempScalar<15, DataType>;
     332             :     template <typename DataType>
     333           0 :     using null_form = ::Tags::Tempi<16, 3, Frame::Inertial, DataType>;
     334             :     template <typename DataType>
     335           0 :     using deriv_null_form = ::Tags::Tempij<17, 3, Frame::Inertial, DataType>;
     336             :     template <typename DataType>
     337           0 :     using lapse_squared = ::Tags::TempScalar<18, DataType>;
     338             :     template <typename DataType>
     339           0 :     using deriv_lapse_multiplier = ::Tags::TempScalar<19, DataType>;
     340             :     template <typename DataType>
     341           0 :     using shift_multiplier = ::Tags::TempScalar<20, DataType>;
     342             :   };
     343             : 
     344             :   template <typename DataType>
     345           0 :   class IntermediateComputer;
     346             : 
     347             :   template <typename DataType>
     348           0 :   using CachedBuffer = CachedTempBuffer<
     349             :       IntermediateComputer<DataType>, internal_tags::x_minus_center<DataType>,
     350             :       internal_tags::a_dot_x<DataType>,
     351             :       internal_tags::a_dot_x_squared<DataType>,
     352             :       internal_tags::half_xsq_minus_asq<DataType>,
     353             :       internal_tags::r_squared<DataType>, internal_tags::r<DataType>,
     354             :       internal_tags::a_dot_x_over_rsquared<DataType>,
     355             :       internal_tags::deriv_log_r_denom<DataType>,
     356             :       internal_tags::deriv_log_r<DataType>, internal_tags::H_denom<DataType>,
     357             :       internal_tags::H<DataType>, internal_tags::deriv_H_temp1<DataType>,
     358             :       internal_tags::deriv_H_temp2<DataType>, internal_tags::deriv_H<DataType>,
     359             :       internal_tags::denom<DataType>, internal_tags::a_dot_x_over_r<DataType>,
     360             :       internal_tags::null_form<DataType>,
     361             :       internal_tags::deriv_null_form<DataType>,
     362             :       internal_tags::lapse_squared<DataType>, gr::Tags::Lapse<DataType>,
     363             :       internal_tags::deriv_lapse_multiplier<DataType>,
     364             :       internal_tags::shift_multiplier<DataType>,
     365             :       gr::Tags::Shift<3, Frame::Inertial, DataType>, DerivShift<DataType>,
     366             :       gr::Tags::SpatialMetric<3, Frame::Inertial, DataType>,
     367             :       DerivSpatialMetric<DataType>,
     368             :       ::Tags::dt<gr::Tags::SpatialMetric<3, Frame::Inertial, DataType>>>;
     369             : 
     370             :   template <typename DataType>
     371             :   class IntermediateComputer {
     372             :    public:
     373           0 :     using CachedBuffer = KerrSchild::CachedBuffer<DataType>;
     374             : 
     375           0 :     IntermediateComputer(const KerrSchild& solution,
     376             :                          const tnsr::I<DataType, 3>& x,
     377             :                          double null_vector_0) noexcept;
     378             : 
     379           0 :     void operator()(gsl::not_null<tnsr::I<DataType, 3>*> x_minus_center,
     380             :                     gsl::not_null<CachedBuffer*> /*cache*/,
     381             :                     internal_tags::x_minus_center<DataType> /*meta*/) const
     382             :         noexcept;
     383             : 
     384           0 :     void operator()(gsl::not_null<Scalar<DataType>*> a_dot_x,
     385             :                     gsl::not_null<CachedBuffer*> cache,
     386             :                     internal_tags::a_dot_x<DataType> /*meta*/) const noexcept;
     387             : 
     388           0 :     void operator()(gsl::not_null<Scalar<DataType>*> a_dot_x_squared,
     389             :                     gsl::not_null<CachedBuffer*> cache,
     390             :                     internal_tags::a_dot_x_squared<DataType> /*meta*/) const
     391             :         noexcept;
     392             : 
     393           0 :     void operator()(gsl::not_null<Scalar<DataType>*> half_xsq_minus_asq,
     394             :                     gsl::not_null<CachedBuffer*> cache,
     395             :                     internal_tags::half_xsq_minus_asq<DataType> /*meta*/) const
     396             :         noexcept;
     397             : 
     398           0 :     void operator()(gsl::not_null<Scalar<DataType>*> r_squared,
     399             :                     gsl::not_null<CachedBuffer*> cache,
     400             :                     internal_tags::r_squared<DataType> /*meta*/) const noexcept;
     401             : 
     402           0 :     void operator()(gsl::not_null<Scalar<DataType>*> r,
     403             :                     gsl::not_null<CachedBuffer*> cache,
     404             :                     internal_tags::r<DataType> /*meta*/) const noexcept;
     405             : 
     406           0 :     void operator()(
     407             :         gsl::not_null<Scalar<DataType>*> a_dot_x_over_rsquared,
     408             :         gsl::not_null<CachedBuffer*> cache,
     409             :         internal_tags::a_dot_x_over_rsquared<DataType> /*meta*/) const noexcept;
     410             : 
     411           0 :     void operator()(gsl::not_null<Scalar<DataType>*> deriv_log_r_denom,
     412             :                     gsl::not_null<CachedBuffer*> cache,
     413             :                     internal_tags::deriv_log_r_denom<DataType> /*meta*/) const
     414             :         noexcept;
     415             : 
     416           0 :     void operator()(gsl::not_null<tnsr::i<DataType, 3>*> deriv_log_r,
     417             :                     gsl::not_null<CachedBuffer*> cache,
     418             :                     internal_tags::deriv_log_r<DataType> /*meta*/) const
     419             :         noexcept;
     420             : 
     421           0 :     void operator()(gsl::not_null<Scalar<DataType>*> H_denom,
     422             :                     gsl::not_null<CachedBuffer*> cache,
     423             :                     internal_tags::H_denom<DataType> /*meta*/) const noexcept;
     424             : 
     425           0 :     void operator()(gsl::not_null<Scalar<DataType>*> H,
     426             :                     gsl::not_null<CachedBuffer*> cache,
     427             :                     internal_tags::H<DataType> /*meta*/) const noexcept;
     428             : 
     429           0 :     void operator()(gsl::not_null<Scalar<DataType>*> deriv_H_temp1,
     430             :                     gsl::not_null<CachedBuffer*> cache,
     431             :                     internal_tags::deriv_H_temp1<DataType> /*meta*/) const
     432             :         noexcept;
     433             : 
     434           0 :     void operator()(gsl::not_null<Scalar<DataType>*> deriv_H_temp2,
     435             :                     gsl::not_null<CachedBuffer*> cache,
     436             :                     internal_tags::deriv_H_temp2<DataType> /*meta*/) const
     437             :         noexcept;
     438             : 
     439           0 :     void operator()(gsl::not_null<tnsr::i<DataType, 3>*> deriv_H,
     440             :                     gsl::not_null<CachedBuffer*> cache,
     441             :                     internal_tags::deriv_H<DataType> /*meta*/) const noexcept;
     442             : 
     443           0 :     void operator()(gsl::not_null<Scalar<DataType>*> denom,
     444             :                     gsl::not_null<CachedBuffer*> cache,
     445             :                     internal_tags::denom<DataType> /*meta*/) const noexcept;
     446             : 
     447           0 :     void operator()(gsl::not_null<Scalar<DataType>*> a_dot_x_over_r,
     448             :                     gsl::not_null<CachedBuffer*> cache,
     449             :                     internal_tags::a_dot_x_over_r<DataType> /*meta*/) const
     450             :         noexcept;
     451             : 
     452           0 :     void operator()(gsl::not_null<tnsr::i<DataType, 3>*> null_form,
     453             :                     gsl::not_null<CachedBuffer*> cache,
     454             :                     internal_tags::null_form<DataType> /*meta*/) const noexcept;
     455             : 
     456           0 :     void operator()(gsl::not_null<tnsr::ij<DataType, 3>*> deriv_null_form,
     457             :                     gsl::not_null<CachedBuffer*> cache,
     458             :                     internal_tags::deriv_null_form<DataType> /*meta*/) const
     459             :         noexcept;
     460             : 
     461           0 :     void operator()(gsl::not_null<Scalar<DataType>*> lapse_squared,
     462             :                     gsl::not_null<CachedBuffer*> cache,
     463             :                     internal_tags::lapse_squared<DataType> /*meta*/) const
     464             :         noexcept;
     465             : 
     466           0 :     void operator()(gsl::not_null<Scalar<DataType>*> lapse,
     467             :                     gsl::not_null<CachedBuffer*> cache,
     468             :                     gr::Tags::Lapse<DataType> /*meta*/) const noexcept;
     469             : 
     470           0 :     void operator()(gsl::not_null<Scalar<DataType>*> deriv_lapse_multiplier,
     471             :                     gsl::not_null<CachedBuffer*> cache,
     472             :                     internal_tags::deriv_lapse_multiplier<DataType> /*meta*/)
     473             :         const noexcept;
     474             : 
     475           0 :     void operator()(gsl::not_null<Scalar<DataType>*> shift_multiplier,
     476             :                     gsl::not_null<CachedBuffer*> cache,
     477             :                     internal_tags::shift_multiplier<DataType> /*meta*/) const
     478             :         noexcept;
     479             : 
     480           0 :     void operator()(
     481             :         gsl::not_null<tnsr::I<DataType, 3>*> shift,
     482             :         gsl::not_null<CachedBuffer*> cache,
     483             :         gr::Tags::Shift<3, Frame::Inertial, DataType> /*meta*/) const noexcept;
     484             : 
     485           0 :     void operator()(gsl::not_null<tnsr::iJ<DataType, 3>*> deriv_shift,
     486             :                     gsl::not_null<CachedBuffer*> cache,
     487             :                     DerivShift<DataType> /*meta*/) const noexcept;
     488             : 
     489           0 :     void operator()(
     490             :         gsl::not_null<tnsr::ii<DataType, 3>*> spatial_metric,
     491             :         gsl::not_null<CachedBuffer*> cache,
     492             :         gr::Tags::SpatialMetric<3, Frame::Inertial, DataType> /*meta*/) const
     493             :         noexcept;
     494             : 
     495           0 :     void operator()(gsl::not_null<tnsr::ijj<DataType, 3>*> deriv_spatial_metric,
     496             :                     gsl::not_null<CachedBuffer*> cache,
     497             :                     DerivSpatialMetric<DataType> /*meta*/) const noexcept;
     498             : 
     499           0 :     void operator()(gsl::not_null<tnsr::ii<DataType, 3>*> dt_spatial_metric,
     500             :                     gsl::not_null<CachedBuffer*> cache,
     501             :                     ::Tags::dt<gr::Tags::SpatialMetric<
     502             :                         3, Frame::Inertial, DataType>> /*meta*/) const noexcept;
     503             : 
     504             :    private:
     505           0 :     const KerrSchild& solution_;
     506           0 :     const tnsr::I<DataType, 3>& x_;
     507           0 :     double null_vector_0_;
     508             :   };
     509             : 
     510             :   template <typename DataType>
     511           0 :   class IntermediateVars : public CachedBuffer<DataType> {
     512             :    public:
     513           0 :     using CachedBuffer = KerrSchild::CachedBuffer<DataType>;
     514             : 
     515           0 :     IntermediateVars(const KerrSchild& solution,
     516             :                      const tnsr::I<DataType, 3>& x) noexcept;
     517             : 
     518           1 :     using CachedBuffer::get_var;
     519             : 
     520           0 :     tnsr::i<DataType, 3> get_var(DerivLapse<DataType> /*meta*/) noexcept;
     521             : 
     522           0 :     Scalar<DataType> get_var(
     523             :         ::Tags::dt<gr::Tags::Lapse<DataType>> /*meta*/) noexcept;
     524             : 
     525           0 :     tnsr::I<DataType, 3> get_var(
     526             :         ::Tags::dt<
     527             :             gr::Tags::Shift<3, Frame::Inertial, DataType>> /*meta*/) noexcept;
     528             : 
     529           0 :     Scalar<DataType> get_var(
     530             :         gr::Tags::SqrtDetSpatialMetric<DataType> /*meta*/) noexcept;
     531             : 
     532           0 :     tnsr::II<DataType, 3> get_var(
     533             :         gr::Tags::InverseSpatialMetric<3, Frame::Inertial,
     534             :                                        DataType> /*meta*/) noexcept;
     535             : 
     536           0 :     tnsr::ii<DataType, 3> get_var(
     537             :         gr::Tags::ExtrinsicCurvature<3, Frame::Inertial,
     538             :                                      DataType> /*meta*/) noexcept;
     539             : 
     540             :    private:
     541             :     // Here null_vector_0 is simply -1, but if you have a boosted solution,
     542             :     // then null_vector_0 can be something different, so we leave it coded
     543             :     // in instead of eliminating it.
     544           0 :     static constexpr double null_vector_0_ = -1.0;
     545             :   };
     546             : 
     547           0 :   double mass_{1.0};
     548           0 :   std::array<double, volume_dim> dimensionless_spin_{{0.0, 0.0, 0.0}};
     549           0 :   std::array<double, volume_dim> center_{{0.0, 0.0, 0.0}};
     550             : };
     551             : 
     552           0 : SPECTRE_ALWAYS_INLINE bool operator==(const KerrSchild& lhs,
     553             :                                       const KerrSchild& rhs) noexcept {
     554             :   return lhs.mass() == rhs.mass() and
     555             :          lhs.dimensionless_spin() == rhs.dimensionless_spin() and
     556             :          lhs.center() == rhs.center();
     557             : }
     558             : 
     559           0 : SPECTRE_ALWAYS_INLINE bool operator!=(const KerrSchild& lhs,
     560             :                                       const KerrSchild& rhs) noexcept {
     561             :   return not(lhs == rhs);
     562             : }
     563             : }  // namespace Solutions
     564             : }  // namespace gr

Generated by: LCOV version 1.14