Skip to content

Declare MIN in Fluid.Dissipation functions as constant - #4828

Open
henrikt-ma wants to merge 1 commit into
modelica:masterfrom
henrikt-ma:dissipation-min-constant
Open

henrikt-ma wants to merge 1 commit into
modelica:masterfrom
henrikt-ma:dissipation-min-constant

Conversation

@henrikt-ma

Copy link
Copy Markdown
Contributor

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 constant can only get its unit from the unit-attribute, or from its binding equation. According to this rule, a constant with no unit-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.

…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>
@henrikt-ma henrikt-ma added the L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation) label Oct 16, 2026
@henrikt-ma henrikt-ma changed the title Declare the small number MIN in Fluid.Dissipation functions as a constant Declare MIN in Fluid.Dissipation functions as constant Oct 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L: Fluid Issue addresses Modelica.Fluid (excl. Dissipation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant