IdealFluid.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 an ideal fluid
30  *
31  * An ideal fluid equation of state:
32  * \f[
33  * p = \rho \epsilon(\gamma-1)
34  * \f]
35  * where \f$\rho\f$ is the rest mass density, \f$\epsilon\f$ is the specific
36  * internal energy, and \f$\gamma\f$ is the adiabatic index.
37  */
38 template <bool IsRelativistic>
39 class IdealFluid : public EquationOfState<IsRelativistic, 2> {
40  public:
41  struct AdiabaticIndex {
42  using type = double;
43  static constexpr OptionString help = {"Adiabatic index gamma"};
44  };
45 
46  static constexpr OptionString help = {
47  "An ideal fluid equation of state.\n"
48  "The pressure is related to the rest mass density by p = rho * epsilon * "
49  "(gamma - 1), where p is the pressure, rho is the rest mass density, "
50  "epsilon is the specific internal energy, and gamma is the adiabatic "
51  "index."};
52 
53  using options = tmpl::list<AdiabaticIndex>;
54 
55  IdealFluid() = default;
56  IdealFluid(const IdealFluid&) = default;
57  IdealFluid& operator=(const IdealFluid&) = default;
58  IdealFluid(IdealFluid&&) = default;
59  IdealFluid& operator=(IdealFluid&&) = default;
60  ~IdealFluid() override = default;
61 
62  explicit IdealFluid(double adiabatic_index) noexcept;
63 
65 
68 
69  private:
70  EQUATION_OF_STATE_FORWARD_DECLARE_MEMBER_IMPLS(2)
71 
72  double adiabatic_index_ = std::numeric_limits<double>::signaling_NaN();
73 };
74 
75 /// \cond
76 template <bool IsRelativistic>
78 /// \endcond
79 } // 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.
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
Equation of state for an ideal fluid.
Definition: IdealFluid.hpp:39
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)
#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