Skip to content

Commit be1f67c

Browse files
author
Rolf Stierle
committed
Added test for mixture and pseudo mixture (pure substance as mixture) for viscosity
1 parent 18fe534 commit be1f67c

File tree

2 files changed

+94
-18
lines changed

2 files changed

+94
-18
lines changed

crates/feos/src/pcsaft/eos/mod.rs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ impl EntropyScaling for PcSaft {
386386
mod tests {
387387
use super::*;
388388
use crate::pcsaft::parameters::utils::{
389-
butane_parameters, propane_butane_parameters, propane_parameters,
389+
butane_parameters, nonane_heptane_parameters, nonane_parameters, propane_butane_parameters,
390+
propane_parameters,
390391
};
391392
use approx::assert_relative_eq;
392393
use feos_core::*;
@@ -547,23 +548,23 @@ mod tests {
547548

548549
#[test]
549550
fn viscosity_mix() -> FeosResult<()> {
550-
let e = &propane_butane_parameters();
551-
let t = 300.0 * KELVIN;
552-
let p = 2.0 * BAR;
553-
let n = dvector![1.0, 0.0] * MOL;
554-
let s = State::new_npt(&e, t, p, &n, None)?;
555-
assert_relative_eq!(
556-
s.viscosity(),
557-
0.00797 * MILLI * PASCAL * SECOND,
558-
epsilon = 1e-5
559-
);
560-
assert_relative_eq!(
561-
s.ln_viscosity_reduced(),
562-
(s.viscosity() / e.viscosity_reference(s.temperature, s.volume, &s.moles))
563-
.into_value()
564-
.ln(),
565-
epsilon = 1e-15
566-
);
551+
// Test case: compare fig 15 of Lötgering-Lin 2018 (https://doi.org/10.1021/acs.iecr.7b04871)
552+
let e = &nonane_heptane_parameters();
553+
let nonane = &nonane_parameters();
554+
555+
let t = 303.15 * KELVIN;
556+
let p = 500.0 * BAR;
557+
let n = dvector![0.25, 0.75] * MOL;
558+
let viscosity_mix = State::new_npt(&e, t, p, &n, None)?.viscosity();
559+
let viscosity_paper = 0.68298 * MILLI * PASCAL * SECOND;
560+
assert_relative_eq!(viscosity_paper, viscosity_mix, epsilon = 1e-8);
561+
562+
// Make sure pure substance case is recovered
563+
let n_pseudo_mix = dvector![1.0, 0.0] * MOL;
564+
let viscosity_pseudo_mix = State::new_npt(&e, t, p, &n_pseudo_mix, None)?.viscosity();
565+
let n_nonane = dvector![1.0] * MOL;
566+
let viscosity_nonane = State::new_npt(&nonane, t, p, &n_nonane, None)?.viscosity();
567+
assert_relative_eq!(viscosity_pseudo_mix, viscosity_nonane, epsilon = 1e-15);
567568
Ok(())
568569
}
569570

crates/feos/src/pcsaft/parameters.rs

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,33 @@ pub mod utils {
391391
PcSaft::new(PcSaftParameters::new_pure(butane_record).unwrap())
392392
}
393393

394+
pub fn nonane_parameters() -> PcSaft {
395+
let nonane_json = r#"
396+
{
397+
"identifier": {
398+
"cas": "111-84-2",
399+
"name": "nonane",
400+
"iupac_name": "nonane",
401+
"smiles": "CCCCCCCCC",
402+
"inchi": "InChI=1S/C9H20/c1-3-5-7-9-8-6-4-2/h3-9H2,1-2H3",
403+
"formula": "C9H20"
404+
},
405+
"molarweight": 128.258,
406+
"m": 4.2079,
407+
"sigma": 3.8448,
408+
"epsilon_k": 244.51,
409+
"viscosity": [
410+
-1.4629,
411+
-3.0058,
412+
-0.5842,
413+
-0.1222
414+
]
415+
}"#;
416+
let nonane_record: PureRecord<PcSaftRecord, PcSaftAssociationRecord> =
417+
serde_json::from_str(nonane_json).expect("Unable to parse json.");
418+
PcSaft::new(PcSaftParameters::new_pure(nonane_record).unwrap())
419+
}
420+
394421
pub fn dme_parameters() -> PcSaftPars {
395422
let dme_json = r#"
396423
{
@@ -522,6 +549,54 @@ pub mod utils {
522549
PcSaft::new(PcSaftParameters::new_binary(binary_record, None, vec![]).unwrap())
523550
}
524551

552+
pub fn nonane_heptane_parameters() -> PcSaft {
553+
let binary_json = r#"[
554+
{
555+
"identifier": {
556+
"cas": "111-84-2",
557+
"name": "nonane",
558+
"iupac_name": "nonane",
559+
"smiles": "CCCCCCCCC",
560+
"inchi": "InChI=1S/C9H20/c1-3-5-7-9-8-6-4-2/h3-9H2,1-2H3",
561+
"formula": "C9H20"
562+
},
563+
"molarweight": 128.258,
564+
"m": 4.2079,
565+
"sigma": 3.8448,
566+
"epsilon_k": 244.51,
567+
"viscosity": [
568+
-1.4629,
569+
-3.0058,
570+
-0.5842,
571+
-0.1222
572+
]
573+
},
574+
{
575+
"identifier": {
576+
"cas": "142-82-5",
577+
"name": "heptane",
578+
"iupac_name": "heptane",
579+
"smiles": "CCCCCCC",
580+
"inchi": "InChI=1S/C7H16/c1-3-5-7-6-4-2/h3-7H2,1-2H3",
581+
"formula": "C7H16"
582+
},
583+
"molarweight": 100.204,
584+
"m": 3.4831,
585+
"sigma": 3.8049,
586+
"epsilon_k": 238.4,
587+
"viscosity": [
588+
-1.2979,
589+
-2.6936,
590+
-0.4951,
591+
-0.0988
592+
]
593+
}
594+
]"#;
595+
let binary_record: [PureRecord<PcSaftRecord, PcSaftAssociationRecord>; 2] =
596+
serde_json::from_str(binary_json).expect("Unable to parse json.");
597+
PcSaft::new(PcSaftParameters::new_binary(binary_record, None, vec![]).unwrap())
598+
}
599+
525600
#[test]
526601
pub fn test_kij() -> FeosResult<()> {
527602
let ch3: String = "CH3".into();

0 commit comments

Comments
 (0)