Maintainer triage (June 29, 2026)
- Status: Verified bug against the current
master source in this fork.
- Severity: High.
- Area labels: area:reactors.
- 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 non-isothermal sensitivity Jacobian tries to assign an n_species x n_species kinetic Jacobian into a larger block that includes temperature.
Evidence
PharmaPy/Reactors.py:397-452 builds jac_states = np.zeros((num_states, num_states)).
PharmaPy/Reactors.py:437-438 assigns jac_r_kin into jac_states[:num_states - 1, :num_states - 1].
- For jacket mode,
num_states = n_species + temp + temp_ht, so the target block is (n_species + 1) x (n_species + 1), not n_species x n_species.
- The non-isothermal parameter branch also leaves
jac_params unset at PharmaPy/Reactors.py:446-452.
Impact
eval_sens=True fails for non-isothermal reactors with jacket states, and non-isothermal sensitivity equations are incomplete even when the shape happens to avoid immediate failure.
Likely fix
Assign kinetic derivatives only to the species block and explicitly implement temperature/jacket rows and parameter derivatives.
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 non-isothermal sensitivity Jacobian tries to assign an
n_species x n_specieskinetic Jacobian into a larger block that includes temperature.Evidence
PharmaPy/Reactors.py:397-452buildsjac_states = np.zeros((num_states, num_states)).PharmaPy/Reactors.py:437-438assignsjac_r_kinintojac_states[:num_states - 1, :num_states - 1].num_states = n_species + temp + temp_ht, so the target block is(n_species + 1) x (n_species + 1), notn_species x n_species.jac_paramsunset atPharmaPy/Reactors.py:446-452.Impact
eval_sens=Truefails for non-isothermal reactors with jacket states, and non-isothermal sensitivity equations are incomplete even when the shape happens to avoid immediate failure.Likely fix
Assign kinetic derivatives only to the species block and explicitly implement temperature/jacket rows and parameter derivatives.