CoolProp
CoolProp.h
1 /*
2 This header file includes the high level API that is meant to be accessed via C++. Functions may accept C++ types like std::vector
3 
4 For the C-style wrapper, refer to CoolPropLib.h
5 
6 \sa CoolPropLib.h
7 */
8 
16 #ifndef CoolProp_H
17 #define CoolProp_H
18 
19  #include <string>
20  #include <vector>
21  #include "DataStructures.h"
22 
23  namespace CoolProp {
24 
28  double Props1SI(std::string FluidName, std::string Output);
36  double PropsSI(const std::string &Output, const std::string &Name1, double Prop1, const std::string &Name2, double Prop2, const std::string &FluidName);
37 
49  std::vector<std::vector<double> > PropsSImulti(const std::vector<std::string> &Outputs,
50  const std::string &Name1,
51  const std::vector<double> &Prop1,
52  const std::string &Name2,
53  const std::vector<double> &Prop2,
54  const std::string &backend,
55  const std::vector<std::string> &fluids,
56  const std::vector<double> &fractions);
57 
60  int get_debug_level();
63  void set_debug_level(int level);
64 
67  void set_error_string(const std::string &error);
70  void set_warning_string(const std::string &warning);
71 
72  /* \brief Extract a value from the saturation ancillary
73  *
74  * @param fluid_name The name of the fluid to be used - HelmholtzEOS backend only
75  * @param output The desired output variable ("P" for instance for pressure)
76  * @param Q The quality, 0 or 1
77  * @param input The input variable ("T")
78  * @param value The input value
79  */
80  double saturation_ancillary(const std::string &fluid_name, const std::string &output, int Q, const std::string &input, double value);
81 
85  std::string get_global_param_string(const std::string &ParamName);
86 
87  /*/// Get a long that represents the fluid type
90  long getFluidType(std::string FluidName);*/
91 
110  std::string get_fluid_param_string(const std::string &FluidName, const std::string &ParamName);
111 
119  bool is_valid_fluid_string(const std::string &fluidstring);
120 
127  bool add_fluids_as_JSON(const std::string &backend, const std::string &fluidstring);
128 
149  void set_reference_stateS(const std::string &FluidName, const std::string &reference_state);
150 
157  void set_reference_stateD(const std::string &FluidName, double T, double rhomolar, double hmolar0, double smolar0);
158 
166  std::string PhaseSI(const std::string &Name1, double Prop1, const std::string &Name2, double Prop2, const std::string &FluidName);
167 
174  void extract_backend(std::string fluid_string, std::string &backend, std::string &fluid);
175 
182  std::string extract_fractions(const std::string &fluid_string, std::vector<double> &fractions);
183 
187  std::string phase_lookup_string(phases Phase);
188 
189  } /* namespace CoolProp */
190 #endif
191 
std::string PhaseSI(const std::string &Name1, double Prop1, const std::string &Name2, double Prop2, const std::string &FluidName)
Return a string representation of the phase.
Definition: CoolProp.cpp:1072
std::string get_global_param_string(const std::string &ParamName)
Get a globally-defined string.
Definition: CoolProp.cpp:959
bool is_valid_fluid_string(const std::string &fluidstring)
Check if the fluid name is valid.
Definition: CoolProp.cpp:822
void set_reference_stateD(const std::string &FluidName, double T, double rhomolar, double hmolar0, double smolar0)
Set the reference state based on a thermodynamic state point specified by temperature and molar densi...
Definition: CoolProp.cpp:943
double PropsSI(const std::string &Output, const std::string &Name1, double Prop1, const std::string &Name2, double Prop2, const std::string &FluidName)
Return a value that depends on the thermodynamic state.
Definition: CoolProp.cpp:589
phases
These are constants for the phases of the fluid.
Definition: DataStructures.h:156
int get_debug_level()
Get the debug level.
Definition: CoolProp.cpp:62
void set_warning_string(const std::string &warning)
An internal function to set the global warning string.
Definition: CoolProp.cpp:68
bool add_fluids_as_JSON(const std::string &backend, const std::string &fluidstring)
Add fluids as a JSON-formatted string.
Definition: CoolProp.cpp:630
std::string phase_lookup_string(phases Phase)
An internal function to extract the phase string, given the phase index; Handy for printing the actua...
Definition: CoolProp.cpp:1047
void extract_backend(std::string fluid_string, std::string &backend, std::string &fluid)
Extract the backend from a string - something like "HEOS::Water" would split to "HEOS" and "Water"...
Definition: CoolProp.cpp:82
std::vector< std::vector< double > > PropsSImulti(const std::vector< std::string > &Outputs, const std::string &Name1, const std::vector< double > &Prop1, const std::string &Name2, const std::vector< double > &Prop2, const std::string &backend, const std::vector< std::string > &fluids, const std::vector< double > &fractions)
Get a matrix of outputs for a given input.
Definition: CoolProp.cpp:554
void set_reference_stateS(const std::string &FluidName, const std::string &reference_state)
Set the reference state based on a string representation.
Definition: CoolProp.cpp:849
void set_error_string(const std::string &error)
Set the global error string.
Definition: CoolProp.cpp:71
double Props1SI(std::string FluidName, std::string Output)
Return a value that does not depend on the thermodynamic state - this is a convenience function that ...
Definition: CoolProp.cpp:773
void set_debug_level(int level)
Set the debug level.
Definition: CoolProp.cpp:61
This file contains flash routines in which the state is unknown, and a solver of some kind must be us...
Definition: AbstractState.h:19
std::string get_fluid_param_string(const std::string &FluidName, const std::string &ParamName)
Get a string for a value from a fluid (numerical values for the fluid can be obtained from Props1SI f...
Definition: CoolProp.cpp:1020
std::string extract_fractions(const std::string &fluid_string, std::vector< double > &fractions)
Extract fractions (molar, mass, etc.) encoded in the string if any.
Definition: CoolProp.cpp:127