modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
452 stars 165 forks source link

Pressure drop in Modelica.Fluid.Pipes.DynamicPipe when dynamic momentum balance is taken into account #3569

Open KarinHH opened 4 years ago

KarinHH commented 4 years ago

I have a problem in understanding the simulation results of a discretized Modelica.Fluid.Pipes.DynamicPipe when using a compressible gas as medium and taking the dynamic momentum balance into account. To illustrate that I built up a very simple model: pressure source + pipe + pressure sink. The pressure in the pressure source is linearly increased over time. The parameterization of the pipe mainly corresponds to the default values, but the parameter "momentumDynamics" is set to "Modelica.Fluid.Types.Dynamics.FixedInitial".

For lower gas velocities (=smaller inlet pressures) the pressure drop is somehow nearly linear distributed over the discrete elements of the pipe (of course the pressure drop is not the same in every element due to the change in medium properties). As the gas velocity gets higher however, the pressure drop in the last flow model (= resistive element) is dominating by far. The picture below showes the pressures in the different flow models along the pipe. The pressure in the last flow model (green dashed line) corresponds to the constant pressure in the pressure sink. Pressures

Actually when looking at the pressure distribution along the pipe it looks as if the pipe was choking. This is however not possible since the velocities are still far below the velocity of sound. The velocity in the last flow model is a lot higher than in the rest of the pipe, because the pressure is a lot lower, since it corresponds to atmospheric pressure. This picture below shows the velocity in the flow models in the pipes as well as the velocities of sound. The velocities of sound are nearly constant at ~330 m/s. Velocities

What I do not understand: Does the simulation result represents the physics correctly? If no, where is the "error" in the equations? If yes, what is the the physical behavior which the model represents here?

What I've tried:

I've posted the same issue on stackoverflow, where I've got the hint to better try to file the issue directly at this place.

I've added the model as save-total. SimplePipe_pressureSourceTotal.zip

hubertus65 commented 4 years ago

First one comment: I think the pressure loss due to acceleration and the dynamic momentum balance should be separated. The pressure loss matters even for pure steady-state and gets significant in two-phase flows. But it arguably does not make sense to only use dynamic momentum balance and not the acceleration loss.

wischhusen commented 3 years ago

Well, I believe it is an discretization error affecting the momentum balance. I can not explain in detial. But some lines seem strange to me. I thought that somehow the flow models are not staggered except the last one when looking at Wb_flows[n+1] for that case.

Nevertheless, when trying all discretization options one finds that at least modelStructure = av_vb will fail because the arrays of flowModel.m_flows and v_pipe1 do not match. I think some further analysis is required here.