GenericParameters

Struct GenericParameters 

Source
pub struct GenericParameters<P, B, A, Bo, C, Data> {
    pub pure: Vec<PureParameters<P, C>>,
    pub binary: Vec<BinaryParameters<B, ()>>,
    pub bonds: Vec<BinaryParameters<Bo, C>>,
    pub association: AssociationParameters<A>,
    pub molar_weight: MolarWeight<DVector<f64>>,
    /* private fields */
}

Fields§

§pure: Vec<PureParameters<P, C>>§binary: Vec<BinaryParameters<B, ()>>§bonds: Vec<BinaryParameters<Bo, C>>§association: AssociationParameters<A>§molar_weight: MolarWeight<DVector<f64>>

Implementations§

Source§

impl GenericParameters<PengRobinsonRecord, f64, (), (), (), (Vec<Record<Identifier, PengRobinsonRecord, ()>>, Vec<BinaryRecord<usize, f64, ()>>)>

Source

pub fn new_simple( tc: &[f64], pc: &[f64], acentric_factor: &[f64], molarweight: &[f64], ) -> FeosResult<Self>

Build a simple parameter set without binary interaction parameters.

Source§

impl<P, B, A, Bo, C, Data> GenericParameters<P, B, A, Bo, C, Data>

Source

pub fn collate<F, T: Scalar + Copy, const N: usize>( &self, f: F, ) -> [DVector<T>; N]
where F: Fn(&P) -> [T; N],

Source

pub fn collate_binary<F, T: Scalar + Default + Copy, const N: usize>( &self, f: F, ) -> [DMatrix<T>; N]
where F: Fn(&B) -> [T; N],

Source

pub fn collate_ab<F, T: Scalar + Copy, const N: usize>( &self, f: F, ) -> [DMatrix<Option<T>>; N]
where F: Fn(&A) -> [T; N],

Source

pub fn collate_cc<F, T: Scalar + Copy, const N: usize>( &self, f: F, ) -> [DMatrix<Option<T>>; N]
where F: Fn(&A) -> [T; N],

Source§

impl<P: Clone, B: Clone, A: CombiningRule<P> + Clone> GenericParameters<P, B, A, (), (), (Vec<Record<Identifier, P, A>>, Vec<BinaryRecord<usize, B, A>>)>

Source

pub fn new( pure_records: Vec<PureRecord<P, A>>, binary_records: Vec<BinaryRecord<usize, B, A>>, ) -> FeosResult<Self>

Source

pub fn new_pure(pure_record: PureRecord<P, A>) -> FeosResult<Self>

Creates parameters for a pure component from a pure record.

Source

pub fn new_binary( pure_records: [PureRecord<P, A>; 2], binary_record: Option<B>, binary_association_records: Vec<BinaryAssociationRecord<A>>, ) -> FeosResult<Self>

Creates parameters for a binary system from pure records and an optional binary interaction parameter.

Source

pub fn from_records( pure_records: Vec<PureRecord<P, A>>, binary_records: Vec<BinaryRecord<Identifier, B, A>>, identifier_option: IdentifierOption, ) -> FeosResult<Self>

Creates parameters from records for pure substances and possibly binary parameters.

Source

pub fn from_model_records(model_records: Vec<P>) -> FeosResult<Self>

Creates parameters from model records with default values for the molar weight, identifiers, association sites, and binary interaction parameters.

Source§

impl<P: Clone, B: Clone, A: Clone> GenericParameters<P, B, A, (), (), (Vec<Record<Identifier, P, A>>, Vec<BinaryRecord<usize, B, A>>)>

Source

pub fn binary_matrix_from_records( pure_records: &[PureRecord<P, A>], binary_records: &[BinaryRecord<Identifier, B, A>], identifier_option: IdentifierOption, ) -> FeosResult<Vec<BinaryRecord<usize, B, A>>>

Helper function to build matrix from list of records in correct order.

Source§

impl<P: Clone, B: Clone, A: CombiningRule<P> + Clone> GenericParameters<P, B, A, (), (), (Vec<Record<Identifier, P, A>>, Vec<BinaryRecord<usize, B, A>>)>

Source

pub fn from_json<F, S>( substances: Vec<S>, file_pure: F, file_binary: Option<F>, identifier_option: IdentifierOption, ) -> FeosResult<Self>

Creates parameters from substance information stored in json files.

Source

pub fn from_multiple_json<F, S>( input: &[(Vec<S>, F)], file_binary: Option<F>, identifier_option: IdentifierOption, ) -> FeosResult<Self>

Creates parameters from substance information stored in multiple json files.

Source

pub fn from_segments( chemical_records: Vec<ChemicalRecord>, segment_records: &[SegmentRecord<P, A>], binary_segment_records: Option<&[BinarySegmentRecord<B, A>]>, ) -> FeosResult<Self>

Creates parameters from the molecular structure and segment information.

The FromSegments trait needs to be implemented for the model record and the binary interaction parameters.

Source

pub fn from_json_segments<F>( substances: &[&str], file_pure: F, file_segments: F, file_binary: Option<F>, identifier_option: IdentifierOption, ) -> FeosResult<Self>

Creates parameters from segment information stored in json files.

The FromSegments trait needs to be implemented for both the model record and the ideal gas record.

Source

pub fn identifiers(&self) -> Vec<&Identifier>

Source

pub fn subset(&self, component_list: &[usize]) -> Self

Return a parameter set containing the subset of components specified in component_list.

§Panics

Panics if index in component_list is out of bounds

Source

pub fn pure_parameters(&self) -> IndexMap<String, DVector<f64>>
where P: Serialize,

Return scalar pure parameters as map.

This function is not particularly efficient and mostly relevant in situations in which the type information is thrown away on purpose (i.e., FFI)

Source

pub fn binary_parameters(&self) -> IndexMap<String, DMatrix<f64>>
where B: Serialize,

Return scalar binary interaction parameters as map.

This function is not particularly efficient and mostly relevant in situations in which the type information is thrown away on purpose (i.e., FFI)

Source

pub fn association_parameters_ab(&self) -> IndexMap<String, DMatrix<f64>>
where A: Serialize,

Return scalar association parameters (AB) as map.

This function is not particularly efficient and mostly relevant in situations in which the type information is thrown away on purpose (i.e., FFI)

Source

pub fn association_parameters_cc(&self) -> IndexMap<String, DMatrix<f64>>
where A: Serialize,

Return scalar association parameters (CC) as map.

This function is not particularly efficient and mostly relevant in situations in which the type information is thrown away on purpose (i.e., FFI)

Source§

impl<P, B, A, Bo> GenericParameters<P, B, A, Bo, f64, (Vec<ChemicalRecord>, Vec<Record<String, P, A>>, Option<Vec<BinaryRecord<String, B, A>>>, Vec<BinaryRecord<String, Bo, ()>>)>

Source

pub fn segment_counts(&self) -> DVector<f64>

Source§

impl<P: Clone, B: Clone, A: CombiningRule<P> + Clone, Bo: Clone, C: GroupCount + Default> GenericParameters<P, B, A, Bo, C, (Vec<ChemicalRecord>, Vec<Record<String, P, A>>, Option<Vec<BinaryRecord<String, B, A>>>, Vec<BinaryRecord<String, Bo, ()>>)>

Source

pub fn from_segments_hetero( chemical_records: Vec<ChemicalRecord>, segment_records: &[SegmentRecord<P, A>], binary_segment_records: Option<&[BinarySegmentRecord<B, A>]>, ) -> FeosResult<Self>
where Bo: Default,

Source

pub fn from_segments_with_bonds( chemical_records: Vec<ChemicalRecord>, segment_records: &[SegmentRecord<P, A>], binary_segment_records: Option<&[BinarySegmentRecord<B, A>]>, bond_records: &[BinarySegmentRecord<Bo, ()>], ) -> FeosResult<Self>

Source

pub fn from_json_segments_hetero<F>( substances: &[&str], file_pure: F, file_segments: F, file_binary: Option<F>, identifier_option: IdentifierOption, ) -> FeosResult<Self>

Creates parameters from segment information stored in json files.

The FromSegments trait needs to be implemented for both the model record and the ideal gas record.

Source

pub fn from_json_segments_with_bonds<F>( substances: &[&str], file_pure: F, file_segments: F, file_binary: Option<F>, file_bonds: F, identifier_option: IdentifierOption, ) -> FeosResult<Self>

Creates parameters from segment information stored in json files.

The FromSegments trait needs to be implemented for both the model record and the ideal gas record.

Source

pub fn component_index(&self) -> Vec<usize>

Source

pub fn identifiers(&self) -> Vec<&Identifier>

Source

pub fn subset(&self, component_list: &[usize]) -> Self

Return a parameter set containing the subset of components specified in component_list.

§Panics

Panics if index in component_list is out of bounds

Auto Trait Implementations§

§

impl<P, B, A, Bo, C, Data> Freeze for GenericParameters<P, B, A, Bo, C, Data>
where Data: Freeze,

§

impl<P, B, A, Bo, C, Data> RefUnwindSafe for GenericParameters<P, B, A, Bo, C, Data>

§

impl<P, B, A, Bo, C, Data> Send for GenericParameters<P, B, A, Bo, C, Data>
where Data: Send, P: Send, C: Send, B: Send, Bo: Send, A: Send,

§

impl<P, B, A, Bo, C, Data> Sync for GenericParameters<P, B, A, Bo, C, Data>
where Data: Sync, P: Sync, C: Sync, B: Sync, Bo: Sync, A: Sync,

§

impl<P, B, A, Bo, C, Data> Unpin for GenericParameters<P, B, A, Bo, C, Data>
where Data: Unpin, P: Unpin, C: Unpin, B: Unpin, Bo: Unpin, A: Unpin,

§

impl<P, B, A, Bo, C, Data> UnwindSafe for GenericParameters<P, B, A, Bo, C, Data>

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PropertiesAD for T

Source§

fn vapor_pressure<const P: usize>( &self, temperature: Temperature, ) -> FeosResult<Pressure<DualSVec<f64, f64, P>>>
where Self: Residual<U1, DualSVec<f64, f64, P>>,

Source§

fn equilibrium_liquid_density<const P: usize>( &self, temperature: Temperature, ) -> FeosResult<(Pressure<DualSVec<f64, f64, P>>, Density<DualSVec<f64, f64, P>>)>
where Self: Residual<U1, DualSVec<f64, f64, P>>,

Source§

fn liquid_density<const P: usize>( &self, temperature: Temperature, pressure: Pressure, ) -> FeosResult<Density<DualSVec<f64, f64, P>>>
where Self: Residual<U1, DualSVec<f64, f64, P>>,

Source§

fn vapor_pressure_parallel<const P: usize>( parameter_names: [String; P], parameters: ArrayView2<'_, f64>, input: ArrayView2<'_, f64>, ) -> (Array1<f64>, Array2<f64>, Array1<bool>)
where Self: ParametersAD<1>,

Source§

fn liquid_density_parallel<const P: usize>( parameter_names: [String; P], parameters: ArrayView2<'_, f64>, input: ArrayView2<'_, f64>, ) -> (Array1<f64>, Array2<f64>, Array1<bool>)
where Self: ParametersAD<1>,

Source§

fn equilibrium_liquid_density_parallel<const P: usize>( parameter_names: [String; P], parameters: ArrayView2<'_, f64>, input: ArrayView2<'_, f64>, ) -> (Array1<f64>, Array2<f64>, Array1<bool>)
where Self: ParametersAD<1>,

Source§

fn bubble_point_pressure<const P: usize>( &self, temperature: Temperature, pressure: Option<Pressure>, liquid_molefracs: SVector<f64, 2>, ) -> FeosResult<Pressure<DualSVec<f64, f64, P>>>
where Self: Residual<U2, DualSVec<f64, f64, P>>,

Source§

fn dew_point_pressure<const P: usize>( &self, temperature: Temperature, pressure: Option<Pressure>, vapor_molefracs: SVector<f64, 2>, ) -> FeosResult<Pressure<DualSVec<f64, f64, P>>>
where Self: Residual<U2, DualSVec<f64, f64, P>>,

Source§

fn bubble_point_pressure_parallel<const P: usize>( parameter_names: [String; P], parameters: ArrayView2<'_, f64>, input: ArrayView2<'_, f64>, ) -> (Array1<f64>, Array2<f64>, Array1<bool>)
where Self: ParametersAD<2>,

Source§

fn dew_point_pressure_parallel<const P: usize>( parameter_names: [String; P], parameters: ArrayView2<'_, f64>, input: ArrayView2<'_, f64>, ) -> (Array1<f64>, Array2<f64>, Array1<bool>)
where Self: ParametersAD<2>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.