Skip to content

Medium: [Thermo] Centralize activity-model selector validation #122

Description

@Mazhar331

Follow-up from #120 / #56

PR #120 fixes #56 by giving DynamicExtractor a default equilibrium function and by adding local validation for the documented activity-model selectors in extraction constructors. That PR intentionally keeps the broader selector source-of-truth cleanup out of scope so the #56 bug fix stays narrow.

Problem

PharmaPy/Extractors.py now has VALID_GAMMA_METHODS = ('ideal', 'UNIFAC', 'UNIQUAC'), while PharmaPy/Phases.py still encodes the same selector set implicitly inside getActivityCoeff. If a supported activity-coefficient model is added, renamed, or deprecated in one place, the extractor validation can drift from the thermo implementation.

The same family of selectors appears under several names, including gamma_model, gamma_method, and activity_model. Related open issues #27 and #59 show adjacent places where activity-model routing already gets dropped or misapplied.

Scope

  • Define one shared source of truth for valid activity-coefficient model selectors, preferably near the thermo implementation that consumes them.
  • Reuse that source for extraction validation added in Fix DynamicExtractor default equilibrium function #120.
  • Audit public producers and consumers of gamma_model, gamma_method, and activity_model in PharmaPy/Phases.py, PharmaPy/Extractors.py, PharmaPy/DynamicExtraction.py, PharmaPy/Distillation.py, and PharmaPy/Evaporators.py.
  • Decide whether selector naming can be unified safely; if not, preserve public aliases and document the compatibility boundary.
  • Add focused tests for invalid selectors at public boundaries and at least one caller-to-callee handoff where practical.
  • Include a units/docs/comments audit. The selectors themselves are categorical, while activity coefficients and distribution coefficients remain dimensionless [-].

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:distillationDistillation models and shortcut column designarea:evaporatorsBatch and continuous evaporator modelsarea:extractionLiquid-liquid extraction and dynamic extraction modelsarea:phasesPhase, stream, and mixed-phase property handlingarea:thermoThermodynamics, VLE, enthalpy, Cp, density, and viscositycorrectnessModel/numerical correctness defectseverity:mediumConfirmed bug with narrower scope or moderate numerical impactstatus:plannedPlanned roadmap or maintenance work, not a verified bug reporttech-debtCode health and refactoring

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions