diff --git a/CHANGELOG.md b/CHANGELOG.md index d92883ab8..2a3d6dade 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `IdealGasModel` enum that collects all implementors of the `IdealGas` trait. [#158](https://github.com/feos-org/feos/pull/158) - Added `feos.ideal_gas` module in Python from which (currently) `Joback` and `JobackParameters` are available. [#158](https://github.com/feos-org/feos/pull/158) - Added binary association parameters to PC-SAFT. [#167](https://github.com/feos-org/feos/pull/167) +- Added derive for `EntropyScaling` for SAFT-VRQ Mie to `ResidualModel` and adjusted parameter initialization. [#179](https://github.com/feos-org/feos/pull/179) ### Changed - Changed the internal implementation of the association contribution to accomodate more general association schemes. [#150](https://github.com/feos-org/feos/pull/150) diff --git a/src/eos.rs b/src/eos.rs index bc69f5a4e..196c16e6e 100644 --- a/src/eos.rs +++ b/src/eos.rs @@ -32,6 +32,7 @@ pub enum ResidualModel { #[cfg(feature = "python")] Python(PyResidual), #[cfg(feature = "saftvrqmie")] + #[implement(entropy_scaling)] SaftVRQMie(SaftVRQMie), #[cfg(feature = "pets")] Pets(Pets), diff --git a/src/pcsaft/parameters.rs b/src/pcsaft/parameters.rs index 3b91ea313..a002aa6c5 100644 --- a/src/pcsaft/parameters.rs +++ b/src/pcsaft/parameters.rs @@ -24,7 +24,7 @@ pub struct PcSaftRecord { /// Dipole moment in units of Debye #[serde(skip_serializing_if = "Option::is_none")] pub mu: Option, - /// Quadrupole moment in units of Debye + /// Quadrupole moment in units of Debye * Angstrom #[serde(skip_serializing_if = "Option::is_none")] pub q: Option, /// Association parameters diff --git a/src/pcsaft/python.rs b/src/pcsaft/python.rs index 089f215d3..51081249e 100644 --- a/src/pcsaft/python.rs +++ b/src/pcsaft/python.rs @@ -12,7 +12,36 @@ use pyo3::prelude::*; use std::convert::{TryFrom, TryInto}; use std::sync::Arc; -/// Create a new set of PC-SAFT pure component parameters. +/// Pure-substance parameters for the PC-Saft equation of state. +/// +/// Parameters +/// ---------- +/// m : float +/// Segment number +/// sigma : float +/// Segment diameter in units of Angstrom. +/// epsilon_k : float +/// Energetic parameter in units of Kelvin. +/// mu : float, optional +/// Dipole moment in units of Debye. +/// q : float, optional +/// Quadrupole moment in units of Debye * Angstrom. +/// kappa_ab : float, optional +/// Association volume parameter. +/// epsilon_k_ab : float, optional +/// Association energy parameter in units of Kelvin. +/// na : float, optional +/// Number of association sites of type A. +/// nb : float, optional +/// Number of association sites of type B. +/// nc : float, optional +/// Number of association sites of type C. +/// viscosity : List[float], optional +/// Entropy-scaling parameters for viscosity. Defaults to `None`. +/// diffusion : List[float], optional +/// Entropy-scaling parameters for diffusion. Defaults to `None`. +/// thermal_conductivity : List[float], optional +/// Entropy-scaling parameters for thermal_conductivity. Defaults to `None`. #[pyclass(name = "PcSaftRecord")] #[pyo3( text_signature = "(m, sigma, epsilon_k, mu=None, q=None, kappa_ab=None, epsilon_k_ab=None, na=None, nb=None, viscosity=None, diffusion=None, thermal_conductivity=None)" diff --git a/src/saftvrqmie/parameters.rs b/src/saftvrqmie/parameters.rs index 7f31bc8e8..b032c1773 100644 --- a/src/saftvrqmie/parameters.rs +++ b/src/saftvrqmie/parameters.rs @@ -66,8 +66,13 @@ impl SaftVRQMieRecord { viscosity: Option<[f64; 4]>, diffusion: Option<[f64; 5]>, thermal_conductivity: Option<[f64; 4]>, - ) -> SaftVRQMieRecord { - SaftVRQMieRecord { + ) -> Result { + if m != 1.0 { + return Err(ParameterError::IncompatibleParameters(format!( + "Segment number `m` is not one. Chain-contributions are currently not supported." + ))); + } + Ok(SaftVRQMieRecord { m, sigma, epsilon_k, @@ -77,7 +82,7 @@ impl SaftVRQMieRecord { viscosity, diffusion, thermal_conductivity, - } + }) } } @@ -171,6 +176,16 @@ impl Parameter for SaftVRQMieParameters { for (i, record) in pure_records.iter().enumerate() { component_index.insert(record.identifier.clone(), i); let r = &record.model_record; + if r.m != 1.0 { + return Err( + ParameterError::IncompatibleParameters( + format!( + "Segment number `m` for component {} is not one. Chain-contributions are currently not supported.", + i + ) + ) + ); + } m[i] = r.m; sigma[i] = r.sigma; epsilon_k[i] = r.epsilon_k; diff --git a/src/saftvrqmie/python.rs b/src/saftvrqmie/python.rs index c8296abc3..3dbc9176e 100644 --- a/src/saftvrqmie/python.rs +++ b/src/saftvrqmie/python.rs @@ -15,10 +15,35 @@ use quantity::python::PySINumber; use std::convert::{TryFrom, TryInto}; use std::sync::Arc; -/// Create a set of Saft-VRQ Mie parameters from records. +/// Pure-substance parameters for the Saft-VRQ Mie equation of state. +/// +/// Parameters +/// ---------- +/// m : float +/// Segment number +/// sigma : float +/// Structure parameter of the Mie potential in units of +/// Angstrom. +/// epsilon_k : float +/// Energetic parameter of the Mie potential in units of +/// Kelvin. +/// lr : float +/// Repulsive exponent of the Mie potential. +/// la : float +/// Attractive exponent of the Mie potential. +/// fh : int +/// Feynman-Hibbs order. One of {0, 1, 2}. +/// `fh = 0` disables quantum corrections so that effectively, +/// the SAFT-VR Mie equation of state is used. +/// viscosity : List[float], optional +/// Entropy-scaling parameters for viscosity. Defaults to `None`. +/// diffusion : List[float], optional +/// Entropy-scaling parameters for diffusion. Defaults to `None`. +/// thermal_conductivity : List[float], optional +/// Entropy-scaling parameters for thermal_conductivity. Defaults to `None`. #[pyclass(name = "SaftVRQMieRecord")] #[pyo3( - text_signature = "(m, sigma, epsilon_k, viscosity=None, diffusion=None, thermal_conductivity=None)" + text_signature = "(m, sigma, epsilon_k, lr, la, fh, viscosity=None, diffusion=None, thermal_conductivity=None)" )] #[derive(Clone)] pub struct PySaftVRQMieRecord(SaftVRQMieRecord); @@ -34,10 +59,20 @@ impl PySaftVRQMieRecord { la: f64, fh: usize, viscosity: Option<[f64; 4]>, - ) -> Self { - Self(SaftVRQMieRecord::new( - m, sigma, epsilon_k, lr, la, fh, viscosity, None, None, - )) + diffusion: Option<[f64; 5]>, + thermal_conductivity: Option<[f64; 4]>, + ) -> PyResult { + Ok(Self(SaftVRQMieRecord::new( + m, + sigma, + epsilon_k, + lr, + la, + fh, + viscosity, + diffusion, + thermal_conductivity, + )?)) } #[getter]