PlasCom2  1.0
XPACC Multi-physics simluation application
EOS.H
Go to the documentation of this file.
1 #ifndef __EOS_H__
2 #define __EOS_H__
3 
4 #include "PCPPTypes.H"
5 
6 
7 namespace eos {
9 
17  class eos {
18 
19  public:
20  eos(){Initialize();};
21 
22  void Initialize() {
23  densityPtr = NULL;
24  momentumPtr = NULL;
25  internalEnergyPtr = NULL;
26  pressurePtr = NULL;
27  temperaturePtr = NULL;
28  specificVolumePtr = NULL;
29 
30  xStart = 0;
31  xEnd = 0;
32  xSize = 0;
33  yStart = 0;
34  yEnd = 0;
35  ySize = 0;
36  zStart = 0;
37  zEnd = 0;
38  zSize = 0;
39  };
40 
44  virtual int InitializeMaterialProperties() = 0;
45 
49  int ComputePressureBuffer(const pcpp::IndexIntervalType &regionInterval,
50  const std::vector<size_t> &bufferSizes);
51 
55  int ComputeTemperatureBuffer(const pcpp::IndexIntervalType &regionInterval,
56  const std::vector<size_t> &bufferSizes);
57 
61  virtual void ComputePressure(size_t index) = 0;
62 
66  virtual void ComputeTemperature(size_t index) = 0;
67 
68  // setup the buffers
69  void SetupPressureBuffer(double *const inPtr) {pressurePtr = inPtr;};
70  void SetupTemperatureBuffer(double *const inPtr) {temperaturePtr = inPtr;};
71  void SetupSpecificVolumeBuffer(double *const inPtr) {specificVolumePtr = inPtr;};
72  void SetupDensityBuffer(double *const inPtr) {densityPtr = inPtr;};
73  void SetupInternalEnergyBuffer(double *const inPtr) {internalEnergyPtr = inPtr;};
74 
75  // virtual functions dealing with material properties
76  virtual double GetSpecificGasConstant() = 0;
77  virtual double GetHeatCapacityCv() = 0;
78  virtual double GetHeatCapacityCp() = 0;
79  virtual double GetGamma() = 0;
80 
81  virtual void SetSpecificGasConstant(const double &inValue) = 0;
82  virtual void SetGamma(const double &inValue) = 0;
83 
84  protected:
85  int numDim;
86  // pointers to buffer indicies
87  double *densityPtr;
88  double *momentumPtr;
90  double *totalEnergyPtr;
91  double *pressurePtr;
92  double *temperaturePtr;
94 
95  // indicies for accessing the buffers
96  size_t xStart;
97  size_t xEnd;
98  size_t xSize;
99  size_t yStart;
100  size_t yEnd;
101  size_t ySize;
102  size_t zStart;
103  size_t zEnd;
104  size_t zSize;
106 
107  // function pointers to avoid virtual lookup
108  // MJA, is this really a performance bottleneck?
109  //void (*ComputePressurePtr)(size_t);
110  //void (*ComputeTemperaturePtr)(size_t);
111 
112 
113  };
114 
124  class perfect_gas : public eos {
125 
126  public:
128  {
129  gammaPtr = NULL;
130  specificGasConstantPtr = NULL;
131 
132  //ComputePressurePtr = &perfect_gas::ComputePressure;
133  //ComputeTemperaturePtr = &perfect_gas::ComputeTemperature;
134  };
135 
137  {
138  delete gammaPtr;
139  delete specificGasConstantPtr;
140 
141  gammaPtr=NULL;
143  }
144 
146 
147  // check that the required material properties are set (gamma, specificGasConst)
149  return 1;
150 
151  gamma = *gammaPtr;
153 
154  gammaMinus1 = gamma-1;
158 
159  return 0;
160  };
161 
163  inline double GetHeatCapacityCv(){return heatCapacityCv;};
164  inline double GetHeatCapacityCp(){return heatCapacityCp;};
165  inline double GetGamma(){return *gammaPtr;};
166 
167  void SetSpecificGasConstant(const double &inValue){
169  specificGasConstantPtr = new double;
170  }
171  *specificGasConstantPtr = inValue;
172  };
173 
174  void SetGamma(const double &inValue){
175  if(!gammaPtr){
176  gammaPtr = new double;
177  }
178  *gammaPtr = inValue;
179  };
180 
181  inline void ComputePressure(size_t index){
182  pressurePtr[index] = gammaMinus1*(internalEnergyPtr[index]);
183  }
184 
185  inline void ComputeTemperature(size_t index){
187  }
188 
189 
190  private:
191 
192  // required data, pointers to track declaration
194  double *gammaPtr;
195 
196  // actual data used in computation
197  double gamma;
199  double gammaMinus1;
200  double inverseCv;
203 
204  }; // class perfect_gas
205 } // namespace eos
206 
207 #endif
208 
209 
GASMODELS
Definition: EOS.H:8
size_t xEnd
Definition: EOS.H:97
double GetHeatCapacityCp()
Definition: EOS.H:164
double gammaMinus1
Definition: EOS.H:199
eos()
Definition: EOS.H:20
double inverseCv
Definition: EOS.H:200
double * pressurePtr
Definition: EOS.H:91
double * specificGasConstantPtr
Definition: EOS.H:193
double GetSpecificGasConstant()
Definition: EOS.H:162
double specificGasConstant
Definition: EOS.H:198
double * totalEnergyPtr
Definition: EOS.H:90
double * gammaPtr
Definition: EOS.H:194
double heatCapacityCv
Definition: EOS.H:201
~perfect_gas()
Definition: EOS.H:136
void SetupPressureBuffer(double *const inPtr)
Definition: EOS.H:69
size_t yEnd
Definition: EOS.H:100
double * temperaturePtr
Definition: EOS.H:92
size_t zEnd
Definition: EOS.H:103
void SetGamma(const double &inValue)
Definition: EOS.H:174
void SetSpecificGasConstant(const double &inValue)
Definition: EOS.H:167
double * densityPtr
Definition: EOS.H:87
double heatCapacityCp
Definition: EOS.H:202
void SetupInternalEnergyBuffer(double *const inPtr)
Definition: EOS.H:73
double GetHeatCapacityCv()
Definition: EOS.H:163
void SetupTemperatureBuffer(double *const inPtr)
Definition: EOS.H:70
double * internalEnergyPtr
Definition: EOS.H:89
Definition: EOS.H:8
size_t numPointsBuffer
Definition: EOS.H:105
void ComputeTemperature(size_t index)
Compute temperature at a single buffer index.
Definition: EOS.H:185
int numDim
Definition: EOS.H:85
Definition: EOS.H:7
size_t ySize
Definition: EOS.H:101
void SetupSpecificVolumeBuffer(double *const inPtr)
Definition: EOS.H:71
void ComputePressure(size_t index)
Compute pressure at a single buffer index.
Definition: EOS.H:181
void SetupDensityBuffer(double *const inPtr)
Definition: EOS.H:72
double GetGamma()
Definition: EOS.H:165
size_t xSize
Definition: EOS.H:98
int InitializeMaterialProperties()
Derive material properties from a minimum required set.
Definition: EOS.H:145
void const size_t const size_t * bufferSizes
Definition: MetricKernels.H:19
size_t yStart
Definition: EOS.H:99
Perfect Gas Equation of State.
Definition: EOS.H:124
double * momentumPtr
Definition: EOS.H:88
size_t xStart
Definition: EOS.H:96
int Initialize(base &stencilSet, int interiorOrder)
Initialize the sbp::base stencilset with the SBP operator of given order.
Definition: Stencil.C:360
double gamma
Definition: EOS.H:197
Simple Block Structured Mesh object.
Definition: IndexUtil.H:21
size_t zStart
Definition: EOS.H:102
double * specificVolumePtr
Definition: EOS.H:93
size_t zSize
Definition: EOS.H:104
void Initialize()
Definition: EOS.H:22