Skip to main content

Config

Struct Config 

Source
#[non_exhaustive]
pub struct Config {
Show 29 fields pub debug_level: u8, pub assume_critical_point_is_stable: bool, pub critical_within_1uk: bool, pub dont_check_prop_limits: bool, pub enable_critical_splines: bool, pub enable_superancillaries: bool, pub henrys_law_to_generate_vle_guesses: bool, pub normalize_gas_constants: bool, pub overwrite_binary_interaction: bool, pub overwrite_departure_fn: bool, pub overwrite_substances: bool, pub phase_envelope_start_pressure_pa: f64, pub ru_codata: f64, pub spinodal_min_delta: f64, pub use_guesses_in_props_si: bool, pub alt_refprop_path: Option<PathBuf>, pub alt_refprop_lib_path: Option<PathBuf>, pub alt_refprop_hmx_bnc_path: Option<PathBuf>, pub refprop_dont_estimate_interaction_params: bool, pub refprop_ignore_error_estimated_interaction_params: bool, pub refprop_use_gerg: bool, pub refprop_use_peng_robinson: bool, pub alt_tables_path: Option<PathBuf>, pub float_punctuation: char, pub list_punctuation: char, pub max_table_dir_size_in_gb: f64, pub save_raw_tables: bool, pub vtpr_always_reload_lib: bool, pub vtpr_unifac_path: Option<PathBuf>,
}
Expand description

Crate configuration state.

This configuration mirrors the configuration options available in CoolProp. Each field corresponds directly to a CoolProp configuration parameter and is synchronized with the underlying CoolProp library when config::update is called.

ยงserde Support

Enable the serde feature for serialization and deserialization support. See the module documentation for details and examples.

ยงThread Safety

The configuration is stored in a global state protected by an RwLock. Use config::read to get the current configuration and config::update to modify it.

Fields (Non-exhaustive)ยง

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
ยงdebug_level: u8

CoolProp debug level.

The debug level controls the verbosity of debugging output from CoolProp. Valid range is 0-10:

  • 0 โ€“ debugging output is disabled
  • > 0 โ€“ debugging output is enabled, with larger values producing more verbose output

Default: 0

ยงassume_critical_point_is_stable: bool

If true, evaluation of the stability of critical point will be skipped and point will be assumed to be stable.

Default: false

ยงcritical_within_1uk: bool

if true, any temperature within 1 uK of the critical temperature will be considered to be AT the critical point.

Default: true

ยงdont_check_prop_limits: bool

If true, when possible, CoolProp will skip checking whether values are inside the property limits.

Default: false

ยงenable_critical_splines: bool

If true, the critical splines will be used in the near-vicinity of the critical point.

Default: true

ยงenable_superancillaries: bool

if true, the superancillary functions will be used for VLE of pure fluids.

Default: true

ยงhenrys_law_to_generate_vle_guesses: bool

If true, when doing water-based mixture dewpoint calculations, use Henryโ€™s Law to generate guesses for liquid-phase composition.

Default: false

ยงnormalize_gas_constants: bool

If true, for mixtures, the molar gas constant (R) will be set to the CODATA value.

Default: true

ยงoverwrite_binary_interaction: bool

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.

Default: false

ยงoverwrite_departure_fn: bool

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.

Default: false

ยงoverwrite_substances: bool

If true, and a substance is added to the substances library that is already there, rather than not adding the substance (and probably throwing an exception), overwrite it.

Default: false

ยงphase_envelope_start_pressure_pa: f64

Starting pressure in Pa for phase envelope construction.

Default: 100.0

ยงru_codata: f64

The value for the ideal gas constant in J/mol/K according to CODATA 2022. This value is used to harmonize all the ideal gas constants. This is especially important in the critical region.

Default: 8.314_462_618_153_24

ยงspinodal_min_delta: f64

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.

Default: 0.5

ยงuse_guesses_in_props_si: bool

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.

Default: false

ยงalt_refprop_path: Option<PathBuf>

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.

Default: None

ยงalt_refprop_lib_path: Option<PathBuf>

An alternative path to the shared library file. If provided, it will be used to load REFPROP.

Default: None

ยงalt_refprop_hmx_bnc_path: Option<PathBuf>

An alternative path to the HMX.BNC file. If provided, it will be passed into REFPROPโ€™s SETUP or SETMIX routines.

Default: None

ยงrefprop_dont_estimate_interaction_params: bool

If true, if the binary interaction parameters in REFPROP are estimated, throw an error rather than silently continuing.

Default: false

ยงrefprop_ignore_error_estimated_interaction_params: bool

If true, if the binary interaction parameters in REFPROP are unable to be estimated, silently continue rather than failing.

Default: false

ยงrefprop_use_gerg: bool

If true, rather than using the highly-accurate pure fluid equations of state, use the pure-fluid EOS from GERG-2008.

Default: false

ยงrefprop_use_peng_robinson: bool

If true, rather than using the highly-accurate pure fluid equations of state, use the Peng-Robinson EOS.

Default: false

ยงalt_tables_path: Option<PathBuf>

If provided, this path will be the root directory for the tabular data. Otherwise, ${HOME}/.CoolProp/Tables is used.

Default: None

ยงfloat_punctuation: char

The first character of this string will be used as the separator between the number fraction.

Default: '.'

ยงlist_punctuation: char

The delimiter to be used when converting a list of strings to a string.

Default: ','

ยงmax_table_dir_size_in_gb: f64

The maximum allowed size of the directory that is used to store tabular data.

Default: 1.0

ยงsave_raw_tables: bool

If true, the raw, uncompressed tables will also be written to file.

Default: false

ยงvtpr_always_reload_lib: bool

If true, the library will always be reloaded, no matter what is currently loaded.

Default: false

ยงvtpr_unifac_path: Option<PathBuf>

The path to the directory containing the UNIFAC JSON files.

Default: None

Implementationsยง

Sourceยง

impl Config

Source

pub fn builder() -> ConfigBuilder

Create an instance of Config using the builder syntax

Trait Implementationsยง

Sourceยง

impl Clone for Config

Sourceยง

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl Debug for Config

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl Default for Config

Sourceยง

fn default() -> Self

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl PartialEq for Config

Sourceยง

fn eq(&self, other: &Config) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท Sourceยง

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Sourceยง

impl StructuralPartialEq for Config

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.