SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Hydro - SoundSpeedSquared.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 37.5 % 8 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 <cstddef>
       7              : 
       8              : #include "DataStructures/DataBox/Tag.hpp"
       9              : #include "DataStructures/Tensor/TypeAliases.hpp"
      10              : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"
      11              : #include "Utilities/Gsl.hpp"
      12              : #include "Utilities/TMPL.hpp"
      13              : 
      14              : /// \cond
      15              : namespace EquationsOfState {
      16              : template <bool IsRelativistic, size_t ThermodynamicDim>
      17              : class EquationOfState;
      18              : }  // namespace EquationsOfState
      19              : /// \endcond
      20              : 
      21              : namespace hydro {
      22              : /// @{
      23              : /*!
      24              :  * \ingroup EquationsOfStateGroup
      25              :  * \brief Computes the relativistic sound speed squared
      26              :  *
      27              :  * The relativistic sound speed squared is given by
      28              :  * \f$c_s^2 = \left(\chi + p\kappa / \rho^2\right)/h\f$, where
      29              :  * \f$p\f$ is the fluid pressure, \f$\rho\f$ is the rest mass density,
      30              :  * \f$h = 1 + \epsilon + p / \rho\f$ is the specific enthalpy
      31              :  * \f$\chi = (\partial p/\partial\rho)_\epsilon\f$ and
      32              :  * \f$\kappa = (\partial p/ \partial \epsilon)_\rho\f$, where
      33              :  * \f$\epsilon\f$ is the specific internal energy.
      34              :  */
      35              : template <typename DataType, size_t ThermodynamicDim>
      36            1 : void sound_speed_squared(
      37              :     gsl::not_null<Scalar<DataType>*> result,
      38              :     const Scalar<DataType>& rest_mass_density,
      39              :     const Scalar<DataType>& specific_internal_energy,
      40              :     const Scalar<DataType>& specific_enthalpy,
      41              :     const EquationsOfState::EquationOfState<true, ThermodynamicDim>&
      42              :         equation_of_state);
      43              : 
      44              : template <typename DataType, size_t ThermodynamicDim>
      45            1 : Scalar<DataType> sound_speed_squared(
      46              :     const Scalar<DataType>& rest_mass_density,
      47              :     const Scalar<DataType>& specific_internal_energy,
      48              :     const Scalar<DataType>& specific_enthalpy,
      49              :     const EquationsOfState::EquationOfState<true, ThermodynamicDim>&
      50              :         equation_of_state);
      51              : /// @}
      52              : 
      53              : namespace Tags {
      54              : /// Compute item for the sound speed squared \f$c_s^2\f$.
      55              : /// \see hydro::sound_speed_squared
      56              : ///
      57              : /// Can be retrieved using `hydro::Tags::SoundSpeedSquared`
      58              : template <typename DataType, bool IsRelativistic, size_t ThermoDim>
      59            1 : struct SoundSpeedSquaredCompute : SoundSpeedSquared<DataType>, db::ComputeTag {
      60            0 :   using argument_tags = typename tmpl::list<
      61              :       RestMassDensity<DataType>, SpecificInternalEnergy<DataType>,
      62              :       SpecificEnthalpy<DataType>,
      63              :       hydro::Tags::EquationOfState<IsRelativistic, ThermoDim>>;
      64              : 
      65            0 :   using return_type = Scalar<DataType>;
      66              : 
      67              :   template <typename EquationOfStateType>
      68            0 :   static void function(const gsl::not_null<Scalar<DataType>*> result,
      69              :                        const Scalar<DataType>& rest_mass_density,
      70              :                        const Scalar<DataType>& specific_internal_energy,
      71              :                        const Scalar<DataType>& specific_enthalpy,
      72              :                        const EquationOfStateType& equation_of_state) {
      73              :     sound_speed_squared(result, rest_mass_density, specific_internal_energy,
      74              :                         specific_enthalpy, equation_of_state);
      75              :   }
      76              : 
      77            0 :   using base = SoundSpeedSquared<DataType>;
      78              : };
      79              : }  // namespace Tags
      80              : }  // namespace hydro
        

Generated by: LCOV version 2.0-1