Skip to content
This repository was archived by the owner on Jun 14, 2022. It is now read-only.
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.2] - 2022-01-10
### Changed
- Changed `ChemicalRecord` to an enum that can hold either the full structural information of a molecule or only segment and bond counts and added an `Identifier`. [#19](https://github.com/feos-org/feos-core/pull/19)
- Removed the `chemical_record` field from `PureRecord` and made `model_record` non-optional. [#19](https://github.com/feos-org/feos-core/pull/19)

## [0.1.1] - 2021-12-22
### Added
- Added `from_multiple_json` function to `Parameter` trait that is able to read parameters from separate JSON files. [#15](https://github.com/feos-org/feos-core/pull/15)
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "feos-core"
version = "0.1.1"
version = "0.1.2"
authors = ["Gernot Bauer <bauer@itt.uni-stuttgart.de>",
"Philipp Rehner <prehner@ethz.ch"]
edition = "2018"
Expand All @@ -27,6 +27,7 @@ argmin = "0.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
indexmap = "1.7"
either = "1.6"
numpy = { version = "0.15", optional = true }
pyo3 = { version = "0.15", optional = true }

Expand Down
4 changes: 2 additions & 2 deletions build_wheel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "feos_core"
version = "0.1.1"
version = "0.1.2"
authors = ["Gernot Bauer <bauer@itt.uni-stuttgart.de>",
"Philipp Rehner <rehner@itt.uni-stuttgart.de"]
"Philipp Rehner <prehner@ethz.ch"]
edition = "2018"

[lib]
Expand Down
27 changes: 8 additions & 19 deletions src/cubic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use ndarray::{Array1, Array2};
use num_dual::DualNum;
use quantity::si::{SIArray1, SIUnit};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::f64::consts::SQRT_2;
use std::rc::Rc;

Expand Down Expand Up @@ -102,7 +101,7 @@ impl PengRobinsonParameters {
acentric_factor: acentric_factor[i],
};
let id = Identifier::new("1", None, None, None, None, None);
PureRecord::new(id, molarweight[i], None, Some(record), None)
PureRecord::new(id, molarweight[i], record, None)
})
.collect();
Ok(PengRobinsonParameters::from_records(
Expand Down Expand Up @@ -130,23 +129,13 @@ impl Parameter for PengRobinsonParameters {
let mut molarweight = Array1::zeros(n);
let mut kappa = Array1::zeros(n);

let mut component_index = HashMap::with_capacity(n);
for (i, record) in pure_records.iter().enumerate() {
component_index.insert(record.identifier.clone(), i);
molarweight[i] = record.molarweight;
match &record.model_record {
Some(r) => {
tc[i] = r.tc;
a[i] = 0.45724 * r.tc.powi(2) * KB_A3 / r.pc;
b[i] = 0.07780 * r.tc * KB_A3 / r.pc;
kappa[i] =
0.37464 + (1.54226 - 0.26992 * r.acentric_factor) * r.acentric_factor;
}
None => panic!(
"No Peng-Robinson parameters for {} found.",
record.identifier.cas
),
};
let r = &record.model_record;
tc[i] = r.tc;
a[i] = 0.45724 * r.tc.powi(2) * KB_A3 / r.pc;
b[i] = 0.07780 * r.tc * KB_A3 / r.pc;
kappa[i] = 0.37464 + (1.54226 - 0.26992 * r.acentric_factor) * r.acentric_factor;
}

let joback_records = pure_records
Expand Down Expand Up @@ -315,8 +304,8 @@ mod tests {
fn peng_robinson() -> EosResult<()> {
let mixture = pure_record_vec();
let propane = mixture[0].clone();
let tc = propane.model_record.clone().unwrap().tc;
let pc = propane.model_record.clone().unwrap().pc;
let tc = propane.model_record.tc;
let pc = propane.model_record.pc;
let parameters =
PengRobinsonParameters::from_records(vec![propane.clone()], Array2::zeros((1, 1)));
let pr = Rc::new(PengRobinson::new(Rc::new(parameters)));
Expand Down
1 change: 1 addition & 0 deletions src/joback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ mod tests {
let segment_records: Vec<SegmentRecord<ModelRecord, JobackRecord>> =
serde_json::from_str(segments_json).expect("Unable to parse json.");
let segments = ChemicalRecord::new(
Identifier::new("", None, None, None, None, None),
vec![
String::from("-Cl"),
String::from("-Cl"),
Expand Down
Loading