Maintainer triage (June 29, 2026)
- Status: Verified bug against the current
master source in this fork.
- Severity: Medium.
- Area labels: area:settlers.
- Tackle batch: P5 - medium-scope correctness defects.
The source review confirmed that the cited code path and failure mode are still present. The original audit details are preserved below for reproduction notes and suggested fixes.
Original audit details
Severity: Medium · Category: logic (copy-paste) · Part of #67
ThreePhaseSettler.design_space_check uses the top-phase density for the bottom phase
Location: PharmaPy/ThreePhaseSettler.py:137 (consumed at 146, 155, 162-164)
density_bot = self.TopPhase.Liquid_1.getDensity() (137) takes the top phase, while the adjacent viscosity_bot = self.BotPhase.Liquid_1.getViscosity() (136) correctly uses BotPhase (and material_balances uses self.BotPhase.Liquid_1.getDensity() at 178). Since the two liquids are split by density, density_top != density_bot. The wrong value feeds the Bond number (146), impeller Reynolds (155), and just-suspended speed N_js (162-164).
- Trigger:
ThreePhaseSettler.solve_unit (auto-invokes design_space_check at 198) on any settler whose two liquids differ in density — the premise of a three-phase settler.
- Wrong result: Bond number, impeller Re, critical agitation speed
N_cr, and N_js are computed with the wrong (lighter) liquid density, so crit2/crit3 are evaluated against incorrect physics; the unit prints a wrong design-feasibility verdict.
- Why major: the design-space verdict is the unit's operability guarantee; a systematic density mix-up can both pass infeasible designs and fail feasible ones.
- Suggested fix:
density_bot = self.BotPhase.Liquid_1.getDensity().
Related (not duplicates): no settler/design_space issue exists in the tracker.
Maintainer triage (June 29, 2026)
mastersource in this fork.The source review confirmed that the cited code path and failure mode are still present. The original audit details are preserved below for reproduction notes and suggested fixes.
Original audit details
Severity: Medium · Category: logic (copy-paste) · Part of #67
ThreePhaseSettler.design_space_checkuses the top-phase density for the bottom phaseLocation:
PharmaPy/ThreePhaseSettler.py:137(consumed at 146, 155, 162-164)density_bot = self.TopPhase.Liquid_1.getDensity()(137) takes the top phase, while the adjacentviscosity_bot = self.BotPhase.Liquid_1.getViscosity()(136) correctly usesBotPhase(andmaterial_balancesusesself.BotPhase.Liquid_1.getDensity()at 178). Since the two liquids are split by density,density_top != density_bot. The wrong value feeds the Bond number (146), impeller Reynolds (155), and just-suspended speedN_js(162-164).ThreePhaseSettler.solve_unit(auto-invokesdesign_space_checkat 198) on any settler whose two liquids differ in density — the premise of a three-phase settler.N_cr, andN_jsare computed with the wrong (lighter) liquid density, so crit2/crit3 are evaluated against incorrect physics; the unit prints a wrong design-feasibility verdict.density_bot = self.BotPhase.Liquid_1.getDensity().Related (not duplicates): no settler/
design_spaceissue exists in the tracker.