mirror of
https://github.com/aselimov/cea-rs.git
synced 2026-04-21 09:24:21 +00:00
Some test fixes and adding initial simple version of matrix data struct
This commit is contained in:
parent
b6a18df17b
commit
93bd1f4d38
4 changed files with 161 additions and 23 deletions
|
|
@ -8,7 +8,7 @@ use crate::{
|
|||
|
||||
pub struct GasMixture {
|
||||
pub(crate) ns: Vec<f64>,
|
||||
pub(crate) nsum: f64
|
||||
pub(crate) nsum: f64,
|
||||
pub(crate) species: Vec<SpeciesThermoData>,
|
||||
pub(crate) transport_data: Vec<SpeciesTransportData>,
|
||||
}
|
||||
|
|
@ -27,14 +27,16 @@ impl GasMixture {
|
|||
let p = s
|
||||
.polynomial_at(temp)
|
||||
.expect("Gas doesn't have a polynomial");
|
||||
p.h_over_rt(temp) - p.s_over_r(temp) + (pressure / P_REF).ln() + (n/self.nsum).ln()
|
||||
p.h_over_rt(temp) - p.s_over_r(temp)
|
||||
+ (pressure / P_REF).ln()
|
||||
+ (n / self.nsum).ln()
|
||||
}
|
||||
Phase::Condensed => todo!(),
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
||||
// Calculate the normalized entropy (S/R) for each mixture component
|
||||
//
|
||||
// Equations 2.17 from reference paper
|
||||
|
|
@ -48,19 +50,19 @@ impl GasMixture {
|
|||
let p = s
|
||||
.polynomial_at(temp)
|
||||
.expect("Gas doesn't have a polynomial");
|
||||
p.s_over_r(temp) - (n/self.nsum).ln() - (pressure/P_REF).ln()
|
||||
p.s_over_r(temp) - (n / self.nsum).ln() - (pressure / P_REF).ln()
|
||||
}
|
||||
Phase::Condensed => todo!(),
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
||||
// Calculate the normalized mixture enthalpy (H/RT)
|
||||
// Note that the enthalpy doesn't have a dependence on the pressure.
|
||||
// Equation 2.14 from the paper
|
||||
pub fn mixture_h_over_rt(&self, temp: f64) -> Vec<f64>{
|
||||
self.ns
|
||||
pub fn mixture_h_over_rt(&self, temp: f64) -> Vec<f64> {
|
||||
self.ns
|
||||
.iter()
|
||||
.zip(self.species.iter())
|
||||
.map(|(n, s)| -> f64 {
|
||||
|
|
@ -69,11 +71,11 @@ impl GasMixture {
|
|||
let p = s
|
||||
.polynomial_at(temp)
|
||||
.expect("Gas doesn't have a polynomial");
|
||||
n*p.h_over_rt(temp)
|
||||
n * p.h_over_rt(temp)
|
||||
}
|
||||
Phase::Condensed => todo!(),
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue