Line data Source code
1 1 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : ///\file 5 : /// Declares function templates to calculate the Ricci tensor 6 : 7 : #pragma once 8 : 9 : #include <cstddef> 10 : 11 : #include "DataStructures/DataBox/Tag.hpp" 12 : #include "DataStructures/Tensor/EagerMath/RaiseOrLowerIndex.hpp" 13 : #include "DataStructures/Tensor/TypeAliases.hpp" 14 : 15 : /// \cond 16 : namespace gsl { 17 : template <typename> 18 : struct not_null; 19 : } // namespace gsl 20 : /// \endcond 21 : 22 : namespace gh { 23 : /// @{ 24 : /*! 25 : * \ingroup GeneralRelativityGroup 26 : * \brief Compute spatial Ricci tensor using evolved variables and 27 : * their first derivatives. 28 : * 29 : * \details Lets write the Christoffel symbols of the first kind as 30 : * \f{align} 31 : * \Gamma_{kij} = \frac{1}{2}(\partial_i \gamma_{jk} + 32 : * \partial_j \gamma_{ik} - 33 : * \partial_k \gamma_{ij}) 34 : * = (\Phi_{(ij)k} - \frac{1}{2}\Phi_{kij}) 35 : * \f} 36 : * substituting \f$\partial_k \gamma_{ij}\rightarrow{}\Phi_{kij}\f$ by 37 : * subtracting out the three-index constraint 38 : * \f$C_{kij}=\partial_{k}\gamma_{ij}-\Phi_{kij}\f$ from every term. We also 39 : * define contractions \f$d_k=\frac{1}{2}\gamma^{ij}\Phi_{kij}\f$ and 40 : * \f$b_k=\frac{1}{2}\gamma^{ij}\Phi_{ijk}\f$. This allows us to rewrite the 41 : * spatial Ricci tensor as: 42 : * \f{align} 43 : * R_{i j} =& \partial_k \Gamma^{k}_{ij} - \partial_i \Gamma^{k}_{kj} 44 : * + \Gamma^{k}_{kl}\Gamma^{l}_{ij} 45 : * - \Gamma^{l}_{ki}\Gamma^{k}_{lj},\\ 46 : * 47 : * =& \gamma^{kl}\left(\partial_{k}\Phi_{(ij)l} - 48 : * \frac{1}{2}\partial_{k}\Phi_{lij}\right) 49 : * - b^{l} (\Phi_{(ij)l} - \frac{1}{2}\Phi_{lij})\nonumber\\ 50 : * & - \gamma^{kl}\left(\partial_{i}\Phi_{(kj)l} 51 : * - \frac{1}{2}\partial_{i}\Phi_{lkj}\right) 52 : * - \Phi_{i}{}^{kl}\left(\Phi_{(kj)l} 53 : * - \frac{1}{2}\Phi_{lkj} 54 : * \right)\nonumber\\ 55 : * & + \gamma^{km}\left(\Phi_{(kl)m} - \frac{1}{2}\Phi_{mkl}\right) 56 : * \gamma^{ln}\left(\Phi_{(ij)n} - \frac{1}{2}\Phi_{nij}\right) 57 : * \nonumber\\ 58 : * 59 : * & - \gamma^{km}\left(\Phi_{(il)m} - \frac{1}{2}\Phi_{mil}\right) 60 : * \gamma^{ln}\left(\Phi_{(jk)n} - \frac{1}{2}\Phi_{njk}\right). 61 : * \f} 62 : * Gathering all terms with second derivatives: 63 : * \f{align} 64 : * R_{i j} =& \frac{1}{2} \gamma^{k l} \left(\partial_k\Phi_{ijl} 65 : * + \partial_k\Phi_{jil} 66 : * - \partial_k\Phi_{lij} 67 : * + \partial_i\Phi_{lkj} 68 : * - \partial_i\Phi_{kjl} 69 : * - \partial_i\Phi_{jkl}\right) 70 : * + \mathcal{O}(\Phi), \nonumber\\ 71 : * =& \frac{1}{2} \gamma^{kl} \left(\partial_{(j}\Phi_{lki)} 72 : * - \partial_{(j}\Phi_{i)kl} 73 : * + \partial_k \Phi_{(ij)l} 74 : * - \partial_l \Phi_{kij} \right) 75 : * + \mathcal{O}(\Phi), 76 : * \f} 77 : * where we use the four-index constraint 78 : * \f$C_{klij}=\partial_k\Phi_{lij}-\partial_l\Phi_{kij}=0\f$ to swap the 79 : * first and second derivatives of the spatial metric, and symmetrize 80 : * \f$R_{ij} = R_{(ij)}\f$. Similarly gathering the remaining terms and 81 : * using the four-index constraint we get: 82 : * \f{align} 83 : * R_{i j} =& - b^k\left(\Phi_{ijk} + \Phi_{jik} - \Phi_{kij}\right) 84 : * -\frac{1}{2} \Phi_i{}^{kl} \left(\Phi_{jkl} + \Phi_{kjl} 85 : * - \Phi_{lkj}\right)\nonumber\\ 86 : * 87 : * &+ \frac{1}{2} d^k \left(\Phi_{ijk} + \Phi_{jik} - \Phi_{kij}\right) 88 : * - \left(\Phi_{(il)}{}^k - \frac{1}{2} \Phi^k{}_{il}\right) 89 : * \left(\Phi_{(kj)}{}^l - \frac{1}{2} \Phi^l{}_{kj}\right) 90 : * + \mathcal{O}(\partial\Phi) \\ 91 : * 92 : * =& \frac{1}{2} \left(\Phi_{ijk} + \Phi_{jik} - \Phi_{kij}\right) 93 : * (d^k - 2 b^k) 94 : * + \frac{1}{4} \Phi_{ik}{}^l \Phi_{jl}{}^k 95 : * + \frac{1}{2} \left(\Phi^k{}_{il} \Phi_{kj}{}^l 96 : * - \Phi^k{}_{li} \Phi^l{}_{kj}\right) 97 : * + \mathcal{O}(\partial\Phi). 98 : * \f} 99 : * Gathering everything together, we compute the spatial Ricci tensor as: 100 : * \f{eqnarray} 101 : * R_{i j} &=& \frac{1}{2} \gamma^{kl} \left(\partial_{(j|}\Phi_{lk|i)} 102 : * - \partial_{(j}\Phi_{i)kl} 103 : * + \partial_k \Phi_{(ij)l} 104 : * - \partial_l \Phi_{kij}\right)\nonumber\\ 105 : * &+& \frac{1}{2} \left(\Phi_{ijk} + \Phi_{jik} - \Phi_{kij}\right) 106 : * (d^k - 2 b^k) 107 : * + \frac{1}{4} \Phi_{ik}{}^l \Phi_{jl}{}^k 108 : * + \frac{1}{2} \left(\Phi^k{}_{il} \Phi_{kj}{}^l 109 : * - \Phi^k{}_{li} \Phi^l{}_{kj}\right). 110 : * \label{eq:rij} 111 : * \f} 112 : * This follows from equations (2.13) - (2.20) of \cite Kidder2001tz . 113 : * 114 : * Note that, in code, the mixed-index variables \f$\Phi_{ij}{}^k\f$ and 115 : * \f$\Phi^i{}_{jk}\f$ in Eq.(\f$\ref{eq:rij}\f$) are computed with a factor of 116 : * \f$1/2\f$ and so the last 3 terms in the same equation that are quadratic in 117 : * these terms occur multiplied by a factor of \f$4\f$. 118 : */ 119 : template <typename DataType, size_t VolumeDim, typename Frame> 120 1 : void spatial_ricci_tensor( 121 : gsl::not_null<tnsr::ii<DataType, VolumeDim, Frame>*> ricci, 122 : const tnsr::iaa<DataType, VolumeDim, Frame>& phi, 123 : const tnsr::ijaa<DataType, VolumeDim, Frame>& deriv_phi, 124 : const tnsr::II<DataType, VolumeDim, Frame>& inverse_spatial_metric); 125 : 126 : template <typename DataType, size_t VolumeDim, typename Frame> 127 1 : tnsr::ii<DataType, VolumeDim, Frame> spatial_ricci_tensor( 128 : const tnsr::iaa<DataType, VolumeDim, Frame>& phi, 129 : const tnsr::ijaa<DataType, VolumeDim, Frame>& deriv_phi, 130 : const tnsr::II<DataType, VolumeDim, Frame>& inverse_spatial_metric); 131 : /// @} 132 : } // namespace gh