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
Follow-up from #120 / #56
PR #120 fixes #56 by supplying a default
DynamicExtractor.k_funand validating activity-model selectors. While addressing review feedback on that PR, an inline TODO inDynamicExtraction.pysurfaced a separate limitation: the dynamic extractor currently does not define or validate stage-wiseK_icallback semantics.Problem
DynamicExtractor.material_balancesand theinitialize_modelequilibrium correction both callself.k_fun(...)and then use the returnedK_ivalues 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 dimensionlessK_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
k_funreturn shapes for scalar, component-wise, and stage-wise distribution coefficientsK_i[-].DynamicExtractor.material_balancesand theinitialize_modelequilibrium correction to validate or broadcast those shapes deliberately.[-], temperature[K], activity coefficients[-], and distribution coefficientsK_i[-].References