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
FluidClass.h
Go to the documentation of this file.
1 
2 #ifndef FLUIDCLASS_H
3 #define FLUIDCLASS_H
4 
5 #include <map>
6 #include <string>
7 #include <exception>
8 #include <vector>
9 
10 #include "CPExceptions.h"
11 #include "CoolPropTools.h"
12 #include "Helmholtz.h"
13 #include "TTSE.h"
14 #include "Units.h"
15 #include "AllFluids.h"
16 
17 // On PowerPC, we are going to use the stdint.h integer types and not let rapidjson use its own
18 #if defined(__powerpc__)
19 #include <stdint.h>
20 #define RAPIDJSON_NO_INT64DEFINE
21 #endif
22 
23 #include "rapidjson/rapidjson.h"
24 #include "rapidjson/document.h"
25 #include "rapidjson/filestream.h" // wrapper of C stream for prettywriter as output
26 #include "rapidjson/prettywriter.h" // for stringify JSON
27 
28 class Fluid;
29 
32 
36 {
38  std::vector<double> a_hs_satL;
39  std::vector<int> n_hs_satL;
40 };
42 {
44  std::string CAS;
45  std::string HSReferenceState;
46 };
48 {
49  double rho, T, v, h, s, rhobar;
51 };
53 {
54  double Tmin, Tmax, pmax, rhomax;
55 };
56 
58 {
59 public:
60  // Default Constructor
62  // Constructor with values
63  AncillaryCurveClass(Fluid *pFluid, std::string Output){built = false; update(pFluid,Output);};
64  void update(Fluid *pFluid, std::string Output);
65  std::vector<double> xL,yL,xV,yV;
66  int build(int N);
67  long iOutput;
69  double interpolateL(double T);
70  double interpolateV(double T);
71  double reverseinterpolateL(double y);
72  double reverseinterpolateV(double y);
73  bool built;
74 };
75 
77 {
78  std::vector< std::vector<double> > hmat,rhomat,cpmat,cp0mat, smat,cvmat,umat,viscmat,kmat,pmat,dpdTmat;
79  std::vector<double> Tvec,pvec;
80  double Tmin,Tmax,pmin,pmax;
81  int nT,np;
83 };
84 
85 
86 
87 
89 {
90 public:
92  CriticalSplineStruct_T(double Tend, double rhoendL, double rhoendV, double drhoLdT_sat, double drhoVdT_sat){
93  this->Tend = Tend;
94  this->rhoendL = rhoendL;
95  this->rhoendV = rhoendV;
96  this->drhoLdT_sat = drhoLdT_sat;
97  this->drhoVdT_sat = drhoVdT_sat;
98  };
103  double interpolate_rho(Fluid* pFluid, int phase, double T);
104 
106  double Tend;
108  double rhoendL;
110  double rhoendV;
112  double drhoLdT_sat;
114  double drhoVdT_sat;
115 };
116 
117 
119 {
120  std::string EOS;
121  std::string CP0;
122  std::string VISCOSITY;
123  std::string CONDUCTIVITY;
124  std::string ECS_LENNARD_JONES;
125  std::string ECS_FITS;
126  std::string SURFACE_TENSION;
127 
128 };
129 
131 {
132  double GWP20, GWP100, GWP500, ODP, HH, PH, FH;
133  std::string ASHRAE34;
134 };
135 
137 {
138  double tau, delta, cached_val;
139 };
140 
142 {
144 };
145 
147 class Fluid
148 {
149  protected:
151  std::string name;
152  std::string REFPROPname;
153  std::vector <std::string> aliases;
154  std::string ECSReferenceFluid;
155 
156  double ECS_qd;
157  std::string EOSReference;
158  std::string TransportReference;
159  bool isPure;
160 
161  // The structures that hold onto ancillary data for the fluid
164 
168  double _get_rho_guess(double T, double p);
169 
170  // The boundaries for the TTSE
172  unsigned int Nsat_TTSE, Nh_TTSE, Np_TTSE;
173  public:
174 
177 
178  std::vector <phi_BC*> phirlist;
179  std::vector <phi_BC*> phi0list;
180 
185  Fluid(){
186  params.R_u=8.314472;
187  isPure=true;
188 
189  enabled_EXTTP = false;
190  // Default parameters for TTSE - others are set in post-load() function
191  built_TTSE_LUT = false;
192  enabled_TTSE_LUT = false;
193  Nsat_TTSE = 400;
194  Nh_TTSE = 200;
195  Np_TTSE = 200;
196  hmin_TTSE = _HUGE;
197  hmax_TTSE = _HUGE;
198  pmin_TTSE = _HUGE;
199  pmax_TTSE = _HUGE;
201  CriticalSpline_T.Tend = _HUGE;
202 
203  preduce = &crit;
204  h_ancillary = NULL;
205  s_ancillary = NULL;
206 
207  ECSReferenceFluid = "R134a";
208  ECS_qd = 1/(0.5e-9);
209  };
210  virtual ~Fluid();
211 
212  // Some post-loading things happen here
213  void post_load(rapidjson::Document &JSON, rapidjson::Document &JSON_CAS);
214 
215  void add_alias(std::string alias){ aliases.push_back(alias);};
216 
217  // Fluid-specific parameters
223  struct HSContainer HS;
224 
229 
230  // The class that holds the information on the critical spline parameters
232 
233  // Member Access functions
235  std::string get_name(){return name;};
237  char * get_namec(){return (char *)name.c_str();};
238  std::string get_REFPROPname(){return REFPROPname;};
239  std::string get_EOSReference(){return EOSReference;};
241  std::vector<std::string> get_aliases(){return aliases;};
243  bool pure(){return isPure;};
245  double R();
246 
247  // These MUST be implemented by derived class
248  virtual double conductivity_Trho(double T, double rho);
249  virtual double viscosity_Trho(double T, double rho);
250 
251  // These Helmholtz energy terms are provided by the base class
252  virtual double phir(double tau, double delta);
253  // First derivative
254  virtual double dphir_dDelta(double tau, double delta);
255  virtual double dphir_dTau(double tau, double delta);
256  // Second derivative
257  virtual double d2phir_dDelta2(double tau, double delta);
258  virtual double d2phir_dDelta_dTau(double tau, double delta);
259  virtual double d2phir_dTau2(double tau, double delta);
260  // Third derivative
261  virtual double d3phir_dDelta3(double tau, double delta);
262  virtual double d3phir_dDelta2_dTau(double tau, double delta);
263  virtual double d3phir_dDelta_dTau2(double tau, double delta);
264  virtual double d3phir_dTau3(double tau, double delta);
265 
266  virtual double phi0(double tau, double delta);
267  virtual double dphi0_dDelta(double tau, double delta);
268  virtual double dphi0_dTau(double tau, double delta);
269 
270  virtual double d2phi0_dDelta2(double tau, double delta);
271  virtual double d2phi0_dDelta_dTau(double tau, double delta);
272  virtual double d2phi0_dTau2(double tau, double delta);
273 
274  virtual double d3phi0_dDelta3(double tau, double delta){throw NotImplementedError();};
275  virtual double d3phi0_dDelta2_dTau(double tau, double delta){return 0;};
276  virtual double d3phi0_dDelta_dTau2(double tau, double delta){return 0;};
277  virtual double d3phi0_dTau3(double tau, double delta);
278 
279  // These thermodynamic properties as a function of temperature and density are
280  // provided by the base class
281  double pressure_Trho(double T, double rho);
282  double enthalpy_Trho(double T, double rho);
283  double entropy_Trho(double T, double rho);
284  double internal_energy_Trho(double T, double rho);
285  double speed_sound_Trho(double T, double rho);
286  double specific_heat_p_Trho(double T, double rho);
287  double specific_heat_p_ideal_Trho(double T);
288  double specific_heat_v_Trho(double T, double rho);
289  double gibbs_Trho(double T, double rho);
290  double dpdT_Trho(double T,double rho);
291  double dpdrho_Trho(double T,double rho);
292  double drhodT_p_Trho(double T,double rho);
293 
294  // Get the density using the Soave EOS
295  double density_Tp_Soave(double T, double p, int iValue = 0);
296 
297  virtual double density_Tp(double T, double p);
298  virtual double density_Tp(double T, double p, double rho_guess);
299 
307  virtual void density_Ts(double T, double s, double &rhoout, double &pout, double &rhoLout, double &rhoVout, double &psatLout, double &psatVout);
308 
316  virtual void temperature_hs(double h, double s, double &Tout, double &rhoout, double &rhoL, double &rhoV, double &TsatLout, double &TsatVout);
317 
325  virtual void temperature_ps(double p, double s, double &Tout, double &rhoout, double &rhoL, double &rhoV, double &TsatLout, double &TsatVout);
326 
336  virtual void temperature_ph(double p, double h, double &Tout, double &rhoout, double &rhoL, double &rhoV, double &TsatLout, double &TsatVout, double T0 = -1, double rho0 = -1);
337 
338  double temperature_prho(double p, double rho, double T0);
339 
340  double temperature_prho_VanDerWaals(double p, double rho);
341  double temperature_prho_PengRobinson(double p, double rho);
342 
344  std::string phase_Tp(double T, double p, double &pL, double &pV, double &rhoL, double &rhoV);
345 
347  long phase_Tp_indices(double T, double p, double &pL, double &pV, double &rhoL, double &rhoV);
348 
350  std::string phase_Trho(double T, double rho, double &pL, double &pV, double &rhoL, double &rhoV);
351 
353  long phase_Trho_indices(double T, double rho, double &pL, double &pV, double &rhoL, double &rhoV);
354 
355  long phase_prho_indices(double p, double rho, double &T, double &TL, double &TV, double &rhoL, double &rhoV);
356 
357  // Optional ancillary functions can be overloaded, will throw a NotImplementedError
358  // to be caught by calling function if not implemented
359  virtual double psat(double T){
360  throw NotImplementedError(std::string("psat not implemented for this fluid"));
361  };
362  virtual double psatL(double T){
363  throw NotImplementedError(std::string("psatL not implemented for this fluid"));
364  };
365  virtual double psatV(double T){
366  throw NotImplementedError(std::string("psatV not implemented for this fluid"));
367  };
368  virtual double rhosatL(double T){
369  throw NotImplementedError(std::string("rhosatL not implemented for this fluid"));
370  };
371  virtual double rhosatV(double T){
372  throw NotImplementedError(std::string("rhosatV not implemented for this fluid"));
373  };
374  double psatL_anc(double T){
375  if (isPure)
376  return psat(T);
377  else
378  return psatL(T);
379  };
380  double psatV_anc(double T){
381  if (isPure)
382  return psat(T);
383  else
384  return psatV(T);
385  };
386  // Ancillary equations composed by interpolating within 3-point
387  // curve that is calculated once
388  double hsatV_anc(double T);
389  double hsatL_anc(double T);
390  double ssatV_anc(double T);
391  double ssatL_anc(double T);
392  double cpsatV_anc(double T);
393  double cpsatL_anc(double T);
394  double drhodT_pL_anc(double T);
395  double drhodT_pV_anc(double T);
399  double Tsat_anc(double p, double Q);
400 
401  double density_Tp_PengRobinson(double T, double p, int solution);
402 
403  std::vector<double> ConformalTemperature(Fluid *InterestFluid, Fluid *ReferenceFluid,double T, double rho, double T0, double rho0, std::string *errstring);
404  // Extended corresponding states functions for fluids that do not have their own high-accuracy
405  // transport property implementation
406  virtual void ECSParams(double *e_k, double *sigma);
407 
410  virtual double ECS_psi_viscosity(double rhor){
411  return 1.0;
412  };
415  virtual double ECS_chi_conductivity(double rhor){
416  return 1.0;
417  };
420  virtual double ECS_f_int(double T){
421  return 1.32e-3;
422  };
428  double viscosity_ECS_Trho(double T, double rho, Fluid * ReferenceFluid);
429 
435  double conductivity_ECS_Trho(double T, double rho, Fluid * ReferenceFluid);
436 
443  virtual double conductivity_background(double T, double rho){
444  throw NotImplementedError(std::string("conductivity_background not implemented for this fluid"));
445  };
446 
453  double conductivity_critical(double T, double rho, double qd = 2e9, double GAMMA = 0.0496, double zeta0 = 1.94e-10);
454 
460  virtual double viscosity_dilute(double T, double e_k, double sigma);
461 
468  virtual double viscosity_residual(double T, double rho){
469  throw NotImplementedError(std::string("viscosity_residual not implemented for this fluid"));
470  };
477  virtual double viscosity_background(double T, double rho){
478  throw NotImplementedError(std::string("viscosity_background not implemented for this fluid"));
479  };
480 
481  virtual double surface_tension_T(double T);
482 
483  void saturation_VdW(double T, double &rhoL, double &rhoV, double &p, double s0=-1);
484 
492  virtual void saturation_T(double T, bool UseLUT, double &psatLout, double &psatVout, double &rhoLout, double &rhoVout);
493 
501  virtual void saturation_p(double p, bool UseLUT, double &TsatLout, double &TsatVout, double &rhoLout, double &rhoVout);
502 
514  virtual void saturation_h(double h, double Tmin, double Tmax, int Q, double &Tsatout, double &rhoout, double &TsatLout, double &TsatVout, double &rhoLout, double &rhoVout);
515 
525  virtual void saturation_s(double s, int Q, double &Tsatout, double &rhoout, double &TsatLout, double &TsatVout, double &rhoLout, double &rhoVout);
526 
534  void rhosatPure(double T, double &rhoLout, double &rhoVout, double &pout, double omega, bool use_guesses);
535 
544  void rhosatPure_Akasaka(double T, double &rhoLout, double &rhoVout, double &pout, double omega, bool use_guesses = false);
545 
551  void rhosatPure_Brent(double T, double &rhoLout, double &rhoVout, double &pout);
552 
558  void rhosatPure_BrentrhoV(double T, double &rhoLout, double &rhoVout, double &pout);
559 
566  double Tsat(double p, double Q, double T_guess);
567 
577  double Tsat(double p, double Q, double T_guess, bool UseLUT, double &rhoLout, double &rhoVout);
578 
581  bool isAlias(std::string name);
582 
585 
588  void enable_EXTTP(void);
590  bool isenabled_EXTTP(void);
592  void disable_EXTTP(void);
593 
596  void enable_TTSE_LUT(void);
598  bool isenabled_TTSE_LUT(void);
600  void disable_TTSE_LUT(void);
602  void enable_TTSE_LUT_writing(void);
604  bool isenabled_TTSE_LUT_writing(void);
606  void disable_TTSE_LUT_writing(void);
608  void set_TTSESat_LUT_size(int Nsat);
610  void set_TTSESinglePhase_LUT_size(int Np, int Nh);
612  void set_TTSESinglePhase_LUT_range(double hmin, double hmax, double pmin, double pmax);
614  void get_TTSESinglePhase_LUT_range(double *hmin, double *hmax, double *pmin, double *pmax);
616  bool build_TTSE_LUT(bool force = false);
618  double interpolate_in_TTSE_LUT(long iParam, long iInput1, double Input1, long iInput2, double Input2);
619 
621  std::string to_json();
622 };
623 
624 
625 
626 #endif
struct HSContainer HS
The point that is used to reduce the T and rho for EOS.
Definition: FluidClass.h:223
void rhosatPure(double T, double &rhoLout, double &rhoVout, double &pout, double omega, bool use_guesses)
std::vector< double > a_hs_satL
Definition: FluidClass.h:38
char * get_namec()
Returns a char* with the name of the fluid.
Definition: FluidClass.h:237
double drhoVdT_sat
Derivative of density w.r.t. temperature along the saturated vapor curve.
Definition: FluidClass.h:114
virtual double d3phir_dDelta_dTau2(double tau, double delta)
Definition: FluidClass.cpp:362
std::vector< phi_BC * > phirlist
Definition: FluidClass.h:178
double R()
Returns the mass-specific gas constant for the fluid in the desired units.
virtual double d2phi0_dTau2(double tau, double delta)
Definition: FluidClass.cpp:411
FluidCacheElement dphir_dDelta
Definition: FluidClass.h:143
double interpolateV(double T)
AncillaryCurveClass * h_ancillary
True if it is a pure fluid, false otherwise.
Definition: FluidClass.h:162
std::vector< std::vector< double > > hmat
Definition: FluidClass.h:78
virtual double d2phir_dDelta_dTau(double tau, double delta)
Definition: FluidClass.cpp:329
virtual void temperature_ph(double p, double h, double &Tout, double &rhoout, double &rhoL, double &rhoV, double &TsatLout, double &TsatVout, double T0=-1, double rho0=-1)
double reverseinterpolateL(double y)
bool build_TTSE_LUT(bool force=false)
Build of the TTSE LUT.
virtual void temperature_ps(double p, double s, double &Tout, double &rhoout, double &rhoL, double &rhoV, double &TsatLout, double &TsatVout)
struct FluidLimits limits
Definition: FluidClass.h:219
virtual double d3phir_dDelta3(double tau, double delta)
Definition: FluidClass.cpp:353
std::string EOS
Definition: FluidClass.h:120
virtual double density_Tp(double T, double p)
Definition: FluidClass.cpp:719
double reverseinterpolateV(double y)
std::string VISCOSITY
Definition: FluidClass.h:122
double rhoendV
Saturated vapor density at the last temperature for which the conventional methods can be used...
Definition: FluidClass.h:110
virtual void temperature_hs(double h, double s, double &Tout, double &rhoout, double &rhoL, double &rhoV, double &TsatLout, double &TsatVout)
void enable_TTSE_LUT_writing(void)
Enable the writing of TTSE tables to file.
unsigned int Nsat_TTSE
Definition: FluidClass.h:172
virtual void saturation_s(double s, int Q, double &Tsatout, double &rhoout, double &TsatLout, double &TsatVout, double &rhoLout, double &rhoVout)
Definition: FluidClass.cpp:803
double Tsat_anc(double p, double Q)
bool isenabled_TTSE_LUT_writing(void)
Check if the writing of TTSE tables to file is enabled.
double rhoVtriple
Definition: FluidClass.h:43
virtual double d3phi0_dTau3(double tau, double delta)
Definition: FluidClass.cpp:419
double psatV_anc(double T)
Definition: FluidClass.h:380
virtual void saturation_h(double h, double Tmin, double Tmax, int Q, double &Tsatout, double &rhoout, double &TsatLout, double &TsatVout, double &rhoLout, double &rhoVout)
Definition: FluidClass.cpp:875
virtual double viscosity_residual(double T, double rho)
Definition: FluidClass.h:468
bool enabled_EXTTP
Definition: FluidClass.h:584
double hmin_TTSE
Definition: FluidClass.h:171
std::vector< std::vector< double > > viscmat
Definition: FluidClass.h:78
double interpolateL(double T)
std::vector< std::string > get_aliases()
Definition: FluidClass.h:241
double specific_heat_p_ideal_Trho(double T)
Definition: FluidClass.cpp:497
virtual double viscosity_background(double T, double rho)
Definition: FluidClass.h:477
PressureUnit p
Definition: FluidClass.h:50
virtual double d3phir_dTau3(double tau, double delta)
Definition: FluidClass.cpp:346
std::string ECSReferenceFluid
A list of aliases of names for the Fluid, each element is a std::string instance. ...
Definition: FluidClass.h:154
std::string CAS
Definition: FluidClass.h:44
std::vector< std::vector< double > > pmat
Definition: FluidClass.h:78
FluidCacheElement d2phir_dDelta2
Definition: FluidClass.h:143
std::string name
A container to hold the cache for residual Helmholtz derivatives.
Definition: FluidClass.h:151
AncillaryCurveClass * s_ancillary
Definition: FluidClass.h:163
virtual double phi0(double tau, double delta)
Definition: FluidClass.cpp:381
FluidCacheElement d2phir_dTau2
Definition: FluidClass.h:143
std::string TransportReference
A std::string that contains a reference for thermo properties for the fluid.
Definition: FluidClass.h:158
void set_TTSESinglePhase_LUT_range(double hmin, double hmax, double pmin, double pmax)
Over-ride the default range of the single-phase LUT.
virtual double ECS_psi_viscosity(double rhor)
Definition: FluidClass.h:410
std::string to_json()
Export this fluid as a JSON file;.
double viscosity_ECS_Trho(double T, double rho, Fluid *ReferenceFluid)
FluidCache cache
Definition: FluidClass.h:150
void enable_EXTTP(void)
double hL_Tmin
Definition: FluidClass.h:37
double gibbs_Trho(double T, double rho)
Definition: FluidClass.cpp:513
virtual double psat(double T)
Definition: FluidClass.h:359
double cpsatV_anc(double T)
double rhoendL
Saturated liquid density at the last temperature for which the conventional methods can be used...
Definition: FluidClass.h:108
std::string CP0
Definition: FluidClass.h:121
double pressure_Trho(double T, double rho)
Definition: FluidClass.cpp:449
void disable_EXTTP(void)
Disable the TTSE.
virtual double d3phi0_dDelta3(double tau, double delta)
Definition: FluidClass.h:274
double drhodT_pL_anc(double T)
AncillaryCurveClass(Fluid *pFluid, std::string Output)
Definition: FluidClass.h:63
std::vector< double > pvec
Definition: FluidClass.h:79
double molemass
Definition: FluidClass.h:43
std::vector< double > yL
Definition: FluidClass.h:65
long phase_prho_indices(double p, double rho, double &T, double &TL, double &TV, double &rhoL, double &rhoV)
double conductivity_critical(double T, double rho, double qd=2e9, double GAMMA=0.0496, double zeta0=1.94e-10)
double psatL_anc(double T)
Definition: FluidClass.h:374
std::vector< std::string > aliases
The REFPROP-compliant name if REFPROP-"name" is not a compatible fluid name. If not included...
Definition: FluidClass.h:153
double rho_hmax
Definition: FluidClass.h:37
virtual double dphi0_dTau(double tau, double delta)
Definition: FluidClass.cpp:403
double entropy_Trho(double T, double rho)
Definition: FluidClass.cpp:473
double _get_rho_guess(double T, double p)
double hmax_TTSE
Definition: FluidClass.h:171
FluidCacheElement phir
Definition: FluidClass.h:143
double density_Tp_Soave(double T, double p, int iValue=0)
Get the density using the Soave EOS.
Definition: FluidClass.cpp:543
struct CriticalStruct reduce
A pointer to the point that is used to reduce the T and rho for EOS.
Definition: FluidClass.h:222
double internal_energy_Trho(double T, double rho)
Definition: FluidClass.cpp:465
long phase_Trho_indices(double T, double rho, double &pL, double &pV, double &rhoL, double &rhoV)
Return the phase using the phase flags from phase enum in CoolProp.h.
std::string get_REFPROPname()
Definition: FluidClass.h:238
void set_TTSESinglePhase_LUT_size(int Np, int Nh)
Over-ride the default size of the single-phase LUT.
void update(Fluid *pFluid, std::string Output)
std::string get_name()
Returns a std::string with the name of the fluid.
Definition: FluidClass.h:235
double Tmax
Definition: FluidClass.h:54
void rebuild_CriticalSplineConstants_T()
Rebuild the constants.
double Ttriple
Definition: FluidClass.h:43
void rhosatPure_BrentrhoV(double T, double &rhoLout, double &rhoVout, double &pout)
virtual double surface_tension_T(double T)
virtual void ECSParams(double *e_k, double *sigma)
virtual double rhosatV(double T)
Definition: FluidClass.h:371
double speed_sound_Trho(double T, double rho)
Definition: FluidClass.cpp:503
double cpsatL_anc(double T)
std::string get_TransportReference()
Definition: FluidClass.h:240
virtual double viscosity_dilute(double T, double e_k, double sigma)
TTSETwoPhaseTableClass TTSESatV
Definition: FluidClass.h:227
Fluid is the abstract base class that is employed by all the other fluids.
Definition: FluidClass.h:147
FluidCacheElement dphir_dTau
Definition: FluidClass.h:143
virtual double dphir_dTau(double tau, double delta)
Definition: FluidClass.cpp:295
std::string ECS_FITS
Definition: FluidClass.h:125
virtual double dphi0_dDelta(double tau, double delta)
Definition: FluidClass.cpp:389
EnvironmentalFactorsStruct environment
Definition: FluidClass.h:176
struct CriticalStruct * preduce
Definition: FluidClass.h:221
double rhoLtriple
Definition: FluidClass.h:43
std::string EOSReference
The critical qd parameter for the Olchowy-Sengers cross-over term.
Definition: FluidClass.h:157
long phase_Tp_indices(double T, double p, double &pL, double &pV, double &rhoL, double &rhoV)
Return the phase using the phase flags from phase enum in CoolProp.h.
void enable_TTSE_LUT(void)
Fluid()
A vector of instances of the phi_BC classes for the ideal-gas Helmholtz energy contribution.
Definition: FluidClass.h:185
void set_TTSESat_LUT_size(int Nsat)
Over-ride the default size of both of the saturation LUT.
double hsatV_anc(double T)
std::vector< double > xL
Definition: FluidClass.h:65
CriticalSplineStruct_T(double Tend, double rhoendL, double rhoendV, double drhoLdT_sat, double drhoVdT_sat)
Definition: FluidClass.h:92
std::vector< std::vector< double > > cvmat
Definition: FluidClass.h:78
TTSESinglePhaseTableClass TTSESinglePhase
Definition: FluidClass.h:228
std::string REFPROPname
The name of the fluid.
Definition: FluidClass.h:152
std::string ECS_LENNARD_JONES
Definition: FluidClass.h:124
bool isenabled_EXTTP(void)
Check if TTSE is enabled.
FluidCacheElement d2phir_dDelta_dTau
Definition: FluidClass.h:143
std::string get_EOSReference()
Definition: FluidClass.h:239
std::vector< std::vector< double > > smat
Definition: FluidClass.h:78
bool isPure
A std::string that contains a reference for the transport properties of the fluid.
Definition: FluidClass.h:159
std::string SURFACE_TENSION
Definition: FluidClass.h:126
double hsatL_anc(double T)
std::vector< int > n_hs_satL
Definition: FluidClass.h:39
double interpolate_in_TTSE_LUT(long iParam, long iInput1, double Input1, long iInput2, double Input2)
Interpolate within the TTSE LUT.
double specific_heat_v_Trho(double T, double rho)
Definition: FluidClass.cpp:480
double drhodT_pV_anc(double T)
void rhosatPure_Brent(double T, double &rhoLout, double &rhoVout, double &pout)
A document for parsing JSON text as DOM.
Definition: document.h:691
CriticalSplineStruct_T CriticalSpline_T
Definition: FluidClass.h:231
double pmin_TTSE
Definition: FluidClass.h:171
double Tsat(double p, double Q, double T_guess)
virtual double psatV(double T)
Definition: FluidClass.h:365
void rhosatPure_Akasaka(double T, double &rhoLout, double &rhoVout, double &pout, double omega, bool use_guesses=false)
double pmax
Definition: FluidClass.h:54
virtual double d3phi0_dDelta2_dTau(double tau, double delta)
Definition: FluidClass.h:275
virtual ~Fluid()
Definition: FluidClass.cpp:147
void disable_TTSE_LUT_writing(void)
Disable the writing of TTSE tables to file.
double density_Tp_PengRobinson(double T, double p, int solution)
Definition: FluidClass.cpp:607
params
virtual double d2phir_dDelta2(double tau, double delta)
Definition: FluidClass.cpp:276
double sV_Tmin
Definition: FluidClass.h:37
double drhodT_p_Trho(double T, double rho)
Definition: FluidClass.cpp:537
struct CriticalStruct crit
Definition: FluidClass.h:218
double hV_Tmin
Definition: FluidClass.h:37
std::vector< double > ConformalTemperature(Fluid *InterestFluid, Fluid *ReferenceFluid, double T, double rho, double T0, double rho0, std::string *errstring)
double T_hmax
Definition: FluidClass.h:37
double pmax_TTSE
Definition: FluidClass.h:171
std::vector< std::vector< double > > umat
Definition: FluidClass.h:78
BibTeXKeysStruct BibTeXKeys
Definition: FluidClass.h:175
double sL_Tmin
Definition: FluidClass.h:37
double dpdrho_Trho(double T, double rho)
Definition: FluidClass.cpp:529
virtual double phir(double tau, double delta)
Definition: FluidClass.cpp:237
bool enabled_TTSE_LUT
Parameters for the Tabular Taylor Series Expansion (TTSE) Method.
Definition: FluidClass.h:584
double ptriple
Definition: FluidClass.h:43
double temperature_prho(double p, double rho, double T0)
virtual double ECS_f_int(double T)
Definition: FluidClass.h:420
unsigned int Np_TTSE
Definition: FluidClass.h:172
virtual double conductivity_background(double T, double rho)
Definition: FluidClass.h:443
virtual double d2phi0_dDelta2(double tau, double delta)
Definition: FluidClass.cpp:396
std::string phase_Tp(double T, double p, double &pL, double &pV, double &rhoL, double &rhoV)
Return the phase given the temperature and pressure.
void get_TTSESinglePhase_LUT_range(double *hmin, double *hmax, double *pmin, double *pmax)
Get the current range of the single-phase LUT.
std::vector< phi_BC * > phi0list
A vector of instances of the phi_BC classes for the residual Helmholtz energy contribution.
Definition: FluidClass.h:179
double dpdT_Trho(double T, double rho)
Definition: FluidClass.cpp:521
double specific_heat_p_Trho(double T, double rho)
Definition: FluidClass.cpp:487
double s_hmax
Definition: FluidClass.h:37
void post_load(rapidjson::Document &JSON, rapidjson::Document &JSON_CAS)
Definition: FluidClass.cpp:162
bool enable_writing_tables_to_files
Definition: FluidClass.h:584
bool isAlias(std::string name)
Definition: FluidClass.cpp:435
virtual double viscosity_Trho(double T, double rho)
Definition: FluidClass.cpp:788
virtual double ECS_chi_conductivity(double rhor)
Definition: FluidClass.h:415
double rhobar
Definition: FluidClass.h:49
double hmax
Definition: FluidClass.h:37
virtual double d3phi0_dDelta_dTau2(double tau, double delta)
Definition: FluidClass.h:276
virtual double d2phi0_dDelta_dTau(double tau, double delta)
Definition: FluidClass.cpp:427
bool isenabled_TTSE_LUT(void)
Check if TTSE is enabled.
std::vector< double > yV
Definition: FluidClass.h:65
double conductivity_ECS_Trho(double T, double rho, Fluid *ReferenceFluid)
std::vector< std::vector< double > > cp0mat
Definition: FluidClass.h:78
unsigned int Nh_TTSE
Definition: FluidClass.h:172
void saturation_VdW(double T, double &rhoL, double &rhoV, double &p, double s0=-1)
bool pure()
Returns true if the fluid is pure, false if pseudo-pure or a mixture.
Definition: FluidClass.h:243
virtual double d2phir_dTau2(double tau, double delta)
Definition: FluidClass.cpp:312
virtual double psatL(double T)
Definition: FluidClass.h:362
double temperature_prho_PengRobinson(double p, double rho)
Definition: FluidClass.cpp:687
TTSETwoPhaseTableClass TTSESatL
Definition: FluidClass.h:226
double interpolate_rho(Fluid *pFluid, int phase, double T)
virtual double dphir_dDelta(double tau, double delta)
Definition: FluidClass.cpp:257
std::vector< std::vector< double > > kmat
Definition: FluidClass.h:78
virtual double rhosatL(double T)
Definition: FluidClass.h:368
virtual void saturation_p(double p, bool UseLUT, double &TsatLout, double &TsatVout, double &rhoLout, double &rhoVout)
void add_alias(std::string alias)
Definition: FluidClass.h:215
double ssatL_anc(double T)
std::vector< double > Tvec
Definition: FluidClass.h:79
virtual double d3phir_dDelta2_dTau(double tau, double delta)
Definition: FluidClass.cpp:370
double ECS_qd
A string that gives the name of the fluids that should be used for the ECS method for transport prope...
Definition: FluidClass.h:156
std::vector< std::vector< double > > rhomat
Definition: FluidClass.h:78
std::vector< double > xV
Definition: FluidClass.h:65
virtual double conductivity_Trho(double T, double rho)
Definition: FluidClass.cpp:795
double enthalpy_Trho(double T, double rho)
Definition: FluidClass.cpp:457
void disable_TTSE_LUT(void)
Disable the TTSE.
double temperature_prho_VanDerWaals(double p, double rho)
Definition: FluidClass.cpp:710
virtual void density_Ts(double T, double s, double &rhoout, double &pout, double &rhoLout, double &rhoVout, double &psatLout, double &psatVout)
virtual void saturation_T(double T, bool UseLUT, double &psatLout, double &psatVout, double &rhoLout, double &rhoVout)
Definition: FluidClass.cpp:948
double Tmin
Definition: FluidClass.h:54
std::string HSReferenceState
Definition: FluidClass.h:45
std::vector< std::vector< double > > cpmat
Definition: FluidClass.h:78
double rhomax
Definition: FluidClass.h:54
double drhoLdT_sat
Derivative of density w.r.t. temperature along the saturated liquid curve.
Definition: FluidClass.h:112
std::vector< std::vector< double > > dpdTmat
Definition: FluidClass.h:78
double accentricfactor
Definition: FluidClass.h:43
bool built_TTSE_LUT
Definition: FluidClass.h:584
double Tend
The last temperature for which the conventional methods can be used.
Definition: FluidClass.h:106
double ssatV_anc(double T)
std::string CONDUCTIVITY
Definition: FluidClass.h:123
std::string phase_Trho(double T, double rho, double &pL, double &pV, double &rhoL, double &rhoV)
Return the phase given the temperature and the density.