Skip to content

High: [Phases] SolidPhase.updatePhase drops shape factor kv when recomputing mass and volume #51

Description

@bernalde

Maintainer triage (June 29, 2026)

  • Status: Verified bug against the current master source in this fork.
  • Severity: High.
  • Area labels: area:phases.
  • Tackle batch: P2 - shared thermo, phase, and basis correctness.

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

SolidPhase.updatePhase(distrib=...) recomputes volume and mass from moments[3] without the solid shape factor kv, unlike the constructor.

Evidence

  • Constructor: self.vol = self.moments[3] * kv at PharmaPy/Phases.py:916-919.
  • Update path: self.vol = self.moments[3] and self.mass = self.moments[3] * self.getDensity() at PharmaPy/Phases.py:947-958.

Impact

Any distribution update for non-unit kv misstates crystal volume and mass, which propagates into slurry/cake balances and solid stream outputs.

Likely fix

Apply self.kv consistently: self.vol = self.moments[3] * self.kv and self.mass = self.vol * self.getDensity().

Metadata

Metadata

Assignees

Labels

area:phasesPhase, stream, and mixed-phase property handlingbugSomething isn't workingcorrectnessModel/numerical correctness defectrefactor:mpvOverlaps the MultiPhaseVessel refactor; revalidate after mergeseverity:highConfirmed bug with major correctness impact or broken documented workflowstatus:verifiedSource-reviewed against the current codebase

Type

No type

Projects

Status
No status

Relationships

None yet

Development

No branches or pull requests

Issue actions