Skip to content

Medium: [DynamicExtraction] Define stage-wise distribution coefficient handling #123

Description

@Mazhar331

Follow-up from #120 / #56

PR #120 fixes #56 by supplying a default DynamicExtractor.k_fun and validating activity-model selectors. While addressing review feedback on that PR, an inline TODO in DynamicExtraction.py surfaced a separate limitation: the dynamic extractor currently does not define or validate stage-wise K_i callback semantics.

Problem

DynamicExtractor.material_balances and the initialize_model equilibrium correction both call self.k_fun(...) and then use the returned K_i values across staged algebra. The current code comments note that stage-wise handling is not implemented. That is broader than the #56 regression, which only ensures the default callback exists and returns dimensionless K_i = gamma_light/gamma_heavy.

Without an explicit stage-wise callback contract, future changes can silently rely on broadcasting or shape coincidences instead of intentional (num_stages, num_comp) behavior.

Scope

  • Define the accepted k_fun return shapes for scalar, component-wise, and stage-wise distribution coefficients K_i [-].
  • Update DynamicExtractor.material_balances and the initialize_model equilibrium correction to validate or broadcast those shapes deliberately.
  • Add tests with unequal numbers of stages and components so stage/component broadcasting mistakes cannot stay green.
  • Include units/docs/comments coverage for mole fractions [-], temperature [K], activity coefficients [-], and distribution coefficients K_i [-].

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:extractionLiquid-liquid extraction and dynamic extraction modelscorrectnessModel/numerical correctness defectseverity:mediumConfirmed bug with narrower scope or moderate numerical impactstatus:plannedPlanned roadmap or maintenance work, not a verified bug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions