Skip to content

Comments

dp_tau_centrifugal bug fix Reynolds number#269

Open
RaphaelGebhart wants to merge 7 commits intoDLR-SR:mainfrom
RaphaelGebhart:Raphael2026dp_tau_centrifugal_FixKinematicViscosity
Open

dp_tau_centrifugal bug fix Reynolds number#269
RaphaelGebhart wants to merge 7 commits intoDLR-SR:mainfrom
RaphaelGebhart:Raphael2026dp_tau_centrifugal_FixKinematicViscosity

Conversation

@RaphaelGebhart
Copy link
Collaborator

@RaphaelGebhart RaphaelGebhart commented Jan 29, 2026

Continues #168.

In the centrifugal pump model used in
ThermofluidStream.Processes.Internal.TurboComponent.dp_tau_centrifugal,
the Reynolds number was calculated incorrectly.

The Reynolds number was overestimated by a factor equal to the density in kg/m³
(e.g. a factor of ~1000 for water). This led to overly strong viscosity effects in the
pump model and therefore incorrect results.

All test models and examples were checked and updated accordingly.
The bug fix has a major impact for open-loop systems, but only a minor impact for
closed-loop systems
, when considering the input output behaviour.

Please vote on how to proceed:

If you vote for 2), please indicate which option you prefer:

  • 2.1)
    First step: mark the function as obsolete
    Second step: remove it from the choices of
    replaceable function dp_tau_pump in ThermofluidStream.Processes.Pump
    Third step: remove the function completely

  • 2.2)
    Do nothing

Results for old vs new (bug fixed) correlation:
SimpleCoolingCycle

Pump TestLiqLoopDowcal100 TestLiqLoopJP8 TestLiqLoopJP8DryAir TestSimpleLoopJP8DryAir TestSimpleLoopWithStaticHeadJP8DryAir

…est models that use the pump, 3) Adapted the control gain in SimpleCoolingCycle, 4) Changed the initialization of the pump test model
@RaphaelGebhart RaphaelGebhart self-assigned this Jan 29, 2026
@RaphaelGebhart RaphaelGebhart added bug Something isn't working p::Processes Concerns package Processes and Undirected.Processes effort::low Low effort expected to solve issue. priority::high Should be treated with high priority layer::text Improvements or additions to model/class on text layer (e.g. equations) labels Jan 29, 2026
@dzimmer
Copy link
Contributor

dzimmer commented Jan 29, 2026

Sure. A mistake should be corrected.
If the impact is major (as it seems), you may want to sync it with a major version release.

@RaphaelGebhart
Copy link
Collaborator Author

RaphaelGebhart commented Jan 30, 2026

I (with support of my trusted AI tool) suggest the following migration strategy:

v1.3

  • Introduce parameter Boolean useLegacyVersion = true
  • Add an assertion:
    assert(not useLegacyVersion, "...", AssertionLevel.warning);
  • This means users will receive a warning by default, informing them that the legacy behavior is deprecated. They are asked to switch to the new version and told that the legacy version will be disabled in v2.0.

v1.4

  • Introduce parameter AssertionLevel assertionLevel = AssertionLevel.error
  • By default, the assertion is promoted to an error, forcing users to migrate.
  • For switching from legacy behavior to the new version users can downgrade the assertion level back to a warning.

v2.0

  • Remove useLegacyVersion and assertionLevel
  • Remove the legacy implementation entirely
  • Provide a conversion script that removes all related modifiers from user models

@dzimmer do you approve this approach?

@CorentinLepais
Copy link
Contributor

I would also fix the bug. You may also want to display the warning on the icon layer to make sure it is properly identified by the users

@nieweber
Copy link
Contributor

I would suggest to fix it. If we want to add the "legacy-flag", I'd only suggest it if the next release is no major release. If we do a major release, we will put it to the release notes and then it should be fine. As long as we don't create a new release it is up to the user to use the latest release or the latest main. So my suggestion: fix it and prepare a major release.

…corrected version of dp_tau_centrifugal 2) Implemented a minor release compatible warning during simulation if useLegacyReynolds that does gets only triggered a few times (during initialisation), 2) Changed all examples and test models to useLegacyReynolds = false, 4) Included 2 test models, one for the characteristics and one for the design point
@RaphaelGebhart
Copy link
Collaborator Author

I would also fix the bug. You may also want to display the warning on the icon layer to make sure it is properly identified by the users

Thanks for the suggestion. Unfortunately, I don’t think this is feasible in this case.

The bug is located inside a function that is used by the pump model, and the proposed fix is also entirely contained within that function. The pump model itself can be configured to use different characteristic functions.

Displaying a warning on the icon layer would require the model to receive information from the selected function. This, in turn, would require introducing an additional output to the function interface. Adding such an output would be a breaking API change and therefore only acceptable in a major release. (If I'm not mistaken)

@RaphaelGebhart
Copy link
Collaborator Author

I would suggest to fix it. If we want to add the "legacy-flag", I'd only suggest it if the next release is no major release. If we do a major release, we will put it to the release notes and then it should be fine. As long as we don't create a new release it is up to the user to use the latest release or the latest main. So my suggestion: fix it and prepare a major release.

The reason I prefer the intermediate step is that it allows us to update all models already in v1.3 and ensure that they run correctly with the fix, while still retaining the option to fall back to the old behavior.

If we apply the fix only in v2.0, we lose access to the legacy formulation entirely, which makes migration harder.
In fact, both ThermofluidStream.Examples.SimpleCoolingCycle and ThermofluidStream.Processes.Tests.Pump failed when applying the fix. While the required model changes were relatively straightforward, this was only obvious because the issue was known.

Without an explicit warning, users may experience failing models without a clear indication of the root cause, which could significantly increase debugging time. The intermediate step provides a controlled migration path and makes the transition much more transparent for users.

@RaphaelGebhart RaphaelGebhart requested review from CorentinLepais and removed request for fvanderlinden January 30, 2026 15:31
@fvanderlinden
Copy link
Contributor

I suggest going with option 1.3 first, than update with a major release to 2.0.

Keeping backward compatibility is important. We will break models with a direct fix.

…cy versions of Dymola (2024x and older) that do not follow the Modelica Guidelines in this point.
@RaphaelGebhart
Copy link
Collaborator Author

Ready for review @CorentinLepais. We also have to update the reference files for regression testing in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional
Since you have already made some changes to the test model, can you maybe improve the layout (extending the size of the white area, add proper names and maybe two showValue block for the two outputs).

Copy link
Contributor

@CorentinLepais CorentinLepais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the documentation of the pump model can be updated to mention the legacy Reynold option (e.g. "- Centrifugal pump, which implements the equations of a scalable centrifugal pump. Warning the function uses by default a deprecated Reynold formulation which can lead to errors. Please see dp_tau_centrifugal documentation for more information")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Icon display in package browser not homogenous (icon layer size is currently based on graphic layer)
  • Documentation missing (at least explain the purpose of the model)
  • Short description next to model name missing
  • Mirror horizontally conduction element

The controller does not allow to reach the setpoints (maybe because the heat source is too small) and when simulated on a longer time the loop starts to oscillate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Icon display in package browser not homogenous (icon layer size is currently based on graphic layer)
  • Documentation missing (at least explain the purpose of the model)
  • Short description next to model name missing
  • Mirror horizontally conduction element

Controller does not allow to reach the setpoint (maybe heat load to small). But maybe it is intended or at least not an issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Icon display in package browser not homogenous (icon layer size is currently based on graphic layer)
  • Documentation missing (at least explain the purpose of the model)
  • Short description next to model name missing
  • Mirror horizontally conduction element
  • inlet_temp block not connected

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Icon display in package browser not homogenous (icon layer size is currently based on graphic layer)
  • Documentation missing (at least explain the purpose of the model)
  • Short description next to model name missing
  • Mirror horizontally conduction element
  • Clean connection lines
  • inlet_temp block not connected

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Icon display in package browser not homogenous (icon layer size is currently based on graphic layer)
  • Documentation missing (at least explain the purpose of the model)
  • Short description next to model name missing
  • Mirror horizontally conduction element
  • inlet_temp block not connected

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

Labels

bug Something isn't working effort::low Low effort expected to solve issue. layer::text Improvements or additions to model/class on text layer (e.g. equations) p::Processes Concerns package Processes and Undirected.Processes priority::high Should be treated with high priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants