chore: remove deprecated flow_boundary and update docs to match new architecture

This commit is contained in:
Sepehr
2026-03-01 20:00:09 +01:00
parent 20700afce8
commit d88914a44f
105 changed files with 11222 additions and 2994 deletions

View File

@@ -257,7 +257,7 @@ impl BphxCondenser {
let fluid = FluidId::new(&self.refrigerant_id);
let p = Pressure::from_pascals(p_pa);
let h_sat_l = backend
let _h_sat_l = backend
.property(
fluid.clone(),
Property::Enthalpy,

View File

@@ -75,6 +75,7 @@ impl std::fmt::Debug for BphxExchanger {
impl BphxExchanger {
/// Minimum valid UA value (W/K)
#[allow(dead_code)]
const MIN_UA: f64 = 0.0;
/// Creates a new BphxExchanger with the specified geometry.

View File

@@ -87,8 +87,11 @@ impl Default for BphxGeometry {
impl BphxGeometry {
/// Minimum valid values for geometry parameters
pub const MIN_PLATES: u32 = 1;
/// Documentation pending
pub const MIN_DIMENSION: f64 = 1e-6;
/// Documentation pending
pub const MIN_CHEVRON_ANGLE: f64 = 10.0;
/// Documentation pending
pub const MAX_CHEVRON_ANGLE: f64 = 80.0;
/// Creates a new geometry builder with the specified number of plates.
@@ -359,20 +362,42 @@ impl BphxGeometryBuilder {
#[derive(Debug, Clone, thiserror::Error)]
pub enum BphxGeometryError {
#[error("Invalid number of plates: {n_plates}, minimum is {min}")]
InvalidPlates { n_plates: u32, min: u32 },
/// Documentation pending
InvalidPlates {
/// Number of plates provided
n_plates: u32,
/// Minimum allowed plates (2)
min: u32,
},
#[error("Invalid {name}: {value}, minimum is {min}")]
/// Documentation pending
InvalidDimension {
/// Documentation pending
name: &'static str,
/// Documentation pending
value: f64,
/// Documentation pending
min: f64,
},
#[error("Invalid chevron angle: {angle}°, valid range is {min}° to {max}°")]
InvalidChevronAngle { angle: f64, min: f64, max: f64 },
/// Documentation pending
InvalidChevronAngle {
/// Angle provided
angle: f64,
/// Minimum allowed angle
min: f64,
/// Maximum allowed angle
max: f64,
},
#[error("Missing required parameter: {name}")]
MissingParameter { name: &'static str },
/// Documentation pending
MissingParameter {
/// Parameter name
name: &'static str,
},
}
#[cfg(test)]

View File

@@ -287,10 +287,12 @@ impl<Model: HeatTransferModel + 'static> HeatExchanger<Model> {
self.hot_conditions.as_ref()
}
/// Documentation pending
pub fn cold_conditions(&self) -> Option<&HxSideConditions> {
self.cold_conditions.as_ref()
}
/// Documentation pending
pub fn hot_fluid_id(&self) -> Option<&FluidsFluidId> {
self.hot_conditions.as_ref().map(|c| c.fluid_id())
}
@@ -461,6 +463,7 @@ impl<Model: HeatTransferModel + 'static> HeatExchanger<Model> {
FluidState::new(temperature, pressure, enthalpy, mass_flow, cp)
}
/// Documentation pending
pub fn compute_residuals_with_ua_scale(
&self,
_state: &StateSlice,
@@ -470,6 +473,7 @@ impl<Model: HeatTransferModel + 'static> HeatExchanger<Model> {
self.do_compute_residuals(_state, residuals, Some(custom_ua_scale))
}
/// Documentation pending
pub fn do_compute_residuals(
&self,
_state: &StateSlice,
@@ -698,7 +702,7 @@ impl<Model: HeatTransferModel + 'static> Component for HeatExchanger<Model> {
fn port_enthalpies(
&self,
state: &StateSlice,
_state: &StateSlice,
) -> Result<Vec<entropyk_core::Enthalpy>, ComponentError> {
let mut enthalpies = Vec::with_capacity(4);

View File

@@ -34,6 +34,7 @@ use std::sync::Arc;
const MIN_UA: f64 = 0.0;
/// Documentation pending
pub struct FloodedCondenser {
inner: HeatExchanger<EpsNtuModel>,
refrigerant_id: String,
@@ -64,6 +65,7 @@ impl std::fmt::Debug for FloodedCondenser {
}
impl FloodedCondenser {
/// Documentation pending
pub fn new(ua: f64) -> Self {
assert!(ua >= MIN_UA, "UA must be non-negative, got {}", ua);
let model = EpsNtuModel::new(ua, ExchangerType::CounterFlow);
@@ -81,6 +83,7 @@ impl FloodedCondenser {
}
}
/// Documentation pending
pub fn try_new(ua: f64) -> Result<Self, ComponentError> {
if ua < MIN_UA {
return Err(ComponentError::InvalidState(format!(
@@ -103,72 +106,88 @@ impl FloodedCondenser {
})
}
/// Documentation pending
pub fn with_refrigerant(mut self, fluid: impl Into<String>) -> Self {
self.refrigerant_id = fluid.into();
self
}
/// Documentation pending
pub fn with_secondary_fluid(mut self, fluid: impl Into<String>) -> Self {
self.secondary_fluid_id = fluid.into();
self
}
/// Documentation pending
pub fn with_fluid_backend(mut self, backend: Arc<dyn FluidBackend>) -> Self {
self.fluid_backend = Some(backend);
self
}
/// Documentation pending
pub fn with_target_subcooling(mut self, subcooling_k: f64) -> Self {
self.target_subcooling_k = subcooling_k.max(0.0);
self
}
/// Documentation pending
pub fn with_subcooling_control(mut self, enabled: bool) -> Self {
self.subcooling_control_enabled = enabled;
self
}
/// Documentation pending
pub fn name(&self) -> &str {
self.inner.name()
}
/// Documentation pending
pub fn ua(&self) -> f64 {
self.inner.ua()
}
/// Documentation pending
pub fn calib(&self) -> &Calib {
self.inner.calib()
}
/// Documentation pending
pub fn set_calib(&mut self, calib: Calib) {
self.inner.set_calib(calib);
}
/// Documentation pending
pub fn target_subcooling(&self) -> f64 {
self.target_subcooling_k
}
/// Documentation pending
pub fn set_target_subcooling(&mut self, subcooling_k: f64) {
self.target_subcooling_k = subcooling_k.max(0.0);
}
/// Documentation pending
pub fn heat_transfer(&self) -> f64 {
self.last_heat_transfer_w.get()
}
/// Documentation pending
pub fn subcooling(&self) -> Option<f64> {
self.last_subcooling_k.get()
}
/// Documentation pending
pub fn set_outlet_indices(&mut self, p_idx: usize, h_idx: usize) {
self.outlet_pressure_idx = Some(p_idx);
self.outlet_enthalpy_idx = Some(h_idx);
}
/// Documentation pending
pub fn set_secondary_conditions(&mut self, conditions: HxSideConditions) {
self.inner.set_cold_conditions(conditions);
}
/// Documentation pending
pub fn set_refrigerant_conditions(&mut self, conditions: HxSideConditions) {
self.inner.set_hot_conditions(conditions);
}
@@ -203,6 +222,7 @@ impl FloodedCondenser {
}
}
/// Documentation pending
pub fn validate_outlet_subcooled(&self, h_out: f64, p_pa: f64) -> Result<f64, ComponentError> {
if self.refrigerant_id.is_empty() {
return Err(ComponentError::InvalidState(

View File

@@ -95,14 +95,17 @@ impl MovingBoundaryCache {
pub struct MovingBoundaryHX {
inner: HeatExchanger<EpsNtuModel>,
geometry: BphxGeometry,
correlation_selector: CorrelationSelector,
_correlation_selector: CorrelationSelector,
refrigerant_id: String,
secondary_fluid_id: String,
fluid_backend: Option<Arc<dyn entropyk_fluids::FluidBackend>>,
// Discretization parameters
n_discretization: usize,
cache: RefCell<MovingBoundaryCache>,
last_htc: Cell<f64>,
last_validity_warning: Cell<bool>,
// Internal state caching
_last_htc: Cell<f64>,
_last_validity_warning: Cell<bool>,
}
impl Default for MovingBoundaryHX {
@@ -120,14 +123,14 @@ impl MovingBoundaryHX {
Self {
inner: HeatExchanger::new(model, "MovingBoundaryHX"),
geometry,
correlation_selector: CorrelationSelector::default(),
_correlation_selector: CorrelationSelector::default(),
refrigerant_id: String::new(),
secondary_fluid_id: String::new(),
fluid_backend: None,
n_discretization: 51,
cache: RefCell::new(MovingBoundaryCache::default()),
last_htc: Cell::new(0.0),
last_validity_warning: Cell::new(false),
_last_htc: Cell::new(0.0),
_last_validity_warning: Cell::new(false),
}
}