Maintainer triage (June 29, 2026)
- Status: Verified bug against the current
master source in this fork.
- Severity: Medium.
- Area labels: area:thermo.
- 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
Finding
The vectorized temperature branch of getKeqVLE replaces vapor pressures with Henry constants using a column mask built from each row, but assigns across all rows.
Evidence
ThermoPhysicalManager.getKeqVLE vector branch builds supercrit at PharmaPy/ThermoModule.py:541-547.
- The loop
for row in supercrit: p_vap[:, row] = self.henry_constant[row] applies each row mask to every temperature row.
Impact
If any time/temperature row is supercritical for a component, that component can be treated with Henry constants in rows where it is not supercritical, corrupting vectorized VLE profiles.
Likely fix
Assign elementwise with p_vap[supercrit] = ... using a broadcasted Henry-constant array, or loop over row indices and assign only that row.
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
Finding
The vectorized temperature branch of
getKeqVLEreplaces vapor pressures with Henry constants using a column mask built from each row, but assigns across all rows.Evidence
ThermoPhysicalManager.getKeqVLEvector branch buildssupercritatPharmaPy/ThermoModule.py:541-547.for row in supercrit: p_vap[:, row] = self.henry_constant[row]applies each row mask to every temperature row.Impact
If any time/temperature row is supercritical for a component, that component can be treated with Henry constants in rows where it is not supercritical, corrupting vectorized VLE profiles.
Likely fix
Assign elementwise with
p_vap[supercrit] = ...using a broadcasted Henry-constant array, or loop over row indices and assign only that row.