#![allow(dead_code)]
mod given_ua;
mod heat_transfer_rate;
mod input;
mod metrics;
mod results;
mod solve;
mod traits;
#[cfg(test)]
pub(crate) mod test_support;
pub use given_ua::{GivenUaConfig, GivenUaError, GivenUaResults};
pub use heat_transfer_rate::HeatTransferRate;
pub use input::{Given, Inlets, Known, MassFlows, PressureDrops};
pub use results::{MinDeltaT, Results};
pub use solve::SolveError;
pub(crate) use traits::DiscretizedHxThermoModel;
use std::marker::PhantomData;
use uom::si::f64::ThermalConductance;
use given_ua::given_ua;
use solve::solve;
use traits::DiscretizedArrangement;
pub struct DiscretizedHx<Arrangement, const N: usize> {
_arrangement: PhantomData<Arrangement>,
}
impl<Arrangement, const N: usize> DiscretizedHx<Arrangement, N> {
pub fn solve<TopFluid, BottomFluid>(
known: &Known<TopFluid, BottomFluid>,
given: Given,
thermo_top: &impl DiscretizedHxThermoModel<TopFluid>,
thermo_bottom: &impl DiscretizedHxThermoModel<BottomFluid>,
) -> Result<Results<TopFluid, BottomFluid, N>, SolveError>
where
Arrangement: DiscretizedArrangement + Default,
TopFluid: Clone,
BottomFluid: Clone,
{
solve::<Arrangement, _, _, N>(known, given, thermo_top, thermo_bottom)
}
pub fn solve_same<Fluid, Model>(
known: &Known<Fluid, Fluid>,
given: Given,
thermo: &Model,
) -> Result<Results<Fluid, Fluid, N>, SolveError>
where
Arrangement: DiscretizedArrangement + Default,
Fluid: Clone,
Model: DiscretizedHxThermoModel<Fluid>,
{
solve::<Arrangement, _, _, N>(known, given, thermo, thermo)
}
pub fn given_ua<TopFluid, BottomFluid>(
known: &Known<TopFluid, BottomFluid>,
target_ua: ThermalConductance,
config: GivenUaConfig,
thermo_top: &impl DiscretizedHxThermoModel<TopFluid>,
thermo_bottom: &impl DiscretizedHxThermoModel<BottomFluid>,
) -> Result<GivenUaResults<TopFluid, BottomFluid, N>, GivenUaError>
where
Arrangement: DiscretizedArrangement + Default,
TopFluid: Clone,
BottomFluid: Clone,
{
given_ua::<Arrangement, _, _, N>(known, target_ua, config, thermo_top, thermo_bottom)
}
pub fn given_ua_same<Fluid, Model>(
known: &Known<Fluid, Fluid>,
target_ua: ThermalConductance,
config: GivenUaConfig,
thermo: &Model,
) -> Result<GivenUaResults<Fluid, Fluid, N>, GivenUaError>
where
Arrangement: DiscretizedArrangement + Default,
Fluid: Clone,
Model: DiscretizedHxThermoModel<Fluid>,
{
given_ua::<Arrangement, _, _, N>(known, target_ua, config, thermo, thermo)
}
}