Skip to content
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
Added parallelization for estimator
  • Loading branch information
g-bauer committed Oct 17, 2022
commit 0f67fe6a99dcedf2c38231ff15d655bf8d5dbfdf
15 changes: 9 additions & 6 deletions feos-core/src/phase_equilibria/phase_diagram_pure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use crate::equation_of_state::EquationOfState;
use crate::errors::EosResult;
use crate::state::{State, StateVec};
use crate::EosUnit;
use ndarray::{Array1, ArrayView1};
use numpy::ndarray::Axis;
use ndarray::{Array1, ArrayView1, Axis};
use quantity::{QuantityArray1, QuantityScalar};
use rayon::prelude::*;
use std::sync::Arc;
Expand Down Expand Up @@ -65,7 +64,13 @@ impl<U: EosUnit, E: EquationOfState> PhaseDiagram<U, E> {
let mut states = Vec::with_capacity(range.len());
let mut vle = None;
for ti in range {
vle = PhaseEquilibrium::pure(eos, *ti * U::reference_temperature(), vle.as_ref(), options).ok();
vle = PhaseEquilibrium::pure(
eos,
*ti * U::reference_temperature(),
vle.as_ref(),
options,
)
.ok();
if let Some(vle) = vle.as_ref() {
states.push(vle.clone());
}
Expand Down Expand Up @@ -97,9 +102,7 @@ impl<U: EosUnit, E: EquationOfState> PhaseDiagram<U, E> {
let mut states: Vec<PhaseEquilibrium<U, E, 2>> = temperatures
.axis_chunks_iter(Axis(0), chunksize)
.into_par_iter()
.filter_map(|t| {
Self::solve_range(eos, t, options).ok()
})
.filter_map(|t| Self::solve_range(eos, t, options).ok())
.flatten()
.collect();

Expand Down
Loading