CoolProp  4.2.5
An open-source fluid property and humid air property database
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
IncompBase.h
Go to the documentation of this file.
1 
2 #ifndef INCOMPRESSIBLE_BASE_H
3 #define INCOMPRESSIBLE_BASE_H
4 
5 #include <string>
6 #include <vector>
7 #include <math.h>
8 #include "FluidClass.h"
9 #include "GlobalConstants.h"
10 #include "CPExceptions.h"
11 #include "CoolPropTools.h"
12 #include "MatrixMath.h"
13 
14 
17 
18 protected:
19  std::string name;
20  std::string description;
21  std::string reference;
22  double Tmin;
23  double TminPsat;
24  double Tmax;
25  double Tref;
26 
27  bool DEBUG;
28 
29 public:
30  std::string getDescription() const {return description;}
31  std::string getName() const {return name;}
32  // For backwards-compatibility.
33  std::string get_name() const {return getName();}
34  std::string getReference() const {return reference;}
35  double getTmax() const {return Tmax;}
36  double getTmin() const {return Tmin;}
37  double getTminPsat() const {return TminPsat;}
38  double getTref() const {return Tref;}
39 
40  void setDebug(bool debug) {this->DEBUG = debug;}
41 
42 public:
43  // Constructor
45  name = "";
46  description = "";
47  reference = "";
48  Tmin = -1.;
49  Tmax = -1.;
50  TminPsat = -1.;
51  Tref = 273.15 + 25. ;
52  DEBUG = false;
53  };
54 
55  // Destructor. No implementation
56  virtual ~IncompressibleClass(){};
57 
58 
59 protected:
61 
63  bool checkCoefficients(std::vector<double> const& coefficients, unsigned int n);
64  bool checkCoefficients(std::vector< std::vector<double> > const& coefficients, unsigned int rows, unsigned int columns);
65 
66 private:
76 
80  DEPRECATED(double simplePolynomial(std::vector<double> const& coefficients, double T));
81  DEPRECATED(double simplePolynomial(std::vector<std::vector<double> > const& coefficients, double x, double T));
82 
84 
87  double simplePolynomialInt(std::vector<double> const& coefficients, double T);
90  double simplePolynomialInt(std::vector<double> const& coefficients, double T1, double T0);
92  double simplePolynomialInt(std::vector<std::vector<double> > const& coefficients, double x, double T);
94  double simplePolynomialInt(std::vector<std::vector<double> > const& coefficients, double x, double T1, double T0);
95 
97 
100  double simpleFracInt(std::vector<double> const& coefficients, double T);
103  double simpleFracInt(std::vector<double> const& coefficients, double T1, double T0);
105  double simpleFracInt(std::vector<std::vector<double> > const& coefficients, double x, double T);
107  double simpleFracInt(std::vector<std::vector<double> > const& coefficients, double x, double T1, double T0);
108 
109 
117  double factorial(double nValue);
119  double binom(double nValue, double nValue2);
120  std::vector<double> fracIntCentralDvector(int m, double T, double Tbase);
121  std::vector<double> fracIntCentralDvector(int m, double T1, double T0, double Tbase);
123  double fracIntCentral(std::vector<double> const& coefficients, double T, double Tbase);
125  double fracIntCentral(std::vector<double> const& coefficients, double T1, double T0, double Tbase);
126 
127 
129 
133  double baseHorner(std::vector<double> const& coefficients, double T);
134  double baseHorner(std::vector< std::vector<double> > const& coefficients, double x, double T);
136  double baseHornerInt(std::vector<double> const& coefficients, double T);
138  double baseHornerInt(std::vector<double> const& coefficients, double T1, double T0);
140  double baseHornerInt(std::vector<std::vector<double> > const& coefficients, double x, double T);
142  double baseHornerInt(std::vector<std::vector<double> > const& coefficients, double x, double T1, double T0);
144  double baseHornerFra(std::vector<double> const& coefficients, double T);
146  double baseHornerFra(std::vector<double> const& coefficients, double T1, double T0);
148  double baseHornerFra(std::vector<std::vector<double> > const& coefficients, double x, double T);
150  double baseHornerFra(std::vector<std::vector<double> > const& coefficients, double x, double T1, double T0);
151 
152 
161  std::vector<double> integrateCoeffs(std::vector<double> const& coefficients);
162  std::vector< std::vector<double> > integrateCoeffs(std::vector< std::vector<double> > const& coefficients, bool axis);
163 
170  DEPRECATED(std::vector<double> deriveCoeffs(std::vector<double> const& coefficients));
171  DEPRECATED(std::vector< std::vector<double> > deriveCoeffs(std::vector< std::vector<double> > const& coefficients, unsigned int axis));
172 
178  double integrateIn2Steps(std::vector<double> const& coefficients, double T);
181  double integrateIn2Steps(std::vector<double> const& coefficients, double T1, double T0);
183  double integrateIn2Steps(std::vector< std::vector<double> > const& coefficients, double x, double T, bool axis);
185  double integrateIn2Steps(std::vector< std::vector<double> > const& coefficients, double x, double T1, double T0);
187  double fracIntIn2Steps(std::vector<double> const& coefficients, double T);
189  double fracIntIn2Steps(std::vector<double> const& coefficients, double T1, double T0);
191  double fracIntIn2Steps(std::vector<std::vector<double> > const& coefficients, double x, double T);
193  double fracIntIn2Steps(std::vector<std::vector<double> > const& coefficients, double x, double T1, double T0);
195  double fracIntCentral2Steps(std::vector<std::vector<double> > const& coefficients, double x, double T, double Tbase);
197  double fracIntCentral2Steps(std::vector<std::vector<double> > const& coefficients, double x, double T1, double T0, double Tbase);
198 
199 public:
207  double polyval(std::vector<double> const& coefficients, double x){
211  //return simplePolynomial(coefficients,x);
212  return baseHorner(coefficients,x);
213  }
214 
219  double polyval(std::vector< std::vector<double> > const& coefficients, double x, double y){
220  //return simplePolynomial(coefficients,x,y);
221  return baseHorner(coefficients,x,y);
222  }
223 
227  double polyint(std::vector<double> const& coefficients, double T){
228  //return simplePolynomialInt(coefficients,T);
229  return baseHornerInt(coefficients,T);
230  //return integrateIn2Steps(coefficients,T);
231  }
232 
237  double polyint(std::vector<double> const& coefficients, double T1, double T0){
238  //return simplePolynomialInt(coefficients,T1,T0);
239  return baseHornerInt(coefficients,T1,T0);
240  //return integrateIn2Steps(coefficients,T1,T0);
241  }
242 
247  double polyint(std::vector< std::vector<double> > const& coefficients, double x, double T){
248  //return simplePolynomialInt(coefficients,x,T);
249  return baseHornerInt(coefficients,x,T);
250  //return integrateIn2Steps(coefficients,x,T,false);
251  }
252 
258  double polyint(std::vector< std::vector<double> > const& coefficients, double x, double T1, double T0){
259  //return simplePolynomialInt(coefficients,x,T1,T0);
260  return baseHornerInt(coefficients,x,T1,T0);
261  //return integrateIn2Steps(coefficients,x,T1,T0);
262  }
263 
267  double polyfracint(std::vector<double> const& coefficients, double T){
268  //return simpleFracInt(coefficients,T);
269  return baseHornerFra(coefficients,T);
270  //return fracIntIn2Steps(coefficients,T);
271  }
272 
277  double polyfracint(std::vector<double> const& coefficients, double T1, double T0){
278  //return simpleFracInt(coefficients,T1,T0);
279  //return baseHornerFracInt(coefficients,T1,T0);
280  return fracIntIn2Steps(coefficients,T1,T0);
281  }
282 
287  double polyfracint(std::vector< std::vector<double> > const& coefficients, double x, double T){
288  //return simpleFracInt(coefficients,x,T);
289  return baseHornerFra(coefficients,x,T);
290  //return fracIntIn2Steps(coefficients,x,T);
291  }
292 
298  double polyfracint(std::vector< std::vector<double> > const& coefficients, double x, double T1, double T0){ //TODO compare speed
299  //return simpleFracInt(coefficients,x,T1,T0);
300  return baseHornerFra(coefficients,x,T1,T0);
301  //return fracIntIn2Steps(coefficients,x,T1,T0);
302  }
303 
308  double polyfracintcentral(std::vector<double> const& coefficients, double T, double Tbase){
309  return fracIntCentral(coefficients,T,Tbase);
310  }
311 
317  double polyfracintcentral(std::vector<double> const& coefficients, double T1, double T0, double Tbase){
318  return fracIntCentral(coefficients,T1,T0,Tbase);
319  }
320 
326  double polyfracintcentral(std::vector< std::vector<double> > const& coefficients, double x, double T, double Tbase){
327  return fracIntCentral2Steps(coefficients,x,T,Tbase);
328  }
329 
336  double polyfracintcentral(std::vector< std::vector<double> > const& coefficients, double x, double T1, double T0, double Tbase){
337  return fracIntCentral2Steps(coefficients,x,T1,T0,Tbase);
338  }
339 
340 
341 
346  double expval(std::vector<double> const& coefficients, double T, int n);
347 
353  double expval(std::vector< std::vector<double> > const& coefficients, double x, double T, int n);
354 };
355 
356 
364 public:
367  // Some functions need top be overwritten!
368 };
369 
370 
371 #endif
double polyfracint(std::vector< double > const &coefficients, double T)
Definition: IncompBase.h:267
double polyint(std::vector< double > const &coefficients, double T1, double T0)
Definition: IncompBase.h:237
The base class for incompressible fluids only.
Definition: IncompBase.h:16
double polyint(std::vector< std::vector< double > > const &coefficients, double x, double T1, double T0)
Definition: IncompBase.h:258
double polyfracintcentral(std::vector< double > const &coefficients, double T, double Tbase)
Definition: IncompBase.h:308
std::string getReference() const
Definition: IncompBase.h:34
std::string reference
Definition: IncompBase.h:21
double polyfracintcentral(std::vector< double > const &coefficients, double T1, double T0, double Tbase)
Definition: IncompBase.h:317
std::string getName() const
Definition: IncompBase.h:31
double polyint(std::vector< double > const &coefficients, double T)
Definition: IncompBase.h:227
double polyint(std::vector< std::vector< double > > const &coefficients, double x, double T)
Definition: IncompBase.h:247
std::string description
Definition: IncompBase.h:20
std::string get_name() const
Definition: IncompBase.h:33
double getTmin() const
Definition: IncompBase.h:36
double getTminPsat() const
Definition: IncompBase.h:37
Fluid is the abstract base class that is employed by all the other fluids.
Definition: FluidClass.h:147
std::string getDescription() const
Definition: IncompBase.h:30
std::vector< double > x(ncmax, 0)
double polyfracint(std::vector< std::vector< double > > const &coefficients, double x, double T)
Definition: IncompBase.h:287
double expval(std::vector< double > const &coefficients, double T, int n)
Definition: IncompBase.cpp:812
double getTref() const
Definition: IncompBase.h:38
double polyfracint(std::vector< std::vector< double > > const &coefficients, double x, double T1, double T0)
Definition: IncompBase.h:298
double polyfracintcentral(std::vector< std::vector< double > > const &coefficients, double x, double T, double Tbase)
Definition: IncompBase.h:326
bool checkCoefficients(std::vector< double > const &coefficients, unsigned int n)
Basic checks for coefficient vectors.
Definition: IncompBase.cpp:16
double polyval(std::vector< double > const &coefficients, double x)
Definition: IncompBase.h:210
double polyval(std::vector< std::vector< double > > const &coefficients, double x, double y)
Definition: IncompBase.h:219
virtual ~IncompressibleClass()
Definition: IncompBase.h:56
double polyfracintcentral(std::vector< std::vector< double > > const &coefficients, double x, double T1, double T0, double Tbase)
Definition: IncompBase.h:336
double polyfracint(std::vector< double > const &coefficients, double T1, double T0)
Definition: IncompBase.h:277
void setDebug(bool debug)
Definition: IncompBase.h:40
std::string name
Definition: IncompBase.h:19
double getTmax() const
Definition: IncompBase.h:35