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

Completely specify initial conditions for DynamicPipeEnergyConservationCheck and DynamicPipeEnergyConservationCheck2 #4424

Closed
casella opened this issue Jun 18, 2024 · 4 comments · Fixed by #4547
Assignees
Labels
L: ModelicaTest Issue addresses ModelicaTest, ModelicaTestConversion4 or ModelicaTestOverdetermined P: high High priority issue
Milestone

Comments

@casella
Copy link
Contributor

casella commented Jun 18, 2024

The models

ModelicaTest.Fluid.TestComponents.Pipes.DynamicPipeEnergyConservationCheck
ModelicaTest.Fluid.TestComponents.Pipes.DynamicPipeEnergyConservationCheck2

do not have fully specified initial conditions. These should be added to make sure that the initialization problem is not tool-dependent. This is probably also the reason why the first of the two models currently fails in OpenModelica.

@casella casella added L: ModelicaTest Issue addresses ModelicaTest, ModelicaTestConversion4 or ModelicaTestOverdetermined P: high High priority issue labels Jun 18, 2024
@casella casella added this to the MSL4.1.0 milestone Jun 18, 2024
@casella casella self-assigned this Jun 18, 2024
@maltelenz
Copy link
Contributor

For the record, WSM fails correctness checking for ModelicaTest.Fluid.TestComponents.Pipes.DynamicPipeEnergyConservationCheck2 at initialization, but matches results afterwards.

MatthiasBSchaefer added a commit to MatthiasBSchaefer/MAP-LIB_ReferenceResults that referenced this issue Feb 21, 2025
@casella
Copy link
Contributor Author

casella commented Feb 25, 2025

EDIT: ModelicaTest.Fluid.TestComponents.Pipes.DynamicPipeEnergyConservationCheck actually doesn't have any state variables, because the default assumptions (which are used by all the pipes in the test) sets mass, momentum & energy balances as steady-state:

Image

so there is actually no missing initial equation for that model. The reason why OMC fails is probably that it doesn't really like to switch off all the potential states with stateSelect = StateSelect.prefer as dummies. Very likely a tool issue.

Regarding ModelicaTest.Fluid.TestComponents.Pipes.DynamicPipeEnergyConservationCheck2, it indeed doesn't have fully specified initial states. In fact, these are the settings for the pipe dynamics options:

Image

DynamicFreeInitial means that we have dynamic balances, but no intial equations. I can set it, e.g., to SteadyStateInitial, so that we get steady-state behaviour instead; note that the assert statment on the energy balance is carried out at the end of the transient, because it is only valid in static conditions. OpenModelica handles this without any problems. Unfortunately, Dymola aborts the code generation, I guess this is due to redundant initial conditions stemming from the state constraints due to the connection with fixed pressures at the outlet.

@HansOlsson can you please check that?

@maltelenz do you want to try what happens with WSL when you set system.energyDynamics = SteadyStateInitial?

@maltelenz
Copy link
Contributor

The two variables we had issues with:

Image

Image

and all tested variables using SteadyStateInitial:

Image

@casella let me know if there is anything else you wanted.

@casella
Copy link
Contributor Author

casella commented Feb 25, 2025

Maybe we can just add a small pressure loss to the test case to avoid index problems. I'll take care of that.

casella added a commit to casella/ModelicaStandardLibrary that referenced this issue Feb 25, 2025
… avoid index reduction with the fixed pressure boundary.

Changed to explicit steady state initialization to avoid unspecified initial conditions
Fixes modelica#4424
casella added a commit that referenced this issue Feb 27, 2025
Added small pressure losses to DynamicPipeEnergyConservationCheck2 to avoid index reduction with the fixed pressure boundary.
Changed to FixedInitial initialization to avoid unspecified initial conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: ModelicaTest Issue addresses ModelicaTest, ModelicaTestConversion4 or ModelicaTestOverdetermined P: high High priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants