From a76fd3207279d188621a6b8bbf140fedcadc637d Mon Sep 17 00:00:00 2001 From: Rolf Stierle Date: Wed, 19 Oct 2022 16:33:17 +0200 Subject: [PATCH 1/4] Relative adsorption, interfacial enrichment, and interface thickness (90-10; just in Python interface, otherwise general) implemented. --- feos-dft/src/interface/mod.rs | 138 +++++++++++++++++++++++++++ feos-dft/src/python/interface/mod.rs | 43 +++++++++ tests/pcsaft/dft.rs | 39 +++++++- 3 files changed, 219 insertions(+), 1 deletion(-) diff --git a/feos-dft/src/interface/mod.rs b/feos-dft/src/interface/mod.rs index 0c9841790..22c247b66 100644 --- a/feos-dft/src/interface/mod.rs +++ b/feos-dft/src/interface/mod.rs @@ -196,6 +196,142 @@ impl PlanarInterface { self } + /// Relative adsorption of component `i' with respect to `j': \Gamma_i^(j) + pub fn relative_adsorption(&self) -> EosResult> { + let s = self.profile.density.shape(); + let mut rho_l = Array1::zeros(s[0]) * U::reference_density(); + let mut rho_v = Array1::zeros(s[0]) * U::reference_density(); + + // Calculate the partial densities in the liquid and in the vapor phase + for i in 0..s[0] { + // rho_l.try_set(i, self.profile.density.get((i, 0)) * m[i])?; + // rho_v.try_set(i, self.profile.density.get((i, s[1] - 1)) * m[i])?; + rho_l.try_set(i, self.profile.density.get((i, 0)))?; + rho_v.try_set(i, self.profile.density.get((i, s[1] - 1)))?; + } + + // Calculate \Gamma_i^(j) + let gamma = Array2::from_shape_fn((s[0], s[0]), |(i, j)| -> f64 { + if i == j { + 0.0 + } else { + (-(rho_l.get(i) - rho_v.get(i)) + * ((&self.profile.density.index_axis(Axis_nd(0), j) - rho_l.get(j)) + / (rho_l.get(j) - rho_v.get(j)) + - (&self.profile.density.index_axis(Axis_nd(0), i) - rho_l.get(i)) + / (rho_l.get(i) - rho_v.get(i))) + .integrate(&self.profile.grid.integration_weights_unit())) + .to_reduced(U::reference_density() * U::reference_length()) + .unwrap() + } + }); + + Ok(gamma * U::reference_density() * U::reference_length()) + } + + /// Interfacial enrichment of component `i': E_i + pub fn interfacial_enrichment(&self) -> EosResult> { + let s = self.profile.density.shape(); + let mut rho_l = Array1::zeros(s[0]) * U::reference_density(); + let mut rho_v = Array1::zeros(s[0]) * U::reference_density(); + + // Calculate the partial densities in the liquid and in the vapor phase + for i in 0..s[0] { + rho_l.try_set(i, self.profile.density.get((i, 0)))?; + rho_v.try_set(i, self.profile.density.get((i, s[1] - 1)))?; + } + + // Calculate interfacial enrichment E_i + let enrichment = Array1::from_shape_fn(s[0], |i| { + (*(self + .profile + .density + .index_axis(Axis_nd(0), i) + .to_owned() + .to_reduced(U::reference_density()) + .unwrap() + .iter() + .max_by(|&a, &b| a.total_cmp(b)) + .unwrap()) + * U::reference_density() + / (rho_l.get(i).max(rho_v.get(i)).unwrap())) + .into_value() + .unwrap() + }); + + Ok(enrichment) + } + + /// Interface thickness (90-10 number density difference) + pub fn interfacial_thickness(&self, limits: (f64, f64)) -> EosResult> { + let s = self.profile.density.shape(); + let rho = self + .profile + .density + .sum_axis(Axis_nd(0)) + .to_reduced(U::reference_density())?; + let z = self.profile.grid.grids()[0]; + let dz = z[1] - z[0]; + let (limit_upper, limit_lower) = if limits.0 > limits.1 { + (limits.0, limits.1) + } else { + (limits.1, limits.0) + }; + + if limit_upper >= 1.0 || limit_upper.is_sign_negative() { + panic!("Upper limit 'l' of interface thickness needs to satisfy 0 < l < 1."); + } + if limit_lower >= 1.0 || limit_lower.is_sign_negative() { + panic!("Lower limit 'l' of interface thickness needs to satisfy 0 < l < 1."); + } + + // Get the densities in the liquid and in the vapor phase + let rho_l = if rho.get(0) > rho.get(s[1] - 1) { + rho[0] + } else { + rho[s[1] - 1] + }; + let rho_v = if rho.get(0) > rho.get(s[1] - 1) { + rho[s[1] - 1] + } else { + rho[0] + }; + + // Density boundaries for interface definition + let rho_upper = rho_v + limit_upper * (rho_l - rho_v); + let rho_lower = rho_v + limit_lower * (rho_l - rho_v); + + // Get indizes right of intersection between density profile and + // constant density boundaries + let index_upper_plus = rho + .iter() + .enumerate() + .find(|(_, &x)| (x - rho_upper).is_sign_negative()) + .expect("Could not find rho_upper value!") + .0; + let index_lower_plus = rho + .iter() + .enumerate() + .find(|(_, &x)| (x - rho_lower).is_sign_negative()) + .expect("Could not find rho_lower value!") + .0; + + // Calculate distance between two density points using a linear + // interpolated density profiles between the two grid points where the + // density profile crosses the limiting densities + let z_upper = z[index_upper_plus - 1] + + (rho_upper - rho[index_upper_plus - 1]) + / (rho[index_upper_plus] - rho[index_upper_plus - 1]) + * dz; + let z_lower = z[index_lower_plus - 1] + + (rho_lower - rho[index_lower_plus - 1]) + / (rho[index_lower_plus] - rho[index_lower_plus - 1]) + * dz; + + // Return + Ok((z_lower - z_upper) * U::reference_length()) + } + fn set_density_scale(&mut self, init: &QuantityArray2) { assert_eq!(self.profile.density.shape(), init.shape()); let n_grid = self.profile.density.shape()[1]; @@ -230,6 +366,8 @@ impl PlanarInterface { } } +impl PlanarInterface {} + fn interp_symmetric( vle_pdgt: &PhaseEquilibrium, 2>, z_pdgt: QuantityArray1, diff --git a/feos-dft/src/python/interface/mod.rs b/feos-dft/src/python/interface/mod.rs index f0787b4ab..7f1a230b3 100644 --- a/feos-dft/src/python/interface/mod.rs +++ b/feos-dft/src/python/interface/mod.rs @@ -114,5 +114,48 @@ macro_rules! impl_planar_interface { PyPhaseEquilibrium(self.0.vle.clone()) } } + + #[pymethods] + impl PyPlanarInterface { + /// Calculates the Gibbs' relative adsorption of component `i' with + /// respect to `j': \Gamma_i^(j) + /// + /// Returns + /// ------- + /// SIArray2 + /// + #[pyo3(text_signature = "($self)")] + fn relative_adsorption(&self) -> PyResult { + Ok(self.0.relative_adsorption()?.into()) + } + + /// Calculates the interfacial enrichment E_i. + /// + /// Returns + /// ------- + /// numpy.ndarray + /// + #[pyo3(text_signature = "($self)")] + fn interfacial_enrichment<'py>(&self, py: Python<'py>) -> PyResult<&'py PyArray1> { + Ok(self.0.interfacial_enrichment()?.to_pyarray(py)) + } + + /// Calculates the interfacial thickness (90-10 number density difference) + /// + /// Parameters + /// ---------- + /// limits : tuple('float', 'float') + /// The bulk phase equilibrium. + /// + /// Returns + /// ------- + /// SINumber + /// + #[pyo3(text_signature = "($self)")] + fn interfacial_thickness(&self) -> PyResult { + let limits = (0.9, 0.1); + Ok(self.0.interfacial_thickness(limits)?.into()) + } + } }; } diff --git a/tests/pcsaft/dft.rs b/tests/pcsaft/dft.rs index 45ce81c55..61cd63189 100644 --- a/tests/pcsaft/dft.rs +++ b/tests/pcsaft/dft.rs @@ -4,7 +4,7 @@ use approx::assert_relative_eq; use feos::hard_sphere::FMTVersion; use feos::pcsaft::{PcSaft, PcSaftFunctional, PcSaftParameters}; use feos_core::parameter::{IdentifierOption, Parameter}; -use feos_core::{Contributions, PhaseEquilibrium, State}; +use feos_core::{Contributions, PhaseEquilibrium, SolverOptions, State}; use feos_dft::interface::PlanarInterface; use ndarray::{arr1, Axis}; use quantity::si::*; @@ -354,3 +354,40 @@ fn test_entropy_bulk_values() -> Result<(), Box> { ); Ok(()) } + +// #[test] +// #[allow(non_snake_case)] +// fn test_dft_relative_adsorption() -> Result<(), Box> { +// let params = Rc::new(PcSaftParameters::from_json( +// vec!["propane", "butane"], +// "tests/pcsaft/test_parameters.json", +// None, +// IdentifierOption::Name, +// )?); + +// let func = Rc::new(PcSaftFunctional::new(params)); +// let t = 200.0 * KELVIN; +// let w = 150.0 * ANGSTROM; +// let points = 1024; + +// let vle = PhaseEquilibrium::dew_point( +// &func, +// t, +// &arr1(&[0.5, 0.5]), +// None, +// None, +// (SolverOptions::default(), SolverOptions::default()), +// )?; +// let profile = PlanarInterface::from_tanh(&vle, points, w, 400.0 * KELVIN)?.solve(None)?; + +// println!( +// "Output {}\n {}\n {}\n {}\n", +// profile.surface_tension.unwrap(), +// profile.relative_adsorption().unwrap(), +// vle.vapor().density, +// vle.liquid().density, +// ); +// assert!(0 == 1); + +// Ok(()) +// } From b028680314518d0cdfcc5b6e6e124a1bc07fcce0 Mon Sep 17 00:00:00 2001 From: Rolf Stierle Date: Tue, 29 Nov 2022 16:33:39 +0100 Subject: [PATCH 2/4] Improvements for Interfacial property diagrams. --- feos-dft/src/interface/mod.rs | 111 +++++++++--------- .../src/interface/surface_tension_diagram.rs | 24 +++- feos-dft/src/python/interface/mod.rs | 9 +- .../interface/surface_tension_diagram.rs | 16 +++ tests/pcsaft/dft.rs | 39 +----- 5 files changed, 99 insertions(+), 100 deletions(-) diff --git a/feos-dft/src/interface/mod.rs b/feos-dft/src/interface/mod.rs index 22c247b66..da2d74ae4 100644 --- a/feos-dft/src/interface/mod.rs +++ b/feos-dft/src/interface/mod.rs @@ -211,59 +211,43 @@ impl PlanarInterface { } // Calculate \Gamma_i^(j) - let gamma = Array2::from_shape_fn((s[0], s[0]), |(i, j)| -> f64 { + let gamma = QuantityArray2::from_shape_fn((s[0], s[0]), |(i, j)| { if i == j { - 0.0 + 0.0 * U::reference_density() * U::reference_length() } else { - (-(rho_l.get(i) - rho_v.get(i)) + -(rho_l.get(i) - rho_v.get(i)) * ((&self.profile.density.index_axis(Axis_nd(0), j) - rho_l.get(j)) / (rho_l.get(j) - rho_v.get(j)) - (&self.profile.density.index_axis(Axis_nd(0), i) - rho_l.get(i)) / (rho_l.get(i) - rho_v.get(i))) - .integrate(&self.profile.grid.integration_weights_unit())) - .to_reduced(U::reference_density() * U::reference_length()) - .unwrap() + .integrate(&self.profile.grid.integration_weights_unit()) } }); - Ok(gamma * U::reference_density() * U::reference_length()) + Ok(gamma) } /// Interfacial enrichment of component `i': E_i pub fn interfacial_enrichment(&self) -> EosResult> { let s = self.profile.density.shape(); - let mut rho_l = Array1::zeros(s[0]) * U::reference_density(); - let mut rho_v = Array1::zeros(s[0]) * U::reference_density(); + let density = self.profile.density.to_reduced(U::reference_density())?; + let rho_l = density.index_axis(Axis_nd(1), 0); + let rho_v = density.index_axis(Axis_nd(1), s[1] - 1); - // Calculate the partial densities in the liquid and in the vapor phase - for i in 0..s[0] { - rho_l.try_set(i, self.profile.density.get((i, 0)))?; - rho_v.try_set(i, self.profile.density.get((i, s[1] - 1)))?; - } - - // Calculate interfacial enrichment E_i let enrichment = Array1::from_shape_fn(s[0], |i| { - (*(self - .profile - .density + *(density .index_axis(Axis_nd(0), i) - .to_owned() - .to_reduced(U::reference_density()) - .unwrap() .iter() .max_by(|&a, &b| a.total_cmp(b)) - .unwrap()) - * U::reference_density() - / (rho_l.get(i).max(rho_v.get(i)).unwrap())) - .into_value() - .unwrap() + .unwrap()) // panics only of itertor is empty + / rho_l[i].max(rho_v[i]) }); Ok(enrichment) } /// Interface thickness (90-10 number density difference) - pub fn interfacial_thickness(&self, limits: (f64, f64)) -> EosResult> { + pub fn interfacial_thickness(&self) -> EosResult> { let s = self.profile.density.shape(); let rho = self .profile @@ -272,6 +256,8 @@ impl PlanarInterface { .to_reduced(U::reference_density())?; let z = self.profile.grid.grids()[0]; let dz = z[1] - z[0]; + + let limits = (0.9_f64, 0.1_f64); let (limit_upper, limit_lower) = if limits.0 > limits.1 { (limits.0, limits.1) } else { @@ -279,23 +265,27 @@ impl PlanarInterface { }; if limit_upper >= 1.0 || limit_upper.is_sign_negative() { - panic!("Upper limit 'l' of interface thickness needs to satisfy 0 < l < 1."); + return Err(EosError::IterationFailed(String::from( + "Upper limit 'l' of interface thickness needs to satisfy 0 < l < 1.", + ))); } if limit_lower >= 1.0 || limit_lower.is_sign_negative() { - panic!("Lower limit 'l' of interface thickness needs to satisfy 0 < l < 1."); + return Err(EosError::IterationFailed(String::from( + "Lower limit 'l' of interface thickness needs to satisfy 0 < l < 1.", + ))); } // Get the densities in the liquid and in the vapor phase - let rho_l = if rho.get(0) > rho.get(s[1] - 1) { - rho[0] - } else { - rho[s[1] - 1] - }; - let rho_v = if rho.get(0) > rho.get(s[1] - 1) { - rho[s[1] - 1] - } else { - rho[0] - }; + let rho_v = rho[0].min(rho[s[1] - 1]); + let rho_l = rho[0].max(rho[s[1] - 1]); + + if (rho_l - rho_v).abs() < 1.0e-10 { + // return Err(EosError::NotConverged( + // "Densities in both phases are to similar for interface thickness calculation." + // .to_string(), + // )); + return Ok(0.0 * U::reference_length()); + } // Density boundaries for interface definition let rho_upper = rho_v + limit_upper * (rho_l - rho_v); @@ -303,18 +293,33 @@ impl PlanarInterface { // Get indizes right of intersection between density profile and // constant density boundaries - let index_upper_plus = rho - .iter() - .enumerate() - .find(|(_, &x)| (x - rho_upper).is_sign_negative()) - .expect("Could not find rho_upper value!") - .0; - let index_lower_plus = rho - .iter() - .enumerate() - .find(|(_, &x)| (x - rho_lower).is_sign_negative()) - .expect("Could not find rho_lower value!") - .0; + + let index_upper_plus = if rho[0] >= rho[s[1] - 1] { + rho.iter() + .enumerate() + .find(|(_, &x)| (x - rho_upper).is_sign_negative()) + .expect("Could not find rho_upper value!") + .0 + } else { + rho.iter() + .enumerate() + .find(|(_, &x)| (rho_upper - x).is_sign_negative()) + .expect("Could not find rho_upper value!") + .0 + }; + let index_lower_plus = if rho[0] >= rho[s[1] - 1] { + rho.iter() + .enumerate() + .find(|(_, &x)| (x - rho_lower).is_sign_negative()) + .expect("Could not find rho_lower value!") + .0 + } else { + rho.iter() + .enumerate() + .find(|(_, &x)| (rho_lower - x).is_sign_negative()) + .expect("Could not find rho_lower value!") + .0 + }; // Calculate distance between two density points using a linear // interpolated density profiles between the two grid points where the @@ -366,8 +371,6 @@ impl PlanarInterface { } } -impl PlanarInterface {} - fn interp_symmetric( vle_pdgt: &PhaseEquilibrium, 2>, z_pdgt: QuantityArray1, diff --git a/feos-dft/src/interface/surface_tension_diagram.rs b/feos-dft/src/interface/surface_tension_diagram.rs index 0122432ee..84b768fc1 100644 --- a/feos-dft/src/interface/surface_tension_diagram.rs +++ b/feos-dft/src/interface/surface_tension_diagram.rs @@ -2,7 +2,8 @@ use super::PlanarInterface; use crate::functional::{HelmholtzEnergyFunctional, DFT}; use crate::solver::DFTSolver; use feos_core::{EosUnit, PhaseEquilibrium, StateVec}; -use quantity::{QuantityArray1, QuantityScalar}; +use ndarray::Array1; +use quantity::{QuantityArray1, QuantityArray2, QuantityScalar}; const DEFAULT_GRID_POINTS: usize = 2048; @@ -76,4 +77,25 @@ impl SurfaceTensionDiagram { self.profiles[i].surface_tension.unwrap() }) } + + pub fn relative_adsorption(&self) -> Vec> { + self.profiles + .iter() + .map(|planar_interf| planar_interf.relative_adsorption().unwrap()) + .collect() + } + + pub fn interfacial_enrichment(&self) -> Vec> { + self.profiles + .iter() + .map(|planar_interf| planar_interf.interfacial_enrichment().unwrap()) + .collect() + } + + pub fn interfacial_thickness(&self) -> QuantityArray1 { + self.profiles + .iter() + .map(|planar_interf| planar_interf.interfacial_thickness().unwrap()) + .collect() + } } diff --git a/feos-dft/src/python/interface/mod.rs b/feos-dft/src/python/interface/mod.rs index 7f1a230b3..b0d8b0772 100644 --- a/feos-dft/src/python/interface/mod.rs +++ b/feos-dft/src/python/interface/mod.rs @@ -142,19 +142,14 @@ macro_rules! impl_planar_interface { /// Calculates the interfacial thickness (90-10 number density difference) /// - /// Parameters - /// ---------- - /// limits : tuple('float', 'float') - /// The bulk phase equilibrium. - /// /// Returns /// ------- /// SINumber /// #[pyo3(text_signature = "($self)")] fn interfacial_thickness(&self) -> PyResult { - let limits = (0.9, 0.1); - Ok(self.0.interfacial_thickness(limits)?.into()) + // let limits = (0.9, 0.1); + Ok(self.0.interfacial_thickness()?.into()) } } }; diff --git a/feos-dft/src/python/interface/surface_tension_diagram.rs b/feos-dft/src/python/interface/surface_tension_diagram.rs index 0f2687b8a..97eb0f060 100644 --- a/feos-dft/src/python/interface/surface_tension_diagram.rs +++ b/feos-dft/src/python/interface/surface_tension_diagram.rs @@ -75,6 +75,22 @@ macro_rules! impl_surface_tension_diagram { pub fn get_surface_tension(&mut self) -> PySIArray1 { self.0.surface_tension().into() } + + #[getter] + pub fn get_relative_adsorption(&self) -> Vec { + self.0.relative_adsorption().iter().cloned().map(|i| i.into()).collect() + } + + #[getter] + pub fn get_interfacial_enrichment<'py>(&self, py: Python<'py>) -> Vec<&'py PyArray1> { + self.0.interfacial_enrichment().iter().map(|i| i.to_pyarray(py)).collect() + } + + #[getter] + pub fn interfacial_thickness(&self) -> PySIArray1 { + // let limits = (0.9, 0.1); + self.0.interfacial_thickness().into() + } } }; } diff --git a/tests/pcsaft/dft.rs b/tests/pcsaft/dft.rs index 61cd63189..45ce81c55 100644 --- a/tests/pcsaft/dft.rs +++ b/tests/pcsaft/dft.rs @@ -4,7 +4,7 @@ use approx::assert_relative_eq; use feos::hard_sphere::FMTVersion; use feos::pcsaft::{PcSaft, PcSaftFunctional, PcSaftParameters}; use feos_core::parameter::{IdentifierOption, Parameter}; -use feos_core::{Contributions, PhaseEquilibrium, SolverOptions, State}; +use feos_core::{Contributions, PhaseEquilibrium, State}; use feos_dft::interface::PlanarInterface; use ndarray::{arr1, Axis}; use quantity::si::*; @@ -354,40 +354,3 @@ fn test_entropy_bulk_values() -> Result<(), Box> { ); Ok(()) } - -// #[test] -// #[allow(non_snake_case)] -// fn test_dft_relative_adsorption() -> Result<(), Box> { -// let params = Rc::new(PcSaftParameters::from_json( -// vec!["propane", "butane"], -// "tests/pcsaft/test_parameters.json", -// None, -// IdentifierOption::Name, -// )?); - -// let func = Rc::new(PcSaftFunctional::new(params)); -// let t = 200.0 * KELVIN; -// let w = 150.0 * ANGSTROM; -// let points = 1024; - -// let vle = PhaseEquilibrium::dew_point( -// &func, -// t, -// &arr1(&[0.5, 0.5]), -// None, -// None, -// (SolverOptions::default(), SolverOptions::default()), -// )?; -// let profile = PlanarInterface::from_tanh(&vle, points, w, 400.0 * KELVIN)?.solve(None)?; - -// println!( -// "Output {}\n {}\n {}\n {}\n", -// profile.surface_tension.unwrap(), -// profile.relative_adsorption().unwrap(), -// vle.vapor().density, -// vle.liquid().density, -// ); -// assert!(0 == 1); - -// Ok(()) -// } From 2d048314f8d02226553de0775fa8a5e0dfeada25 Mon Sep 17 00:00:00 2001 From: Rolf Stierle Date: Thu, 1 Dec 2022 15:16:01 +0100 Subject: [PATCH 3/4] Changelog added; commented blocks removed. --- feos-dft/CHANGELOG.md | 3 +++ feos-dft/src/interface/mod.rs | 9 +-------- feos-dft/src/python/interface/mod.rs | 1 - feos-dft/src/python/interface/surface_tension_diagram.rs | 1 - 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/feos-dft/CHANGELOG.md b/feos-dft/CHANGELOG.md index 8cf352dc0..d36b0f7e2 100644 --- a/feos-dft/CHANGELOG.md +++ b/feos-dft/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- `PlanarInterface` can now has methods for the calculation of the 90-10 interface thickness (`PlanarInterface::interfacial_thickness`), interfacial enrichtment (`PlanarInterface::interfacial_enrichment`), and the relative adsorption (`PlanarInterface::relative_adsorption`). + ### Changed - Added `Send` and `Sync` as supertraits to `HelmholtzEnergyFunctional` and all related traits. [#57](https://github.com/feos-org/feos/pull/57) - Renamed the `3d_dft` feature to `rayon` in accordance to the other feos crates. [#62](https://github.com/feos-org/feos/pull/62) diff --git a/feos-dft/src/interface/mod.rs b/feos-dft/src/interface/mod.rs index da2d74ae4..956288327 100644 --- a/feos-dft/src/interface/mod.rs +++ b/feos-dft/src/interface/mod.rs @@ -204,8 +204,6 @@ impl PlanarInterface { // Calculate the partial densities in the liquid and in the vapor phase for i in 0..s[0] { - // rho_l.try_set(i, self.profile.density.get((i, 0)) * m[i])?; - // rho_v.try_set(i, self.profile.density.get((i, s[1] - 1)) * m[i])?; rho_l.try_set(i, self.profile.density.get((i, 0)))?; rho_v.try_set(i, self.profile.density.get((i, s[1] - 1)))?; } @@ -239,7 +237,7 @@ impl PlanarInterface { .index_axis(Axis_nd(0), i) .iter() .max_by(|&a, &b| a.total_cmp(b)) - .unwrap()) // panics only of itertor is empty + .unwrap()) // panics only of iterator is empty / rho_l[i].max(rho_v[i]) }); @@ -280,10 +278,6 @@ impl PlanarInterface { let rho_l = rho[0].max(rho[s[1] - 1]); if (rho_l - rho_v).abs() < 1.0e-10 { - // return Err(EosError::NotConverged( - // "Densities in both phases are to similar for interface thickness calculation." - // .to_string(), - // )); return Ok(0.0 * U::reference_length()); } @@ -293,7 +287,6 @@ impl PlanarInterface { // Get indizes right of intersection between density profile and // constant density boundaries - let index_upper_plus = if rho[0] >= rho[s[1] - 1] { rho.iter() .enumerate() diff --git a/feos-dft/src/python/interface/mod.rs b/feos-dft/src/python/interface/mod.rs index b0d8b0772..fc4ae5df8 100644 --- a/feos-dft/src/python/interface/mod.rs +++ b/feos-dft/src/python/interface/mod.rs @@ -148,7 +148,6 @@ macro_rules! impl_planar_interface { /// #[pyo3(text_signature = "($self)")] fn interfacial_thickness(&self) -> PyResult { - // let limits = (0.9, 0.1); Ok(self.0.interfacial_thickness()?.into()) } } diff --git a/feos-dft/src/python/interface/surface_tension_diagram.rs b/feos-dft/src/python/interface/surface_tension_diagram.rs index 97eb0f060..eaaafc602 100644 --- a/feos-dft/src/python/interface/surface_tension_diagram.rs +++ b/feos-dft/src/python/interface/surface_tension_diagram.rs @@ -88,7 +88,6 @@ macro_rules! impl_surface_tension_diagram { #[getter] pub fn interfacial_thickness(&self) -> PySIArray1 { - // let limits = (0.9, 0.1); self.0.interfacial_thickness().into() } } From c011d19d31266ab4614be5363a343ee0676751e9 Mon Sep 17 00:00:00 2001 From: Rolf Stierle Date: Thu, 1 Dec 2022 15:39:19 +0100 Subject: [PATCH 4/4] English error corrected. --- feos-dft/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/feos-dft/CHANGELOG.md b/feos-dft/CHANGELOG.md index d36b0f7e2..387ed5e4f 100644 --- a/feos-dft/CHANGELOG.md +++ b/feos-dft/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- `PlanarInterface` can now has methods for the calculation of the 90-10 interface thickness (`PlanarInterface::interfacial_thickness`), interfacial enrichtment (`PlanarInterface::interfacial_enrichment`), and the relative adsorption (`PlanarInterface::relative_adsorption`). +- `PlanarInterface` now has methods for the calculation of the 90-10 interface thickness (`PlanarInterface::interfacial_thickness`), interfacial enrichtment (`PlanarInterface::interfacial_enrichment`), and relative adsorption (`PlanarInterface::relative_adsorption`). ### Changed - Added `Send` and `Sync` as supertraits to `HelmholtzEnergyFunctional` and all related traits. [#57](https://github.com/feos-org/feos/pull/57)