Skip to content
This repository was archived by the owner on Jul 28, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use StateVec in SurfaceTensionDiagram
  • Loading branch information
prehner committed Apr 7, 2022
commit c71605e42d5087de02e0ea76450e13514ab72f7d
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.2.0] - 2022-03-??
### Changed
- Renamed `AxisGeometry` to `Geometry`.
- Removed `PyGeometry` and `PyFMTVersion` in favor of a simpler implementation using `PyO3`'s new `#[pyclass]` for fieldless enums feature.
- `DFTSolver` now uses `Verbosity` instead of a `bool` to control its output.
- Renamed `AxisGeometry` to `Geometry`. [#19](https://github.com/feos-org/feos-dft/pull/19)
- Removed `PyGeometry` and `PyFMTVersion` in favor of a simpler implementation using `PyO3`'s new `#[pyclass]` for fieldless enums feature. [#19](https://github.com/feos-org/feos-dft/pull/19)
- `DFTSolver` now uses `Verbosity` instead of a `bool` to control its output. [#19](https://github.com/feos-org/feos-dft/pull/19)
- `SurfaceTensionDiagram` now uses the new `StateVec` struct to access properties of the bulk phases. [#19](https://github.com/feos-org/feos-dft/pull/19)

### Packaging
- Updated `pyo3` and `numpy` dependencies to 0.16.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rustdoc-args = [ "--html-in-header", "./docs-header.html" ]

[dependencies]
quantity = { version = "0.5", features = ["linalg"] }
feos-core = { git = "https://github.com/feos-org/feos-core" }
feos-core = { git = "https://github.com/feos-org/feos-core", branch = "state_vec" }
num-dual = "0.5"
ndarray = { version = "0.15", features = ["serde", "rayon"] }
ndarray-stats = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion build_wheel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ crate-type = ["cdylib"]

[dependencies]
quantity = "0.5"
feos-core = { git = "https://github.com/feos-org/feos-core" }
feos-core = { git = "https://github.com/feos-org/feos-core", branch = "state_vec" }
feos-dft = { path = "..", features = ["python"] }
pyo3 = { version = "0.16", features = ["extension-module", "abi3", "abi3-py37"] }
numpy = "0.16"
39 changes: 5 additions & 34 deletions src/interface/surface_tension_diagram.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use super::PlanarInterface;
use crate::functional::{HelmholtzEnergyFunctional, DFT};
use crate::solver::DFTSolver;
use feos_core::{Contributions, EosUnit, EquationOfState, PhaseEquilibrium};
use ndarray::Array1;
use feos_core::{EosUnit, PhaseEquilibrium, StateVec};
use quantity::{QuantityArray1, QuantityScalar};

const DEFAULT_GRID_POINTS: usize = 2048;
Expand Down Expand Up @@ -64,40 +63,12 @@ impl<U: EosUnit, F: HelmholtzEnergyFunctional> SurfaceTensionDiagram<U, F> {
Self { profiles }
}

pub fn temperature(&self) -> QuantityArray1<U> {
QuantityArray1::from_shape_fn(self.profiles.len(), |i| {
self.profiles[i].profile.temperature
})
}

pub fn pressure(&self) -> QuantityArray1<U> {
QuantityArray1::from_shape_fn(self.profiles.len(), |i| {
self.profiles[i].vle.vapor().pressure(Contributions::Total)
})
pub fn vapor(&self) -> StateVec<'_, U, DFT<F>> {
self.profiles.iter().map(|p| p.vle.vapor()).collect()
}

pub fn vapor_molefracs(&self) -> Array1<f64> {
let mut x: Array1<f64> = self
.profiles
.iter()
.map(|p| p.vle.vapor().molefracs[0])
.collect();
if self.profiles[0].vle.vapor().eos.components() == 1 {
x[0] = 0.0;
}
x
}

pub fn liquid_molefracs(&self) -> Array1<f64> {
let mut x: Array1<f64> = self
.profiles
.iter()
.map(|p| p.vle.liquid().molefracs[0])
.collect();
if self.profiles[0].vle.liquid().eos.components() == 1 {
x[0] = 0.0;
}
x
pub fn liquid(&self) -> StateVec<'_, U, DFT<F>> {
self.profiles.iter().map(|p| p.vle.liquid()).collect()
}

pub fn surface_tension(&mut self) -> QuantityArray1<U> {
Expand Down