Trait Residual

Source
pub trait Residual:
    Components
    + Send
    + Sync {
    // Required methods
    fn compute_max_density(&self, moles: &Array1<f64>) -> f64;
    fn residual_helmholtz_energy_contributions<D: DualNum<f64> + Copy + ScalarOperand>(
        &self,
        state: &StateHD<D>,
    ) -> Vec<(String, D)>;

    // Provided methods
    fn residual_helmholtz_energy<D: DualNum<f64> + Copy + ScalarOperand>(
        &self,
        state: &StateHD<D>,
    ) -> D { ... }
    fn validate_moles(
        &self,
        moles: Option<&Moles<Array1<f64>>>,
    ) -> EosResult<Moles<Array1<f64>>> { ... }
    fn max_density(
        &self,
        moles: Option<&Moles<Array1<f64>>>,
    ) -> EosResult<Density> { ... }
    fn second_virial_coefficient(
        &self,
        temperature: Temperature,
        moles: Option<&Moles<Array1<f64>>>,
    ) -> EosResult<Quot<f64, Density>> { ... }
    fn third_virial_coefficient(
        &self,
        temperature: Temperature,
        moles: Option<&Moles<Array1<f64>>>,
    ) -> EosResult<<<f64 as Div<Density>>::Output as Div<Density>>::Output> { ... }
    fn second_virial_coefficient_temperature_derivative(
        &self,
        temperature: Temperature,
        moles: Option<&Moles<Array1<f64>>>,
    ) -> EosResult<<<f64 as Div<Density>>::Output as Div<Temperature>>::Output> { ... }
    fn third_virial_coefficient_temperature_derivative(
        &self,
        temperature: Temperature,
        moles: Option<&Moles<Array1<f64>>>,
    ) -> EosResult<<<<f64 as Div<Density>>::Output as Div<Density>>::Output as Div<Temperature>>::Output> { ... }
}
Expand description

A residual Helmholtz energy model.

Required Methods§

Source

fn compute_max_density(&self, moles: &Array1<f64>) -> f64

Return the maximum density in Angstrom^-3.

This value is used as an estimate for a liquid phase for phase equilibria and other iterations. It is not explicitly meant to be a mathematical limit for the density (if those exist in the equation of state anyways).

Source

fn residual_helmholtz_energy_contributions<D: DualNum<f64> + Copy + ScalarOperand>( &self, state: &StateHD<D>, ) -> Vec<(String, D)>

Evaluate the reduced Helmholtz energy of each individual contribution and return them together with a string representation of the contribution.

Provided Methods§

Source

fn residual_helmholtz_energy<D: DualNum<f64> + Copy + ScalarOperand>( &self, state: &StateHD<D>, ) -> D

Evaluate the residual reduced Helmholtz energy $\beta A^\mathrm{res}$.

Source

fn validate_moles( &self, moles: Option<&Moles<Array1<f64>>>, ) -> EosResult<Moles<Array1<f64>>>

Check if the provided optional mole number is consistent with the equation of state.

In general, the number of elements in moles needs to match the number of components of the equation of state. For a pure component, however, no moles need to be provided. In that case, it is set to the constant reference value.

Source

fn max_density(&self, moles: Option<&Moles<Array1<f64>>>) -> EosResult<Density>

Calculate the maximum density.

This value is used as an estimate for a liquid phase for phase equilibria and other iterations. It is not explicitly meant to be a mathematical limit for the density (if those exist in the equation of state anyways).

Source

fn second_virial_coefficient( &self, temperature: Temperature, moles: Option<&Moles<Array1<f64>>>, ) -> EosResult<Quot<f64, Density>>

Calculate the second virial coefficient $B(T)$

Source

fn third_virial_coefficient( &self, temperature: Temperature, moles: Option<&Moles<Array1<f64>>>, ) -> EosResult<<<f64 as Div<Density>>::Output as Div<Density>>::Output>

Calculate the third virial coefficient $C(T)$

Source

fn second_virial_coefficient_temperature_derivative( &self, temperature: Temperature, moles: Option<&Moles<Array1<f64>>>, ) -> EosResult<<<f64 as Div<Density>>::Output as Div<Temperature>>::Output>

Calculate the temperature derivative of the second virial coefficient $B’(T)$

Source

fn third_virial_coefficient_temperature_derivative( &self, temperature: Temperature, moles: Option<&Moles<Array1<f64>>>, ) -> EosResult<<<<f64 as Div<Density>>::Output as Div<Density>>::Output as Div<Temperature>>::Output>

Calculate the temperature derivative of the third virial coefficient $C’(T)$

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§