#[derive(Debug, Clone, PartialEq)]
pub struct ThermoProp {
pub temperature: f64,
pub pressure: f64,
pub density: f64,
pub enthalpy: f64,
pub entropy: f64,
pub cv: f64,
pub cp: f64,
pub sound_speed: f64,
pub quality: f64,
pub internal_energy: f64,
}
impl std::fmt::Display for ThermoProp {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "T = {:.4} K", self.temperature)?;
writeln!(f, "P = {:.4} kPa", self.pressure)?;
writeln!(f, "D = {:.6} mol/L", self.density)?;
writeln!(f, "H = {:.4} J/mol", self.enthalpy)?;
writeln!(f, "S = {:.4} J/(mol·K)", self.entropy)?;
writeln!(f, "Cv = {:.4} J/(mol·K)", self.cv)?;
writeln!(f, "Cp = {:.4} J/(mol·K)", self.cp)?;
writeln!(f, "W = {:.4} m/s", self.sound_speed)?;
write!(f, "Q = {:.6}", self.quality)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SaturationProps {
pub temperature: f64,
pub pressure: f64,
pub density_liquid: f64,
pub density_vapor: f64,
}
impl std::fmt::Display for SaturationProps {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "T_sat = {:.4} K ({:.2} °C)", self.temperature, self.temperature - 273.15)?;
writeln!(f, "P_sat = {:.4} kPa", self.pressure)?;
writeln!(f, "D_liq = {:.6} mol/L", self.density_liquid)?;
write!(f, "D_vap = {:.6} mol/L", self.density_vapor)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct TransportProps {
pub viscosity: f64,
pub thermal_conductivity: f64,
}
impl std::fmt::Display for TransportProps {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "eta = {:.6} µPa·s", self.viscosity)?;
write!(f, "tcx = {:.6} W/(m·K)", self.thermal_conductivity)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct CriticalProps {
pub temperature: f64,
pub pressure: f64,
pub density: f64,
}
impl std::fmt::Display for CriticalProps {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "Tc = {:.4} K ({:.2} °C)", self.temperature, self.temperature - 273.15)?;
writeln!(f, "Pc = {:.4} kPa ({:.4} bar)", self.pressure, self.pressure / 100.0)?;
write!(f, "Dc = {:.6} mol/L", self.density)
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct FluidInfo {
pub molar_mass: f64,
pub triple_point_temp: f64,
pub normal_boiling_point: f64,
pub critical_temperature: f64,
pub critical_pressure: f64,
pub critical_density: f64,
pub compressibility_factor: f64,
pub acentric_factor: f64,
pub dipole_moment: f64,
pub gas_constant: f64,
}
impl std::fmt::Display for FluidInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
writeln!(f, "M = {:.4} g/mol", self.molar_mass)?;
writeln!(f, "T_trp = {:.4} K", self.triple_point_temp)?;
writeln!(f, "T_nbp = {:.4} K ({:.2} °C)", self.normal_boiling_point, self.normal_boiling_point - 273.15)?;
writeln!(f, "Tc = {:.4} K ({:.2} °C)", self.critical_temperature, self.critical_temperature - 273.15)?;
writeln!(f, "Pc = {:.4} kPa", self.critical_pressure)?;
writeln!(f, "Dc = {:.6} mol/L", self.critical_density)?;
writeln!(f, "Zc = {:.6}", self.compressibility_factor)?;
writeln!(f, "omega = {:.6}", self.acentric_factor)?;
writeln!(f, "dip = {:.4} debye", self.dipole_moment)?;
write!(f, "R = {:.6} J/(mol·K)", self.gas_constant)
}
}