feat(python): implement python bindings for all components and solvers

This commit is contained in:
Sepehr
2026-02-21 20:34:56 +01:00
parent 8ef8cd2eba
commit 4440132b0a
310 changed files with 11577 additions and 397 deletions

View File

@@ -113,10 +113,10 @@ impl FluidState {
/// # use entropyk_core::Power;
/// struct SimpleModel { ua: f64 }
/// impl HeatTransferModel for SimpleModel {
/// fn compute_heat_transfer(&self, _: &FluidState, _: &FluidState, _: &FluidState, _: &FluidState) -> Power {
/// fn compute_heat_transfer(&self, _: &FluidState, _: &FluidState, _: &FluidState, _: &FluidState, _: Option<f64>) -> Power {
/// Power::from_watts(0.0)
/// }
/// fn compute_residuals(&self, _: &FluidState, _: &FluidState, _: &FluidState, _: &FluidState, _: &mut ResidualVector) {}
/// fn compute_residuals(&self, _: &FluidState, _: &FluidState, _: &FluidState, _: &FluidState, _: &mut ResidualVector, _: Option<f64>) {}
/// fn n_equations(&self) -> usize { 3 }
/// fn ua(&self) -> f64 { self.ua }
/// }
@@ -141,6 +141,7 @@ pub trait HeatTransferModel: Send + Sync {
hot_outlet: &FluidState,
cold_inlet: &FluidState,
cold_outlet: &FluidState,
dynamic_ua_scale: Option<f64>,
) -> Power;
/// Computes residuals for the solver.
@@ -154,6 +155,7 @@ pub trait HeatTransferModel: Send + Sync {
cold_inlet: &FluidState,
cold_outlet: &FluidState,
residuals: &mut ResidualVector,
dynamic_ua_scale: Option<f64>,
);
/// Returns the number of equations this model contributes.
@@ -170,9 +172,9 @@ pub trait HeatTransferModel: Send + Sync {
/// Sets the UA calibration scale (e.g. from Calib.f_ua).
fn set_ua_scale(&mut self, _s: f64) {}
/// Returns the effective UA used in heat transfer: ua_scale × ua_nominal.
fn effective_ua(&self) -> f64 {
self.ua() * self.ua_scale()
/// Returns the effective UA used in heat transfer. If dynamic_ua_scale is provided, it is used instead of ua_scale.
fn effective_ua(&self, dynamic_ua_scale: Option<f64>) -> f64 {
self.ua() * dynamic_ua_scale.unwrap_or_else(|| self.ua_scale())
}
}