SpECTRE Documentation Coverage Report
Current view: top level - PointwiseFunctions/AnalyticSolutions/RadiationTransport/M1Grey - ConstantM1.hpp Hit Total Coverage
Commit: d0fc80462417e83e5cddfa1b9901bb4a9b6af4d6 Lines: 13 34 38.2 %
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 <array>
       7             : #include <limits>
       8             : #include <pup.h>
       9             : 
      10             : #include "DataStructures/Tensor/TypeAliases.hpp"
      11             : #include "Evolution/Systems/RadiationTransport/M1Grey/Tags.hpp"  // IWYU pragma: keep
      12             : #include "Options/String.hpp"
      13             : #include "PointwiseFunctions/AnalyticSolutions/AnalyticSolution.hpp"
      14             : #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Minkowski.hpp"
      15             : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp"  // IWYU pragma: keep
      16             : #include "Utilities/TMPL.hpp"
      17             : #include "Utilities/TaggedTuple.hpp"
      18             : 
      19             : // IWYU pragma: no_forward_declare Tensor
      20             : 
      21             : /// \cond
      22             : class DataVector;
      23             : /// \endcond
      24             : 
      25             : namespace RadiationTransport {
      26             : namespace M1Grey {
      27           1 : namespace Solutions {
      28             : 
      29             : /*!
      30             :  * \brief Constant solution to M1 equations in Minkowski spacetime.
      31             :  *
      32             :  * An analytic solution to the 3-D M1 system. The user specifies the mean
      33             :  * flow velocity of the fluid and the radiation energy density in the
      34             :  * fluid frame J.
      35             :  * The radiation is taken to be in equilibrium with the fluid
      36             :  * (i.e. comoving, with an isotropic pressure P=J/3)
      37             :  *
      38             :  */
      39           1 : class ConstantM1 : public MarkAsAnalyticSolution {
      40             :  public:
      41             :   /// The mean flow velocity.
      42           1 :   struct MeanVelocity {
      43           0 :     using type = std::array<double, 3>;
      44           0 :     static constexpr Options::String help = {"The mean flow velocity."};
      45             :   };
      46             : 
      47             :   /// The radiation comoving energy density
      48           1 :   struct ComovingEnergyDensity {
      49           0 :     using type = double;
      50           0 :     static constexpr Options::String help = {
      51             :         "Comoving energy density of radiation."};
      52             :   };
      53             : 
      54           0 :   using options = tmpl::list<MeanVelocity, ComovingEnergyDensity>;
      55           0 :   static constexpr Options::String help = {
      56             :       "Constant radiation field in equilibrium with fluid, in Minkowski "
      57             :       "spacetime."};
      58             : 
      59           0 :   ConstantM1() = default;
      60           0 :   ConstantM1(const ConstantM1& /*rhs*/) = delete;
      61           0 :   ConstantM1& operator=(const ConstantM1& /*rhs*/) = delete;
      62           0 :   ConstantM1(ConstantM1&& /*rhs*/) = default;
      63           0 :   ConstantM1& operator=(ConstantM1&& /*rhs*/) = default;
      64           0 :   ~ConstantM1() = default;
      65             : 
      66           0 :   ConstantM1(const std::array<double, 3>& mean_velocity,
      67             :              double comoving_energy_density);
      68             : 
      69           0 :   explicit ConstantM1(CkMigrateMessage* /*unused*/) {}
      70             : 
      71             :   /// @{
      72             :   /// Retrieve fluid and neutrino variables at `(x, t)`
      73             :   template <typename NeutrinoSpecies>
      74           1 :   auto variables(const tnsr::I<DataVector, 3>& x, double t,
      75             :                  tmpl::list<RadiationTransport::M1Grey::Tags::TildeE<
      76             :                      Frame::Inertial, NeutrinoSpecies>> /*meta*/) const
      77             :       -> tuples::TaggedTuple<RadiationTransport::M1Grey::Tags::TildeE<
      78             :           Frame::Inertial, NeutrinoSpecies>>;
      79             : 
      80             :   template <typename NeutrinoSpecies>
      81           1 :   auto variables(const tnsr::I<DataVector, 3>& x, double t,
      82             :                  tmpl::list<RadiationTransport::M1Grey::Tags::TildeS<
      83             :                      Frame::Inertial, NeutrinoSpecies>> /*meta*/) const
      84             :       -> tuples::TaggedTuple<RadiationTransport::M1Grey::Tags::TildeS<
      85             :           Frame::Inertial, NeutrinoSpecies>>;
      86             : 
      87             :   template <typename NeutrinoSpecies>
      88           1 :   auto variables(const tnsr::I<DataVector, 3>& x, double t,
      89             :                  tmpl::list<RadiationTransport::M1Grey::Tags::GreyEmissivity<
      90             :                      NeutrinoSpecies>> /*meta*/) const
      91             :       -> tuples::TaggedTuple<
      92             :           RadiationTransport::M1Grey::Tags::GreyEmissivity<NeutrinoSpecies>>;
      93             : 
      94             :   template <typename NeutrinoSpecies>
      95           1 :   auto variables(
      96             :       const tnsr::I<DataVector, 3>& x, double t,
      97             :       tmpl::list<RadiationTransport::M1Grey::Tags::GreyAbsorptionOpacity<
      98             :           NeutrinoSpecies>> /*meta*/) const
      99             :       -> tuples::TaggedTuple<RadiationTransport::M1Grey::Tags::
     100             :                                  GreyAbsorptionOpacity<NeutrinoSpecies>>;
     101             : 
     102             :   template <typename NeutrinoSpecies>
     103           1 :   auto variables(
     104             :       const tnsr::I<DataVector, 3>& x, double t,
     105             :       tmpl::list<RadiationTransport::M1Grey::Tags::GreyScatteringOpacity<
     106             :           NeutrinoSpecies>> /*meta*/) const
     107             :       -> tuples::TaggedTuple<RadiationTransport::M1Grey::Tags::
     108             :                                  GreyScatteringOpacity<NeutrinoSpecies>>;
     109             : 
     110           1 :   auto variables(const tnsr::I<DataVector, 3>& x, double t,
     111             :                  tmpl::list<hydro::Tags::LorentzFactor<DataVector>> /*meta*/)
     112             :       const -> tuples::TaggedTuple<hydro::Tags::LorentzFactor<DataVector>>;
     113             : 
     114           1 :   auto variables(
     115             :       const tnsr::I<DataVector, 3>& x, double t,
     116             :       tmpl::list<hydro::Tags::SpatialVelocity<DataVector, 3>> /*meta*/) const
     117             :       -> tuples::TaggedTuple<hydro::Tags::SpatialVelocity<DataVector, 3>>;
     118             :   /// @}
     119             : 
     120             :   /// Retrieve a collection of fluid and neutrino variables at `(x, t)`
     121             :   template <typename... Tags>
     122           1 :   tuples::TaggedTuple<Tags...> variables(const tnsr::I<DataVector, 3>& x,
     123             :                                          double t,
     124             :                                          tmpl::list<Tags...> /*meta*/) const {
     125             :     static_assert(sizeof...(Tags) > 1,
     126             :                   "The generic template will recurse infinitely if only one "
     127             :                   "tag is being retrieved.");
     128             :     return {get<Tags>(variables(x, t, tmpl::list<Tags>{}))...};
     129             :   }
     130             : 
     131             :   /// Retrieve the metric variables
     132             :   template <typename Tag>
     133           1 :   tuples::TaggedTuple<Tag> variables(const tnsr::I<DataVector, 3>& x, double t,
     134             :                                      tmpl::list<Tag> /*meta*/) const {
     135             :     return background_spacetime_.variables(x, t, tmpl::list<Tag>{});
     136             :   }
     137             : 
     138             :   // clang-tidy: no runtime references
     139           0 :   void pup(PUP::er& /*p*/);  //  NOLINT
     140             : 
     141             :  private:
     142           0 :   friend bool operator==(const ConstantM1& lhs, const ConstantM1& rhs);
     143             : 
     144           0 :   std::array<double, 3> mean_velocity_{
     145             :       {std::numeric_limits<double>::signaling_NaN(),
     146             :        std::numeric_limits<double>::signaling_NaN(),
     147             :        std::numeric_limits<double>::signaling_NaN()}};
     148           0 :   double comoving_energy_density_ =
     149             :       std::numeric_limits<double>::signaling_NaN();
     150           0 :   gr::Solutions::Minkowski<3> background_spacetime_{};
     151             : };
     152             : 
     153           0 : bool operator!=(const ConstantM1& lhs, const ConstantM1& rhs);
     154             : }  // namespace Solutions
     155             : }  // namespace M1Grey
     156             : }  // namespace RadiationTransport

Generated by: LCOV version 1.14