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
CPState.h
Go to the documentation of this file.
1 
2 #ifndef CPSTATE_H
3 #define CPSTATE_H
4 
5 #include <iostream>
6 #include "FluidClass.h"
7 #include "CoolProp.h"
8 #include "TTSE.h"
9 #include "IncompBase.h"
10 #include "IncompLiquid.h"
11 #include "IncompSolution.h"
12 
13 bool match_pair(long iI1, long iI2, long I1, long I2);
14 void sort_pair(long *iInput1, double *Value1, long *iInput2, double *Value2, long I1, long I2);
15 
36 {
37 private:
38  bool is_cached;
39  double value;
40 public:
42  CachedElement(){this->clear();};
44  void operator=( const double& value){this->value = value; this->is_cached = true;};
46  operator bool() const {return is_cached;};
48  operator double() const {return value;};
50  void clear(){is_cached = false; this->value = _HUGE;};
51 };
52 
54 {
55 public:
62  void clear(){phi0.clear();
63  dphi0_dTau.clear();
72  phir.clear();
73  dphir_dTau.clear();
82  };
83 };
84 
85 // A macro to disallow the copy constructor and operator= functions
86 // This should be used in the private: declarations for a class
87 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
88  TypeName(const TypeName&); \
89  void operator=(const TypeName&)
90 
91 // Modified Version (no move semantics)
92 #define DISALLOW_COPY_MOVE_AND_ASSIGN(TypeName) \
93 TypeName(const TypeName&); \
94 void operator=(const TypeName&); \
95 TypeName(TypeName&&); \
96 void operator=(const TypeName&&)
97 
99 {
100 protected:
101 
102  // TODO Solutions: Remove dummy string
104  std::string brine_string;
105 
107 
108  std::string _Fluid;
109 
111 
112  // Saturation values
114 
115  // Pointers to the Liquid and Vapor classes
117 
118  void add_saturation_states(void);
119  void remove_saturation_states(void);
120 
121  void _pre_update(void);
122  void _post_update(void);
123 
124  // To be used to update internal variables if you know that your parameters are T,Q or P,Q
125  void update_twophase(long iInput1, double Value1, long iInput2, double Value2);
126 
127  // To be used to update internal variables if you know that your parameters are T,D
128  void update_Trho(long iInput1, double Value1, long iInput2, double Value2);
129 
130  // To be used to update internal variables if you know that your parameters are T,P
131  void update_Tp(long iInput1, double Value1, long iInput2, double Value2);
132 
135  void update_ph(long iInput1, double Value1, long iInput2, double Value2, double T0 = -1, double rho0 = -1);
136 
137  // To be used to update internal variables if you know that your parameters are P,S
138  void update_ps(long iInput1, double Value1, long iInput2, double Value2);
139 
140  // To be used to update internal variables if you know that your parameters are P,D
141  void update_prho(long iInput1, double Value1, long iInput2, double Value2);
142 
143  // To be used to update internal variables if you know that your parameters are H,S
144  void update_hs(long iInput1, double Value1, long iInput2, double Value2);
145 
146  // To be used to update internal variables if you know that your parameters are T,S
147  void update_Ts(long iInput1, double Value1, long iInput2, double Value2);
148 
149  // Update using the TTSE lookup tables
150  void update_TTSE_LUT(long iInput1, double Value1, long iInput2, double Value2);
151 
152  // Update using the incompressible liquid or incompressible solution
153  void update_incompressible(long iInput1, double Value1, long iInput2, double Value2);
154 
155  // Check whether the quality corresponds to saturated liquid or vapor
156  void check_saturated_quality(double Q);
157 
159  bool within_TTSE_range(long iInput1, double Value1, long iInput2, double Value2)
160  { if (get_debug_level()>10)
161  { std::cout << format("%s:%d: CoolPropStateClassSI::within_TTSE_range %d,%g,%d,%g,%s",__FILE__,__LINE__,iInput1,Value1,iInput2,Value2,this->pFluid->get_name().c_str()).c_str() << std::endl; }
162  return this->pFluid->TTSESinglePhase.within_range(iInput1,Value1,iInput2,Value2);
163  }
164 
166  double interp_linear(double Q, double valueL, double valueV);
167  double interp_recip(double Q, double valueL, double valueV);
168 
169  //DISALLOW_COPY_AND_ASSIGN(CoolPropStateClassSI);
170 public:
171 
174  {
175  return CoolPropStateClassSI(this->get_name());
176  }
177  else
178  {
179  return CoolPropStateClassSI(this->pFluid);
180  }
181  };
182 
183 // CoolPropStateClassSI( const CoolPropStateClassSI& other ); // non construction-copyable
184 // CoolPropStateClassSI& operator=( const CoolPropStateClassSI& ); // non copyable
185 
186  long fluid_type;
187 
190 
193 
196 
200 
204 
205  // Bulk values
207 
208  // Smoothing values
210 
211  // Phase flags
213 
214  // Default Constructor
215  CoolPropStateClassSI(){_noSatLSatV = true; SatL = NULL; SatV = NULL;};
216 
217  // Constructor with fluid name
218  CoolPropStateClassSI(std::string FluidName);
219 
220  // Constructor with fluid pointer
222 
223  // Destructor to clear SatL and SatV
225 
227  double Tsat(double Q);
228 
229  double superheat(void);
230 
232  std::string get_name(void){
234  {
235  return pFluid->get_name();
236  }
238  {
239  return this->pIncompLiquid->getName();
240  }
242  {
243  return this->pIncompSolution->getName();
244  return brine_string;
245  }
246  else{
247  throw ValueError();
248  }
249  };
250 
252  void no_SatLSatV(void){_noSatLSatV = true;};
253 
254  // Property updater
255  // Uses the indices in CoolProp for the input parameters
256  // If P,H are inputs, can also use the input values of T0,rho0 as start guess for the 2D Newton solver
257  void update(long iInput1, double Value1, long iInput2, double Value2, double T0 = -1, double rho0 = -1);
258 
259  // Returns an output based on the key provided
260  // where iInput is one of iT,iP,iH,iS,....
261  double keyed_output(long iInput);
262 
263  // Property accessors for saturation parameters directly
264  // These all are calculated every time if the state is saturated or two-phase
265  double rhoL(void){return rhosatL;};
266  double rhoV(void){return rhosatV;};
267  double pL(void){return psatL;};
268  double pV(void){return psatV;};
269  double TL(void){return TsatL;};
270  double TV(void){return TsatV;};
271  // Derived parameters for the saturation states
272  double hL(void);
273  double hV(void);
274  double sL(void);
275  double sV(void);
276  double cpL(void);
277  double cpV(void);
278  double viscL(void);
279  double viscV(void);
280  double condL(void);
281  double condV(void);
282 
283  // The phase as an integer flag
284  long phase(void);
285 
286  // Bulk properties accessors - temperature and density are directly calculated every time
287  // All other parameters are calculated on an as-needed basis
288  // If single-phase, just plug into the EOS, otherwise need to do two-phase analysis
289  double T(void){return _T;};
290  double rho(void){return _rho;};
291  double p(void){return _p;};
292  double Q(void){return _Q;};
293  double h(void);
294  double s(void);
295  double cp(void);
296  double cv(void);
297  double speed_sound(void);
298  double isothermal_compressibility(void);
299  double isobaric_expansion_coefficient(void);
300  double drhodh_constp(void);
301  double drhodp_consth(void);
303  double drhodh_constp_smoothed(double xend);
305  double drhodp_consth_smoothed(double xend);
307  void rho_smoothed(double xend, double &rho_spline, double &dsplinedh, double &dsplinedp);
308 
309  double viscosity(void);
310  double conductivity(void);
311  double Prandtl(void);
312 
313  double surface_tension(void);
314 
315 
316  // ----------------------------------------
317  // Extended two-phase calculations things
318  // ----------------------------------------
320  void enable_EXTTP(void);
322  bool isenabled_EXTTP(void);
324  void disable_EXTTP(void);
325 
326  // ----------------------------------------
327  // TTSE LUT things
328  // ----------------------------------------
330  void enable_TTSE_LUT(void);
332  bool isenabled_TTSE_LUT(void);
334  void disable_TTSE_LUT(void);
336  void enable_TTSE_LUT_writing(void);
338  bool isenabled_TTSE_LUT_writing(void);
340  void disable_TTSE_LUT_writing(void);
342  void set_TTSESat_LUT_size(int N);
344  void set_TTSESinglePhase_LUT_size(int Np, int Nh);
346  void set_TTSESinglePhase_LUT_range(double hmin, double hmax, double pmin, double pmax);
348  void get_TTSESinglePhase_LUT_range(double *hmin, double *hmax, double *pmin, double *pmax);
349 
351  double B_TTSE(double _p, double _h);
353  double B_over_D_TTSE(double _p, double _h);
354 
355  // ----------------------------------------
356  // Derivatives of properties
357  // ----------------------------------------
358 
359  double dvdp_constT(void);
360  double dvdT_constp(void);
361 
362  double drhodT_constp(void);
363  double drhodp_constT(void);
364  double d2rhodp2_constT(void);
365  double d2rhodTdp(void);
366  double d2rhodT2_constp(void);
367  double d2rhodhdQ(void);
368  double d2rhodpdQ(void);
369  double d2rhodhdp(void);
370  double d2rhodh2_constp(void);
371 
372  double dpdrho_constT(void);
373  double dpdrho_consth(void);
374  double dpdT_constrho(void);
375  double dpdT_consth(void);
376  double d2pdrho2_constT(void);
377  double d2pdrhodT(void);
378  double d2pdT2_constrho(void);
379 
380  double dhdrho_constT(void);
381  double dhdrho_constp(void);
382  double dhdT_constrho(void);
383  double dhdT_constp(void);
384  double dhdp_constT(void);
385  double d2hdrho2_constT(void);
386  double d2hdrhodT(void);
387  double d2hdT2_constrho(void);
388  double d2hdT2_constp(void);
389  double d2hdp2_constT(void);
390  double d2hdTdp(void);
391 
392  double dsdrho_constT(void);
393  double dsdT_constrho(void);
394  double dsdrho_constp(void);
395  double dsdT_constp(void);
396  double dsdp_constT(void);
397  double d2sdrho2_constT(void);
398  double d2sdrhodT(void);
399  double d2sdT2_constrho(void);
400  double d2sdT2_constp(void);
401  double d2sdp2_constT(void);
402  double d2sdTdp(void);
403 
404  // Fundamental derivative of gas dynamics
406 
407  double d2pdv2_consts(void);
408 
409  // Other functions and derivatives
410  double dhdp_constrho(void);
411  double Z(void);
412  double dZdDelta(void);
413  double dZdTau(void);
414  double B(void);
415  double dBdT(void);
416  double C(void);
417  double dCdT(void);
418 
419 
420 
421  // ----------------------------------------
422  // Derivatives along the saturation curve
423  // ----------------------------------------
424 
426  double dTdp_along_sat(void);
428  double d2Tdp2_along_sat(void);
430  double ddp_dTdp_along_sat(void);
432  double ddT_dTdp_along_sat(void);
433 
434  double dhdp_along_sat_vapor(void);
435  double dhdp_along_sat_liquid(void);
436  double d2hdp2_along_sat_vapor(void);
437  double d2hdp2_along_sat_liquid(void);
438 
439  double dsdp_along_sat_vapor(void);
440  double dsdp_along_sat_liquid(void);
441  double d2sdp2_along_sat_vapor(void);
442  double d2sdp2_along_sat_liquid(void);
443 
444  double drhodp_along_sat_vapor(void);
445  double drhodp_along_sat_liquid(void);
446  double d2rhodp2_along_sat_vapor(void);
447  double d2rhodp2_along_sat_liquid(void);
448 
449  double dsdT_along_sat_vapor(void);
450  double dsdT_along_sat_liquid(void);
451 
452  double dhdT_along_sat_vapor(void);
453  double dhdT_along_sat_liquid(void);
454 
455  double drhodT_along_sat_vapor(void);
456  double drhodT_along_sat_liquid(void);
457 
458  // ----------------------------------------
459  // Helmholtz Energy Derivatives
460  // ----------------------------------------
461 
462  double phi0(double tau, double delta);
463  double dphi0_dDelta(double tau, double delta);
464  double dphi0_dTau(double tau, double delta);
465  double d2phi0_dDelta2(double tau, double delta);
466  double d2phi0_dDelta_dTau(double tau, double delta);
467  double d2phi0_dTau2(double tau, double delta);
468  double d3phi0_dDelta3(double tau, double delta);
469  double d3phi0_dDelta2_dTau(double tau, double delta);
470  double d3phi0_dDelta_dTau2(double tau, double delta);
471  double d3phi0_dTau3(double tau, double delta);
472 
473  double phir(double tau, double delta);
474  double dphir_dDelta(double tau, double delta);
475  double dphir_dTau(double tau, double delta);
476  double d2phir_dDelta2(double tau, double delta);
477  double d2phir_dDelta_dTau(double tau, double delta);
478  double d2phir_dTau2(double tau, double delta);
479  double d3phir_dDelta3(double tau, double delta);
480  double d3phir_dDelta2_dTau(double tau, double delta);
481  double d3phir_dDelta_dTau2(double tau, double delta);
482  double d3phir_dTau3(double tau, double delta);
483 };
484 
485 
486 
487 
488 
489 
490 
491 
492 
493 
494 
495 
496 
497 
498 
499 
500 
501 
502 
503 
504 
505 
506 
507 
508 
509 
510 
512 {
513 
514 public:
515 
518 
520  CoolPropStateClass(std::string FluidName);
521 
524 
527  void update(long iInput1, double Value1, long iInput2, double Value2);
528 
531 
549 
562 
567 
572 
574  void rho_smoothed(double xend, double &rho_spline, double &dsplinedh, double &dsplinedp)
575  {
576  CoolPropStateClassSI::rho_smoothed(xend,rho_spline,dsplinedh,dsplinedp);
577  dsplinedh *= conversion_factor("H");
578  dsplinedp *= conversion_factor("P");
579  }
580 
584 
587  void set_TTSESinglePhase_LUT_range(double hmin, double hmax, double pmin, double pmax)
588  {
589  double _hmin = hmin / conversion_factor("H"); // [J/kg]
590  double _hmax = hmax / conversion_factor("H"); // [J/kg]
591  double _pmin = pmin / conversion_factor("P"); // [kPa]
592  double _pmax = pmax / conversion_factor("P"); // [kPa]
594  };
596  void get_TTSESinglePhase_LUT_range(double *hmin, double *hmax, double *pmin, double *pmax)
597  {
598  // Call the base class function
600 
601  // Unit conversions
602  *hmin *= conversion_factor("H"); // [kJ/kg]
603  *hmax *= conversion_factor("H"); // [kJ/kg]
604  *pmin *= conversion_factor("P"); // [kPa]
605  *pmax *= conversion_factor("P"); // [kPa]
606  };
607 
611 
614 
624 
632 
643  double d2hdTdp(void){return CoolPropStateClassSI::d2hdTdp()*conversion_factor("H/T/P");};
644 
655  double d2sdTdp(void){return CoolPropStateClassSI::d2sdTdp()*conversion_factor("S/T/P");};
656 
660  //
665 
670 
675 
680 
683 
686 
689 };
690 
691 #endif
double dhdp_constrho(void)
Definition: CPState.cpp:2153
double d2pdv2_consts(void)
Definition: CPState.cpp:2134
double dsdp_constT(void)
Definition: CPState.cpp:2298
double conductivity(void)
Definition: CPState.cpp:1524
double drhodp_along_sat_vapor(void)
Definition: CPState.cpp:2468
double drhodT_constp(void)
Definition: CPState.h:615
void update_Ts(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:719
double d2sdT2_constrho(void)
Definition: CPState.h:652
double interp_recip(double Q, double valueL, double valueV)
Definition: CPState.cpp:2768
double cpV(void)
Definition: CPState.cpp:1376
double dpdT_consth(void)
Definition: CPState.h:628
double d2rhodhdQ(void)
Definition: CPState.h:620
double TV(void)
Definition: CPState.h:537
double d2rhodhdQ(void)
Definition: CPState.cpp:2350
std::string brine_string
Temporary until solutions are fixed.
Definition: CPState.h:104
double dphi0_dDelta(double tau, double delta)
Definition: CPState.cpp:2560
double d2hdT2_constp(void)
Definition: CPState.h:641
double sV(void)
Definition: CPState.h:542
void _pre_update(void)
Definition: CPState.cpp:177
double d2rhodhdp(void)
Definition: CPState.h:622
double hV(void)
Definition: CPState.cpp:1341
double keyed_output(long iInput)
Return an output based on the integer key for the term.
Definition: CPState.cpp:1077
void disable_TTSE_LUT_writing(void)
Disable the writing of TTSE tables to file.
Definition: CPState.cpp:2788
double isothermal_compressibility(void)
Definition: CPState.cpp:1673
double dphir_dTau(double tau, double delta)
Definition: CPState.cpp:2671
double rhoL(void)
Definition: CPState.h:265
double d2rhodpdQ(void)
Definition: CPState.h:621
double dhdp_along_sat_vapor(void)
Definition: CPState.cpp:2410
double Tsat(double Q)
Saturation temperature.
Definition: CPState.cpp:143
double dsdrho_constT(void)
Definition: CPState.cpp:2226
void update_twophase(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:330
void set_TTSESinglePhase_LUT_size(int Np, int Nh)
Over-ride the default size of the single-phase LUT.
Definition: CPState.cpp:2792
double d2phir_dDelta_dTau(double tau, double delta)
Definition: CPState.cpp:2694
void update_ps(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:637
double dsdT_along_sat_vapor(void)
Definition: CPState.cpp:2529
double dhdp_along_sat_liquid(void)
Definition: CPState.h:667
double dhdT_constp(void)
Definition: CPState.cpp:2271
double d2sdrho2_constT(void)
Definition: CPState.cpp:2238
void no_SatLSatV(void)
Stop it from adding the SatL and SatV class pointers.
Definition: CPState.h:252
double d2sdTdp(void)
Definition: CPState.h:655
CachedElement d2phir_dDelta2
Definition: CPState.h:56
double d2rhodp2_along_sat_liquid(void)
Definition: CPState.cpp:2504
double dhdT_along_sat_vapor(void)
Definition: CPState.h:681
double drhodp_consth(void)
Definition: CPState.cpp:2037
double d2rhodh2_constp(void)
Definition: CPState.h:623
CachedElement()
Default constructor.
Definition: CPState.h:42
void update_hs(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:679
double dhdT_constp(void)
Definition: CPState.h:636
double sL(void)
Definition: CPState.h:541
double d3phir_dDelta3(double tau, double delta)
Definition: CPState.cpp:2753
double drhodp_along_sat_vapor(void)
Definition: CPState.h:676
double phir(double tau, double delta)
Definition: CPState.cpp:2649
EXPORT_CODE int CONVENTION get_debug_level()
CachedElement d3phi0_dDelta_dTau2
Definition: CPState.h:56
double drhodh_constp(void)
Definition: CPState.h:565
double isobaric_expansion_coefficient(void)
Definition: CPState.h:564
bool match_pair(long iI1, long iI2, long I1, long I2)
Definition: CPState.cpp:132
double d2hdp2_along_sat_vapor(void)
Definition: CPState.cpp:2422
double drhodT_along_sat_liquid(void)
Definition: CPState.h:688
double s(void)
Entropy in kJ/kg/K.
Definition: CPState.h:555
double d3phi0_dTau3(double tau, double delta)
Definition: CPState.cpp:2616
double dhdT_along_sat_liquid(void)
Definition: CPState.h:682
void enable_TTSE_LUT(void)
Enable the TTSE.
Definition: CPState.cpp:2778
double pV(void)
Definition: CPState.h:535
double viscV(void)
Definition: CPState.h:546
double d3phir_dDelta_dTau2(double tau, double delta)
Definition: CPState.cpp:2729
double d2rhodh2_constp(void)
Definition: CPState.cpp:2086
double d2sdrhodT(void)
Definition: CPState.cpp:2242
double drhodp_consth(void)
Definition: CPState.h:566
double ddp_dTdp_along_sat(void)
Partial derivative w.r.t. pressure of dTdp along saturation curve.
Definition: CPState.cpp:2379
void get_TTSESinglePhase_LUT_range(double *hmin, double *hmax, double *pmin, double *pmax)
Get the current range of the single-phase LUT.
Definition: CPState.cpp:2796
double d2pdrhodT(void)
Definition: CPState.h:630
double dhdT_along_sat_vapor(void)
Definition: CPState.cpp:2518
double dCdT(void)
Definition: CPState.cpp:2196
double TL(void)
Definition: CPState.h:269
std::string getName() const
Definition: IncompBase.h:31
double pL(void)
Definition: CPState.h:267
Base class for simplified brine/solution models.
Definition: IncompLiquid.h:25
double dpdT_consth(void)
Definition: CPState.cpp:2258
double dvdp_constT(void)
Definition: CPState.cpp:2249
void rho_smoothed(double xend, double &rho_spline, double &dsplinedh, double &dsplinedp)
Density corresponding to the smoothed derivatives in the region of x=0 to x=xend. ...
Definition: CPState.h:574
double surface_tension(void)
Definition: CPState.cpp:1740
double isothermal_compressibility(void)
Definition: CPState.h:563
IncompressibleLiquid * pIncompLiquid
A pointer to the class for an incompressible liquid.
Definition: CPState.h:189
double d2pdT2_constrho(void)
Definition: CPState.h:631
void update(long iInput1, double Value1, long iInput2, double Value2, double T0=-1, double rho0=-1)
Definition: CPState.cpp:213
double d2hdp2_along_sat_liquid(void)
Definition: CPState.cpp:2430
double dhdrho_constp(void)
Definition: CPState.cpp:2275
double dZdDelta(void)
Definition: CPState.cpp:2173
double d2rhodp2_constT(void)
Definition: CPState.h:617
double d2phi0_dDelta2(double tau, double delta)
Definition: CPState.cpp:2582
double p(void)
Pressure in kPa.
Definition: CPState.h:551
double drhodp_constT(void)
Definition: CPState.cpp:2328
double dsdp_constT(void)
Definition: CPState.h:649
double d2rhodp2_along_sat_vapor(void)
Definition: CPState.cpp:2496
EXPORT_CODE int CONVENTION get_standard_unit_system(void)
double d2hdrhodT(void)
Definition: CPState.h:639
double d2sdTdp(void)
Definition: CPState.cpp:2322
double ddT_dTdp_along_sat(void)
Partial derivative w.r.t. temperature of dTdp along saturation curve.
Definition: CPState.cpp:2385
bool isenabled_TTSE_LUT(void)
Check if TTSE is enabled.
Definition: CPState.cpp:2780
double Z(void)
Definition: CPState.cpp:2169
double sL(void)
Definition: CPState.cpp:1352
double drhodh_constp_smoothed(double xend)
A smoothed version of the derivative using a spline curve in the region of x=0 to x=xend...
Definition: CPState.cpp:1821
double d3phi0_dDelta2_dTau(double tau, double delta)
Definition: CPState.cpp:2632
CachedElement d2phir_dDelta_dTau
Definition: CPState.h:56
double dvdp_constT(void)
Definition: CPState.h:612
std::string get_name()
Returns a std::string with the name of the fluid.
Definition: FluidClass.h:235
double d2rhodp2_along_sat_liquid(void)
Definition: CPState.h:679
double dsdrho_constp(void)
Definition: CPState.cpp:2306
double condL(void)
Definition: CPState.h:547
CoolPropStateClassSI copy(void)
Definition: CPState.h:172
double d2sdp2_constT(void)
Definition: CPState.h:654
CachedElement phi0
Definition: CPState.h:56
Base class for simplified brine/solution models.
double dZdTau(void)
Definition: CPState.cpp:2177
std::string format(const char *fmt,...)
double dphi0_dTau(double tau, double delta)
Definition: CPState.cpp:2571
double dpdrho_consth(void)
Definition: CPState.h:626
CachedElement d3phir_dDelta2_dTau
Definition: CPState.h:56
double d2hdp2_constT(void)
Definition: CPState.cpp:2286
double superheat(void)
Definition: CPState.cpp:159
double cp(void)
Definition: CPState.cpp:1460
Fluid * pFluid
A pointer to a CoolProp fluid.
Definition: CPState.h:195
double dsdT_constp(void)
Definition: CPState.h:648
void remove_saturation_states(void)
Fluid is the abstract base class that is employed by all the other fluids.
Definition: FluidClass.h:147
double d2sdT2_constp(void)
Definition: CPState.cpp:2310
void operator=(const double &value)
Assignment operator - sets the value and sets the flag.
Definition: CPState.h:44
double convert_from_SI_to_unit_system(long iInput, double value, int new_system)
Definition: Units.cpp:123
double B_over_D_TTSE(double _p, double _h)
Get the ratio directly which is just a bit faster.
Definition: CPState.cpp:1565
double drhodT_along_sat_vapor(void)
Definition: CPState.h:687
double d2rhodTdp(void)
Definition: CPState.cpp:2338
double d2sdp2_along_sat_liquid(void)
Definition: CPState.h:674
void set_TTSESinglePhase_LUT_range(double hmin, double hmax, double pmin, double pmax)
Over-ride the default range of the single-phase LUT.
Definition: CPState.cpp:2794
double Q(void)
Definition: CPState.h:292
StateCache()
Definition: CPState.h:56
double d2phir_dDelta2(double tau, double delta)
Definition: CPState.cpp:2682
CachedElement d2phi0_dTau2
Definition: CPState.h:56
void disable_EXTTP(void)
Disable the extended two-phase calculations.
Definition: CPState.cpp:2776
void get_TTSESinglePhase_LUT_range(double *hmin, double *hmax, double *pmin, double *pmax)
Get the current range of the single-phase LUT.
Definition: CPState.h:596
std::string _Fluid
Definition: CPState.h:108
double d2hdrhodT(void)
Definition: CPState.cpp:2215
double dsdrho_constp(void)
Definition: CPState.h:647
bool within_range(long iInput1, double Input1, long iInput2, double Input2)
See if the inputs are within range.
Definition: TTSE.cpp:2113
CachedElement dphir_dTau
Definition: CPState.h:56
CachedElement d2phi0_dDelta_dTau
Definition: CPState.h:56
double C(void)
Definition: CPState.cpp:2191
double d2pdrho2_constT(void)
Definition: CPState.h:629
double d2sdp2_along_sat_vapor(void)
Definition: CPState.h:673
bool isenabled_TTSE_LUT_writing(void)
Check if the writing of TTSE tables to file is enabled.
Definition: CPState.cpp:2786
double dhdrho_constT(void)
Definition: CPState.cpp:2203
double drhodp_consth_smoothed(double xend)
A smoothed version of the derivative using a spline curve in the region of x=0 to x=xend...
Definition: CPState.h:571
double dpdrho_constT(void)
Definition: CPState.cpp:2114
double dhdrho_constT(void)
Definition: CPState.h:633
double d2sdp2_constT(void)
Definition: CPState.cpp:2317
TTSESinglePhaseTableClass TTSESinglePhase
Definition: FluidClass.h:228
void update_TTSE_LUT(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:761
double dhdp_along_sat_liquid(void)
Definition: CPState.cpp:2398
CachedElement d3phir_dDelta_dTau2
Definition: CPState.h:56
double speed_sound(void)
Definition: CPState.cpp:1627
double pL(void)
Definition: CPState.h:534
double condL(void)
Definition: CPState.cpp:1379
double cv(void)
Constant volume specific heat in kJ/kg/K.
Definition: CPState.h:559
double dTdp_along_sat(void)
Derivative of temperature w.r.t. pressure along saturation curve.
Definition: CPState.h:662
double d2hdp2_along_sat_vapor(void)
Definition: CPState.h:668
double d2hdp2_along_sat_liquid(void)
Definition: CPState.h:669
double cp(void)
Constant pressure specific heat in kJ/kg/K.
Definition: CPState.h:557
double drhodT_constp(void)
Definition: CPState.cpp:2108
double dsdT_along_sat_liquid(void)
Definition: CPState.h:685
double rhoV(void)
Definition: CPState.h:266
void update_incompressible(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:1020
double dhdp_constT(void)
Definition: CPState.cpp:2267
double hL(void)
Definition: CPState.cpp:1330
double d2hdT2_constrho(void)
Definition: CPState.cpp:2220
void update_ph(long iInput1, double Value1, long iInput2, double Value2, double T0=-1, double rho0=-1)
Definition: CPState.cpp:598
double d2Tdp2_along_sat(void)
Definition: CPState.h:664
double Prandtl(void)
Definition: CPState.cpp:1553
void clear()
Definition: CPState.h:62
double d2sdrho2_constT(void)
Definition: CPState.h:650
double d2hdT2_constrho(void)
Definition: CPState.h:640
double dsdrho_constT(void)
Definition: CPState.h:645
StateCache cache
Definition: CPState.h:106
double d2hdT2_constp(void)
Definition: CPState.cpp:2279
double viscosity(void)
Definition: CPState.cpp:1494
double dsdp_along_sat_vapor(void)
Definition: CPState.cpp:2445
CachedElement dphi0_dDelta
Definition: CPState.h:56
double cpL(void)
Definition: CPState.cpp:1375
void set_TTSESat_LUT_size(int N)
Over-ride the default size of both of the saturation LUT.
Definition: CPState.cpp:2790
double d2rhodT2_constp(void)
Definition: CPState.cpp:2343
double dphir_dDelta(double tau, double delta)
Definition: CPState.cpp:2660
double B_TTSE(double _p, double _h)
Evaluate the B term from TTSE method.
Definition: CPState.cpp:1557
CachedElement d3phi0_dTau3
Definition: CPState.h:56
double d2rhodp2_along_sat_vapor(void)
Definition: CPState.h:678
double h(void)
Enthalpy in kJ/kg.
Definition: CPState.h:553
double fundamental_derivative_of_gas_dynamics(void)
Definition: CPState.cpp:2148
double dhdT_along_sat_liquid(void)
Definition: CPState.cpp:2513
double d2hdTdp(void)
Definition: CPState.cpp:2291
double d2Tdp2_along_sat(void)
Second derivative of temperature w.r.t. pressure along saturation curve.
Definition: CPState.cpp:2391
void update_prho(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:486
double drhodT_along_sat_liquid(void)
Definition: CPState.cpp:2541
CachedElement d3phi0_dDelta2_dTau
Definition: CPState.h:56
CachedElement phir
Definition: CPState.h:56
double hV(void)
Definition: CPState.h:540
void set_TTSESinglePhase_LUT_range(double hmin, double hmax, double pmin, double pmax)
Definition: CPState.h:587
double d2phir_dTau2(double tau, double delta)
Definition: CPState.cpp:2705
double conversion_factor(std::string num)
Definition: Units.cpp:267
double p(void)
Definition: CPState.h:291
double d2pdrho2_constT(void)
Definition: CPState.cpp:2122
double sV(void)
Definition: CPState.cpp:1363
double d2sdT2_constrho(void)
Definition: CPState.cpp:2234
double d3phi0_dDelta_dTau2(double tau, double delta)
Definition: CPState.cpp:2628
void clear()
Clear the flag and the value.
Definition: CPState.h:50
double h(void)
Definition: CPState.cpp:1382
double drhodh_constp(void)
Definition: CPState.cpp:1745
double d2rhodhdp(void)
Definition: CPState.cpp:2097
CachedElement dphi0_dTau
Definition: CPState.h:56
double d2sdrhodT(void)
Definition: CPState.h:651
double d2sdp2_along_sat_vapor(void)
Definition: CPState.cpp:2451
double dsdT_along_sat_liquid(void)
Definition: CPState.cpp:2524
double B(void)
Definition: CPState.cpp:2182
void sort_pair(long *iInput1, double *Value1, long *iInput2, double *Value2, long I1, long I2)
Definition: CPState.cpp:136
void rho_smoothed(double xend, double &rho_spline, double &dsplinedh, double &dsplinedp)
Density corresponding to the smoothed derivatives in the region of x=0 to x=xend. ...
Definition: CPState.cpp:1851
double d2rhodTdp(void)
Definition: CPState.h:618
double drhodT_along_sat_vapor(void)
Definition: CPState.cpp:2535
double drhodh_constp_smoothed(double xend)
Definition: CPState.h:569
CachedElement dphir_dDelta
Definition: CPState.h:56
void enable_TTSE_LUT_writing(void)
Enable the writing of TTSE tables to file.
Definition: CPState.cpp:2784
CachedElement d3phir_dDelta3
Definition: CPState.h:56
double phi0(double tau, double delta)
Definition: CPState.cpp:2549
double isobaric_expansion_coefficient(void)
Definition: CPState.cpp:1710
CachedElement d3phi0_dDelta3
Definition: CPState.h:56
double T(void)
Definition: CPState.h:289
double s(void)
Definition: CPState.cpp:1420
double d2sdp2_along_sat_liquid(void)
Definition: CPState.cpp:2459
double rho(void)
Definition: CPState.h:290
void update(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:2818
double d2hdp2_constT(void)
Definition: CPState.h:642
double pV(void)
Definition: CPState.h:268
double d2rhodpdQ(void)
Definition: CPState.cpp:2355
double d2hdTdp(void)
Definition: CPState.h:643
CoolPropStateClassSI * SatV
Definition: CPState.h:116
double dsdT_constrho(void)
Definition: CPState.cpp:2230
double dhdT_constrho(void)
Definition: CPState.cpp:2207
void enable_EXTTP(void)
Enable the extended two-phase calculations.
Definition: CPState.cpp:2772
void check_saturated_quality(double Q)
Definition: CPState.cpp:163
double drhodp_along_sat_liquid(void)
Definition: CPState.h:677
bool within_TTSE_range(long iInput1, double Value1, long iInput2, double Value2)
Check whether within the TTSE range.
Definition: CPState.h:159
double conductivity(void)
Thermal conductivity in kJ/kg/K.
Definition: CPState.h:561
double drhodp_constT(void)
Definition: CPState.h:616
double viscL(void)
Definition: CPState.cpp:1377
double dsdp_along_sat_liquid(void)
Definition: CPState.cpp:2439
std::string get_name(void)
Get the name of the fluid.
Definition: CPState.h:232
double d3phir_dTau3(double tau, double delta)
Definition: CPState.cpp:2717
double hL(void)
Definition: CPState.h:539
double dsdT_constrho(void)
Definition: CPState.h:646
double dBdT(void)
Definition: CPState.cpp:2187
double dvdT_constp(void)
Definition: CPState.h:613
double dsdT_constp(void)
Definition: CPState.cpp:2302
double d3phi0_dDelta3(double tau, double delta)
Definition: CPState.cpp:2636
double dsdp_along_sat_liquid(void)
Definition: CPState.h:672
double dvdT_constp(void)
Definition: CPState.cpp:2253
double dhdp_along_sat_vapor(void)
Definition: CPState.h:666
double dpdrho_consth(void)
Definition: CPState.cpp:2262
double cv(void)
Definition: CPState.cpp:1575
void add_saturation_states(void)
Definition: CPState.cpp:1312
double dpdrho_constT(void)
Definition: CPState.h:625
void update_Tp(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:552
void _post_update(void)
Definition: CPState.cpp:312
double viscL(void)
Definition: CPState.h:545
IncompressibleSolution * pIncompSolution
A pointer to the class for an incompressible solution.
Definition: CPState.h:192
void disable_TTSE_LUT(void)
Disable the TTSE.
Definition: CPState.cpp:2782
double dpdT_constrho(void)
Definition: CPState.h:627
double d2pdrhodT(void)
Definition: CPState.cpp:2126
bool isenabled_EXTTP(void)
Check if extended two-phase calculations are enabled.
Definition: CPState.cpp:2774
double d2sdT2_constp(void)
Definition: CPState.h:653
void update_Trho(long iInput1, double Value1, long iInput2, double Value2)
Definition: CPState.cpp:424
double condV(void)
Definition: CPState.h:548
CoolPropStateClassSI * SatL
Definition: CPState.h:116
CachedElement d2phi0_dDelta2
Definition: CPState.h:56
double viscV(void)
Definition: CPState.cpp:1378
double dsdp_along_sat_vapor(void)
Definition: CPState.h:671
double d2phi0_dTau2(double tau, double delta)
Definition: CPState.cpp:2604
double dhdrho_constp(void)
Definition: CPState.h:634
double d2hdrho2_constT(void)
Definition: CPState.h:638
double d2pdT2_constrho(void)
Definition: CPState.cpp:2130
double d2phi0_dDelta_dTau(double tau, double delta)
Definition: CPState.cpp:2593
double dhdT_constrho(void)
Definition: CPState.h:635
double d2hdrho2_constT(void)
Definition: CPState.cpp:2211
double interp_linear(double Q, double valueL, double valueV)
Extended two-phase calculations need different interpolation functions.
Definition: CPState.cpp:2765
double keyed_output(long iInput)
Returns an output based on the key provided where iInput is one of iT,iP,iH,iS,....
Definition: CPState.h:530
double dsdT_along_sat_vapor(void)
Definition: CPState.h:684
double drhodp_consth_smoothed(double xend)
A smoothed version of the derivative using a spline curve in the region of x=0 to x=xend...
Definition: CPState.cpp:1791
double d2rhodp2_constT(void)
Definition: CPState.cpp:2333
double dTdp_along_sat(void)
Derivative of temperature w.r.t. pressure along saturation curve.
Definition: CPState.cpp:2366
double cpV(void)
Definition: CPState.h:544
double condV(void)
Definition: CPState.cpp:1380
double dhdp_constT(void)
Definition: CPState.h:637
CachedElement d2phir_dTau2
Definition: CPState.h:56
double cpL(void)
Definition: CPState.h:543
double d3phir_dDelta2_dTau(double tau, double delta)
Definition: CPState.cpp:2741
double d2rhodT2_constp(void)
Definition: CPState.h:619
double dpdT_constrho(void)
Definition: CPState.cpp:2118
double TV(void)
Definition: CPState.h:270
double drhodp_along_sat_liquid(void)
Definition: CPState.cpp:2482
double TL(void)
Definition: CPState.h:536
CachedElement d3phir_dTau3
Definition: CPState.h:56