DarkEnergyFluid.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <boost/preprocessor/arithmetic/dec.hpp>
7 #include <boost/preprocessor/arithmetic/inc.hpp>
8 #include <boost/preprocessor/control/expr_iif.hpp>
9 #include <boost/preprocessor/list/adt.hpp>
10 #include <boost/preprocessor/repetition/for.hpp>
11 #include <boost/preprocessor/repetition/repeat.hpp>
12 #include <boost/preprocessor/tuple/to_list.hpp>
13 #include <limits>
14 #include <pup.h>
15 
17 #include "Options/Options.hpp"
19 #include "PointwiseFunctions/Hydro/EquationsOfState/EquationOfState.hpp" // IWYU pragma: keep
20 #include "Utilities/TMPL.hpp"
21 
22 /// \cond
23 class DataVector;
24 /// \endcond
25 
26 namespace EquationsOfState {
27 /*!
28  * \ingroup EquationsOfStateGroup
29  * \brief Equation of state for a dark energy fluid
30  *
31  * A dark energy fluid equation of state:
32  * \f[
33  * p = w(z) \rho ( 1.0 + \epsilon)
34  * \f]
35  * where \f$\rho\f$ is the rest mass density, \f$\epsilon\f$ is the specific
36  * internal energy, and \f$w(z) > 0\f$ is a parameter depending on the redshift
37  * \f$z\f$.
38  */
39 template <bool IsRelativistic>
40 class DarkEnergyFluid : public EquationOfState<IsRelativistic, 2> {
41  public:
42  static_assert(IsRelativistic,
43  "Dark energy fluid equation of state only makes sense in a "
44  "relativistic setting.");
45 
46  struct ParameterW {
47  using type = double;
48  static constexpr OptionString help = {"Parameter w(z)"};
49  };
50 
51  static constexpr OptionString help = {
52  "A dark energy fluid equation of state.\n"
53  "The pressure is related to the rest mass density by "
54  "p = w(z) * rho * (1 + epsilon), where p is the pressure, rho is the "
55  "rest mass density, epsilon is the specific internal energy, and w(z) is "
56  "a parameter."};
57 
58  using options = tmpl::list<ParameterW>;
59 
60  DarkEnergyFluid() = default;
61  DarkEnergyFluid(const DarkEnergyFluid&) = default;
62  DarkEnergyFluid& operator=(const DarkEnergyFluid&) = default;
63  DarkEnergyFluid(DarkEnergyFluid&&) = default;
64  DarkEnergyFluid& operator=(DarkEnergyFluid&&) = default;
65  ~DarkEnergyFluid() override = default;
66 
67  explicit DarkEnergyFluid(double parameter_w) noexcept;
68 
70 
73 
74  private:
75  EQUATION_OF_STATE_FORWARD_DECLARE_MEMBER_IMPLS(2)
76 
77  double parameter_w_ = std::numeric_limits<double>::signaling_NaN();
78 };
79 
80 /// \cond
81 template <bool IsRelativistic>
83  0;
84 /// \endcond
85 } // namespace EquationsOfState
Base class for equations of state which need two independent thermodynamic variables in order to dete...
Definition: EquationOfState.hpp:171
Base class for equations of state depending on whether or not the system is relativistic, and the number of independent thermodynamic variables (ThermodynamicDim) needed to determine the pressure.
Definition: EquationOfState.hpp:63
T signaling_NaN(T... args)
Defines classes and functions for making classes creatable from input files.
Contains all equations of state, including base class.
Definition: DarkEnergyFluid.hpp:26
Defines macros to allow serialization of abstract template base classes.
Equation of state for a dark energy fluid.
Definition: DarkEnergyFluid.hpp:40
const char *const OptionString
The string used in option structs.
Definition: Options.hpp:26
#define WRAPPED_PUPable_decl_base_template(baseClassName, className)
Mark derived template classes as serializable.
Definition: CharmPupable.hpp:32
Defines a list of useful type aliases for tensors.
Stores a collection of function values.
Definition: DataVector.hpp:46
Wraps the template metaprogramming library used (brigand)
Definition: DarkEnergyFluid.hpp:46
#define EQUATION_OF_STATE_FORWARD_DECLARE_MEMBERS(DERIVED, DIM)
Macro used to generate forward declarations of member functions in derived classes.
Definition: EquationOfState.hpp:313