Repository navigation
Declare each species' phase and read it instead of the X-name rule - #1096
Merged
Merged
Conversation
Model files may give each species `phase: soluble | particulate | gas`. The compiled model resolves it once into `species_phases`, falling back to the name rule (X... particulate, S_gas_... gas, otherwise soluble) for an undeclared species; that rule now lives only in `core/phases.py`. Every shipped and example model declares its phases, each equal to what the name rule gave, so no number changes. The clarifier's settling and TSS species, the biofilm's soluble mask, the measures' gas-phase states and the editor's settling suggestions read the declared phase. Part of #957. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merging main put rows_for one line over the function-size limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #957. This adds the last item that issue listed.
Summary
A model file can now give each species
phase: soluble | particulate | gas. The compiled model resolves the phases once intomodel.species_phases. An undeclared species falls back to the old name rule (X...particulate,S_gas_...gas, otherwise soluble), which now lives only inaquakin/core/phases.py.Every shipped and example model declares its species' phases. The code that used to guess from the
Xprefix now reads the declared phase:solids_species/lumped_tss_weights(the clarifiers' settling and TSS species, used bybuild_bsm1andbuild_a2o);BiofilmReactor,IFASUnit);_gas_phase), a fourth name guess found along the way;model_infonow sends each species'phase.Things a reviewer should know
solids_specieserror wording changed: it now says the model "has no particulate species" instead of referring toX-prefixed names.tests/ui/test_forms.py::test_settling_species_follow_the_units_modelnow passes species records carrying aphase, becausesuggest_speciesreads phases rather than names. The expected values are unchanged. It adds a solubleXSOLspecies, which the old name rule would have settled.docs/model_format.mdis now exactly at its 645-line ceiling.aquakin/models/*, so this needsfull-ci.Testing
tests/unit+tests/ui, fast tier: 3240 passed.test_a2o,test_biofilm,test_biofilm_variant,test_bsm1,test_bsm1_asmn_n2o,test_golden_numbers,test_ifas,test_plant_measures,test_plant_spec,test_primary_clarifier), not slow: 202 passed, 1 skipped.sphinx-build -W: clean.scripts/check_types.pyand pyright: clean.check_test_integrity.py: no test weakened.tests/unit/test_species_phase.pyuses a hand-built model whose declared phases disagree with the names. Four of its tests failed with the consumers switched back to the name rule.full-cicovers them.Patch coverage
python scripts/patch_coverage.py: 100.00% of 28 changed lines.Generated by Claude Code