Conversation
Replaces the hardcoded transport-species revival cutoff in compute_transport_properties with the same tsize/esize threshold and smooth_truncation gate used elsewhere in the solve, so it stays consistent (and correct under a custom trace value) whether or not smooth_truncation is enabled. (cherry picked from commit 7202b68)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Transport-species screening in
compute_transport_propertiesused a hardcoded, always-hard-zero cutoff to decide whether to revive a trace gas species for the transport-species list, ignoringsmooth_truncationentirely and drifting out of sync with a customtracevalue. This replaces it with the sametsize/esizethreshold andcompute_nj_effectivesmooth gate used everywhere else in the solve.djkees#11
Changes
source/equilibrium.f90: replaced the hardcodedtransport_log_cutoff = 25.328436d0constant and its hardnj(i) <= 0.0d0step check withgas_amount_ln_threshold(ion-aware, usingtsize/esize) andcompute_nj_effective(respectssmooth_truncation/truncation_width), matching the pattern used at every other activity-threshold check in this file. Added a comment noting why this loop rarely has anything to revive in the common converged path (species are already screened by the far more permissivelog_minfloor before this loop runs) and when it actually matters (the singular-matrix fallback path, or a future tighter/configurable reporting floor).source/equilibrium_test.pf: strengthened the existingtest_equilibrium_transport_ch4_o2_smooth_truncationstub with transport-property assertions; addedtest_equilibrium_transport_ionized_smooth_truncation(ions + transport + smooth_truncation together, not otherwise covered); addedtest_transport_screening_smooth_gate_at_threshold, which isolates the changed loop directly by callingcompute_transport_propertiestwice on the same converged solution with one species pinned exactly at its activity threshold — once withsmooth_truncationoff, once on.Testing
cmake --build build-dev --target cea_core_test -j4 && ./build-dev/source/cea_core_test.exe— full 124-test suite (122 pre-existing + 2 new) passes.test_transport_screening_smooth_gate_at_thresholdactually isolates this change: temporarily reverted justequilibrium.f90(keeping the new test) and reran — that one test failed as expected (equilibrium_test.pf:4184, the smooth-mode revival assertion), with every other test still passing. Restored the fix and reconfirmed all 124 pass.smooth_truncationon vs. off through the Python bindings: converged results agree to 1e-8–1e-16 relative (ordinary solve-path noise, not a discrepancy), with a ~4-45% per-solve timing overhead for smooth mode depending on mixture size, consistent with it being an opt-in, numerically-smoother reformulation rather than a different physical model.Compatibility / Numerical behavior
For default settings (no custom
trace,smooth_truncationoff), behavior is unchanged:tsizeequals the old hardcoded constant's value by coincidence at convergence, and the full pre-existing test suite (including several exact-reference-value regression tests) passes unmodified. Real behavior changes are scoped to: (1) a customtracevalue, which the old code silently ignored for this one loop; (2) ionized mixtures, which now get the same looseresizethreshold used everywhere else instead of a flat cutoff; (3)smooth_truncation=Trueruns, where deep-trace species (near thelog_minreporting floor) are now revived to a small nonzero amount instead of an exact hard zero — validated directly by the new isolated test, and shown not to meaningfully affect aggregate transport properties in two realistic end-to-end cases.Drafted with Claude's assistance.
xsize, and asmooth_truncationflag ignored entirely by this one loop) was found by direct reading ofequilibrium.f90and tracing whereeq_soln%njis populated before this loop runs (compute_reported_nj/log_min), not taken from the issue text alone.njdiffs, not just aggregate outputs.Suggested changelog entry (for
CHANGELOG.md, left to the maintainer to place)