Add common angle/solid-angle units to units namespace#430
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends EKAT’s units utility by adding commonly used angle/solid-angle symbols to the ekat::units namespace and introducing a convenience API for renaming derived units’ string representations.
Changes:
- Added
Units::rename(std::string_view)to retag a unit’s string representation while preserving its dimensions/scaling. - Added
ekat::units::radandekat::units::sras named dimensionless units for angle and solid angle. - Refactored several derived-unit declarations to use
rename(...), and removeddynandremunit constants.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4d1d6d0 to
8a990b8
Compare
Contributor
Author
|
This PR turned into a more general cleanup of the Units class and units namespace:
|
2db069f to
c0e9510
Compare
c0e9510 to
90b8089
Compare
Contributor
|
shouldn't the derived units belong to the downstream app/customer? |
Contributor
Author
That's one way to approach the issue. In general, yes, but I find it "reasonable" to provide some "common" ones (like N, Pa, J, W, etc). |
mahf708
approved these changes
Apr 14, 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.
Motivation
radis used a lot in E3SM, and users need to inject code likeUnits rad (ekat::units::Units::nondimensional(),"rad")which is not super-clear. It'd be clearer to just use
ekat::units::raddirectly.Also, added a
renamemethod, so one can dowhich I think it's clearer (in intent) than
Finally, i removed
dynandrem, as they are non-SI units, but unlikeg(which is used) they seem to be quite niche.E3SM Stakeholder Feedback
Testing