Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in dp_volumeFlowRate_MFLOW() function #4552

Open
casella opened this issue Feb 26, 2025 · 1 comment · May be fixed by #4553
Open

Bug in dp_volumeFlowRate_MFLOW() function #4552

casella opened this issue Feb 26, 2025 · 1 comment · May be fixed by #4553
Assignees
Labels
bug Critical/severe issue L: Fluid.Dissipation Issue addresses Modelica.Fluid.Dissipation
Milestone

Comments

@casella
Copy link
Contributor

casella commented Feb 26, 2025

While trying to solve #4424, I discovered that the pressure/flow behaviour of the Modelica.Fluid.Fittings.GenericResistances.VolumeFlowRate model when I set a = 0 and b > 0 was not

dp = b*V_flow

as claimed by the documentation, but rather dp = 1/b*V_flow, which of course caused the pressure losses to be wrong by many orders of magnitude. The issue can be traced back to this chunk of code:

M_FLOW := IN_var.rho*(if a>0 and b<=0 then
Modelica.Fluid.Dissipation.Utilities.Functions.General.SmoothPower(
(1/a)*dp,
(1/a)*dp_min,
0.5)
elseif a>0 and b>0 then
sign(dp)*(-b/(2*a) + sqrt((b/(2*a))^2 + (1/a)*abs(dp)))
else b*dp);

where the last line should be dp/b rather than b*dp.

Probably nobody has ever used this component in this way, i.e. to obtain a linear pressure-flow characteristic, otherwise we would have heard about that. This needs of course to be fixed in MSL 4.1.0.

@casella casella self-assigned this Feb 26, 2025
@casella casella added bug Critical/severe issue L: Fluid.Dissipation Issue addresses Modelica.Fluid.Dissipation labels Feb 26, 2025
@casella casella added this to the MSL4.1.0 milestone Feb 26, 2025
@casella casella linked a pull request Feb 26, 2025 that will close this issue
@casella
Copy link
Contributor Author

casella commented Feb 26, 2025

@Esther-Devakirubai, once #4533 is merged in, it will need to be back-ported to maint/4.1.0@

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: Fluid.Dissipation Issue addresses Modelica.Fluid.Dissipation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant