Repository navigation
Move the CHNS tests off the trace-sulfur closure edge - #44
Merged
Merged
Conversation
With no N and a 1e14 kg S budget the returned fallback holds no S: S2_bar and S_kg_total are 0 on seeds 0 to 2, on the Hirschmann and the Fischer buffer alike.
At S/H 1e-4 the full CHNS test sits at the edge of convergence: whether a root closes S depends on the BLAS kernel of the machine, and on some CI runners the test ran past its timeout. The convergence test now uses S/H 3e-3, 10 times the smallest ratio that converged on seeds 0 to 2 on every machine tried, and asserts no fallback and every element within its tolerance. A new test at S/H 1e-5 asserts the warned fallback, a warning that names S and a state inside the CHNOS mass gate. The module timeout is 4 times the slowest CI duration, 193 s, and the mass balance page names the trace-S case.
The convergence test pins P_surf against the Hirschmann value with a Fischer guard and takes its tolerances from the solver defaults. The fallback test asserts that the warning names S alone, that the solve stops after FALLBACK_ATTEMPTS and well before nguess, and pins P_surf; its docstrings state the current case, not the scan. The mass balance page places the trace-S case in the fallback step and says that the returned state keeps most of the S budget.
At S/H 1e-4 the example returned a warned fallback at 0.36 bar while the page promised a few hundred bar. It now uses S/H 3e-3, prints Surface pressure: 0.36 bar with no warning, and a test runs the code block of the page and checks the printed line and the absence of a fallback. The page names Python 3.12 or newer, as pyproject.toml requires.
The trace-S test bounds the attempts above by the fallback cap plus a few draws, the install example test asserts the Hirschmann buffer and no warning of any kind, and the convergence test keeps the P_surf pin without the range and residual checks it implies. The mass balance page says that the S kept by the fallback depends on the restart sequence, and the install page names CPython 3.12 and 3.13.
The draw of the first fallback depends on the machine, so the test bounds the attempt count by the fallback cap below and the nguess of its helper above, one named constant.
The convergence test checks the returned atmosphere and melt masses against each budget next to the solver residual. The fallback test comment says that the scalar gate bounds H, C and N and not the S kept, and the install example test asserts that no warning is captured. The mass balance page introduces the trace-S case as a fallback that returns a budget not emptied.
The docstring gives the edge between S/H 1e-4 and 1e-3 with the machines it was measured on, so the 3e-3 target sits 3 to 10 times above it, and the module comment names the nightly job and the test whose duration sets the timeout.
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.
Description
Since the per-element closure gate of #39,
test_full_chns_convergessits at the edge of what the solver can close (with the Fischer buffer as well as with the new Hirschmann default): for H 1e20, C 1e17, N 1e17 and S 1e16 kg, no restart finds a root that closes S to its own tolerance, and the per-element gate returns the warned fallback after 100 more attempts. Whether a seed converges there depends on round-off, so on the CPU of the runner. The test then ran 2 to 3 times longer, and it timed out at 480 s in the nightly of #43 (https://github.com/FormingWorlds/CALLIOPE/actions/runs/40238902062) while it passed on main (https://github.com/FormingWorlds/CALLIOPE/actions/runs/40241498764). This moves each test away from that edge.test_full_chns_convergesuses S/H 3e-3, a target that converges, and asserts no fallback, each element within its tolerance, gas plus melt equal to the budget, and the surface pressure.FALLBACK_ATTEMPTSandnguess, and a state inside the CHNOS mass gate. It makes no assertion on the size of the S miss, which depends on the restart sequence.S2_barandS_kg_totalat 0 again.pyproject.tomlrequires.docs/Explanations/testing.md.docs/Explanations/mass_balance.mdsays that a trace element far below the dominant budget can end in the warned fallback, and what the warning names.No source change.
Validation of changes
macOS (Apple silicon), Python 3.12, tip
0ffa6e880bf836acb2d09aea5d500ef0d4d7a475:pytest -o addopts= tests/test_stoichiometry_integration.py tests/test_solve.pyin one process: 78 passed.comment-cap --base origin/main --max 3: 0 blocks.The targets come from seed scans on macOS and on CI runners of more than one CPU type; the final tests ran only on the nightly runner above.
Checklist