ModelicaStandardLibrary icon indicating copy to clipboard operation
ModelicaStandardLibrary copied to clipboard

Fixed Wb_flows discretization terms for DynamicPipe

Open mestinso opened this issue 2 years ago • 3 comments

  • Fixes made for all structure cases: av_b, a_vb, a_v_b, and av_vb
  • The updated discretization terms give more accurate derivatives associated with the volumes
  • Energy is now properly conserved (previously av_b, a_vb, and a_v_b had conservation errors)

mestinso avatar Mar 06 '22 02:03 mestinso

@mestinso Thank you for you valuable effort!

What I'd like to have are test models (covering all the branches) where the current imlementation raises an assert, but with your fix results in succeeding models. This way we can easily see what the expected purpose of the changes are. Thanks again.

beutlich avatar Mar 15 '22 20:03 beutlich

@mestinso Thank you for you valuable effort!

What I'd like to have are test models (covering all the branches) where the current imlementation raises an assert, but with your fix results in succeeding models. This way we can easily see what the expected purpose of the changes are. Thanks again.

@beutlich Sure. Do you suggest I add these test models into ModelicaTest as part of this PR?

mestinso avatar Mar 16 '22 02:03 mestinso

Do you suggest I add these test models into ModelicaTest as part of this PR?

Exactly.

beutlich avatar Mar 16 '22 09:03 beutlich

@mestinso did you ever get around to adding those tests to ModelicaTest?

bilderbuchi avatar Dec 12 '22 12:12 bilderbuchi

@mestinso did you ever get around to adding those tests to ModelicaTest?

@bilderbuchi Unfortunately no, but thanks for the prompt here. I expect to get a little time here in the coming weeks, so, hopefully, I'll push an update soon.

mestinso avatar Dec 14 '22 22:12 mestinso

@mestinso Did you got time to add the test to Modelica Test?

TManikantan avatar Feb 24 '23 09:02 TManikantan

@bilderbuchi @TManikantan @hubertus65 @beutlich Two new tester models have been added. The first tester checks for energy conservation for water flow without the kinetic energy term and the second tester checks for energy conservation for airflow with the kinetic energy term. Note that for the previous version of the DynamicPipe model, 6/12 asserts passed in the first tester and 1/4 asserts passed in the second tester.

mestinso avatar Feb 25 '23 00:02 mestinso

Nice work! It's kinda surprising that in DynamicPipeEnergyConservationCheck.mo you don't need an epsilon on the isEqual -- do you think that could be fragile w.r.t. floating-point comparison issues?

bilderbuchi avatar Feb 27 '23 11:02 bilderbuchi

@bilderbuchi @hubertus65 I went ahead and adjusted those tolerances as recommended.

mestinso avatar Mar 07 '23 21:03 mestinso

@casella @rfranke a reminder would you please review this fix?

TManikantan avatar Mar 15 '23 05:03 TManikantan

Had email with Francesco, and he will review

MartinOtter avatar Mar 28 '23 15:03 MartinOtter