1 #ifndef COOLPROP_CONFIGURATION
2 #define COOLPROP_CONFIGURATION
21 #define CONFIGURATION_KEYS_ENUM \
22 X(NORMALIZE_GAS_CONSTANTS, "NORMALIZE_GAS_CONSTANTS", true, "If true, for mixtures, the molar gas constant (R) will be set to the CODATA value") \
23 X(CRITICAL_WITHIN_1UK, "CRITICAL_WITHIN_1UK", true, \
24 "If true, any temperature within 1 uK of the critical temperature will be considered to be AT the critical point") \
25 X(CRITICAL_SPLINES_ENABLED, "CRITICAL_SPLINES_ENABLED", true, \
26 "If true, the critical splines will be used in the near-vicinity of the critical point") \
27 X(SAVE_RAW_TABLES, "SAVE_RAW_TABLES", false, "If true, the raw, uncompressed tables will also be written to file") \
28 X(ALTERNATIVE_TABLES_DIRECTORY, "ALTERNATIVE_TABLES_DIRECTORY", "", \
29 "If provided, this path will be the root directory for the tabular data. Otherwise, ${HOME}/.CoolProp/Tables is used") \
30 X(ALTERNATIVE_REFPROP_PATH, "ALTERNATIVE_REFPROP_PATH", "", \
31 "An alternative path to be provided to the directory that contains REFPROP's fluids and mixtures directories. If provided, the SETPATH " \
32 "function will be called with this directory prior to calling any REFPROP functions.") \
33 X(ALTERNATIVE_REFPROP_HMX_BNC_PATH, "ALTERNATIVE_REFPROP_HMX_BNC_PATH", "", \
34 "An alternative path to the HMX.BNC file. If provided, it will be passed into REFPROP's SETUP or SETMIX routines") \
35 X(ALTERNATIVE_REFPROP_LIBRARY_PATH, "ALTERNATIVE_REFPROP_LIBRARY_PATH", "", \
36 "An alternative path to the shared library file. If provided, it will be used to load REFPROP") \
37 X(REFPROP_DONT_ESTIMATE_INTERACTION_PARAMETERS, "REFPROP_DONT_ESTIMATE_INTERACTION_PARAMETERS", false, \
38 "If true, if the binary interaction parameters in REFPROP are estimated, throw an error rather than silently continuing") \
39 X(REFPROP_IGNORE_ERROR_ESTIMATED_INTERACTION_PARAMETERS, "REFPROP_IGNORE_ERROR_ESTIMATED_INTERACTION_PARAMETERS", false, \
40 "If true, if the binary interaction parameters in REFPROP are unable to be estimated, silently continue rather than failing") \
41 X(REFPROP_USE_GERG, "REFPROP_USE_GERG", false, \
42 "If true, rather than using the highly-accurate pure fluid equations of state, use the pure-fluid EOS from GERG-2008") \
43 X(REFPROP_ERROR_THRESHOLD, "REFPROP_ERROR_THRESHOLD", static_cast<int>(0), "The highest acceptable error code without throwing an exception") \
44 X(REFPROP_USE_PENGROBINSON, "REFPROP_USE_PENGROBINSON", false, \
45 "If true, rather than using the highly-accurate pure fluid equations of state, use the Peng-Robinson EOS") \
46 X(MAXIMUM_TABLE_DIRECTORY_SIZE_IN_GB, "MAXIMUM_TABLE_DIRECTORY_SIZE_IN_GB", 1.0, \
47 "The maximum allowed size of the directory that is used to store tabular data") \
48 X(DONT_CHECK_PROPERTY_LIMITS, "DONT_CHECK_PROPERTY_LIMITS", false, \
49 "If true, when possible, CoolProp will skip checking whether values are inside the property limits") \
50 X(HENRYS_LAW_TO_GENERATE_VLE_GUESSES, "HENRYS_LAW_TO_GENERATE_VLE_GUESSES", false, \
51 "If true, when doing water-based mixture dewpoint calculations, use Henry's Law to generate guesses for liquid-phase composition") \
52 X(PHASE_ENVELOPE_STARTING_PRESSURE_PA, "PHASE_ENVELOPE_STARTING_PRESSURE_PA", 100.0, "Starting pressure [Pa] for phase envelope construction") \
53 X(R_U_CODATA, "R_U_CODATA", 8.3144598, \
54 "The value for the ideal gas constant in J/mol/K according to CODATA 2014. This value is used to harmonize all the ideal gas constants. " \
55 "This is especially important in the critical region.") \
56 X(VTPR_UNIFAC_PATH, "VTPR_UNIFAC_PATH", "", "The path to the directory containing the UNIFAC JSON files. Should be slash terminated") \
57 X(SPINODAL_MINIMUM_DELTA, "SPINODAL_MINIMUM_DELTA", 0.5, \
58 "The minimal delta to be used in tracing out the spinodal; make sure that the EOS has a spinodal at this value of delta=rho/rho_r") \
59 X(OVERWRITE_FLUIDS, "OVERWRITE_FLUIDS", false, \
60 "If true, and a fluid is added to the fluids library that is already there, rather than not adding the fluid (and probably throwing an " \
61 "exception), overwrite it") \
62 X(OVERWRITE_DEPARTURE_FUNCTION, "OVERWRITE_DEPARTURE_FUNCTION", false, \
63 "If true, and a departure function to be added is already there, rather than not adding the departure function (and probably throwing an " \
64 "exception), overwrite it") \
65 X(OVERWRITE_BINARY_INTERACTION, "OVERWRITE_BINARY_INTERACTION", false, \
66 "If true, and a pair of binary interaction pairs to be added is already there, rather than not adding the binary interaction pair (and " \
67 "probably throwing an exception), overwrite it") \
68 X(USE_GUESSES_IN_PROPSSI, "USE_GUESSES_IN_PROPSSI", false, \
69 "If true, calls to the vectorized versions of PropsSI use the previous state as guess value while looping over the input vectors, only makes " \
70 "sense when working with a single fluid and with points that are not too far from each other.") \
71 X(ASSUME_CRITICAL_POINT_STABLE, "ASSUME_CRITICAL_POINT_STABLE", false, \
72 "If true, evaluation of the stability of critical point will be skipped and point will be assumed to be stable") \
73 X(VTPR_ALWAYS_RELOAD_LIBRARY, "VTPR_ALWAYS_RELOAD_LIBRARY", false, \
74 "If true, the library will always be reloaded, no matter what is currently loaded") \
75 X(FLOAT_PUNCTUATION, "FLOAT_PUNCTUATION", ".", "The first character of this string will be used as the separator between the number fraction.") \
76 X(LIST_STRING_DELIMITER, "LIST_STRING_DELIMITER", ",", "The delimiter to be used when converting a list of strings to a string")
81 #define X(Enum, String, Default, Desc) Enum,
117 operator bool()
const {
122 operator double()
const {
127 operator std::string()
const {
132 operator int()
const {
188 void add_to_json(rapidjson::Value& val, rapidjson::Document& d)
const {
190 rapidjson::Value name(name_string.c_str(), d.GetAllocator());
193 rapidjson::Value v(
v_bool);
194 val.AddMember(name, v, d.GetAllocator());
199 val.AddMember(name, v, d.GetAllocator());
204 val.AddMember(name, v, d.GetAllocator());
208 rapidjson::Value v(v_string.c_str(), d.GetAllocator());
209 val.AddMember(name, v, d.GetAllocator());
232 if (!val.IsDouble() && !val.IsInt()) {
235 if (val.IsDouble()) {
238 v_double =
static_cast<double>(val.GetInt());
243 if (!val.IsString()) {
246 v_string = val.GetString();
257 if (type != this->type) {
268 std::string v_string;
275 std::map<configuration_keys, ConfigurationItem>
items;
286 std::map<configuration_keys, ConfigurationItem>::iterator it =
items.find(key);
288 if (it !=
items.end()) {
297 std::pair<configuration_keys, ConfigurationItem> pair(item.
get_key(), item);
302 std::map<configuration_keys, ConfigurationItem>&
get_items(
void) {
312 #define X(Enum, String, Default, Desc) add_item(ConfigurationItem(Enum, Default));