pub struct Stream {
pub capacitance_rate: CapacitanceRate,
pub inlet_temperature: ThermodynamicTemperature,
pub outlet_temperature: ThermodynamicTemperature,
pub heat_flow: HeatFlow,
}Expand description
A fully-resolved heat exchanger stream.
Fields§
§capacitance_rate: CapacitanceRateEffective capacitance rate for the stream.
inlet_temperature: ThermodynamicTemperatureTemperature at the exchanger inlet.
outlet_temperature: ThermodynamicTemperatureTemperature after the stream leaves the exchanger.
When the capacitance rate tends to infinity this matches the inlet temperature.
heat_flow: HeatFlowNet heat flow direction and magnitude for the stream.
Implementations§
Source§impl Stream
impl Stream
Sourcepub fn new_from_heat_flow(
capacitance_rate: CapacitanceRate,
inlet_temperature: ThermodynamicTemperature,
heat_flow: HeatFlow,
) -> Self
pub fn new_from_heat_flow( capacitance_rate: CapacitanceRate, inlet_temperature: ThermodynamicTemperature, heat_flow: HeatFlow, ) -> Self
Construct a fully-resolved stream from a known heat flow.
Given the stream’s inlet temperature, capacitance rate, and heat flow,
this calculates the outlet temperature using the energy balance:
Q = C * (T_out - T_in).
This constructor is useful when you know the heat transfer rate for a stream (for example, from measurements or system specifications) and need to determine the resulting outlet temperature.
§Example
use uom::si::{
f64::{Power, ThermodynamicTemperature},
power::kilowatt,
thermal_conductance::kilowatt_per_kelvin,
thermodynamic_temperature::degree_celsius,
};
use twine_components::thermal::hx::{CapacitanceRate, Stream};
use twine_thermo::HeatFlow;
let stream = Stream::new_from_heat_flow(
CapacitanceRate::new::<kilowatt_per_kelvin>(3.)?,
ThermodynamicTemperature::new::<degree_celsius>(80.),
HeatFlow::outgoing(Power::new::<kilowatt>(60.))?,
);
// Outlet temperature is calculated automatically
assert_eq!(
stream.outlet_temperature.get::<degree_celsius>(),
60.0
);Sourcepub fn new_from_outlet_temperature(
capacitance_rate: CapacitanceRate,
inlet_temperature: ThermodynamicTemperature,
outlet_temperature: ThermodynamicTemperature,
) -> Self
pub fn new_from_outlet_temperature( capacitance_rate: CapacitanceRate, inlet_temperature: ThermodynamicTemperature, outlet_temperature: ThermodynamicTemperature, ) -> Self
Construct a fully-resolved stream from known inlet and outlet temperatures.
Given the stream’s inlet and outlet temperatures along with its capacitance rate,
this calculates the heat flow using the energy balance: Q = C * (T_out - T_in).
The heat flow direction is automatically determined from the temperature change:
- If outlet > inlet, the heat flow is
HeatFlow::In - If outlet < inlet, the heat flow is
HeatFlow::Out - If outlet = inlet, the heat flow is
HeatFlow::None
This constructor is useful when you know both inlet and outlet temperatures for a stream (for example, from measurements) and need to determine the heat transfer rate.
§Example
use uom::si::{
f64::ThermodynamicTemperature,
power::kilowatt,
thermal_conductance::kilowatt_per_kelvin,
thermodynamic_temperature::degree_celsius,
};
use twine_components::thermal::hx::{CapacitanceRate, Stream};
use twine_thermo::HeatFlow;
let stream = Stream::new_from_outlet_temperature(
CapacitanceRate::new::<kilowatt_per_kelvin>(3.)?,
ThermodynamicTemperature::new::<degree_celsius>(80.),
ThermodynamicTemperature::new::<degree_celsius>(60.),
);
// Heat flow magnitude is calculated automatically (80°C → 60°C means heat is leaving)
assert!(matches!(stream.heat_flow, HeatFlow::Out(_)));
assert_eq!(
stream.heat_flow.signed().abs().get::<kilowatt>(),
60.0
);§Panics
Panics if the temperatures cannot be compared (e.g., contain NaN values) or if the calculated heat rate magnitude is invalid (which should not occur in normal use).