# Simscape two-phase fluid in closed accumulator looses pressure

5 views (last 30 days)
Patrick on 1 Jun 2023
Commented: Yifeng Tang on 16 Jun 2023
Dear community,
I used a Receiver Accumulator (2P) and closed all ports with caps and a perfect insulator in a simple simscape model. Just the BV port was left open and conected with a Controlled Mass Flow Rate Source (2P) to a reservoir. The massflow was set to zero, so there should not be any fluid going out or into the accumulator. The accumulator is charged with liquid water.
During the simulation, the mass stays constant in the accumulator, what is reasonable. Also the mass flow at the mass flow rate source stays zero as it should be. However, the pressure is rising and then immediatly drops as you can see below:
Do you have any idea, where it comes from? Is it a solver unstability? Is there a solution to gain more stability?
Thank you very much,
Patrick
Yifeng Tang on 8 Jun 2023
This looks strange and ... interesting. If you could share a model, I can look into this and see if there is a plausible explanation to this.
Patrick on 9 Jun 2023
Edited: Patrick on 9 Jun 2023
Of course, here is the model attached. Thank you!

Yifeng Tang on 9 Jun 2023
Hi Patrick,
I believe what you are seeing is the result of the "upwind energy scheme" implemented at all ports of thermo-fluids domains (Gas, MA, TL, 2P). It's documented here: https://www.mathworks.com/help/hydro/ug/simscape-fluids-numerical-scheme.html
In your case, while the mass flow rate source block makes the mass flow zero, it will not enforce zero energy flow. Since the internal energy on the two sides are different, due to pressure difference, there can be some small energy flowing through (think of it as conduction). If you look at Phi_BV in the result explorer, you'll see it's small but not zero, unlike Phi_AV,AL,BL. The amount of the energy flow depends on the difference in internal energy on both sides, and how big the port sizes are. The side with bigger port size will dominate in "conduct" or "diffuse" its property to the other end. Usually this effect is not obvious as the energy content carried by some flow will be orders of magnitude greater, but since you have zero flow, you may see a bit of that.
A few things to try to see this effect in play:
1. make the outlet reservoir pressure the same as the accumulator, so delta_h is the same. Phi will be zero. Or,
2. comment out the source and reservoir. No mass flow or energy flow, no state change. Or,
3. Use an inifite flow resistence block in place of the source. This block enforce zero mass flow and zero energy flow. Or,
4. make the outlet reservoir port size a lot smaller, say 1e-9. You may still see a small gradual change in the states (e.g. pressure), but the amount is going to be way smaller.
That said, I don't yet understand why the small energy loss through the port is leading to the pressure change in this fashion. I suspect that this has to do with the fact that the whole volume is filled with liquid water, and the volume is fixed. So any internal energy change will force the solver to find a point where rho remains the same for the given internal energy, and where that point is on the property table, well, I don't know, but it's unlikely to stay at the same location. I attached a simple test: a constant volume in TL domain, using the H port to take out a tiny amount of heat. The pressure will change quite a lot.
Hope this helps. If you find out why exactly the pressure changes in this fashion, please share your insights as well.
Thanks!
Patrick on 16 Jun 2023
Thank you for that detailed explanation and the example model. Unfortunately, the solutions doesn't fit for me as I would like to have the opportunity to pump fluid inside or outside of the accumulator. I hoped there would be a possibility to reduce the error significantly by changing the solver settings etc.
Best regards
Patrick
Yifeng Tang on 16 Jun 2023
If you feel comfortable with customizing the blocks with Simscape language, you can add an "if ... else ..." or modechart into the source block, so when the flow is zero, it effectively applies the equations from the infinite flow resistance.
If I can think of any other quick fix, I'll let you know.

### Categories

Find more on Tanks and Accumulators in Help Center and File Exchange

R2023a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!