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

Generated by: LCOV version 1.14