SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/ScalarTensor - StressEnergy.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 33.3 % 9 3
Test Date: 2026-10-22 17:29:42
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 "DataStructures/DataVector.hpp"
       7              : #include "DataStructures/Tensor/Tensor.hpp"
       8              : #include "Evolution/Systems/CurvedScalarWave/Tags.hpp"
       9              : #include "Evolution/Systems/ScalarTensor/Tags.hpp"
      10              : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      11              : #include "Utilities/Gsl.hpp"
      12              : 
      13              : namespace ScalarTensor {
      14              : 
      15              : /*!
      16              :  * \brief Add in the trace-reversed stress-energy source term to the \f$\Pi\f$
      17              :  * evolved variable of the ::gh system.
      18              :  *
      19              :  * \details The only stress energy source term in the Generalized Harmonic
      20              :  * evolution equations is in the equation for \f$\Pi_{a b}\f$:
      21              :  * \f[
      22              :  * \partial_t \Pi_{ab} + \text{\{spatial derivative terms\}} =
      23              :  * \text{\{GH source terms\}}
      24              :  * - 16 \pi \alpha (T^{(\Psi)}_{ab} - \frac{1}{2} g_{a b} g^{cd}T^{(\Psi)}_{cd})
      25              :  * ~.
      26              :  * \f]
      27              :  *
      28              :  * (note that this function takes as argument the trace-reversed stress-energy
      29              :  * tensor)
      30              :  *
      31              :  * This function adds that contribution to the existing value of `dt_pi`. The
      32              :  * spacetime terms in the GH equation should be computed before passing the
      33              :  * `dt_pi` to this function for updating.
      34              :  *
      35              :  * \param dt_pi Time derivative of the $\Pi_{ab}$ variable in the ::gh system.
      36              :  * The vacuum part should be computed before with ::gh::TimeDerivative
      37              :  * \param trace_reversed_stress_energy Trace-reversed stress energy tensor of
      38              :  * the scalar $T^{(\Psi), \text{TR}}_{a b} \equiv T^{(\Psi)}_{ab} - \frac{1}{2}
      39              :  *  g_{a b} g^{cd}T^{(\Psi)}_{cd} = \partial_a \Psi \partial_b \Psi $.
      40              :  * \param lapse Lapse $\alpha$.
      41              :  *
      42              :  * \see `gh::TimeDerivative` for details about the spacetime
      43              :  * part of the time derivative calculation.
      44              :  */
      45            1 : void add_stress_energy_term_to_dt_pi(
      46              :     gsl::not_null<tnsr::aa<DataVector, 3_st>*> dt_pi,
      47              :     const tnsr::aa<DataVector, 3_st>& trace_reversed_stress_energy,
      48              :     const Scalar<DataVector>& lapse);
      49              : 
      50              : /*!
      51              :  * \brief Compute the trace-reversed stress-energy tensor of the scalar field.
      52              :  *
      53              :  * \details The trace-reversed stress energy tensor is needed to compute the
      54              :  * backreaction of the scalar to the spacetime evolution and is given by
      55              :  * \f{align*}{
      56              :  * T^{(\Psi), \text{TR}}_{a b} &\equiv T^{(\Psi)}_{ab} - \frac{1}{2}
      57              :  *  g_{a b} g^{cd}T^{(\Psi)}_{cd} \\
      58              :  *  &= \partial_a \Psi \partial_b \Psi ~,
      59              :  * \f}
      60              :  *
      61              :  * where \f$T^{(\Psi)}_{ab}\f$ is the standard stress-energy tensor of the
      62              :  * scalar.
      63              :  *
      64              :  * In terms of the evolved variables of the scalar,
      65              :  * \f{align*}{
      66              :     T_{00} &= \alpha^2 \Pi^{2} - 2 \alpha \Pi \beta^{i} \Phi_{i}
      67              :      + \beta^{i} \beta^{j} \Phi_{i} \Phi{j}~,                     \\
      68              :     T_{0k} &= - \alpha \Pi \Phi_{k} + \beta^{i} \Phi_{i} \Phi_{k}~,          \\
      69              :     T_{ij} &= \Phi_{i} \Phi{j}~.
      70              :  * \f}
      71              :  *
      72              :  * where \f$\alpha\f$ is the lapse.
      73              :  *
      74              :  * \param stress_energy Trace-reversed stress energy tensor of
      75              :  * the scalar $T^{(\Psi), \text{TR}}_{a b} \equiv T^{(\Psi)}_{ab} - \frac{1}{2}
      76              :  *  g_{a b} g^{cd}T^{(\Psi)}_{cd} = \partial_a \Psi \partial_b \Psi $.
      77              :  * \param pi_scalar Scalar evolution variable $\Pi$.
      78              :  * \param phi_scalar Scalar evolution variable $\Phi_i$.
      79              :  * \param lapse Lapse $\alpha$.
      80              :  * \param shift Shift $\beta^{i}$.
      81              :  */
      82            1 : void trace_reversed_stress_energy(
      83              :     gsl::not_null<tnsr::aa<DataVector, 3_st>*> stress_energy,
      84              :     const Scalar<DataVector>& pi_scalar,
      85              :     const tnsr::i<DataVector, 3_st>& phi_scalar,
      86              :     const Scalar<DataVector>& lapse, const tnsr::I<DataVector, 3_st>& shift);
      87              : 
      88              : namespace Tags {
      89              : 
      90              : /*!
      91              :  * \brief Compute tag for the trace reversed stress energy tensor.
      92              :  *
      93              :  * \details Compute using ScalarTensor::trace_reversed_stress_energy.
      94              :  */
      95            1 : struct TraceReversedStressEnergyCompute
      96              :     : TraceReversedStressEnergy<DataVector, 3_st, Frame::Inertial>,
      97              :       db::ComputeTag {
      98            0 :   static constexpr size_t Dim = 3;
      99            0 :   using argument_tags =
     100              :       tmpl::list<CurvedScalarWave::Tags::Pi, CurvedScalarWave::Tags::Phi<Dim>,
     101              :                  gr::Tags::Lapse<DataVector>,
     102              :                  gr::Tags::Shift<DataVector, 3, Frame::Inertial>>;
     103            0 :   using return_type = tnsr::aa<DataVector, Dim, Frame::Inertial>;
     104            0 :   static constexpr void (*function)(
     105              :       const gsl::not_null<tnsr::aa<DataVector, Dim>*> result,
     106              :       const Scalar<DataVector>&, const tnsr::i<DataVector, Dim>&,
     107              :       const Scalar<DataVector>&,
     108              :       const tnsr::I<DataVector, Dim>&) = &trace_reversed_stress_energy;
     109            0 :   using base = TraceReversedStressEnergy<DataVector, Dim, Frame::Inertial>;
     110              : };
     111              : }  // namespace Tags
     112              : 
     113              : }  // namespace ScalarTensor
        

Generated by: LCOV version 2.0-1