SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Hydro - StressEnergy.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 4 5 80.0 %
Date: 2025-12-05 05:03:31
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/Tensor/TypeAliases.hpp"
       7             : #include "Utilities/Gsl.hpp"
       8             : 
       9             : namespace hydro {
      10             : 
      11             : /*!
      12             :  * \brief The total mass-energy density measured by a normal observer, $E = n_a
      13             :  * n_b T^{ab}$
      14             :  *
      15             :  * This quantity sources the gravitational field equations in the 3+1
      16             :  * decomposition (see Eq. (2.138) in \cite BaumgarteShapiro).
      17             :  *
      18             :  * Perfect fluid contribution (Eq. (5.33) in \cite BaumgarteShapiro):
      19             :  *
      20             :  * \begin{equation}
      21             :  *   E_\mathrm{fluid} = \rho h W^2 - p
      22             :  * \end{equation}
      23             :  *
      24             :  * Magnetic field contribution (Eq. (5.152) in \cite BaumgarteShapiro):
      25             :  *
      26             :  * \begin{equation}
      27             :  *   E_\mathrm{em} = b^2 \left(W^2 - \frac{1}{2}\right) - (\alpha b^t)^2
      28             :  * \end{equation}
      29             :  *
      30             :  * where $\alpha b^t = W B^k v_k$.
      31             :  *
      32             :  * \param result Output buffer. Will be resized if needed.
      33             :  * \param rest_mass_density $\rho$
      34             :  * \param specific_enthalpy $h$
      35             :  * \param pressure $p$
      36             :  * \param lorentz_factor $W$
      37             :  * \param magnetic_field_dot_spatial_velocity $B^k v_k$
      38             :  * \param comoving_magnetic_field_squared $b^2$
      39             :  *
      40             :  * \see gr::Tags::EnergyDensity
      41             :  */
      42             : template <typename DataType>
      43           1 : void energy_density(gsl::not_null<Scalar<DataType>*> result,
      44             :                     const Scalar<DataType>& rest_mass_density,
      45             :                     const Scalar<DataType>& specific_enthalpy,
      46             :                     const Scalar<DataType>& pressure,
      47             :                     const Scalar<DataType>& lorentz_factor,
      48             :                     const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
      49             :                     const Scalar<DataType>& comoving_magnetic_field_squared);
      50             : 
      51             : /*!
      52             :  * \brief The spatial momentum density $S^i = -\gamma^{ij} n^a T_{aj}$
      53             :  *
      54             :  * This quantity sources the gravitational field equations in the 3+1
      55             :  * decomposition (see Eq. (2.138) in \cite BaumgarteShapiro).
      56             :  *
      57             :  * Perfect fluid contribution (Eq. (5.34) in \cite BaumgarteShapiro):
      58             :  *
      59             :  * \begin{equation}
      60             :  *   S^i_\mathrm{fluid} = \rho h W^2 v^i
      61             :  * \end{equation}
      62             :  *
      63             :  * Magnetic field contribution (Eq. (5.153) in \cite BaumgarteShapiro):
      64             :  *
      65             :  * \begin{equation}
      66             :  *   S^i_\mathrm{em} = b^2 W^2 v^i - \alpha b^t \gamma^{ij} b_j
      67             :  * \end{equation}
      68             :  *
      69             :  * where $\alpha b^t \gamma^{ij} b_j = B^k v_k B^i + (B^k v_k)^2 W^2 v^i$.
      70             :  *
      71             :  * \param result Output buffer. Will be resized if needed.
      72             :  * \param rest_mass_density $\rho$
      73             :  * \param specific_enthalpy $h$
      74             :  * \param spatial_velocity $v^i$
      75             :  * \param lorentz_factor $W$
      76             :  * \param magnetic_field $B^i$
      77             :  * \param magnetic_field_dot_spatial_velocity $B^k v_k$
      78             :  * \param comoving_magnetic_field_squared $b^2$
      79             :  *
      80             :  * \see gr::Tags::MomentumDensity
      81             :  */
      82             : template <typename DataType>
      83           1 : void momentum_density(
      84             :     gsl::not_null<tnsr::I<DataType, 3>*> result,
      85             :     const Scalar<DataType>& rest_mass_density,
      86             :     const Scalar<DataType>& specific_enthalpy,
      87             :     const tnsr::I<DataType, 3>& spatial_velocity,
      88             :     const Scalar<DataType>& lorentz_factor,
      89             :     const tnsr::I<DataType, 3>& magnetic_field,
      90             :     const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
      91             :     const Scalar<DataType>& comoving_magnetic_field_squared);
      92             : 
      93             : /*!
      94             :  * \brief The trace of the spatial stress tensor, $S =
      95             :  * \gamma^{ij}\gamma_{ia}\gamma_{jb}T^{ab}$
      96             :  *
      97             :  * This quantity sources the gravitational field equations in the 3+1
      98             :  * decomposition (see Eq. (2.138) in \cite BaumgarteShapiro).
      99             :  *
     100             :  * Perfect fluid contribution (Eq. (5.36) in \cite BaumgarteShapiro):
     101             :  *
     102             :  * \begin{equation}
     103             :  *   S_\mathrm{fluid} = 3 p + \rho h (W^2 - 1)
     104             :  * \end{equation}
     105             :  *
     106             :  * Magnetic field contribution (Eq. (5.155) in \cite BaumgarteShapiro):
     107             :  *
     108             :  * \begin{equation}
     109             :  *   S_\mathrm{em} = b^2 (W^2 v^2 + \frac{3}{2}) - \gamma^{ij} b_i b_j
     110             :  * \end{equation}
     111             :  *
     112             :  * where $\gamma^{ij} b_i b_j = b^2 + (B^k v_k)^2 (W^2 v^2 + 1)$.
     113             :  *
     114             :  * \param result Output buffer. Will be resized if needed.
     115             :  * \param rest_mass_density $\rho$
     116             :  * \param specific_enthalpy $h$
     117             :  * \param pressure $p$
     118             :  * \param spatial_velocity_squared $v^2 = \gamma_{ij} v^i v^j$
     119             :  * \param lorentz_factor $W$
     120             :  * \param magnetic_field_dot_spatial_velocity $B^k v_k$
     121             :  * \param comoving_magnetic_field_squared $b^2$
     122             :  *
     123             :  * \see gr::Tags::StressTrace
     124             :  */
     125             : template <typename DataType>
     126           1 : void stress_trace(gsl::not_null<Scalar<DataType>*> result,
     127             :                   const Scalar<DataType>& rest_mass_density,
     128             :                   const Scalar<DataType>& specific_enthalpy,
     129             :                   const Scalar<DataType>& pressure,
     130             :                   const Scalar<DataType>& spatial_velocity_squared,
     131             :                   const Scalar<DataType>& lorentz_factor,
     132             :                   const Scalar<DataType>& magnetic_field_dot_spatial_velocity,
     133             :                   const Scalar<DataType>& comoving_magnetic_field_squared);
     134             : 
     135             : /*!
     136             :  * \brief Stress Energy Tesnor, $T^{ab}=
     137             :  * (\rho h)^{*} u^a u ^b + p^{*} g^{ab} - b^{a} b^{b}$,
     138             :  *
     139             :  * where $(\rho h)^{*} = \rho h + b^{2}$ and $p^{*} = p + b^{2}/2$
     140             :  * are the enthalpy density and fluid pressure augmented by contributions of
     141             :  * magnetic pressure $p_{mag}$ = b^{2}/2, respectively.
     142             :  *
     143             :  * $b$ refers to magnetic field measured in the comoving frame of the fluid
     144             :  * $b^{a} = ^{*}F^{ab} u_{b}$.
     145             :  */
     146             : template <typename DataType>
     147           1 : void stress_energy_tensor(
     148             :     gsl::not_null<tnsr::AA<DataType, 3>*> result,
     149             :     const Scalar<DataType>& rest_mass_density,
     150             :     const Scalar<DataType>& specific_internal_energy,
     151             :     const Scalar<DataType>& pressure, const Scalar<DataType>& lorentz_factor,
     152             :     const Scalar<DataType>& lapse,
     153             :     const Scalar<DataType>& comoving_magnetic_field_magnitude,
     154             :     const tnsr::I<DataType, 3>& spatial_velocity,
     155             :     const tnsr::I<DataType, 3>& shift,
     156             :     const tnsr::I<DataType, 3>& magnetic_field,
     157             :     const tnsr::ii<DataType, 3>& spatial_metric,
     158             :     const tnsr::II<DataType, 3>& inverse_spatial_metric);
     159             : }  // namespace hydro

Generated by: LCOV version 1.14