SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/RadiationTransport/M1Grey - Sources.hpp Hit Total Coverage
Commit: d0fc80462417e83e5cddfa1b9901bb4a9b6af4d6 Lines: 1 5 20.0 %
Date: 2024-03-29 00:33: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/DataBox/Prefixes.hpp"
       7             : #include "DataStructures/Tensor/TypeAliases.hpp"  // IWYU pragma: keep
       8             : #include "Evolution/Systems/RadiationTransport/M1Grey/Tags.hpp"  // IWYU pragma: keep
       9             : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp"  //  IWYU pragma: keep
      10             : #include "PointwiseFunctions/GeneralRelativity/TagsDeclarations.hpp"  // IWYU pragma: keep
      11             : #include "Utilities/Gsl.hpp"
      12             : #include "Utilities/TMPL.hpp"  // for EXPAND_PACK_LEFT_TO...
      13             : 
      14             : // IWYU pragma: no_include "PointwiseFunctions/GeneralRelativity/Tags.hpp"
      15             : 
      16             : /// \cond
      17             : class DataVector;
      18             : /// \endcond
      19             : 
      20             : // IWYU pragma: no_forward_declare Tensor
      21             : // IWYU pragma: no_forward_declare Tags::deriv
      22             : 
      23             : namespace RadiationTransport::M1Grey {
      24             : 
      25             : // Implementation of the curvature source terms
      26             : // for the M1 system, for an individual species.
      27             : namespace detail {
      28             : void compute_sources_impl(gsl::not_null<Scalar<DataVector>*> source_tilde_e,
      29             :                           gsl::not_null<tnsr::i<DataVector, 3>*> source_tilde_s,
      30             :                           const Scalar<DataVector>& tilde_e,
      31             :                           const tnsr::i<DataVector, 3>& tilde_s,
      32             :                           const tnsr::II<DataVector, 3>& tilde_p,
      33             :                           const Scalar<DataVector>& source_n,
      34             :                           const tnsr::i<DataVector, 3>& source_i,
      35             :                           const Scalar<DataVector>& lapse,
      36             :                           const tnsr::i<DataVector, 3>& d_lapse,
      37             :                           const tnsr::iJ<DataVector, 3>& d_shift,
      38             :                           const tnsr::ijj<DataVector, 3>& d_spatial_metric,
      39             :                           const tnsr::II<DataVector, 3>& inv_spatial_metric,
      40             :                           const tnsr::ii<DataVector, 3>& extrinsic_curvature);
      41             : }  // namespace detail
      42             : 
      43             : /*!
      44             :  * \brief Compute the curvature source terms for the flux-balanced
      45             :  * grey M1 radiation transport.
      46             :  *
      47             :  *
      48             :  * A flux-balanced system has the generic form:
      49             :  * \f[
      50             :  * \partial_t U_i + \partial_m F^m(U_i) = S(U_i)
      51             :  * \f]
      52             :  *
      53             :  * where \f$F^a()\f$ denotes the flux of a conserved variable \f$U_i\f$ and
      54             :  * \f$S()\f$ denotes the source term for the conserved variable.
      55             :  *
      56             :  * For the grey M1 formalism (neglecting coupling to the fluid):
      57             :  * \f{align*}
      58             :  * S({\tilde E}) &= \alpha \tilde P^{ij} K_{ij} - \tilde S^i \partial_i
      59             :  * \alpha,\\ S({\tilde S_i}) &= -\tilde E \partial_i \alpha + \tilde S_k
      60             :  * \partial_i \beta^k
      61             :  * + \frac{1}{2} \alpha \tilde P^{jk} \partial_i \gamma_{jk},
      62             :  * \f}
      63             :  *
      64             :  * where \f${\tilde E}\f$, \f${\tilde S_i}\f$, \f${\tilde P}^{ij}\f$ are the
      65             :  * densitized energy, momentum, and pressure tensor of the neutrinos/photons,
      66             :  * \f$K_{ij}\f$ is the extrinsic curvature, and \f$\alpha\f$, \f$\beta^i\f$,
      67             :  * \f$\gamma_{ij}\f$ are the lapse, shift and 3-metric.
      68             :  *
      69             :  * In the main function, we loop over all neutrino species, and then call
      70             :  * the actual implementation of the curvature source terms.
      71             :  */
      72             : template <typename... NeutrinoSpecies>
      73           1 : struct ComputeSources {
      74           0 :   using return_tags = tmpl::list<
      75             :       ::Tags::Source<Tags::TildeE<Frame::Inertial, NeutrinoSpecies>>...,
      76             :       ::Tags::Source<Tags::TildeS<Frame::Inertial, NeutrinoSpecies>>...>;
      77             : 
      78           0 :   using argument_tags = tmpl::list<
      79             :       Tags::TildeE<Frame::Inertial, NeutrinoSpecies>...,
      80             :       Tags::TildeS<Frame::Inertial, NeutrinoSpecies>...,
      81             :       Tags::TildeP<Frame::Inertial, NeutrinoSpecies>...,
      82             :       Tags::M1HydroCouplingNormal<NeutrinoSpecies>...,
      83             :       Tags::M1HydroCouplingSpatial<Frame::Inertial, NeutrinoSpecies>...,
      84             :       gr::Tags::Lapse<DataVector>,
      85             :       ::Tags::deriv<gr::Tags::Lapse<DataVector>, tmpl::size_t<3>,
      86             :                     Frame::Inertial>,
      87             :       ::Tags::deriv<gr::Tags::Shift<DataVector, 3>, tmpl::size_t<3>,
      88             :                     Frame::Inertial>,
      89             :       ::Tags::deriv<gr::Tags::SpatialMetric<DataVector, 3>, tmpl::size_t<3>,
      90             :                     Frame::Inertial>,
      91             :       gr::Tags::InverseSpatialMetric<DataVector, 3>,
      92             :       gr::Tags::ExtrinsicCurvature<DataVector, 3>>;
      93             : 
      94           0 :   static void apply(
      95             :       const gsl::not_null<typename Tags::TildeE<
      96             :           Frame::Inertial, NeutrinoSpecies>::type*>... sources_tilde_e,
      97             :       const gsl::not_null<typename Tags::TildeS<
      98             :           Frame::Inertial, NeutrinoSpecies>::type*>... sources_tilde_s,
      99             :       const typename Tags::TildeE<Frame::Inertial,
     100             :                                   NeutrinoSpecies>::type&... tilde_e,
     101             :       const typename Tags::TildeS<Frame::Inertial,
     102             :                                   NeutrinoSpecies>::type&... tilde_s,
     103             :       const typename Tags::TildeP<Frame::Inertial,
     104             :                                   NeutrinoSpecies>::type&... tilde_p,
     105             :       const typename Tags::M1HydroCouplingNormal<
     106             :           NeutrinoSpecies>::type&... source_n,
     107             :       const typename Tags::M1HydroCouplingSpatial<
     108             :           Frame::Inertial, NeutrinoSpecies>::type&... source_i,
     109             :       const Scalar<DataVector>& lapse, const tnsr::i<DataVector, 3>& d_lapse,
     110             :       const tnsr::iJ<DataVector, 3>& d_shift,
     111             :       const tnsr::ijj<DataVector, 3>& d_spatial_metric,
     112             :       const tnsr::II<DataVector, 3>& inv_spatial_metric,
     113             :       const tnsr::ii<DataVector, 3>& extrinsic_curvature) {
     114             :     EXPAND_PACK_LEFT_TO_RIGHT(detail::compute_sources_impl(
     115             :         sources_tilde_e, sources_tilde_s, tilde_e, tilde_s, tilde_p, source_n,
     116             :         source_i, lapse, d_lapse, d_shift, d_spatial_metric, inv_spatial_metric,
     117             :         extrinsic_curvature));
     118             :   }
     119             : };
     120             : 
     121             : }  // namespace RadiationTransport::M1Grey

Generated by: LCOV version 1.14