PolytropicFluid.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 // IWYU pragma: no_forward_declare Tensor
27 
28 namespace EquationsOfState {
29 /*!
30  * \ingroup EquationsOfStateGroup
31  * \brief Equation of state for a polytropic fluid
32  *
33  * A polytropic equation of state \f$p=K\rho^{\Gamma}\f$ where \f$K\f$ is the
34  * polytropic constant and \f$\Gamma\f$ is the polytropic exponent. The
35  * polytropic exponent is related to the polytropic index \f$N_p\f$ by
36  * \f$N_p=1/(\Gamma-1)\f$.
37  */
38 template <bool IsRelativistic>
39 class PolytropicFluid : public EquationOfState<IsRelativistic, 1> {
40  public:
42  using type = double;
43  static constexpr OptionString help = {"Polytropic constant K"};
44  static double lower_bound() noexcept { return 0.0; }
45  };
46 
48  using type = double;
49  static constexpr OptionString help = {"Polytropic exponent Gamma"};
50  static double lower_bound() noexcept { return 1.0; }
51  };
52 
53  static constexpr OptionString help = {
54  "A polytropic fluid equation of state.\n"
55  "The pressure is related to the rest mass density by p = K rho ^ Gamma, "
56  "where p is the pressure, rho is the rest mass density, K is the "
57  "polytropic constant, and Gamma is the polytropic exponent. The "
58  "polytropic index N is defined as Gamma = 1 + 1 / N."};
59 
60  using options = tmpl::list<PolytropicConstant, PolytropicExponent>;
61 
62  PolytropicFluid() = default;
63  PolytropicFluid(const PolytropicFluid&) = default;
64  PolytropicFluid& operator=(const PolytropicFluid&) = default;
65  PolytropicFluid(PolytropicFluid&&) = default;
66  PolytropicFluid& operator=(PolytropicFluid&&) = default;
67  ~PolytropicFluid() override = default;
68 
69  PolytropicFluid(double polytropic_constant,
70  double polytropic_exponent) noexcept;
71 
73 
76 
77  private:
78  EQUATION_OF_STATE_FORWARD_DECLARE_MEMBER_IMPLS(1)
79 
80  double polytropic_constant_ = std::numeric_limits<double>::signaling_NaN();
81  double polytropic_exponent_ = std::numeric_limits<double>::signaling_NaN();
82 };
83 
84 /// \cond
85 template <bool IsRelativistic>
87  0;
88 /// \endcond
89 } // namespace EquationsOfState
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
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)
Base class for equations of state which need one thermodynamic variable in order to determine the pre...
Definition: EquationOfState.hpp:74
Equation of state for a polytropic fluid.
Definition: PolytropicFluid.hpp:39
#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