Update project structure and configurations

This commit is contained in:
2026-05-23 10:19:55 +02:00
parent ab5dc7e568
commit 62efea0646
1832 changed files with 83568 additions and 51829 deletions

View File

@@ -589,9 +589,9 @@ fn test_screw_energy_balance() {
// At this operating point:
// h_suc=400 kJ/kg, h_dis=440 kJ/kg, h_eco=260 kJ/kg
// ṁ_suc=1.2 kg/s, ṁ_eco=0.144 kg/s, ṁ_total=1.344 kg/s
// Energy in = 1.2×400000 + 0.144×260000 + W/0.92
// Energy out = 1.344×440000
// W = (1.344×440000 - 1.2×400000 - 0.144×260000) × 0.92
// First law (fluid side): ṁ_suc×h_suc + ṁ_eco×h_eco + W_fluid = ṁ_total×h_dis
// W_fluid = W_shaft × η_mech
// W_shaft = (ΔH) / η_mech
let m_suc = 1.2_f64;
let m_eco = 0.144_f64;
@@ -601,21 +601,21 @@ fn test_screw_energy_balance() {
let h_eco = 260_000.0_f64;
let eta_mech = 0.92_f64;
let w_expected = (m_total * h_dis - m_suc * h_suc - m_eco * h_eco) * eta_mech;
let delta_h = m_total * h_dis - m_suc * h_suc - m_eco * h_eco;
let w_shaft = delta_h / eta_mech;
let w_fluid = w_shaft * eta_mech; // == delta_h
println!(
"Expected shaft power: {:.0} W = {:.1} kW",
w_expected,
w_expected / 1000.0
"Shaft power: {:.0} W = {:.1} kW, Fluid power: {:.0} W",
w_shaft, w_shaft / 1000.0, w_fluid
);
// Verify that this W closes the energy balance (residual[2] ≈ 0)
let state = vec![m_suc, m_eco, h_suc, h_dis, w_expected];
// Verify: W_shaft closes the energy balance via residual[2]
// State layout: [m_suc, m_eco, w_shaft] — enthalpies come from ports, not state
let state = vec![m_suc, m_eco, w_shaft];
let mut residuals = vec![0.0; 5];
comp.compute_residuals(&state, &mut residuals).unwrap();
// residual[2] = energy_in - energy_out
// = (ṁ_suc×h_suc + ṁ_eco×h_eco + W/η) - ṁ_total×h_dis
// Should be exactly 0 if W was computed correctly
// residual[2] = (ṁ_suc×h_suc + ṁ_eco×h_eco + W_shaft×η) - ṁ_total×h_dis
println!("Energy balance residual: {:.4} J/s", residuals[2]);
assert!(
residuals[2].abs() < 1.0,