3 #define _CRTDBG_MAP_ALLOC
4 #define _CRT_SECURE_NO_WARNINGS
30 printf(
"Testing %s \n",this->
get_name().c_str());
31 printf(
"Inputs: T = %3.3f degC \t p = %2.4f bar \n",T_K-273.15,p/1e5);
33 result = this->
rho(T_K,p);
34 printf(
"From object: rho = %4.2f \t kg/m3 \n",result);
35 result = this->
cp(T_K,p);
36 printf(
"From object: cp = %1.5f \t kJ/kg-K \n",result/1e3);
37 result = this->
h(T_K,p);
38 printf(
"From object: h = %3.3f \t kJ/kg \n",result/1e3);
39 result = this->
s(T_K,p);
40 printf(
"From object: s = %1.5f \t kJ/kg-K \n",result/1e3);
41 result = this->
visc(T_K,p);
42 printf(
"From object: eta = %1.5f \t 1e-5 Pa-s\n",result*1e5);
43 result = this->
cond(T_K,p);
44 printf(
"From object: lambda = %1.5f \t W/m-k \n",result*1e3);
45 result = this->
u(T_K,p);
46 printf(
"From object: u = %3.3f \t kJ/kg \n",result/1e3);
47 result = this->
psat(T_K);
48 printf(
"From object: psat = %2.4f \t bar \n",result/1e5);
65 throw ValueError(
"Please specify the minimum temperature.");
66 }
else if(
Tmax < 0.) {
67 throw ValueError(
"Please specify the maximum temperature.");
68 }
else if ( (
Tmin>T_K) || (T_K>
Tmax) ) {
84 double ps =
psat(T_K);
86 throw ValueError(
format(
"Equations are valid for liquid phase only: %f < %f. ",p,ps));
103 std::vector<IncompressibleLiquid*> tmpVector;
153 while (!liquid_list.empty()) {
154 delete liquid_list.back();
155 liquid_list.pop_back();
160 return liquid_list[index];
164 std::map<std::string,IncompressibleLiquid*>::iterator it;
166 it = liquid_map.find(name);
168 if (it != liquid_map.end() )
181 for (std::vector<IncompressibleLiquid*>::iterator it = liquid_list.begin(); it != liquid_list.end(); it++)
184 liquid_map[(*it)->get_name()] = *it;
193 if (pLiquid == NULL){
212 out = pLiquid->
rho(T,p_SI);
break;
214 out = pLiquid->
cp(T,p_SI);
break;
216 out = pLiquid->
s(T,p_SI);
break;
218 out = pLiquid->
u(T,p_SI);
break;
220 out = pLiquid->
h(T,p_SI);
break;
222 out = pLiquid->
visc(T,p_SI);
break;
224 out = pLiquid->
cond(T,p_SI);
break;
226 out = pLiquid->
getTmin();
break;
228 out = pLiquid->
getTmax();
break;
230 out = pLiquid->
psat(T);
break;
232 throw ValueError(
format(
"Your index [%d] is invalid for the incompressible liquid %s",iOutput,pLiquid->
getName().c_str()));
void testInputs(double T_K, double p)
Base class for simplified brine/solution models.
New fluids added with more coefficients.
double pIncompLiquidSI(long iOutput, double T, double p_SI, IncompressibleLiquid *pLiquid)
virtual double cp(double T_K, double p)
double pIncompLiquid(long iOutput, double T, double p, IncompressibleLiquid *pLiquid)
std::string getName() const
Base class for simplified brine/solution models.
virtual double u(double T_K, double p)
Internal energy as a function of temperature and pressure.
EXPORT_CODE int CONVENTION get_standard_unit_system(void)
std::string get_name() const
double IncompLiquidSI(long iOutput, double T, double p_SI, long iFluid)
double convert_from_SI_to_unit_system(long iInput, double value, int new_system)
virtual double rho(double T_K, double p)
Density as a function of temperature and pressure.
bool checkT(double T_K)
Check validity of temperature input.
bool IsIncompressibleLiquid(std::string name)
virtual double s(double T_K, double p)
Entropy as a function of temperature and pressure.
virtual double h(double T_K, double p)
Enthalpy as a function of temperature and pressure.
virtual double psat(double T_K)
Saturation pressure as a function of temperature.
IncompressibleLiquid * get_liquid(long index)
void set_liquids(std::vector< IncompressibleLiquid * > list)
double convert_from_unit_system_to_SI(long iInput, double value, int old_system)
bool checkP(double T_K, double p)
Check validity of pressure input.
virtual double cond(double T_K, double p)
Thermal conductivity as a function of temperature and pressure.
bool checkTP(double T, double p)
Check validity of temperature and pressure input.
virtual double visc(double T_K, double p)
Viscosity as a function of temperature and pressure.