Skip to main content

RefpropLibrary

Struct RefpropLibrary 

Source
pub struct RefpropLibrary { /* private fields */ }
Expand description

Holds a dynamically-loaded REFPROP shared library with pre-resolved function pointers for zero-overhead calls.

All function symbols are resolved once at construction time. If any required symbol is missing the constructor returns an error instead of panicking later.

All methods are unsafe because they forward raw pointers to Fortran code that cannot be verified by the Rust compiler.

Implementations§

Source§

impl RefpropLibrary

Source

pub fn load_from_dir(dir: &Path) -> Result<Self, RefpropSysError>

Try to load the REFPROP shared library from a directory that contains the DLL / .so. Common file names are tried automatically.

On 64-bit Windows the 64-bit DLL (REFPRP64.DLL) is tried first. If a candidate file exists but cannot be loaded (e.g. architecture mismatch), the next candidate is tried.

All required symbols are resolved eagerly. If any symbol is missing, an error is returned immediately.

Source

pub fn load_from_file(path: &Path) -> Result<Self, RefpropSysError>

Load the REFPROP shared library from an exact file path.

Source

pub unsafe fn SETPATHdll(&self, hpath: *const c_char, length: c_long)

Set the path where REFPROP will look for fluid files, mixture files, etc.

Source

pub unsafe fn SETUPdll( &self, nc: *const c_int, hfld: *const c_char, hfmix: *const c_char, hrf: *const c_char, ierr: *mut c_int, herr: *mut c_char, hfld_length: c_long, hfmix_length: c_long, hrf_length: c_long, herr_length: c_long, )

Set up a fluid or mixture for subsequent calculations.

Source

pub unsafe fn TPFLSHdll( &self, t: *const c_double, p: *const c_double, z: *const c_double, d: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, h: *mut c_double, s: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Temperature-pressure flash calculation.

Source

pub unsafe fn PHFLSHdll( &self, p: *const c_double, h: *const c_double, z: *const c_double, t: *mut c_double, d: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, s: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Pressure-enthalpy flash calculation.

Source

pub unsafe fn PSFLSHdll( &self, p: *const c_double, s: *const c_double, z: *const c_double, t: *mut c_double, d: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, h: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Pressure-entropy flash calculation.

Source

pub unsafe fn SATTdll( &self, t: *const c_double, z: *const c_double, kph: *const c_int, p: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Saturation properties at a given temperature.

Source

pub unsafe fn SATPdll( &self, p: *const c_double, z: *const c_double, kph: *const c_int, t: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Saturation properties at a given pressure.

Source

pub unsafe fn CRITPdll( &self, z: *const c_double, tcrit: *mut c_double, pcrit: *mut c_double, dcrit: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Critical-point properties.

Source

pub unsafe fn TRNPRPdll( &self, t: *const c_double, d: *const c_double, z: *const c_double, eta: *mut c_double, tcx: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Transport properties (viscosity, thermal conductivity).

Source

pub unsafe fn SETMIXdll( &self, hmxnme: *const c_char, hfmix: *const c_char, hrf: *const c_char, nc: *mut c_int, hfld: *mut c_char, z: *mut c_double, ierr: *mut c_int, herr: *mut c_char, hmxnme_length: c_long, hfmix_length: c_long, hrf_length: c_long, hfld_length: c_long, herr_length: c_long, )

Load a predefined mixture from a .MIX file.

Returns the number of components (nc), the fluid file string (hfld), and the molar composition array (z).

Source

pub unsafe fn TDFLSHdll( &self, t: *const c_double, d: *const c_double, z: *const c_double, p: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, h: *mut c_double, s: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Temperature-density flash calculation.

Source

pub unsafe fn PDFLSHdll( &self, p: *const c_double, d: *const c_double, z: *const c_double, t: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, h: *mut c_double, s: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Pressure-density flash calculation.

Source

pub unsafe fn THFLSHdll( &self, t: *const c_double, h: *const c_double, z: *const c_double, kr: *mut c_double, p: *mut c_double, d: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, s: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Temperature-enthalpy flash calculation.

Source

pub unsafe fn TSFLSHdll( &self, t: *const c_double, s: *const c_double, z: *const c_double, kr: *mut c_double, p: *mut c_double, d: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, h: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Temperature-entropy flash calculation.

Source

pub unsafe fn DHFLSHdll( &self, d: *const c_double, h: *const c_double, z: *const c_double, t: *mut c_double, p: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, s: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Density-enthalpy flash calculation.

Source

pub unsafe fn DSFLSHdll( &self, d: *const c_double, s: *const c_double, z: *const c_double, t: *mut c_double, p: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, h: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Density-entropy flash calculation.

Source

pub unsafe fn HSFLSHdll( &self, h: *const c_double, s: *const c_double, z: *const c_double, t: *mut c_double, p: *mut c_double, d: *mut c_double, dl: *mut c_double, dv: *mut c_double, x: *mut c_double, y: *mut c_double, q: *mut c_double, e: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, ierr: *mut c_int, herr: *mut c_char, herr_length: c_long, )

Enthalpy-entropy flash calculation.

Source

pub unsafe fn THERMdll( &self, t: *const c_double, d: *const c_double, z: *const c_double, p: *mut c_double, e: *mut c_double, h: *mut c_double, s: *mut c_double, cv: *mut c_double, cp: *mut c_double, w: *mut c_double, hjt: *mut c_double, )

Compute thermodynamic properties from temperature and density.

No error return – REFPROP always produces a result.

Source

pub unsafe fn INFOdll( &self, icomp: *const c_int, wmm: *mut c_double, ttrp: *mut c_double, tnbpt: *mut c_double, tc: *mut c_double, pc: *mut c_double, dc: *mut c_double, zc: *mut c_double, acf: *mut c_double, dip: *mut c_double, rgas: *mut c_double, )

Fluid information (molar mass, triple point, etc.).

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> 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, 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.