Configuration Variables¶
At runtime, there are a several configuration variables that can be used to change the behavior of CoolProp
Warning
The adjustment of the internal configuration variables might have side effects that you are not expecting, use with caution!!
From C++ and the SWIG wrappers, the values can be directly set/changed by using the type-specified getter/setter functions get_config_bool(), set_config_bool(), get_config_string(), set_config_string(), etc., as in something like:
In [1]: import CoolProp.CoolProp as CP
In [2]: current_val = CP.get_config_bool(CP.CRITICAL_WITHIN_1UK)
In [3]: CP.set_config_bool(CP.CRITICAL_WITHIN_1UK, current_val)
From all languages, the configuration state can obtained by retrieving the configuration state in the form of a JSON formatted string. For instance, in python, you can get the default configuration state from
In [4]: import CoolProp.CoolProp as CP, json
In [5]: json.loads(CP.get_config_as_json_string())
Out[5]:
{'NORMALIZE_GAS_CONSTANTS': True,
'CRITICAL_WITHIN_1UK': True,
'CRITICAL_SPLINES_ENABLED': True,
'SAVE_RAW_TABLES': False,
'ALTERNATIVE_TABLES_DIRECTORY': '',
'ALTERNATIVE_REFPROP_PATH': '',
'ALTERNATIVE_REFPROP_HMX_BNC_PATH': '',
'ALTERNATIVE_REFPROP_LIBRARY_PATH': '',
'REFPROP_DONT_ESTIMATE_INTERACTION_PARAMETERS': False,
'REFPROP_IGNORE_ERROR_ESTIMATED_INTERACTION_PARAMETERS': False,
'REFPROP_USE_GERG': False,
'REFPROP_ERROR_THRESHOLD': 0,
'REFPROP_USE_PENGROBINSON': False,
'MAXIMUM_TABLE_DIRECTORY_SIZE_IN_GB': 1.0,
'DONT_CHECK_PROPERTY_LIMITS': False,
'HENRYS_LAW_TO_GENERATE_VLE_GUESSES': False,
'PHASE_ENVELOPE_STARTING_PRESSURE_PA': 100.0,
'R_U_CODATA': 8.3144598,
'VTPR_UNIFAC_PATH': '',
'SPINODAL_MINIMUM_DELTA': 0.5,
'OVERWRITE_FLUIDS': False,
'OVERWRITE_DEPARTURE_FUNCTION': False,
'OVERWRITE_BINARY_INTERACTION': False,
'USE_GUESSES_IN_PROPSSI': False,
'ASSUME_CRITICAL_POINT_STABLE': False,
'VTPR_ALWAYS_RELOAD_LIBRARY': False,
'FLOAT_PUNCTUATION': '.',
'LIST_STRING_DELIMITER': ','}
Most modern languages have facilities for interfacing with JSON formatted strings and converting them back and forth with language-specific data structures. For instance, in python, there is the built-in json
package that converts json-formatted strings to python dictionaries, lists, etc.
Configuration Keys¶
Here is a list of (alphabetically sorted) configuration keys that can be used, along with a short description of the use of each of the configuration keys:
ALTERNATIVE_REFPROP_HMX_BNC_PATH
: An alternative path to the HMX.BNC file. If provided, it will be passed into REFPROP’s SETUP or SETMIX routines
ALTERNATIVE_REFPROP_LIBRARY_PATH
: An alternative path to the shared library file. If provided, it will be used to load REFPROP
ALTERNATIVE_REFPROP_PATH
: An alternative path to be provided to the directory that contains REFPROP’s fluids and mixtures directories. If provided, the SETPATH function will be called with this directory prior to calling any REFPROP functions.
ALTERNATIVE_TABLES_DIRECTORY
: If provided, this path will be the root directory for the tabular data. Otherwise, ${HOME}/.CoolProp/Tables is used
ASSUME_CRITICAL_POINT_STABLE
: If true, evaluation of the stability of critical point will be skipped and point will be assumed to be stable
CRITICAL_SPLINES_ENABLED
: If true, the critical splines will be used in the near-vicinity of the critical point
CRITICAL_WITHIN_1UK
: If true, any temperature within 1 uK of the critical temperature will be considered to be AT the critical point
DONT_CHECK_PROPERTY_LIMITS
: If true, when possible, CoolProp will skip checking whether values are inside the property limits
FLOAT_PUNCTUATION
: The first character of this string will be used as the separator between the number fraction.
HENRYS_LAW_TO_GENERATE_VLE_GUESSES
: If true, when doing water-based mixture dewpoint calculations, use Henry’s Law to generate guesses for liquid-phase composition
LIST_STRING_DELIMITER
: The delimiter to be used when converting a list of strings to a string
MAXIMUM_TABLE_DIRECTORY_SIZE_IN_GB
: The maximum allowed size of the directory that is used to store tabular data
NORMALIZE_GAS_CONSTANTS
: If true, for mixtures, the molar gas constant (R) will be set to the CODATA value
OVERWRITE_BINARY_INTERACTION
: If true, and a pair of binary interaction pairs to be added is already there, rather than not adding the binary interaction pair (and probably throwing an exception), overwrite it
OVERWRITE_DEPARTURE_FUNCTION
: If true, and a departure function to be added is already there, rather than not adding the departure function (and probably throwing an exception), overwrite it
OVERWRITE_FLUIDS
: 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 exception), overwrite it
PHASE_ENVELOPE_STARTING_PRESSURE_PA
: Starting pressure [Pa] for phase envelope construction
REFPROP_DONT_ESTIMATE_INTERACTION_PARAMETERS
: If true, if the binary interaction parameters in REFPROP are estimated, throw an error rather than silently continuing
REFPROP_ERROR_THRESHOLD
: The highest acceptable error code without throwing an exception
REFPROP_IGNORE_ERROR_ESTIMATED_INTERACTION_PARAMETERS
: If true, if the binary interaction parameters in REFPROP are unable to be estimated, silently continue rather than failing
REFPROP_USE_GERG
: If true, rather than using the highly-accurate pure fluid equations of state, use the pure-fluid EOS from GERG-2008
REFPROP_USE_PENGROBINSON
: If true, rather than using the highly-accurate pure fluid equations of state, use the Peng-Robinson EOS
R_U_CODATA
: 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. This is especially important in the critical region.
SAVE_RAW_TABLES
: If true, the raw, uncompressed tables will also be written to file
SPINODAL_MINIMUM_DELTA
: 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
USE_GUESSES_IN_PROPSSI
: If true, calls to the vectorized versions of PropsSI use the previous state as guess value while looping over the input vectors, only makes sense when working with a single fluid and with points that are not too far from each other.
VTPR_ALWAYS_RELOAD_LIBRARY
: If true, the library will always be reloaded, no matter what is currently loaded
VTPR_UNIFAC_PATH
: The path to the directory containing the UNIFAC JSON files. Should be slash terminated