CoolProp
4.2.5
An open-source fluid property and humid air property database
|
#include "CoolProp.h"
#include "REFPROP.h"
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <exception>
#include <stdio.h>
#include "string.h"
#include "FluidClass.h"
#include "CoolPropTools.h"
#include "CPExceptions.h"
#include "Brine.h"
#include "Solvers.h"
#include "CPState.h"
#include "IncompLiquid.h"
#include "TTSE.h"
#include "purefluids/R290.h"
#include "purefluids/R134a.h"
#include "AllFluids.h"
#include "gitrevision.h"
#include "version.h"
#include "Catch/catch.hpp"
Go to the source code of this file.
Functions | |
double | _CoolProp_Fluid_PropsSI (long iOutput, long iName1, double Value1, long iName2, double Value2, Fluid *pFluid) |
The lower-level methods that can throw exceptions. More... | |
double | _PropsSI (std::string Output, std::string Name1, double Prop1, std::string Name2, double Prop2, std::string Ref) |
double | _Props1SI (std::string FluidName, std::string Output) |
void | set_warning (std::string warning) |
int | _get_standard_unit_system () |
void | _set_standard_unit_system (int unit_sys) |
std::map< std::string, long > | param_map (map_data, map_data+sizeof map_data/sizeof map_data[0]) |
void | set_err_string (std::string error_string) |
void | set_phase (std::string Phase_str) |
Nearly deprecated function. More... | |
Fluid * | get_fluid (long iFluid) |
long | get_Fluid_index (std::string FluidName) |
bool | add_REFPROP_fluid (std::string FluidName) |
Add a REFPROP fluid to the fluid listing in CoolProp. More... | |
std::string | get_ASHRAE34 (std::string fluid) |
long | get_param_index (std::string param) |
long | getFluidType (std::string FluidName) |
EXPORT_CODE int CONVENTION | IsFluidType (const char *Ref, const char *Type) |
double | _T_hp_secant (std::string Ref, double h, double p, double T_guess) |
std::string | Phase_Trho (std::string Fluid, double T, double rho) |
std::string | Phase (std::string Fluid, double T, double p) |
std::string | Phase_Tp (std::string Fluid, double T, double p) |
double | _Props1 (std::string FluidName, std::string Output) |
double | Props1SI (std::string FluidName, std::string Output) |
double | Props1 (std::string FluidName, std::string Output) |
EXPORT_CODE double CONVENTION | IProps (long iOutput, long iName1, double Prop1, long iName2, double Prop2, long iFluid) |
EXPORT_CODE double CONVENTION | IPropsSI (long iOutput, long iName1, double Prop1, long iName2, double Prop2, long iFluid) |
double | PropsSI (std::string Output, std::string Name1, double Prop1, std::string Name2, double Prop2, std::string Ref) |
double | Props (std::string Output, std::string Name1, double Prop1, std::string Name2, double Prop2, std::string Ref) |
double | Props (std::string Output, char Name1, double Prop1, char Name2, double Prop2, std::string Ref) |
double | _CoolProp_Deriv_Terms (long iTerm, double T, double rho, Fluid *pFluid) |
Calculate some interesting derivatives. More... | |
double | DerivTerms (long iTerm, double T, double rho, Fluid *pFluid) |
double | DerivTerms (std::string Term, double T, double rho, std::string Fluidname) |
int | set_reference_stateS (std::string Ref, std::string reference_state) |
int | set_reference_stateP (Fluid *pFluid, std::string reference_state) |
int | set_reference_stateD (std::string Ref, double T, double rho, double h0, double s0) |
std::string | get_BibTeXKey (std::string Ref, std::string item) |
std::string | get_global_param_string (std::string ParamName) |
std::string | get_fluid_param_string (std::string FluidName, std::string ParamName) |
TEST_CASE ("Check ancillaries and surface tension","[fast]") | |
Variables | |
int | global_Phase = -1 |
bool | global_SinglePhase = false |
bool | global_SaturatedL = false |
bool | global_SaturatedV = false |
int | unit_system = UNIT_SYSTEM_KSI |
std::pair< std::string, long > | map_data [] |
FluidsContainer | Fluids = FluidsContainer() |
Calculate some interesting derivatives.
Definition at line 913 of file CoolProp.cpp.
double _CoolProp_Fluid_PropsSI | ( | long | iOutput, |
long | iName1, | ||
double | Value1, | ||
long | iName2, | ||
double | Value2, | ||
Fluid * | pFluid | ||
) |
The lower-level methods that can throw exceptions.
Definition at line 765 of file CoolProp.cpp.
int _get_standard_unit_system | ( | ) |
Returns the value for the integer flag corresponding to the current set of units
Definition at line 61 of file CoolProp.cpp.
double _Props1 | ( | std::string | FluidName, |
std::string | Output | ||
) |
Definition at line 556 of file CoolProp.cpp.
double _Props1SI | ( | std::string | FluidName, |
std::string | Output | ||
) |
Definition at line 514 of file CoolProp.cpp.
double _PropsSI | ( | std::string | Output, |
std::string | Name1, | ||
double | Prop1, | ||
std::string | Name2, | ||
double | Prop2, | ||
std::string | Ref | ||
) |
Definition at line 613 of file CoolProp.cpp.
void _set_standard_unit_system | ( | int | ) |
Sets the flag for the integer flag corresponding to the current set of units
val | The integer value for the current set of units, one of enumerated values UNIT_SYSTEM_SI, UNIT_SYSTEM_KSI (see GlobalConstants.h) |
Definition at line 62 of file CoolProp.cpp.
double _T_hp_secant | ( | std::string | Ref, |
double | h, | ||
double | p, | ||
double | T_guess | ||
) |
Definition at line 448 of file CoolProp.cpp.
bool add_REFPROP_fluid | ( | std::string | FluidName | ) |
Add a REFPROP fluid to the fluid listing in CoolProp.
Definition at line 253 of file CoolProp.cpp.
Return some low level derivative terms, see source for a complete list
iTerm | long desired output |
T | Temperature [K] |
rho | Density [kg/m^3] |
pFluid | Pointer to Fluid instance |
Definition at line 1001 of file CoolProp.cpp.
double DerivTerms | ( | std::string | Term, |
double | T, | ||
double | rho, | ||
std::string | FluidName | ||
) |
Return some low level derivative terms, see source for a complete list
Term | String, some options are "phir" (residual Helmholtz energy),"dphir_dDelta", "dphir_dTau", etc. |
T | Temperature [K] |
rho | Density [kg/m^3] |
FluidName | String |
Definition at line 1004 of file CoolProp.cpp.
std::string get_ASHRAE34 | ( | std::string | fluid | ) |
Definition at line 275 of file CoolProp.cpp.
std::string get_BibTeXKey | ( | std::string | FluidName, |
std::string | item | ||
) |
Returns the BibTeX key from the bibtex library of CoolProp corresponding to the item requested
FluidName | The name of the fluid |
item | String, one of "EOS","CP0", "VISCOSITY", "CONDUCTIVITY", "ECS_LENNARD_JONES", "ECS_FITS", "SURFACE_TENSION" |
Definition at line 1122 of file CoolProp.cpp.
Get a pointer to a fluid that has been loaded
iFluid | The integer index for the fluid (get from get_Fluid_index) |
Definition at line 236 of file CoolProp.cpp.
long get_Fluid_index | ( | std::string | FluidName | ) |
Get the fluid index for a given fluid name
FluidName | The name for a fluid |
Definition at line 239 of file CoolProp.cpp.
std::string get_fluid_param_string | ( | std::string | FluidName, |
std::string | ParamName | ||
) |
Get a string for a value from a fluid (numerical values can be obtained from Props1 function)
FluidName | The name of the fluid |
ParamName | A string, one of "aliases", "CAS", "CAS_number", "ASHRAE34", "REFPROPName","REFPROP_name", "TTSE_mode" |
Definition at line 1173 of file CoolProp.cpp.
std::string get_global_param_string | ( | std::string | ParamName | ) |
Get a globally-defined string
ParamName | A string, one of "version", "errstring", "warnstring", "gitrevision", "FluidsList", "fluids_list" |
Definition at line 1142 of file CoolProp.cpp.
long get_param_index | ( | std::string | param | ) |
Get the parameter index for a given parameter
param | The string for an input or output parameter |
Definition at line 288 of file CoolProp.cpp.
long getFluidType | ( | std::string | FluidName | ) |
Get a long that represents the fluid type
FluidName | The fluid name as a string |
Definition at line 369 of file CoolProp.cpp.
EXPORT_CODE double CONVENTION IProps | ( | long | iOutput, |
long | iName1, | ||
double | Prop1, | ||
long | iName2, | ||
double | Prop2, | ||
long | iFluid | ||
) |
Definition at line 758 of file CoolProp.cpp.
EXPORT_CODE double CONVENTION IPropsSI | ( | long | iOutput, |
long | iName1, | ||
double | Prop1, | ||
long | iName2, | ||
double | Prop2, | ||
long | iFluid | ||
) |
Definition at line 861 of file CoolProp.cpp.
EXPORT_CODE int CONVENTION IsFluidType | ( | const char * | Ref, |
const char * | Type | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 390 of file CoolProp.cpp.
std::string Phase | ( | std::string | FluidName, |
double | T, | ||
double | p | ||
) |
Return the phase of the given state point with temperature, pressure as inputs
FluidName | The name of the fluid |
T | Temperature [K] |
p | Pressure [kPa] |
Definition at line 490 of file CoolProp.cpp.
std::string Phase_Tp | ( | std::string | FluidName, |
double | T, | ||
double | p | ||
) |
Return the phase of the given state point with temperature, pressure as inputs
FluidName | The name of the fluid |
T | Temperature [K] |
p | Pressure [kPa] |
Definition at line 504 of file CoolProp.cpp.
std::string Phase_Trho | ( | std::string | FluidName, |
double | T, | ||
double | rho | ||
) |
Return the phase of the given state point with temperature, density as inputs
FluidName | The name of the fluid |
T | Temperature [K] |
rho | Density [kg/m^3] |
Definition at line 476 of file CoolProp.cpp.
double Props | ( | std::string | Output, |
std::string | Name1, | ||
double | Prop1, | ||
std::string | Name2, | ||
double | Prop2, | ||
std::string | FluidName | ||
) |
Return a value that depends on the thermodynamic state
Output | The output parameter, one of "T","D","H",etc. |
Name1 | The first state variable name, one of "T","D","H",etc. |
Prop1 | The first state variable value |
Name2 | The second state variable name, one of "T","D","H",etc. |
Prop2 | The second state variable value |
FluidName | The fluid name |
Definition at line 902 of file CoolProp.cpp.
double Props | ( | std::string | Output, |
char | Name1, | ||
double | Prop1, | ||
char | Name2, | ||
double | Prop2, | ||
std::string | FluidName | ||
) |
Return a value that depends on the thermodynamic state
Output | The output parameter, one of "T","D","H",etc. |
Name1 | The first state variable name, one of "T","D","H",etc. |
Prop1 | The first state variable value |
Name2 | The second state variable name, one of "T","D","H",etc. |
Prop2 | The second state variable value |
FluidName | The fluid name |
Definition at line 907 of file CoolProp.cpp.
double Props1 | ( | std::string | FluidName, |
std::string | Output | ||
) |
Return a fluid value that does not depend on the thermodynamic state
FluidName | The name of the fluid |
Output | The name of the output parameter, some options are "Ttriple", "Tcrit", "pcrit", "Tmin", "molemass", "rhocrit", "accentric" (not all parameters are valid for all fluids) |
Definition at line 586 of file CoolProp.cpp.
double Props1SI | ( | std::string | FluidName, |
std::string | Output | ||
) |
Return a fluid value that does not depend on the thermodynamic state
FluidName | The name of the fluid |
Output | The name of the output parameter, some options are "Ttriple", "Tcrit", "pcrit", "Tmin", "molemass", "rhocrit", "accentric" (not all parameters are valid for all fluids) |
Definition at line 570 of file CoolProp.cpp.
double PropsSI | ( | std::string | Output, |
std::string | Name1, | ||
double | Prop1, | ||
std::string | Name2, | ||
double | Prop2, | ||
std::string | FluidName | ||
) |
Return a value that depends on the thermodynamic state
Output | The output parameter, one of "T","D","H",etc. |
Name1 | The first state variable name, one of "T","D","H",etc. |
Prop1 | The first state variable value |
Name2 | The second state variable name, one of "T","D","H",etc. |
Prop2 | The second state variable value |
FluidName | The fluid name |
Definition at line 886 of file CoolProp.cpp.
void set_err_string | ( | std::string | err_string | ) |
Set the global error string
err_string | The error string to use |
Definition at line 191 of file CoolProp.cpp.
void set_phase | ( | std::string | Phase_str | ) |
Nearly deprecated function.
Definition at line 196 of file CoolProp.cpp.
int set_reference_stateD | ( | std::string | FluidName, |
double | T, | ||
double | rho, | ||
double | h0, | ||
double | s0 | ||
) |
Set the reference state based on a state point
FluidName | The name of the fluid |
T | Temperature at reference state [K] |
rho | Density at reference state [kg/m^3] |
h0 | Enthalpy at reference state [kJ/kg] |
s0 | Entropy at references state [kJ/kg/K] |
Definition at line 1100 of file CoolProp.cpp.
int set_reference_stateP | ( | Fluid * | pFluid, |
std::string | reference_state | ||
) |
Set the reference state for a pointer to a fluid (not exposed)
pFluid | A pointer to a Fluid instance |
reference_state | The reference state to use, one of "IIR" (h=200 kJ/kg, s=1 kJ/kg/K at 0C sat. liq.) "ASHRAE" (h=0,s=0 @ -40C sat liq), "NBP" (h=0,s=0 @ 1.0 bar sat liq.) |
Definition at line 1049 of file CoolProp.cpp.
int set_reference_stateS | ( | std::string | FluidName, |
std::string | reference_state | ||
) |
Set the reference state based on a string representation (consistent naming with RFPROP)
FluidName | The name of the fluid |
reference_state | The reference state to use, one of "IIR" (h=200 kJ/kg, s=1 kJ/kg/K at 0C sat. liq.) "ASHRAE" (h=0,s=0 @ -40C sat liq), "NBP" (h=0,s=0 @ 1.0 bar sat liq.) |
Definition at line 1037 of file CoolProp.cpp.
void set_warning | ( | std::string | warning | ) |
An internal function to set the global warning string (API for warnings is not formalized)
warning | The string to set as the warning string |
Definition at line 59 of file CoolProp.cpp.
TEST_CASE | ( | "Check ancillaries and surface tension" | , |
"" | [fast] | ||
) |
Definition at line 1231 of file CoolProp.cpp.
FluidsContainer Fluids = FluidsContainer() |
Definition at line 189 of file CoolProp.cpp.
int global_Phase = -1 |
Definition at line 51 of file CoolProp.cpp.
bool global_SaturatedL = false |
Definition at line 53 of file CoolProp.cpp.
bool global_SaturatedV = false |
Definition at line 54 of file CoolProp.cpp.
bool global_SinglePhase = false |
Definition at line 52 of file CoolProp.cpp.
std::pair<std::string, long> map_data[] |
Definition at line 65 of file CoolProp.cpp.
int unit_system = UNIT_SYSTEM_KSI |
Definition at line 57 of file CoolProp.cpp.