Skip to content

[GL#80] Isobaric dynamic mass balance #156

Open

Description

@modelibot

Imported automatically from GitLab.

Original GitLab issue: https://gitlab.pam-retd.fr/thermosysproandco/ThermoSysPro/-/work_items/80
Original GitLab IID: 80
Original author: SIMONINI Giorgio (@giorgio.simonini) (GitHub: @Sonyoyo)

Original creation date: 2024-05-21T19:58:58.596Z
Original update date: 2025-07-28T09:54:50.206Z


In the volumes (and derived components) dynamic_mass_bamancecan be set to:

  • false → BQ=0: inflows equal outflows.
  • true → BQ=V*der(rho) : the inflow/outflow inbalance compensate compression/dilation.

In ThermoSysPro the der(rho) term is generally decomposed in the ddph*der(P) (isenthalpic) and ddhp*der(h) (isobaric) terms.

I'am wondering whether an intermediate choice to take into account only the isobaric term, aka the thermal dilatation, would be a good enhancement for the library. I think this would make sense at least for liquid water for a couple of reasons:

  • Liquid water is generally considered as incompressible (ddph~0).
  • Variations of h travel slowly (transported by the mass flow) compared to Pvariations: it should be easier to solve the isobaric term only than the whole equation.

This could be useful for example to model the thermal dilatation in the primary circuit of a PWR ( @viola.ferrara).

Activity

  1. modelibot commented on Oct 12, 2026

    @modelibot
    Author

    Comment by SIMONINI Giorgio (@giorgio.simonini) (GitHub: @Sonyoyo) on 2024-05-30T13:26:20.786Z:

    We have some discussion today with users of the ThermoPower library (Polimi).
    They have the same decomposition of the density derivative in the two terms; however, ddph is set to zero if the flow is monophasic.
    @viola.ferrara should test something on this issue (e.g. simplified_mass_balance=true) in the next days.

  2. added
    enhancement
    on Oct 12, 2026
  3. modelibot commented on Oct 12, 2026

    @modelibot
    Author

    Comment by VESCOVI Guilherme (@guilherme.vescovi) (GitHub: @guivesc) on 2025-06-26T12:43:01.971Z:

    Test model:

    Pasted_image_20250625102153

    • Volume:
      • dynamic mass balance = true
      • steady state = false
      • $BQ = V \left( \left. \frac{\partial\rho}{\partial P} \right|{h=const} \frac{dP}{dt} + \left. \frac{\partial\rho}{\partial h}\right|{P=const} \frac{dh}{dt} \right)$
      • $BH = V \left[ \left(h \left.\frac{\partial\rho}{\partial P} \right|{h=const} -1 \right) \frac{dP}{dt} + \left(h \left. \frac{\partial\rho}{\partial h}\right|{P=const} +\rho \right)\frac{dh}{dt} \right]$
    • pipe
      • inertia = true
    • tank
      • dynamic = false
      • steady state = false
      • steady state mech = false

    Simulation : Oscilations that may slow down simulation. Oscilations only occur when pipe inertia = true

    Pasted_image_20250626104557

    Modified volume option 1 : $\left.\frac{\partial\rho}{\partial P}\right|_{h=const}=0$

    • Volume:
      • dynamic mass balance = true
        • simple dynamic mass balance = true
      • steady state = false
      • $BQ = V \left. \frac{\partial\rho}{\partial h}\right|_{P=const} \frac{dh}{dt}$
      • $BH = V \left[ \left(-1 \right) \frac{dP}{dt} + \left(h \left. \frac{\partial\rho}{\partial h}\right|_{P=const} +\rho \right)\frac{dh}{dt} \right]$
    • pipe
      • inertia = true
    • tank
      • dynamic = false
      • steady state = false
      • steady state mech = false

    Simulation : Simulation stops very early

    Pasted_image_20250626110016

    Modified volume option 2 : $\frac{dP}{dt}=0$

    Removed initial condition P=P0:

    Pasted_image_20250626112855

    • Volume:
      • dynamic mass balance = true
        • simple dynamic mass balance = true
      • steady state = false
      • $BQ = V \left. \frac{\partial\rho}{\partial h}\right|_{P=const} \frac{dh}{dt}$
      • $BH = V \left(h \left. \frac{\partial\rho}{\partial h}\right|_{P=const} +\rho \right)\frac{dh}{dt}$
    • pipe
      • inertia = true
    • tank
      • dynamic = false
      • steady state = false
      • steady state mech = false

    Simulation : Oscilations disapear for massflow and are reduced for pressure

    Pasted_image_20250626113146

  4. modelibot commented on Oct 12, 2026

    @modelibot
    Author

    Comment by SIMONINI Giorgio (@giorgio.simonini) (GitHub: @Sonyoyo) on 2025-06-26T14:12:28.844Z:

    I tried to make some tests on my side:

    • Oscillations (and many many events) are also (and mainly) presents without inertia (tested with a SingularPressureLoss instead of LumpedStraightPipe).
    • With inertia, I had some wrong setup yesterday, leading to big oscillations, but which were more related to the Pressure difference between the Tank and the Volume. Tying to free the P0 in the volume while imposing the Q=0 allows for far lower oscillations that does not slow down the simulation. So maybe this is not a sufficient test case... I will retry the TANDEM-SMR-NSSS case to see if it work properly...
    • By the way, maybe, too long pipes lead to to strong inertia: potentially a more meshed approach would better describe the real phenomena... 🤔
    • I am not sure of the der(P)=0 approach... maybe we should discuss of it.
  5. modelibot commented on Oct 12, 2026

    @modelibot
    Author

    Comment by VESCOVI Guilherme (@guilherme.vescovi) (GitHub: @guivesc) on 2025-07-10T09:18:25.754Z:

    Test: adding pressure losses to dissipate kinetic energy

    Config:

    • Dymola 2025x refresh 1
    • tandem_edf
    • thermosyspro branch 75

    NSSS:

    • Original model
    • volumes with dynamic_mass_balance = false
    • pipes avec inertia = false
    • RESULT: no mass flow oscillations (stable massflow), but no fluid dilation effect

    NSSS_Dilation: NSSS_Dilation.mo

    • volumes with dynamic_mass_balance = true
    • pipes avec inertia = true
    • RESULT: active fluid dilation, but mass flow oscillations, chaotic massflow at outlet of upper plenum, simulation fails before 10s

    NSSS_Dilation_pdc: NSSS_Dilation_pdc.mo

    • volumes with dynamic_mass_balance = true
    • pipes avec inertia = true
    • addition of pressure losses with k=1 around the upper plenum, to add some dissipation
      image{width=309 height=167}
    • RESULT: active fluid dilation, still oscillations in mass flow, however the outlet of upper plenum becomes stable, simulation does not fail

    MASS FLOW GRAPH IN UPPER PLENUM:

    image{width=446 height=338}

    Adding the pressure losses solves the chaotic flow variations at upper plenum outlet, but it does not solve the more "stable" oscillation of mass flow in the circuit.

  6. modelibot commented on Oct 12, 2026

    @modelibot
    Author

    Comment by SIMONINI Giorgio (@giorgio.simonini) (GitHub: @Sonyoyo) on 2025-07-25T12:52:41.466Z:

    Nice tests, thanks.

    So, the main issue "no dilatation or chaotic flow to pressurizer" is quite resolved with "appropriate pressure losses". However, it still is quite strange that we have such oscillations in the main circuit. It would also be interesting to run longer simulations: the oscillations seem to increase in amplitude, maybe to an asymptote? Will they diverge, stabilize or disappear?

  7. modelibot commented on Oct 12, 2026

    @modelibot
    Author

    Comment by VESCOVI Guilherme (@guilherme.vescovi) (GitHub: @guivesc) on 2025-07-25T13:01:59.114Z:

    For this example, if I am not mistaken, the oscillations are stable, they don't diverge even for long simulation times. They just reamin with their oscillation pattern.

  8. modelibot commented on Oct 12, 2026

    @modelibot
    Author

    Comment by VESCOVI Guilherme (@guilherme.vescovi) (GitHub: @guivesc) on 2025-07-25T13:09:32.115Z:

    I think these oscillations are also related to the difference in h and h_vol : with flow inversions, the condition :

    0 = if (Q > 0) then C1.h - C1.h_vol else C2.h - C2.h_vol;
    

    changes between true and false, which causes the enthalpy to oscillate. If we replace the previous condition by :

    0=C1.h - C1.h_vol
    

    The mass flow converges to a constant value... Maybe this is just a consequence of the problem, but something to think about...

  9. modelibot commented on Oct 12, 2026

    @modelibot
    Author

    Comment by SIMONINI Giorgio (@giorgio.simonini) (GitHub: @Sonyoyo) on 2025-07-28T09:54:50.132Z:

    Ah, I think I read too quickly your previous post: we still have oscillations in the expansion leg and they are probably responsible for the oscillations of mass flow in the whole circuit.

    Concerning your thoughts on h and h_vol, I agree that the enthalpy is indeed quite different between the pressurizer and the loop, so this could be the right direction to go.

    Maybe just trying to mesh the extension leg. Or trying something else also in relationship with #152 (formerly GL#76).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementinit

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions