diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d69100a7..dea89e8ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add Rayon global thread pool control via `FEOS_MAX_THREADS` and `set_num_threads()`/ `get_num_threads()` to Python. [#346](https://github.com/feos-org/feos/pull/346) - Added DIPPR107 parameterization for ideal gas heat capacities of Burkhardt et al. [#344](https://github.com/feos-org/feos/pull/344) +- Implemented `IdealGasAD` for `Dippr`. [#357](https://github.com/feos-org/feos/pull/357) ### Fixed - Fixed the calculation of temperature and pressure derivatives of dew and bubble points. [#347](https://github.com/feos-org/feos/pull/347) diff --git a/crates/feos/src/ideal_gas/dippr.rs b/crates/feos/src/ideal_gas/dippr.rs index 89824b07a..f976fbe11 100644 --- a/crates/feos/src/ideal_gas/dippr.rs +++ b/crates/feos/src/ideal_gas/dippr.rs @@ -1,5 +1,5 @@ use feos_core::parameter::Parameters; -use feos_core::{FeosResult, IdealGas}; +use feos_core::{FeosResult, IdealGas, IdealGasAD}; use nalgebra::DVector; use num_dual::DualNum; use quantity::{JOULE, KELVIN, KILO, MOL, MolarEntropy, Temperature}; @@ -152,6 +152,28 @@ impl IdealGas for Dippr { } } +impl + Copy> IdealGasAD for Dippr { + type Real = Self; + + type Lifted + Copy> = Self; + + fn re(&self) -> Self::Real { + self.clone() + } + + fn lift + Copy>(&self) -> Self::Lifted { + self.clone() + } + + fn ln_lambda3(&self, temperature: D) -> D { + IdealGas::ln_lambda3(self, temperature) + } + + fn ideal_gas_model(&self) -> &'static str { + "Ideal gas (DIPPR)" + } +} + #[cfg(test)] mod tests { use approx::assert_relative_eq;