SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/Hydro - MassFlux.hpp Hit Total Coverage
Commit: 1f2210958b4f38fdc0400907ee7c6d5af5111418 Lines: 3 8 37.5 %
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 <cstddef>
       7             : 
       8             : #include "DataStructures/DataBox/Tag.hpp"
       9             : #include "DataStructures/Tensor/TypeAliases.hpp"
      10             : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"
      11             : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"
      12             : #include "Utilities/TMPL.hpp"
      13             : 
      14             : /// \cond
      15             : namespace gsl {
      16             : template <typename>
      17             : struct not_null;
      18             : }  // namespace gsl
      19             : /// \endcond
      20             : 
      21             : namespace hydro {
      22             : /// @{
      23             : /// Computes the vector \f$J^i\f$ in \f$\dot{M} = -\int J^i s_i d^2S\f$,
      24             : /// representing the mass flux through a surface with normal \f$s_i\f$.
      25             : ///
      26             : /// Note that the integral is understood
      27             : /// as a flat-space integral: all metric factors are included in \f$J^i\f$.
      28             : /// In particular, if the integral is done over a Strahlkorper, the
      29             : /// `gr::surfaces::euclidean_area_element` of the Strahlkorper should be used,
      30             : /// and \f$s_i\f$ is
      31             : /// the normal one-form to the Strahlkorper normalized with the flat metric,
      32             : /// \f$s_is_j\delta^{ij}=1\f$.
      33             : ///
      34             : /// The formula is
      35             : /// \f$ J^i = \rho W \sqrt{\gamma}(\alpha v^i-\beta^i)\f$,
      36             : /// where \f$\rho\f$ is the mass density, \f$W\f$ is the Lorentz factor,
      37             : /// \f$v^i\f$ is the spatial velocity of the fluid,
      38             : /// \f$\gamma\f$ is the determinant of the 3-metric \f$\gamma_{ij}\f$,
      39             : /// \f$\alpha\f$ is the lapse, and \f$\beta^i\f$ is the shift.
      40             : template <typename DataType, size_t Dim, typename Frame>
      41           1 : void mass_flux(gsl::not_null<tnsr::I<DataType, Dim, Frame>*> result,
      42             :                const Scalar<DataType>& rest_mass_density,
      43             :                const tnsr::I<DataType, Dim, Frame>& spatial_velocity,
      44             :                const Scalar<DataType>& lorentz_factor,
      45             :                const Scalar<DataType>& lapse,
      46             :                const tnsr::I<DataType, Dim, Frame>& shift,
      47             :                const Scalar<DataType>& sqrt_det_spatial_metric);
      48             : 
      49             : template <typename DataType, size_t Dim, typename Frame>
      50           1 : tnsr::I<DataType, Dim, Frame> mass_flux(
      51             :     const Scalar<DataType>& rest_mass_density,
      52             :     const tnsr::I<DataType, Dim, Frame>& spatial_velocity,
      53             :     const Scalar<DataType>& lorentz_factor, const Scalar<DataType>& lapse,
      54             :     const tnsr::I<DataType, Dim, Frame>& shift,
      55             :     const Scalar<DataType>& sqrt_det_spatial_metric);
      56             : /// @}
      57             : 
      58             : namespace Tags {
      59             : /// Compute item for mass flux vector \f$J^i\f$.
      60             : ///
      61             : /// Can be retrieved using `hydro::Tags::MassFlux`
      62             : template <typename DataType, size_t Dim, typename Frame>
      63           1 : struct MassFluxCompute : MassFlux<DataType, Dim, Frame>,
      64             :                                db::ComputeTag {
      65           0 :   using argument_tags =
      66             :       tmpl::list<hydro::Tags::RestMassDensity<DataType>,
      67             :                  hydro::Tags::SpatialVelocity<DataType, Dim, Frame>,
      68             :                  hydro::Tags::LorentzFactor<DataType>,
      69             :                  ::gr::Tags::Lapse<DataType>,
      70             :                  ::gr::Tags::Shift<DataType, Dim, Frame>,
      71             :                  ::gr::Tags::SqrtDetSpatialMetric<DataType>>;
      72             : 
      73           0 :   using return_type = tnsr::I<DataType, Dim, Frame>;
      74             : 
      75           0 :   static constexpr auto function = static_cast<void (*)(
      76             :       gsl::not_null<tnsr::I<DataType, Dim, Frame>*>, const Scalar<DataType>&,
      77             :       const tnsr::I<DataType, Dim, Frame>&, const Scalar<DataType>&,
      78             :       const Scalar<DataType>&, const tnsr::I<DataType, Dim, Frame>&,
      79             :       const Scalar<DataType>&)>(&mass_flux<DataType, Dim, Frame>);
      80             : 
      81           0 :   using base = MassFlux<DataType, Dim, Frame>;
      82             : };
      83             : }  // namespace Tags
      84             : }  // namespace hydro

Generated by: LCOV version 1.14