SPH
Eos.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 #include "common/ForwardDecl.h"
9 #include "common/Globals.h"
12 
14 
16 class IEos : public Polymorphic {
17 public:
19  virtual Pair<Float> evaluate(const Float rho, const Float u) const = 0;
20 
22  virtual Float getInternalEnergy(const Float rho, const Float p) const = 0;
23 
25  virtual Float getDensity(const Float p, const Float u) const = 0;
26 };
27 
28 
30 class IdealGasEos : public IEos {
31 private:
32  Float gamma;
33 
34 public:
35  explicit IdealGasEos(const Float gamma);
36 
37  virtual Pair<Float> evaluate(const Float rho, const Float u) const override;
38 
39  virtual Float getInternalEnergy(const Float rho, const Float p) const override;
40 
41  virtual Float getDensity(const Float p, const Float u) const override;
42 
43  Float getTemperature(const Float u) const;
44 
45  Float getSpecificEntropy(const Float rho, const Float p) const;
46 };
47 
52 class TaitEos : public IEos {
53 private:
54  Float c0;
55  Float rho0;
56  Float gamma;
57 
58 public:
59  explicit TaitEos(const BodySettings& settings);
60 
61  virtual Pair<Float> evaluate(const Float rho, const Float u) const override;
62 
63  virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override {
65  }
66 
67  virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override {
69  }
70 };
71 
77 class MieGruneisenEos : public IEos {
78 private:
79  Float c0;
80  Float rho0;
81  Float Gamma;
82  Float s;
83 
84 public:
85  explicit MieGruneisenEos(const BodySettings& settings);
86 
87  virtual Pair<Float> evaluate(const Float rho, const Float u) const override;
88 
89  virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override {
91  }
92 
93  virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override {
95  }
96 };
97 
109 class TillotsonEos : public IEos {
110 private:
111  Float u0;
112  Float uiv;
113  Float ucv;
114  Float a;
115  Float b;
116  Float rho0;
117  Float A;
118  Float B;
119  Float alpha;
120  Float beta;
121 
122 public:
123  explicit TillotsonEos(const BodySettings& settings);
124 
125  virtual Pair<Float> evaluate(const Float rho, const Float u) const override;
126 
127  virtual Float getInternalEnergy(const Float rho, const Float p) const override;
128 
130  virtual Float getDensity(const Float p, const Float u) const override;
131 };
132 
136 class SimplifiedTillotsonEos : public IEos {
137 private:
138  Float rho0;
139  Float A;
140  Float c;
141 
142 public:
143  explicit SimplifiedTillotsonEos(const BodySettings& settings);
144 
145  virtual Pair<Float> evaluate(const Float rho, const Float u) const override;
146 
148  virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override {
150  }
151 
153  virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override {
155  }
156 };
157 
161 class MurnaghanEos : public IEos {
162 private:
163  Float rho0;
164  Float A;
165 
166 public:
167  explicit MurnaghanEos(const BodySettings& settings);
168 
169  virtual Pair<Float> evaluate(const Float rho, const Float u) const override;
170 
172  virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override {
174  }
175 
177  virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override {
179  }
180 };
181 
183 class Aneos : public IEos {
184 private:
185 public:
186  explicit Aneos(const BodySettings& settings);
187 
188  virtual Pair<Float> evaluate(const Float rho, const Float u) const override;
189 
191  virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override {
193  }
194 
196  virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override {
198  }
199 };
200 
201 
Generic dynamically allocated resizable storage.
#define NOT_IMPLEMENTED
Helper macro marking missing implementation.
Definition: Assert.h:100
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
Global parameters of the code.
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Definition: Globals.h:13
#define UNUSED(x)
Definition: Object.h:37
#define NAMESPACE_SPH_END
Definition: Object.h:12
ANEOS equation defined by a look-up table.
Definition: Eos.h:183
virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override
Currently not implemented.
Definition: Eos.h:196
virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override
Currently not implemented.
Definition: Eos.h:191
Aneos(const BodySettings &settings)
Definition: Eos.cpp:208
virtual Pair< Float > evaluate(const Float rho, const Float u) const override
Computes pressure and local sound speed from given density rho and specific internal energy u.
Definition: Eos.cpp:212
Base class for equations of state.
Definition: Eos.h:16
virtual Float getInternalEnergy(const Float rho, const Float p) const =0
Inverted function; computes specific internal energy u from given density rho and pressure p.
virtual Float getDensity(const Float p, const Float u) const =0
Inverted function; computes density from pressure p and internal energy u.
virtual Pair< Float > evaluate(const Float rho, const Float u) const =0
Computes pressure and local sound speed from given density rho and specific internal energy u.
Equation of state for ideal gas.
Definition: Eos.h:30
Float getTemperature(const Float u) const
Definition: Eos.cpp:28
virtual Float getDensity(const Float p, const Float u) const override
Inverted function; computes density from pressure p and internal energy u.
Definition: Eos.cpp:24
Float getSpecificEntropy(const Float rho, const Float p) const
Definition: Eos.cpp:32
virtual Pair< Float > evaluate(const Float rho, const Float u) const override
Computes pressure and local sound speed from given density rho and specific internal energy u.
Definition: Eos.cpp:15
IdealGasEos(const Float gamma)
Definition: Eos.cpp:12
virtual Float getInternalEnergy(const Float rho, const Float p) const override
Inverted function; computes specific internal energy u from given density rho and pressure p.
Definition: Eos.cpp:20
Mie-Gruneisen equation of state.
Definition: Eos.h:77
virtual Pair< Float > evaluate(const Float rho, const Float u) const override
Computes pressure and local sound speed from given density rho and specific internal energy u.
Definition: Eos.cpp:62
MieGruneisenEos(const BodySettings &settings)
Definition: Eos.cpp:55
virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override
Definition: Eos.h:89
virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override
Definition: Eos.h:93
Murnaghan equation of state.
Definition: Eos.h:161
virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override
Currently not implemented.
Definition: Eos.h:177
virtual Pair< Float > evaluate(const Float rho, const Float u) const override
Computes pressure and local sound speed from given density rho and specific internal energy u.
Definition: Eos.cpp:198
virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override
Currently not implemented.
Definition: Eos.h:172
MurnaghanEos(const BodySettings &settings)
Definition: Eos.cpp:194
Simplified Tillotsons equation of state, valid for small pressures and energies.
Definition: Eos.h:136
virtual Pair< Float > evaluate(const Float rho, const Float u) const override
Computes pressure and local sound speed from given density rho and specific internal energy u.
Definition: Eos.cpp:183
virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override
Currently not implemented.
Definition: Eos.h:148
SimplifiedTillotsonEos(const BodySettings &settings)
Definition: Eos.cpp:175
virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override
Currently not implemented.
Definition: Eos.h:153
Array with fixed number of allocated elements.
Definition: StaticArray.h:19
Tait equation of state.
Definition: Eos.h:52
virtual Pair< Float > evaluate(const Float rho, const Float u) const override
Computes pressure and local sound speed from given density rho and specific internal energy u.
Definition: Eos.cpp:46
TaitEos(const BodySettings &settings)
Definition: Eos.cpp:40
virtual Float getDensity(const Float UNUSED(p), const Float UNUSED(u)) const override
Definition: Eos.h:67
virtual Float getInternalEnergy(const Float UNUSED(rho), const Float UNUSED(p)) const override
Definition: Eos.h:63
Tillotson equation of state .
Definition: Eos.h:109
virtual Float getInternalEnergy(const Float rho, const Float p) const override
Inverted function; computes specific internal energy u from given density rho and pressure p.
Definition: Eos.cpp:130
virtual Float getDensity(const Float p, const Float u) const override
Definition: Eos.cpp:158
virtual Pair< Float > evaluate(const Float rho, const Float u) const override
Computes pressure and local sound speed from given density rho and specific internal energy u.
Definition: Eos.cpp:87
TillotsonEos(const BodySettings &settings)
Definition: Eos.cpp:75
Base class for all polymorphic objects.
Definition: Object.h:88