1#[derive(Debug, Clone, PartialEq)]
20pub struct ThermoProp {
21 pub temperature: f64,
22 pub pressure: f64,
23 pub density: f64,
24 pub enthalpy: f64,
25 pub entropy: f64,
26 pub cv: f64,
27 pub cp: f64,
28 pub sound_speed: f64,
29 pub quality: f64,
30 pub internal_energy: f64,
31}
32
33impl std::fmt::Display for ThermoProp {
34 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35 writeln!(f, "T = {:.4} K", self.temperature)?;
36 writeln!(f, "P = {:.4} kPa", self.pressure)?;
37 writeln!(f, "D = {:.6} mol/L", self.density)?;
38 writeln!(f, "H = {:.4} J/mol", self.enthalpy)?;
39 writeln!(f, "S = {:.4} J/(mol·K)", self.entropy)?;
40 writeln!(f, "Cv = {:.4} J/(mol·K)", self.cv)?;
41 writeln!(f, "Cp = {:.4} J/(mol·K)", self.cp)?;
42 writeln!(f, "W = {:.4} m/s", self.sound_speed)?;
43 write!(f, "Q = {:.6}", self.quality)
44 }
45}
46
47#[derive(Debug, Clone, PartialEq)]
53pub struct SaturationProps {
54 pub temperature: f64,
56 pub pressure: f64,
58 pub density_liquid: f64,
60 pub density_vapor: f64,
62}
63
64impl std::fmt::Display for SaturationProps {
65 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
66 writeln!(f, "T_sat = {:.4} K ({:.2} °C)", self.temperature, self.temperature - 273.15)?;
67 writeln!(f, "P_sat = {:.4} kPa", self.pressure)?;
68 writeln!(f, "D_liq = {:.6} mol/L", self.density_liquid)?;
69 write!(f, "D_vap = {:.6} mol/L", self.density_vapor)
70 }
71}
72
73#[derive(Debug, Clone, PartialEq)]
77pub struct TransportProps {
78 pub viscosity: f64,
80 pub thermal_conductivity: f64,
82}
83
84impl std::fmt::Display for TransportProps {
85 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
86 writeln!(f, "eta = {:.6} µPa·s", self.viscosity)?;
87 write!(f, "tcx = {:.6} W/(m·K)", self.thermal_conductivity)
88 }
89}
90
91#[derive(Debug, Clone, PartialEq)]
94pub struct CriticalProps {
95 pub temperature: f64,
97 pub pressure: f64,
99 pub density: f64,
101}
102
103impl std::fmt::Display for CriticalProps {
104 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
105 writeln!(f, "Tc = {:.4} K ({:.2} °C)", self.temperature, self.temperature - 273.15)?;
106 writeln!(f, "Pc = {:.4} kPa ({:.4} bar)", self.pressure, self.pressure / 100.0)?;
107 write!(f, "Dc = {:.6} mol/L", self.density)
108 }
109}
110
111#[derive(Debug, Clone, PartialEq)]
115pub struct FluidInfo {
116 pub molar_mass: f64,
118 pub triple_point_temp: f64,
120 pub normal_boiling_point: f64,
122 pub critical_temperature: f64,
124 pub critical_pressure: f64,
126 pub critical_density: f64,
128 pub compressibility_factor: f64,
130 pub acentric_factor: f64,
132 pub dipole_moment: f64,
134 pub gas_constant: f64,
136}
137
138impl std::fmt::Display for FluidInfo {
139 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
140 writeln!(f, "M = {:.4} g/mol", self.molar_mass)?;
141 writeln!(f, "T_trp = {:.4} K", self.triple_point_temp)?;
142 writeln!(f, "T_nbp = {:.4} K ({:.2} °C)", self.normal_boiling_point, self.normal_boiling_point - 273.15)?;
143 writeln!(f, "Tc = {:.4} K ({:.2} °C)", self.critical_temperature, self.critical_temperature - 273.15)?;
144 writeln!(f, "Pc = {:.4} kPa", self.critical_pressure)?;
145 writeln!(f, "Dc = {:.6} mol/L", self.critical_density)?;
146 writeln!(f, "Zc = {:.6}", self.compressibility_factor)?;
147 writeln!(f, "omega = {:.6}", self.acentric_factor)?;
148 writeln!(f, "dip = {:.4} debye", self.dipole_moment)?;
149 write!(f, "R = {:.6} J/(mol·K)", self.gas_constant)
150 }
151}