fix: update constants precision and centralize definitions#84
Closed
Copilot wants to merge 5 commits into
Closed
Conversation
…mum depth When a weir (or other link) opening exceeds the rim of a storage node, no warning was previously issued. For non-storage nodes, WARN02 fires when node_validate detects the fullDepth was increased in link_validate. Storage nodes skip the fullDepth extension (correctly, since storage volume is defined by user-configured curves), so WARN02 never fired. Add WARN13 "WARNING 13: link opening exceeds maximum depth for Node" to text.h, and issue it in link_validate when a link crown height exceeds the fullDepth of a storage node (with no surcharge depth). Fixes: Maximum depth warning missing for weir opening exceeding storage node rim.
…ning Add WARNING 13 for link opening exceeding storage node maximum depth
…ient - Update GRAVITY from 32.2 to 32.174 (US customary, ft/s²) - Update SI_GRAVITY from 9.81 to 9.80665 (standard gravity, m/s²) - Update PHI from 1.486 to 1.4859 (Manning equation unit factor) - Replace hardcoded 1.49 with PHI in lid.c (3 occurrences) - Replace hardcoded 1.49 with PHI in transect.c (1 occurrence) - Remove redundant MCOEFF constant from subcatch.c, use PHI instead Resolves constants precision issue where values were applied inconsistently and at lower precision than necessary.
Copilot
AI
changed the title
[WIP] Update constants for improved precision
Fix constants precision and eliminate hardcoded Manning coefficient
May 28, 2026
Copilot
AI
changed the title
Fix constants precision and eliminate hardcoded Manning coefficient
fix: update constants precision and centralize definitions
May 28, 2026
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.
Several physical constants were specified at reduced precision and duplicated across files. GRAVITY was 32.2 (should be 32.174), SI_GRAVITY was 9.81 (should be 9.80665), and PHI was 1.486 (should be 1.4859, i.e. 0.3048^(-1/3)). Hardcoded
1.49appeared in multiple source files instead of referencing the named constant.Precision updates
GRAVITYSI_GRAVITYPHIApplied consistently to both:
src/legacy/engine/consts.hsrc/engine/core/Constants.hpp(+ derivedSQRT_GRAVITY,INV_SQRT_GRAVITY)Centralized constant usage (refactored engine)
PHIdefinitions inTransect.cpp,Runoff.hppGRAVITYinHydStructures.hpp,XSection.cpp32.2inForceMain.cpp→constants::GRAVITY1.49inLID.cpp→constants::PHIAll local usages now reference
constants::PHI/constants::GRAVITYfrom the single header: