Skip to content

Fix drying condensed latent heat factor#124

Merged
bernalde merged 6 commits into
masterfrom
fix/issue-24-drying-latent-heat
Jul 24, 2026
Merged

Fix drying condensed latent heat factor#124
bernalde merged 6 commits into
masterfrom
fix/issue-24-drying-latent-heat

Conversation

@Mazhar331

@Mazhar331 Mazhar331 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #24.
Refs #20, #21, #48, #103, #108, #116, #119.

Acceptance Criteria

Dimensional Analysis

  • unit_model converts get_drying_rate output from [mol/m**3/s] to dry_rate [kg/m**3/s] using molecular weights [kg/mol].
  • getHeatVaporization(..., basis='mass') returns latent_heat [J/kg].
  • Condensed latent power is therefore (kg/m**3/s) * (J/kg) = J/m**3/s.
  • denom_cond is a volumetric heat capacity [J/m**3/K], so -drying_terms / denom_cond is [K/s].

Coordination Notes

Tests

  • Red check before source fix: conda run -n pharmapy python -m pytest tests/test_drying_latent_heat_factor.py -q failed by 2x in the condensed temperature-rate assertion.
  • conda run -n pharmapy python -m pytest tests/test_drying_latent_heat_factor.py tests/test_drying_energy_rate_basis.py -q - 2 passed.
  • conda run -n pharmapy python -m pytest tests/test_drying_model.py tests/test_drying_energy_rate_basis.py tests/test_drying_latent_heat_factor.py -q - 6 passed.
  • conda run -n pharmapy python -m pytest tests/ -m "not assimulo" -q - 40 passed, 15 deselected.
  • conda run -n pharmapy python -m pytest tests/ -m assimulo -q - 15 passed, 40 deselected.
  • conda run -n pharmapy python -m pytest --collect-only -q - 55 tests collected.
  • git -c core.whitespace=blank-at-eol,blank-at-eof,space-before-tab,cr-at-eol diff --cached --check - passed.

Environment: conda run -n pharmapy using Python 3.10.20.

Branch Hygiene

Review Follow-Up Metadata

  • Pushed 6337303 directly to existing branch fix/issue-24-drying-latent-heat.
  • Merged current origin/master at 18442e9 into the branch, preserving the High: [Drying] Gas balance and Darcy velocity produce order-of-magnitude drying transient errors #81 relative-permeability Darcy gas-velocity fix and the High: [Drying] Condensed-phase energy balance doubles latent heat #24 condensed latent-heat fix.
  • Addressed the new comment-cleanup review: removed stale z_cake script notes, old commented state/interpolation lines, the # Physical properties banner, the obsolete self.rho_liq comment, unused sauter_diam, old gas-pressure notes, and stale drying-rate/p_gas_total alternatives.
  • Normalized units in touched drying lines, including z_cake [m], x_csd [m], csd [-], mom_zero [-], y_volat [-], dry_volatiles [mol/m**3/s], dry_rates [mol/m**3/s], mw_avg_gas [g/mol], temp_gas_inputs [K], cpg_mix [J/kg/K], and denom_cond [J/m**3/K].
  • Documented why the initial rho_liq [kg/m**3] is used only for irreducible saturation and why unit_model recomputes self.rho_liq during integration.
  • Verification: unit audit passed; focused tests 11 passed, 2 warnings; full suite 71 passed, 2 warnings; CRLF-aware diff check passed.

@Mazhar331
Mazhar331 marked this pull request as ready for review July 17, 2026 19:09

@Mazhar331 Mazhar331 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer review — issue #24 condensed-phase latent-heat factor.

The change is correct and well-scoped. Drying.energy_balance removes the unexplained * 2 from the condensed-phase latent sink, matching the fix the issue triage requested. getHeatVaporization(..., basis='mass') already returns the full mass-basis latent heat [J/kg], and dry_rate is mass-basis [kg/m**3/s] after the #108 shared conversion, so their product is the full latent power [J/m**3/s] once. Dividing by denom_cond [J/m**3/K] yields [K/s]. The added Numpy-format docstring documents this units contract.

Verification performed (locally, conda run -n pharmapy, Python 3.10.20)

  • pytest tests/test_drying_latent_heat_factor.py tests/test_drying_energy_rate_basis.py -q — 2 passed.
  • Full lanes: pytest tests/ -m assimulo — 15 passed, 40 deselected; pytest tests/ -m "not assimulo" — 40 passed, 15 deselected (55 total).
  • Recomputed the new fixture by hand: dry_rate[:, [0,2]] * latent_heat sums to [256000, 338000, 128000] J/m**3/s, denom_cond = 900000 J/m**3/K, so dTcond_dt = [-256000, -338000, -128000]/900000 K/s. Matches the asserted literals, which are implementation-independent.
  • Red-on-base mutation: re-added * 2 to the source line in a scratch worktree and re-ran. Both test_drying_latent_heat_factor.py and test_drying_energy_rate_basis.py failed, each by exactly the 2× factor (observed values were exactly double the expected). Putting the bug back makes the tests fail, which confirms they guard the fix. The three node values are distinct, so a reorder/transpose would also be caught by value, and the volatile-count axis (2) differs from the node axis (3), avoiding a shape-collision ambiguity.
  • Grepped the repo: no other call site relied on the doubled value, and no other doubled-latent expression exists on this PR's head. (The * 2 still present in the working tree of the #81 branch is that separate PR's copy, consistent with the coordination note that whichever of #119/#124 merges second needs a small rebase.)

Blocking

None.

Nonblocking

  • Docstring Returns section omits the return_terms=True output. See inline comment.

Linked issue

Closes #24 is correct: the PR fully resolves the issue's core ask (remove the unphysical factor of two from the condensed-phase evaporative-cooling sink).

Merge readiness

No blocking findings. This review is posted as a COMMENT because I authored this PR — this account cannot submit a formal APPROVE/REQUEST_CHANGES on its own PR; an eligible maintainer's approval is needed if branch protection requires one. Live GitHub state currently reports mergeStateStatus: CLEAN and an empty reviewDecision (no approval gate reported).

Comment thread PharmaPy/Drying_Model.py Outdated
@Mazhar331

Mazhar331 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the PR #124 review feedback in commit 733f149.

Changes made:

  • Normalized touched drying source/test unit comments to [...], including pre-existing unit comments in touched lines.
  • Clarified energy_balance(return_terms=True) documentation so the raw diagnostic and [K/s] rate contributions are described separately.
  • Removed stale/debug inline comments and inactive heat-loss formulas.
  • Left heat-loss placeholders as explicit zero arrays [J/m**3/s]; a_V remains defined by the existing bed surface-area calculation rather than by a dead heat-loss comment.
  • Replaced the High: [Drying] Condensed-phase energy balance doubles latent heat #24-specific test comment with direct latent-power unit wording [J/m**3/s].

Tests run:

  • /home/mlaljee/miniforge3/envs/pharmapy/bin/python -m pytest tests/test_drying_latent_heat_factor.py tests/test_drying_energy_rate_basis.py -q -> 2 passed.
  • /home/mlaljee/miniforge3/envs/pharmapy/bin/python -m pytest tests/ -q -> 55 passed.
  • CRLF-aware git diff --cached --check -> passed.

Post-push CI on 733f149: Core tests SUCCESS; Assimulo integration tests SUCCESS. mergeStateStatus is CLEAN. No review comments were intentionally declined. The formal review state remains CHANGES_REQUESTED until @bernalde re-reviews or dismisses the prior review.

@Mazhar331

Copy link
Copy Markdown
Collaborator Author

Verification pass (read-only) at head 790cc52 — the review feedback is addressed and the fix holds.

Comment-by-comment status

  • Nonblocking — Returns docstring omitted the return_terms=True output (inline on PharmaPy/Drying_Model.py): Addressed in 790cc52. The Returns section now documents both the default [dTg_dt, dTcond_dt] (return_terms=False) and the return_terms=True diagnostic tuple (convec_term, drying, heat_cond, heat_loss_emp).

No blocking findings were raised in the review.

Verification

  • 790cc52 is a docstring-only delta (+5/−1, entirely within the energy_balance Returns block); git compare 28434d7...790cc52 touches no code lines.
  • The core High: [Drying] Condensed-phase energy balance doubles latent heat #24 fix is intact at head: drying_terms = (dry_rate[:, self.idx_volatiles] * latent_heat).sum(axis=1) (single latent factor, no * 2). Because the follow-up changes only the docstring, the earlier verification still applies — targeted and full test lanes green (55 tests), and the red-on-base mutation (re-adding * 2) fails both regressions by exactly 2×.

Remaining issues: none.

Another review round: not warranted. The follow-up is exactly the documentation clarification the comment requested — docstring-only, no behavior, public-API, or CI change.

Merge readiness: mergeStateStatus: CLEAN, reviewDecision empty, and master is unprotected (no required_pull_request_reviews), so no approving-review gate is enforced. Note that both reviews on this PR are COMMENTs from the author account, which cannot supply a formal APPROVE; if a maintainer later adds branch protection requiring approval, an eligible non-author account would need to approve.

@Mazhar331
Mazhar331 requested review from andres9403 and bernalde July 17, 2026 19:36
Comment thread PharmaPy/Drying_Model.py Outdated
``dry_rate`` gives the full latent power [J/m**3/s].
"""

# temp_ref = 298

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Missing units regardless

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 733f149: the inactive heat-loss expression was removed instead of keeping a commented formula, and the behavior-preserving placeholder is now explicit np.zeros_like(temp_gas) # [J/m**3/s].

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up in 55a530b: completed the stricter units/docs audit for this branch, normalized touched unit annotations to [...], and updated NumPy-style docs on touched functions. Validation: /home/mlaljee/miniforge3/envs/pharmapy/bin/python /tmp/pharmapy_unit_audit.py PharmaPy/Drying_Model.py tests/test_drying_energy_rate_basis.py tests/test_drying_latent_heat_factor.py -> passed; /home/mlaljee/miniforge3/envs/pharmapy/bin/python -m pytest tests/test_drying_energy_rate_basis.py tests/test_drying_latent_heat_factor.py -q -> 2 passed; CRLF-aware git diff --cached --check -> passed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed at 7c12c1d: the inactive heat-loss formulas were removed, the retained placeholders are annotated as [J/m**3/s], and the drying-model unit audit now covers the flagged temperature, molecular weight, heat-capacity, permeability, and surface-area terms.

Comment thread PharmaPy/Drying_Model.py Outdated
@@ -476,7 +518,7 @@ def energy_balance(self, time, temp_gas, temp_sol, satur, y_gas, x_liq,
# heat_loss_cond = self.h_T_loss * self.a_V * (temp_sol - self.T_ambient)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of this comment? Should we define self.a_V elsewhere?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 733f149: the stale a_V comment and inactive heat-loss formulas were removed. a_V remains defined by the existing bed surface-area calculation; this PR does not introduce a new heat-loss model.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up in 55a530b: completed the stricter units/docs audit for this branch, normalized touched unit annotations to [...], and updated NumPy-style docs on touched functions. Validation: /home/mlaljee/miniforge3/envs/pharmapy/bin/python /tmp/pharmapy_unit_audit.py PharmaPy/Drying_Model.py tests/test_drying_energy_rate_basis.py tests/test_drying_latent_heat_factor.py -> passed; /home/mlaljee/miniforge3/envs/pharmapy/bin/python -m pytest tests/test_drying_energy_rate_basis.py tests/test_drying_latent_heat_factor.py -q -> 2 passed; CRLF-aware git diff --cached --check -> passed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed at 7c12c1d: the stale a_V inline comment was removed. a_V remains the existing bed surface-area calculation and is now documented as [m**2/m**3]; relocating it would be outside #24.

Comment thread tests/test_drying_energy_rate_basis.py Outdated

# The mass-rate latent powers are [256000, 338000, 128000] J/m**3/s. Issue #24
# separately tracks the existing factor of two applied to those powers.
# The mass-rate latent powers are [256000, 338000, 128000] J/m**3/s.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Units in []. Also, do we still need to talk about issue 24?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 733f149: the test comment now uses [...] units and no longer talks about issue 24; it states the latent powers directly as [J/m**3/s].

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up in 55a530b: completed the stricter units/docs audit for this branch, normalized touched unit annotations to [...], and updated NumPy-style docs on touched functions. Validation: /home/mlaljee/miniforge3/envs/pharmapy/bin/python /tmp/pharmapy_unit_audit.py PharmaPy/Drying_Model.py tests/test_drying_energy_rate_basis.py tests/test_drying_latent_heat_factor.py -> passed; /home/mlaljee/miniforge3/envs/pharmapy/bin/python -m pytest tests/test_drying_energy_rate_basis.py tests/test_drying_latent_heat_factor.py -q -> 2 passed; CRLF-aware git diff --cached --check -> passed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed at 7c12c1d: the test comments now use [...] units and no longer refer to issue 24. The fixture uses unequal node/species counts and explicit expected values.

@Mazhar331

Mazhar331 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed 6337303 to the existing #124 branch.

Addressed the new drying-model comment cleanup by removing stale script notes, old commented state/interpolation snippets, the obsolete self.rho_liq comment, unused sauter_diam, old pressure/drying alternatives, and the removable # Physical properties banner. The reviewed variables and nearby touched values now use bracketed units, including z_cake [m], mw_avg_gas [g/mol], temp_gas_inputs [K], cpg_mix [J/kg/K], x_csd [m], csd [-], and mom_zero [-].

The #24 latent-heat behavior is unchanged except for the intended fix: no extra factor of two, and return_terms=True reports the condensed latent contribution over denom_cond [J/m**3/K].

Verification: unit audit passed; focused tests 11 passed, 2 warnings; full suite 71 passed, 2 warnings; CRLF-aware diff check passed.

@Mazhar331

Copy link
Copy Markdown
Collaborator Author

Read-only verification pass — head 55a530b

This is a verification pass, not a formal approval. No files, branches, comments, threads, or CI runs were modified.

Scope: the three inline comments from @bernalde's CHANGES_REQUESTED review (2026-07-20), the earlier self-review thread, and a units/documentation/comments audit of the changed code plus the adjacent call path.

Comment status

Thread Comment Status
PRRT_kwDOLmbe4s6R3ub8 (resolved) Returns section omitted the return_terms=True output Addressed
PRRT_kwDOLmbe4s6SZd8r @bernalde, Drying_Model.py L470: "Do we need this? Missing units regardless" Addressed
PRRT_kwDOLmbe4s6SZeV4 @bernalde, Drying_Model.py L518: "What's the point of this comment? Should we define self.a_V elsewhere?" Partially addressed
PRRT_kwDOLmbe4s6SZetT @bernalde, test_drying_energy_rate_basis.py L119: "Units in []. Also, do we still need to talk about issue 24?" Addressed

No comment was declined. @bernalde's review body was empty, so the three inline comments are the full set.

Details:

  • L470 — tracing the diff hunk, the targeted line is the stale # temp_ref = 298. It is gone at head (grep temp_ref returns nothing), and the commented-out heat_loss/heat_loss_cond formulas were removed too (Drying_Model.py:520, :532 are now np.zeros_like(...) # [J/m**3/s]). The reply in that thread describes a different line than the one commented on, but the outcome covers both readings.
  • L518 — the commented # heat_loss_cond = self.h_T_loss * self.a_V * ... line is removed. The a_V half is answered only in the thread reply, not in code: Drying_Model.py:659 (self.a_V = moments[2] * (1 - porosity) / moments[3]) still has no unit annotation, while the disabled alternative on :658 keeps # [m**2/m**3]. a_V feeds heat_transf (:517-519) and get_drying_rate (:240). Adding # [m**2/m**3] to :659 would close this.
  • L119 — head reads # The mass-rate latent powers are [256000, 338000, 128000] [J/m**3/s]. Units bracketed, issue-High: [Drying] Condensed-phase energy balance doubles latent heat #24 narrative removed.

Test evidence

I re-ran the guard check against the current head rather than trusting the earlier log.

I put the bug back: in a throwaway copy of the head Drying_Model.py I re-added the * 2 to the condensed latent term (drying_terms = (dry_rate[:, self.idx_volatiles] * latent_heat * 2).sum(axis=1), Drying_Model.py:533-535) and ran the two head tests against that mutated copy. Both tests failed3/3 elements mismatched, observed values exactly 2× expected ([-0.568889, -0.751111, -0.284444] vs [-0.284444, -0.375556, -0.142222]). The tests failing here is the reassuring outcome: it proves they would have caught the original bug and still guard the fix today. The control run against the unmutated head source passed 2/2, so the failure is attributable to the mutation and not to the harness. I confirmed the mutated file — not the installed package — was the one imported.

Expected values are hand-computable and independent of the production expression: 0.036·2e6 + 0.184·1e6 = 256000, 0.054·2e6 + 0.230·1e6 = 338000, 0.018·2e6 + 0.092·1e6 = 128000 [J/m**3/s], over denom_cond = 1000·0.5·1000 + 0.5·0.5·2000·800 = 900000 [J/m**3/K]. The three node values are distinct, so a reorder or transpose would be caught by value, not merely by shape.

One fixture note: in tests/test_drying_latent_heat_factor.py the node count (3) equals the species count (3) for y_gas and dry_rate. The sibling test deliberately avoids that collision for latent_heat (test_drying_energy_rate_basis.py:64-66). Benign here because the values are asymmetric, but it drops a convention the neighbouring file documents.

CI

Run 29867685160, head_sha confirmed 55a530be6826390738e7b2ffd2f292645e52a14b:

  • Core tests — SUCCESS (40 passed, 5 skipped, 6 deselected)
  • Assimulo integration tests — SUCCESS (15 passed, 40 deselected)

Both drying tests appear PASSED in the Assimulo job log. No runs were started, re-run, or cancelled.

Units / documentation / comments audit

The changed hunks and the surrounding call path, not only the fixed line.

1. dTg_dt is annotated [K/s], but the PR's own annotations say it is not. Drying_Model.py:526 labels conv_term [J*kg/m**6/s] and :502 labels denom_gas [J/m**3/K]; their quotient is [kg*K/m**3/s]. Line :528 also adds conv_term to sensible_heat [J/m**3/s]. The Notes block (:482-489) acknowledges this as dimensional debt, yet :528, the Returns section (:472-474), and unit_model:350 all still assert [K/s] unqualified. The extra factor is rho_gas, entering twice (via dTg_dz at :524 and explicitly at :526). Please either qualify those three labels or drop the Notes claim — as written the file contradicts itself.

2. mw_avg_gas is labelled [g/mol] but is not a molar mass. :492 (and :316) compute np.dot(y_gas, self.Vapor_1.mw). y_gas is documented as mass fractions (:454-455) and passed as mass_frac= to getCp/getViscosity. On a mass basis the mixture molar mass is 1 / Σ(w_i / M_i), not a mass-weighted arithmetic mean. The label propagates into rho_gas (:320) and cvg_mix (:499), and denom_gas sits in the reviewed balance. Pre-existing, but this PR is what converts an unlabeled ambiguity into a definite — and incorrect — unit claim.

3. Saturation denominator asymmetry between the two balances. material_balance floors the void fraction (:415-416, epsilon_gas[epsilon_gas <= eps] = eps); energy_balance does not (:501), so denom_gas (:502) goes to zero as satur → 1 and dTg_dt diverges. Both lines are inside the touched region.

4. self.drying diagnostic uses the wrong denominator, and the docstring mislabels it. :543 is drying_terms / denom_gas — condensed-phase latent power over the gas capacity. It is [K/s] dimensionally, but it matches no term in either balance: dTg_dt (:528) uses sensible_heat, and dTcond_dt (:539) divides by denom_cond. Returns at :479-480 describes the remaining tuple entries as "gas-temperature-rate contributions", which is not true for this one.

5. The states_di metadata change is user-visible and diverges from the repo convention. :168-179 changes 'units': '''[-]' and 'K''[K]'. These are not comments: Plotting.py:184-186 and :267-271 append any non-empty value to the axis label as ylabel + ' (' + latexify_name(units, units=True) + ')'. Drying plots will now read temp_gas ([K]), and saturation / y_gas / x_liq axes gain a ([-]) suffix that the previous empty string suppressed. No other PharmaPy module brackets these values (18 × 'K', 10 × '', none bracketed). The review request was "Units in []" on a test comment; extending it to plotting metadata changes rendered output, is untested, and is inconsistent with the rest of the package. Suggest reverting these five entries.

6. Constants left unannotated inside annotated hunks. :69 self.T_ambient = 298 (no [K]) and :75 self.h_T_loss = 30 (no [W/m**2/K]) sit immediately below :72/:74, which this diff did bracket.

7. Adjacent call-path quantities feeding the reviewed balances are unannotated. In solve_unit: :634 alpha [m/kg], :635 rho_sol [kg/m**3], :636 porosity [-], :648 k_perm, :652 cp_sol [J/kg/K], :659 a_V [m**2/m**3], :671 dPg_dz [Pa/m], :672 pres_gas [Pa] — all consumed by denom_cond, heat_transf, or vel_gas.

8. Comment regression introduced by this PR. sat_red (:305-306) and k_ra (:307) are computed and never used. Their only consumer and explanation was the commented # vel_gas = self.k_perm * k_ra * self.dPg_dz / visc_gas line, which this PR deleted. Three lines of dead arithmetic now carry a # [-] label and no reason to exist — either remove them or restore a one-line note.

9. Blanket multi-unit labels. :290-291 states_reord … # [-] and [K] and :349 inputs … # inlet states: [-] and [K] annotate a heterogeneous array with two units at once instead of per quantity. :297 x_liq[:, -2] = 0 # [-] has a unit but no rationale for the magic index.

10. Missing docstring on the reviewed call path. get_y_equilib (:201) has none, despite converting mass fractions to mole fractions and returning the equilibrium gas mole fractions [-] that set the drying rate consumed by both balances.

11. Scope. +149/−98 in Drying_Model.py for a one-line physics fix. Beyond the annotations, the diff removes a # TODO: check term by term in material balance down this line marker and a dead drying_terms = rho_gas / self.rho_liq * cpg_mix assignment. Both are defensible; neither was requested, and the TODO is discarded rather than addressed.

The #24 fix itself — drying_terms = (dry_rate[:, self.idx_volatiles] * latent_heat).sum(axis=1) at Drying_Model.py:533-535 — is correct and dimensionally sound: [kg/m**3/s] × [J/kg] = [J/m**3/s], divided by denom_cond [J/m**3/K] gives [K/s].

Remaining issues

Items 1–5 above should be resolved before merge. Item 5 changes rendered output and was not requested by any reviewer; items 1, 2 and 4 are inaccurate claims in newly added documentation on the reviewed function. Items 6, 7 and the a_V annotation at :659 are one-line fixes that also close the outstanding half of the L518 comment.

Gate

master is unprotected (GET /branches/master/protection → 404), so no approving-review count is enforced. mergeStateStatus is CLEAN, but reviewDecision is CHANGES_REQUESTED: @bernalde, that verdict holds until you re-review or dismiss it — neither the author nor CI can clear it.

@bernalde bernalde left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments can be cleaned up

Comment thread PharmaPy/Drying_Model.py Outdated
temp_cond_init = self.CakePhase.Solid_1.temp # [K]
temp_gas_init = self.Vapor_1.temp # [K]
z_cake = self.CakePhase.z_external # [m], for drying_script_inyoung
# z_cake = self.CakePhase.z_external # This line for 2MSMPR_Filter.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment can now be removed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 6337303: removed the stale for drying_script_inyoung note and the old 2MSMPR_Filter.py z_cake comment. The active assignment now keeps only z_cake = ... # [m].

Comment thread PharmaPy/Drying_Model.py Outdated
porosity = self.CakePhase.porosity # [-]

xliq = states_prev[:, num_comp + 1: num_comp + 1 + self.num_volatiles]
# xliq = states_init[:, num_comp + 1: num_comp + 1 + self.num_volatiles]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment might be removed, please verify

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 6337303: removed the # Physical properties banner and adjacent stale commented initialization block. The active quantities now either carry bracketed units or are covered by the solve_unit NumPy notes.

Comment thread PharmaPy/Drying_Model.py Outdated

self.k_perm = 1 / alpha / rho_sol / (1 - porosity)
self.k_perm = 1 / alpha / rho_sol / (1 - porosity) # [m**2]
# self.rho_liq = rho_liq

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we need this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 6337303: removed the obsolete commented self.rho_liq assignment. The solve_unit notes now state that the initial rho_liq [kg/m**3] is only used for the irreducible-saturation estimate, while unit_model recomputes self.rho_liq from the current liquid state during integration.

# Conflicts:
#	PharmaPy/Drying_Model.py
#	tests/test_drying_energy_rate_basis.py
@bernalde
bernalde merged commit 660919e into master Jul 24, 2026
2 checks passed
@bernalde
bernalde deleted the fix/issue-24-drying-latent-heat branch July 24, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

High: [Drying] Condensed-phase energy balance doubles latent heat

2 participants