use crate::support::{
hx::{
NtuRelation,
arrangement::{CounterFlow, ParallelFlow},
},
thermo::capability::{HasEnthalpy, HasPressure, StateFrom, ThermoModel},
units::SpecificEnthalpy,
};
use uom::si::f64::{Pressure, ThermodynamicTemperature};
#[doc(hidden)]
pub trait DiscretizedArrangement: NtuRelation {
const BOTTOM_FLOWS_LEFT_TO_RIGHT: bool;
#[inline]
fn bottom_select<T>(forward: T, reverse: T) -> T {
if Self::BOTTOM_FLOWS_LEFT_TO_RIGHT {
forward
} else {
reverse
}
}
}
impl DiscretizedArrangement for CounterFlow {
const BOTTOM_FLOWS_LEFT_TO_RIGHT: bool = false;
}
impl DiscretizedArrangement for ParallelFlow {
const BOTTOM_FLOWS_LEFT_TO_RIGHT: bool = true;
}
#[doc(hidden)]
pub trait DiscretizedHxThermoModel<Fluid>:
ThermoModel<Fluid = Fluid>
+ HasPressure
+ HasEnthalpy
+ StateFrom<(Fluid, ThermodynamicTemperature, Pressure)>
+ StateFrom<(Fluid, Pressure, SpecificEnthalpy)>
{
}
impl<Fluid, T> DiscretizedHxThermoModel<Fluid> for T where
T: ThermoModel<Fluid = Fluid>
+ HasPressure
+ HasEnthalpy
+ StateFrom<(Fluid, ThermodynamicTemperature, Pressure)>
+ StateFrom<(Fluid, Pressure, SpecificEnthalpy)>
{
}