Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<D>` 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)
Expand Down
24 changes: 23 additions & 1 deletion crates/feos/src/ideal_gas/dippr.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -152,6 +152,28 @@ impl IdealGas for Dippr {
}
}

impl<D: DualNum<f64> + Copy> IdealGasAD<D> for Dippr {
type Real = Self;

type Lifted<D2: DualNum<f64, Inner = D> + Copy> = Self;

fn re(&self) -> Self::Real {
self.clone()
}

fn lift<D2: DualNum<f64, Inner = D> + Copy>(&self) -> Self::Lifted<D2> {
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;
Expand Down
Loading