-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
In building larger and more robust OpenMDAO models, we've noticed that connections between variables with units=None and those with real units (e.g., "m", "kg", and especially "unitless") can lead to silent modeling bugs.
Currently:
- Connecting
output: units='m'→input: units=Noneissues only a warning. - Connecting
output: units=None→input: units='m'raises an error. - Connecting
output: units="unitless"→input: units=Noneonly warns. - Connecting
output: units=None→input: units="unitless"raises an error.
This inconsistent behavior makes None problematic for modeling, and difficult to detect during development unless warnings are explicitly checked.
Proposal
We propose in CS25 to:
- Deprecate the use of implicit
units=Nonewhen declaring input variables in favor of explicitly using"unitless"where appropriate. - Disallow connections involving
units=None, even if both ends areNone, to prevent ambiguity.
Motivation
- We want all unit mismatches to raise errors — not just warnings — for better model safety.
"unitless"is explicit and supports dimensional analysis;Nonedoes not.- Prevents silent failures when unitless variables are incorrectly connected to dimensional ones.
CS25 Unit Test Observations
We noticed that in the cs25 unit tests, many warnings are issued due to connections where variables with units=None are connected to variables with units like "m" or "deg". This indicates a real-world example of the problem due to None being allowed.
We need to fix those cases.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request