Repository navigation
Declare MIN in Fluid.Dissipation functions as constant - #4828
Open
henrikt-ma wants to merge 1 commit into
Open
henrikt-ma wants to merge 1 commit into
henrikt-ma wants to merge 1 commit into
Conversation
…tant The functions use one protected variable MIN=Modelica.Constants.eps to guard divisions by quantities as different as areas, viscosities and thermal conductivities, as in max(MIN, IN_var.lambda). As a variable, MIN has a single unit, so these uses cannot all be unit consistent. Declaring MIN as a constant, which it is, lets each use take the unit of the quantity it is compared with, without changing any values. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
This simple fix avoids that unit inference machinery prototypes (implementing one of the fairly stable parts of the ongoing unit checking design efforts in MAP-Lang) try to infer the unit of these variables (which will result in conflicting requirements).
The rule which this fix relies on is that a variable declared
constantcan only get its unit from theunit-attribute, or from its binding equation. According to this rule, aconstantwith nounit-attribute and an empty unit binding equation will behave like a numeric literal with regard to unit checking, so each occurrence may effectively be treated as getting a separate unit inferred from context.