Skip to content
Merged
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
Require kappa_ab and epsilon_k_ab
  • Loading branch information
prehner committed Apr 19, 2024
commit f9cda7e3dac7021bcd8195b2c8ee9196313b76a4
33 changes: 11 additions & 22 deletions src/pcsaft/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,24 +247,17 @@ impl PcSaftRecord {
diffusion: Option<[f64; 5]>,
thermal_conductivity: Option<[f64; 4]>,
) -> PcSaftRecord {
let association_record = if kappa_ab.is_none()
&& epsilon_k_ab.is_none()
&& na.is_none()
&& nb.is_none()
&& nc.is_none()
{
None
} else {
Some(AssociationRecord::new(
PcSaftAssociationRecord::new(
kappa_ab.unwrap_or_default(),
epsilon_k_ab.unwrap_or_default(),
),
na.unwrap_or_default(),
nb.unwrap_or_default(),
nc.unwrap_or_default(),
))
};
let association_record =
if let (Some(kappa_ab), Some(epsilon_k_ab)) = (kappa_ab, epsilon_k_ab) {
Some(AssociationRecord::new(
PcSaftAssociationRecord::new(kappa_ab, epsilon_k_ab),
na.unwrap_or_default(),
nb.unwrap_or_default(),
nc.unwrap_or_default(),
))
} else {
None
};
Self {
m,
sigma,
Expand All @@ -282,12 +275,8 @@ impl PcSaftRecord {
#[derive(Serialize, Deserialize, Clone, Copy, Default)]
pub struct PcSaftAssociationRecord {
/// Association volume parameter
#[serde(skip_serializing_if = "f64::is_zero")]
#[serde(default)]
pub kappa_ab: f64,
/// Association energy parameter in units of Kelvin
#[serde(skip_serializing_if = "f64::is_zero")]
#[serde(default)]
pub epsilon_k_ab: f64,
}

Expand Down