ConstantM1.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <array>
7 #include <limits>
8 #include <pup.h>
9
11 #include "Evolution/Systems/RadiationTransport/M1Grey/Tags.hpp" // IWYU pragma: keep
12 #include "Options/Options.hpp"
13 #include "PointwiseFunctions/AnalyticSolutions/GeneralRelativity/Minkowski.hpp"
14 #include "PointwiseFunctions/Hydro/Tags.hpp" // IWYU pragma: keep
15 #include "Utilities/MakeArray.hpp" // IWYU pragma: keep
16 #include "Utilities/TMPL.hpp"
18
19 // IWYU pragma: no_forward_declare Tensor
20
21 /// \cond
22 class DataVector;
23 /// \endcond
24
26 namespace M1Grey {
27 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 class ConstantM1 {
40  public:
42
43  /// The mean flow velocity.
44  struct MeanVelocity {
46  static constexpr OptionString help = {"The mean flow velocity."};
47  };
48
49  /// The radiation comoving energy density
51  using type = double;
52  static constexpr OptionString help = {
53  "Comoving energy density of radiation."};
54  };
55
56  using options = tmpl::list<MeanVelocity, ComovingEnergyDensity>;
57  static constexpr OptionString help = {
58  "Constant radiation field in equilibrium with fluid, in Minkowski "
59  "spacetime."};
60
61  ConstantM1() = default;
62  ConstantM1(const ConstantM1& /*rhs*/) = delete;
63  ConstantM1& operator=(const ConstantM1& /*rhs*/) = delete;
64  ConstantM1(ConstantM1&& /*rhs*/) noexcept = default;
65  ConstantM1& operator=(ConstantM1&& /*rhs*/) noexcept = default;
66  ~ConstantM1() = default;
67
68  ConstantM1(MeanVelocity::type mean_velocity,
69  ComovingEnergyDensity::type comoving_energy_density) noexcept;
70
71  explicit ConstantM1(CkMigrateMessage* /*unused*/) noexcept {}
72
73  // @{
74  /// Retrieve M1 variables at (x, t)
75  template <typename NeutrinoSpecies>
76  auto variables(const tnsr::I<DataVector, 3>& x, double t,
78  Frame::Inertial, NeutrinoSpecies>> /*meta*/) const noexcept
80  Frame::Inertial, NeutrinoSpecies>>;
81
82  template <typename NeutrinoSpecies>
83  auto variables(const tnsr::I<DataVector, 3>& x, double t,
85  Frame::Inertial, NeutrinoSpecies>> /*meta*/) const noexcept
87  Frame::Inertial, NeutrinoSpecies>>;
88  // @}
89
90  // @{
91  /// Retrieve hydro variable at (x, t)
92  auto variables(
93  const tnsr::I<DataVector, 3>& x, double t,
94  tmpl::list<hydro::Tags::LorentzFactor<DataVector>> /*meta*/) const
96
97  auto variables(const tnsr::I<DataVector, 3>& x, double t,
99  DataVector, 3, Frame::Inertial>> /*meta*/) const noexcept
102  // @}
103
104  /// Retrieve a collection of hydro and/or M1 variables at (x, t)
105  template <typename... Tags>
106  tuples::TaggedTuple<Tags...> variables(const tnsr::I<DataVector, 3>& x,
107  double t,
108  tmpl::list<Tags...> /*meta*/) const
109  noexcept {
110  static_assert(sizeof...(Tags) > 1,
111  "The generic template will recurse infinitely if only one "
112  "tag is being retrieved.");
113  return {get<Tags>(variables(x, t, tmpl::list<Tags>{}))...};
114  }
115
116  /// Retrieve the metric variables
117  template <typename Tag>
118  tuples::TaggedTuple<Tag> variables(const tnsr::I<DataVector, 3>& x, double t,
119  tmpl::list<Tag> /*meta*/) const noexcept {
120  return background_spacetime_.variables(x, t, tmpl::list<Tag>{});
121  }
122
123  // clang-tidy: no runtime references
124  void pup(PUP::er& /*p*/) noexcept; // NOLINT
125
126  private:
127  friend bool operator==(const ConstantM1& lhs, const ConstantM1& rhs) noexcept;
128
129  MeanVelocity::type mean_velocity_ =
131  ComovingEnergyDensity::type comoving_energy_density_ =
133  gr::Solutions::Minkowski<3> background_spacetime_{};
134 };
135
136 bool operator!=(const ConstantM1& lhs, const ConstantM1& rhs) noexcept;
137 } // namespace Solutions
138 } // namespace M1Grey
The mean flow velocity.
Definition: ConstantM1.hpp:44
Defines class tuples::TaggedTuple.
The spatial velocity of the fluid, where . Here is the spatial part of the 4-velocity of the fluid...
Definition: Tags.hpp:156
T signaling_NaN(T... args)
Defines function make_array.
Items related to general relativistic radiation transport.
Definition: Fluxes.cpp:16
auto variables(const tnsr::I< DataVector, 3 > &x, double t, tmpl::list< RadiationTransport::M1Grey::Tags::TildeE< Frame::Inertial, NeutrinoSpecies >>) const noexcept -> tuples::TaggedTuple< RadiationTransport::M1Grey::Tags::TildeE< Frame::Inertial, NeutrinoSpecies >>
Retrieve M1 variables at (x, t)
Defines classes and functions for making classes creatable from input files.
Constant solution to M1 equations in Minkowski spacetime.
Definition: ConstantM1.hpp:39
tuples::TaggedTuple< Tags... > variables(const tnsr::I< DataVector, 3 > &x, double t, tmpl::list< Tags... >) const noexcept
Retrieve a collection of hydro and/or M1 variables at (x, t)
Definition: ConstantM1.hpp:106
Definition: ConstantM1.hpp:50
The densitized energy density of neutrinos of a given species .
Definition: Tags.hpp:26
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:29
tuples::TaggedTuple< Tag > variables(const tnsr::I< DataVector, 3 > &x, double t, tmpl::list< Tag >) const noexcept
Retrieve the metric variables.
Definition: ConstantM1.hpp:118
The densitized momentum density of neutrinos of a given species .
Definition: Tags.hpp:36
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
The Lorentz factor , where is the spatial velocity of the fluid.
Definition: Tags.hpp:68
Definition: DataBoxTag.hpp:29
Defines a list of useful type aliases for tensors.
Stores a collection of function values.
Definition: DataVector.hpp:42
Wraps the template metaprogramming library used (brigand)
Definition: IndexType.hpp:44