Test drying energy rate basis#116
Conversation
Mazhar331
left a comment
There was a problem hiding this comment.
Maintainer review. I am the PR author, so GitHub only allows a COMMENT review from this account; this is not a formal approval. mergeStateStatus is CLEAN and reviewDecision is empty (the branch has no protection reporting a review gate), so no maintainer approval is being demanded by live GitHub state.
The change is a single new focused regression test (tests/test_drying_energy_rate_basis.py, +99), no production code touched. It is correct, well-scoped, and genuinely guards issue #48.
What I verified
- Changed-file set matches
gh pr diff --name-only(one new test file). Merge-base isbeb53e4, exactly the base tip / PR #108 head. - Expected values are independent literals, hand-checked against the code, not recomputations of production expressions:
- mass conversion
mol/m^3/s * (MW/1000) = kg/m^3/s→ rates[0.036, 0, 0.184],[0.054, 0, 0.230]. - gas sensible
cpg*(Tg-295)*sum(m_dot)=[1100, 3408];denom_gas = cvg*eps*rho = [450, 1100]→dTg/dt = [1100/450, 3408/1100]. - condensed latent
sum(m_dot_i * L_i * 2)=[512000, 676000];denom_cond = 900000→dTcond/dt = [-512000/900000, -676000/900000].
- mass conversion
- Mutation check: deleting the
_drying_rate_mass_basiscall inunit_model(the pre-#108 / issue #48 defect) makes the test fail — gas rate66.67vs expected2.44(≈27×), matching the PR's "about 27 times" red-check claim. The test is a real regression guard, not vacuously green. - Test lanes reproduce the PR body exactly:
-m "not assimulo"→ 33 passed, 12 deselected;-m assimulo→ 12 passed, 33 deselected; targetedtest_drying_model.py + test_drying_energy_rate_basis.py→ 5 passed. - The
* 2latent factor is pinned and documented as owned by #24; the test correctly characterizes current behavior rather than changing it. Keeping this a focused unit test (rather than an end-to-end run that would assert #24's unstable multiplier) is the right call. - Working tree clean after runs; only gitignored
.pycartifacts generated.
Nonblocking
- The production fix for #48 (the
dry_rate * MW / 1000conversion atDrying_Model.py:287) lives in PR #108, which is the base of this stacked PR — this PR's own diff contains only the test.Closes #48therefore only takes effect once the stack reachesmaster, and #48 is not actually "resolved with regression coverage" from #116's diff alone. The body already documents the stacking and the manual-close caveat, so this is fine as-is; just confirm the intended close ownership between #108 (fix) and #116 (test) so #48 is neither closed prematurely by #108 nor left dangling. - The fixture uses
number_nodes == num_volatiles == 2. Inenergy_balancethe latent term broadcastslatent_heat(per-node in the real model) againstdry_rate[:, idx_volatiles](per-volatile columns); with both dims equal to 2 the test cannot distinguish per-node from per-component latent semantics. This does not weaken the #48 guard (the mutation check moves both gas and condensed rates ≈27×, and the sensible term viadry_rate.sumis unambiguous), and the underlying broadcasting shape inenergy_balance:410is pre-existing and out of scope here. Worth a note only if a future change makes nodes ≠ volatiles.
Summary
- Blocking: none.
- Nonblocking:
Closes #48close-ownership across the #108/#116 stack;nodes == volatiles == 2fixture coincidence in the latent term. - Questions: none.
- Tests run: targeted drying tests (5 passed),
not assimulolane (33 passed),assimulolane (12 passed), and a mutation check confirming the test fails without the mass conversion. All green. - Merge-readiness: content is ready on the merits. It targets the non-default base
fix/issue-21-drying-gas-mass-rateand is stacked on PR #108, so #108 must land (and this PR be retargeted tomaster) before merge and before #48 auto-closes. This authorCOMMENTdoes not satisfy any branch-protection approval that may apply after those gates clear.
|
Addressed the review feedback for head Changes made:
Commits pushed: none. This was a metadata-only correction; repository content and head SHA are unchanged. Verification on the unchanged head:
Intentionally not changed:
No unresolved inline threads exist, so no thread replies were required. |
|
Addressed the latent-heat fixture-shape review note on head Changes made:
Why this is OK for the current PR:
Verification:
No unresolved inline review threads exist. |
|
Coordination follow-up for the latent-heat shape note:
|
|
Read-only resolution check of my earlier maintainer review ( Both review findings addressed
Verification performed (read-only)
Coordination notes are consistent and technically accurateThe note on #101 (
One follow-up for #101 (not blocking #116)This PR's AssessmentAll review feedback on #116 is resolved at head |
|
Addressed the latest review feedback on head Changes made:
Verification:
The inline review thread has been replied to. |
|
Addressed the corrected end-to-end Drying test rationale on head Changes made:
Why no full class-style
Verification:
The inline review thread has been replied to. |
|
Read-only review-resolution check of @bernalde's Comment-by-comment status@bernalde's inline thread on
What this pass did not change
The only substantively open item is the end-to-end example, which was deferred rather than added. The rationale is factually accurate (all cited blockers verified OPEN), but whether the documented deferral is acceptable — versus requiring an example in this PR — is @bernalde's decision, not something the author can self-resolve. Assessment
Verification-only pass; no code, reviews, or thread states were modified. |
|
Coordination note from PR #119 / issue #81: The end-to-end Drying example/test discussed on this PR should remain deferred until the open Drying correctness work is solved and merged. PR #119 fixes #81's gas-velocity, gas-source holdup, and single-node initialization defects, but a realistic Before turning the class/Purdue-style example into an integration assertion, wait for #21 / PR #108, #24, #28, #37, #42, #81 / PR #119, and #101 to land. Until then, PR #116's focused |
Summary
unit_modelregression that drives the real energy-balance call path.Refs #21, #24, #48, #108.
Acceptance Criteria
cpgin J/kg/K with total drying rate in kg/m^3/s.origin/masterand passes with PR Fix drying gas mass-rate balance #108's shared conversion.Dimensional Analysis
get_drying_rate: mol/m^3/s.(mol/m^3/s) * (kg/mol) = kg/m^3/s.(J/kg/K) * K * (kg/m^3/s) = J/m^3/s.(kg/m^3/s) * (J/kg) = J/m^3/s.Coordination Notes
unit_model. Duplicating the conversion inenergy_balancewould double-convert after Fix drying gas mass-rate balance #108 lands.master, then close it manually with links to Fix drying gas mass-rate balance #108 and this PR.* 2latent-heat factor on the same energy expression. This PR documents and tests the current multiplier without changing its behavior; High: [Drying] Condensed-phase energy balance doubles latent heat #24 will need to update the pinned condensed-rate expectation when it removes the multiplier.solve_unitDrying transient example is intentionally deferred. The blocker is not the absence of a checked-in example; it is that open Drying correctness work still affects realistic transient assertions (Critical: [Drying] Gas species balance adds molar source terms to mass-fraction states #21 / PR Fix drying gas mass-rate balance #108, High: [Drying] Condensed-phase energy balance doubles latent heat #24, High: [Drying] Gas molecular weight is computed from mass fractions as mole fractions #28, Medium: [Drying] Gas energy balance multiplies convective enthalpy by density twice #37, Medium: [Drying] Volatile liquid mass-fraction column is forced to zero each RHS evaluation #42, High: [Drying] Gas balance and Darcy velocity produce order-of-magnitude drying transient errors #81, and High: [Phases] Multi-temperature VaporPhase mass-basis latent heat drops component columns #101). Once those land, the class examples can seed broader integration coverage, likely under testing umbrella Expand test coverage across modules (unit + integration) #7 or a dedicated follow-up issue.tests/test_drying_energy_rate_basis.py. PR Fix drying gas mass-rate balance #108 overlaps inPharmaPy/Drying_Model.pyandtests/test_drying_model.py, but those changes are the prerequisite base rather than competing hunks.Tests
conda run -n pharmapy python -m pytest tests/test_drying_model.py tests/test_drying_energy_rate_basis.py -q— 5 passed.conda run -n pharmapy python -m pytest tests/ -m "not assimulo"— 33 passed, 12 deselected.conda run -n pharmapy python -m pytest tests/ -m assimulo— 12 passed, 33 deselected.origin/master(1a3ab31) — failed as expected: gas energy rates were about 27 times the mass-basis expectations.Branch Hygiene
fix/issue-21-drying-gas-mass-rate(non-default).beb53e40d07bb06a7be0e573858e52947f808cbb, the current head of PR Fix drying gas mass-rate balance #108.masteror merged through the stack.Refs #48; close High: [Drying] Energy terms multiply molar drying rates by mass-basis heat quantities #48 manually after PR Fix drying gas mass-rate balance #108 and this PR both reachmaster.