Skip to content

Commit e14c16f

Browse files
authored
Fix in the calculation of enthalpies of adsorption for mixtures (#329)
1 parent baf5330 commit e14c16f

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88
### Fixed
9+
- Fixed calculation of enthalpies of adsorption for mixtures. [#329](https://github.com/feos-org/feos/pull/329)
910
- Updated to `ndarray` 0.17 and `num-dual`0.13 to fix a broken dependency resolution. [#327](https://github.com/feos-org/feos/pull/327)
1011
- Fixed calculation of parameter combination in entropy scaling for mixtures in `viscosity_correlation`, `diffusion_correlation`, `thermal_conductivity_correlation`. [#323](https://github.com/feos-org/feos/pull/323)
1112

crates/feos-core/src/phase_equilibria/tp_flash.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ impl<E: Residual> State<E> {
9090
log_iter!(verbosity, "{:-<77}", "");
9191
log_iter!(
9292
verbosity,
93-
" {:4} | | {:10.8} | {:10.8}",
93+
" {:4} | | {:10.8?} | {:10.8?}",
9494
0,
95-
new_vle_state.vapor().molefracs,
96-
new_vle_state.liquid().molefracs,
95+
new_vle_state.vapor().molefracs.data.as_vec(),
96+
new_vle_state.liquid().molefracs.data.as_vec(),
9797
);
9898

9999
let mut iter = 0;
@@ -279,11 +279,11 @@ impl<E: Residual> PhaseEquilibrium<E, 2> {
279279
let res = res_vec.norm();
280280
log_iter!(
281281
verbosity,
282-
" {:4} | {:14.8e} | {:.8} | {:.8}",
282+
" {:4} | {:14.8e} | {:.8?} | {:.8?}",
283283
iter,
284284
res,
285-
self.vapor().molefracs,
286-
self.liquid().molefracs,
285+
self.vapor().molefracs.data.as_vec(),
286+
self.liquid().molefracs.data.as_vec(),
287287
);
288288
if res < abs_tol {
289289
return Ok(true);

crates/feos-dft/src/adsorption/pore.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ where
139139
}
140140

141141
pub fn enthalpy_of_adsorption(&self) -> FeosResult<MolarEnergy> {
142-
Ok((self.partial_molar_enthalpy_of_adsorption()?
143-
* Dimensionless::new(&self.profile.bulk.molefracs))
144-
.sum())
142+
Ok(self
143+
.partial_molar_enthalpy_of_adsorption()?
144+
.dot(&Dimensionless::new(self.profile.bulk.molefracs.clone())))
145145
}
146146

147147
fn _henry_coefficients<N: DualNum<f64> + Copy + DctNum>(&self, temperature: N) -> DVector<N> {

crates/feos-dft/src/profile/properties.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ where
352352
let n = drho_dmu.shape()[0];
353353
let mut dn_dmu = DMatrix::zeros(n, n);
354354
dn_dmu
355-
.row_iter_mut()
355+
.column_iter_mut()
356356
.zip(drho_dmu.outer_iter())
357357
.for_each(|(mut dn, drho)| dn.add_assign(&self.integrate_reduced_segments(&drho)));
358358
Ok(DnDmu::from_reduced(dn_dmu))

0 commit comments

Comments
 (0)