Simulation of two phase fluid with Simscape - pressure behavior unexplicable

I simulate the attached system, using the two phase fluid and the self crated properties block with the properties of hydrogen. The tank has 7 bar, the reservoir has 2 bar. Imidiatelly after starting simulation, the pressure in the tank drops down to the level of the reservoir (2 bar). That makes logical for me so sence. When I have a pressure tank with a small exit (area: 1e-4 m²) the pressure in the tank should go down slowly. The level is also plottet, where one can see that even the tank goes empty slowly.
So waht could be my mistake here?

3 Comments

I don't quite understand your question.
By "small exit", did you mean the port area of the BL port?
Were you expecting the pressure to go down more slowly?
Right now, it looks like you have a full tank of liquid hydrogen, discharging into some reservoir at a lower pressure. Is that what you are trying to simulate? It's hard to tell without the actual model.
Thanks for answering. I'm sorry for the difficulties. I added some annotation in the screenshot to claify. But all in all you understood the thing I'm trying to simulate right and also your understanding of my system is right. I drawed a circle arround the pressure drop in one of the plots. This is the drop I mean and I'm wondering about. At AV I measure directly the pressure in the tank. The tank has 50l. All ports and even the pipe have a area in the range of 1e-4 m².
Hi Marcel, it seems like you are experiencing a rapid drop in pressure in the tank to match the reservoir pressure immediately after starting the simulation. This abrupt pressure equalization may be unexpected, especially when considering the small exit area of the tank. One potential explanation for this behavior could be related to the properties and behavior of the two-phase fluid you are using in the simulation. If the fluid properties or phase change characteristics are not accurately represented, it could lead to unrealistic pressure dynamics. Additionally, the modeling of the exit area and flow characteristics plays a crucial role in determining the rate at which pressure decreases in the tank. A small exit area, as you mentioned, should indeed result in a slower pressure drop compared to a larger exit area. However, if there are errors in how the flow is modeled or if there are issues with boundary conditions, it could lead to unexpected results. To troubleshoot this issue, you may want to carefully review and validate the properties of the two-phase fluid block, ensure that the exit area and flow calculations are accurately represented, and double-check all boundary conditions and assumptions in your simulation setup. It might also be helpful to compare your results with theoretical calculations or experimental data if available to verify the accuracy of your model.

Sign in to comment.

 Accepted Answer

Hi Marcel,
The port area parameter of the Receiver Accumulator block doesn't affect the pressure drop between inside and outside the volume. In fact, there is NO pressure difference between the pressure inside the receiver and at the port. See here:
  • Flow resistance through the outlets is not modeled. To model pressure losses associated with the outlets, connect a Local Restriction (2P) block or a Flow Resistance (2P) block to the ports of the Receiver-Accumulator (2P) block.
In your case, the pressure drop is solely due to the pipe block and the local restriction block. If you expect a different flow rate or change of pressure, look for different parameters for those two blocks.
That said, the port area of the receiver does play another role. It's used in calculating the local velocity at the port, which is part of the total energy flow. So, keep it at a reasonable value, for example the actual port area :).

14 Comments

Hi, thanks for the answer. As I understood your answer, you explaint, why the blue and orange lines (both presseures) align in the plot. My actual question remains, why drops the pressure in the tank down immeadiately to the pressure level of the environment block? As you mentiond, I used the right blocks to simulate area restriction and flow resistance (more or less pipe). So for my understanding the pressure in the tank should go down slowly. I already tried different values at the local restriction and pipe block, but still the same effect occurs. What could be my mistake?
I suspect it's the parameters, i.e. whether the parameters you've tried for the pipe and flow restriction provide enough flow resistance to slow down the exit of the fluid and drop of pressure.
Also note that the time scale of your plot is huge (1e5 seconds). It's hard to tell how "fast" was the initial drop from this scale.
If you feel comfortable sharing the actual model here, I can help take a look.
I attached the system in Simscape/Simulink and the corresponding Matlab script with the parameters and the hydrogen properties table (the script is an more extended one and has some more parameters, as needed).
If you want to please try arround...
Hi Yifeng,
After reviewing the code, I came up with the following suggestions that can help you resolve issues for Marcel.
Here are some steps to potentially fix this issue:
1. Pressure Control: Make sure that the pressure control parameters are configured correctly to maintain a gradual decrease in pressure. Adjusting the `p_range`, `r_max`, `r_min`, and `D` values in the pressure control section of your code can help regulate the pressure drop more effectively.
2. Exit Area Adjustment: If a small exit area is causing a rapid pressure drop, consider increasing the exit area to allow for a slower release of hydrogen from the tank. Modifying the `stack_io` parameter or any other relevant parameters related to exit area can help achieve this.
3. Simulation Initialization: Check if the initialization of the simulation is leading to an abrupt change in pressure. Ensure that initial conditions and parameters are set up correctly to avoid sudden drops in tank pressure at the beginning of the simulation. By fine-tuning these aspects of your code, you should be able to address the issue of the tank emptying too quickly after simulation start.
Additionally, monitoring and adjusting other relevant parameters based on simulation results can help optimize the performance of your hydrogen fuel system simulation. Implementing these suggestions can lead to improved accuracy and reliability in your hydrogen fuel system simulation, ultimately enhancing its overall effectiveness.
Good luck!
@Umar the Matlab script was to a more extende model, that's confusing. Now I put all the parameters in the Simulink/Simscape model and you only need to load the hydrogen properties table to get the system run. See attachment.
So your 1st point has no impact here (there parameters are not in the model). The 2nd point I just tried (increase the exit area), but unfortunaley there was no impact to the pressure behaviour. Of course the total volume flow etc. changed. I tried values 1e-2...1e-5 m². Regardng your 3rd point: I adapted initial conditions a bit, but the abrupt pressure drop keeps beeing there.
I changed the are of the local restriction. here area 1e-5 m²:
and here 1e-4 m²:
Yes there is a change, but I zoomed in and the transient behaviour from 7 bar to 2 bar takes below 1 second... the tank has 50l volume. That's for my understanding much to fast, isn't it?
Hi Marcel,
I took a look at the model and the results. I don't see anything obviously wrong with the way you built the model, so the question is whether it's set up to do what you intended. Maybe a few question can help us figure out.
(1) The tank is originally filled with Liquid H2, with zero vapor H2. Is that intended?
(2) At the start of simulation, within 0.1 sec, a small amount of liquid H2 (<0.5% of total mass) left the tank. Because liquid H2 is not very compressible, this leads to a rapid drop in pressure. The drop in pressure then leads to evaporation of tiny amount liquid into vapor (<1e-6 by mass and 1e-5 by volume). Is this intended?
(3) the pipe and orifices are sized with ~1e-4 m^2 cross section area. This feels about right for gaseous H2 delivery (which of course depends on the size/power of your system), but could be too high for liquid H2 transport. Do you have more information on the physical size?
Maybe some overall description of the system you try to model will be helpful for the community to understand your problem better and provide further suggestions.
Thank's for the answer.
The system I try to simulate is bigger. It is a system that stores liquid hydrogen, evaporises it and provides a fuel cell with this vaporised hydroden. But, due to some dufficulties and for better understanding when one takes a first look to the system I broke it down to this simplified system.
Regarding (1): About the initial fillevel I don't know. I know the initial temperature (-253 degC) and pressure (5 to 8 bar). With these Condition the tank is 100% liquid.
Regarding (2): Could you please explain more in detail what happens and how do I see this effect in my system?
Regarding (3): The fuel cell has a nominal power of 30kW. I simulated the fuel cell with the PEM fuel cell given by matlab example and got a needed volume flow of approx 3 l/s (@ 30kW). So the area should be big enought to provide the fuel cell with this flow, without ventilation. The actually needed area I hoped to simulate with this system here.
It would even help to get the pressure behave properly, regardless of the actual/exact parameter (like are, initial pressure etc.) just to have a proper start for further building up simulation.
Hi Marcel,
Thanks for the information. They are very helpful.
Some quick feedback:
(1) 20K and 5-8 bar for H2 should be indeed in the liquid phase. The way you have set up the initial conditions in the tank, accordingly to the P-H diagram, looks OK.
(2) I now understand that the reservoir is there to mimic the boundary condition at the stack. 2 bar is typical for stack pressure. Usually there is a pressure reducing valve at the hydrogen source to regulate the outlet pressure and flow. The regulated flow will try to keep the stack pressure stable as H2 is consumed. I'll follow up later on what can be a better way to model this. Missing such a valve basically makes the gas path "open" and you'll get way too much flow and in wrong phase (liquid, instead of gas).
(3) 30kW is useful in estimating a steady-state H2 flow or consumption rate. However, I'd rather use a mass flow to describe the H2 flow, because volumetric flow depends on the phase, pressure, temperature, etc. Mass flow can be estimated by the energy contained per mass of hydrogen, i.e. the low heating value of H2.
LHV_H2 = 119.96; % kJ/g, H2 low heating value
Power = 30; % kW, expected power
eta_FC = 0.45; % 1, nominal fuel cell efficiency
mdot_H2 = Power / LHV_H2 / eta_FC % g/s, expected H2 mass flow
mdot_H2 = 0.5557
This rough estimate gives me ~0.55 g/s H2 flow, which feels quite reasonable.
I'll follow up later on (2).
It seems to go in the right direction.
Your right, a pressure controlling valve is of course needed. I attach now the Simscape tank-system again, but with a commented out pressure control and a script with the nessesary parameter (same as in one of the first uploads from myself; so only the very last parameters are from interst).
The reason I did not go along with this pressure control untill now, is just due to the fact, that there is no need to control the pressure if it drops down right after flowing out of the tank (7 bar) to 2 bar. You know what I mean? I would like to regulate the pressure to 2.25 bar (so slightly more then in the environment (fuel cell)), but if the pressue is already 2 bar, there is no need to control, since the pressure can only be reduced by such pressure control. There we are again at the fundamental problem of the pressure drop.
Hi Marcel,
I'd like to share with you the steps I took and the (simple) models I built to understand and analyze your problem.
In "LiqH2States.slx", I focus on the thermodynamic process of the hydrogen inside and out of the tank. As H2 is passed through a valve for its pressure to be reduced, the process closely resembles a "isenthalpic process", i.e. no work done to the fluid and specific enthalpy will not change. What I observed from the P-H diagram:
  1. If the initial enthalpy is low, even if the pressure is reduced from 7 bar to 2 bar, the H2 will remain liquid. This can be observed by drawing a straight line down from the initial state to 2 bar and see whether it crosses the phase line. If the initial enthalpy is less than that of the saturation liquid at 2 bar, the H2 in tank will remain liquid all the time, and as liquid density doesn't change much with pressure, the pressure in the tank will drop very quickly once some H2 is removed from the tank.
  2. Below you can see what I mean by whether the isenthalpic process will let the state crosses the phase line: (left) initial enthalpy lowvat -15kJ/kg and (right) initial enthalpy "reasonable" at 50 kJ/kg
In LiqH2Tank.slx, I played with different initial specific enthalpy values inside the H2 tank, while using a mass flow source or a carefully parametrized flow resistance to let H2 out of the tank. The idea here is to observe the change inside the tank as H2 flows out. What you'll see is that (1) H2 in tank will quick drop its pressure to get to the phase line; (2) pressure will then start to stablize and gradually decrease as H2 flows out; (3) H2 state will "slide" along the phase line towards lower pressure; (4) at certain point, when the pressure is low enough, a sudden change in enthalpy will occur, likely due to the depletion of liquid H2.
The magnitude of the initial pressure drop has to do with the initial enthalpy, i.e. how close the initial state is to the phase line. If the initial state is saturated liquid or mixture, very minimum pressure drop will occur. This is because vapor has to form inside the tank to stablize the pressure.
In LiqH2TankSupply.slx, given what I learned from the two models above, I added in a pressure reducing valve from Simscape Fluids, a pipe with temperature boundary to mimic the evaporator, and a pressure boundary (reservoir). I also added a mass flow rate source between the evaporator and the reservoir to mimic the H2 consumption in the fuel cell stack, which is the whole reason why we need to stablize the outlet pressure by providing right amount of H2.
The pressure reducing valve was able to control the pressure inside the evaporator by regulating the flow. The outlet state from the valve is at low pressure in mixture state, as expected. The evaporator then vaporizes the mixture. Seems reasonable to me, at least on the system level.
Hope this aligns with what you are trying to model.
Biggest lesson learned: initial conditions are important.
Happy modeling.
Wow, that was a very detailed response! Thanks for that.
I had a look at the three models. As you wrote, the initial conditions were the most important parameter. So you set the initial specific enthalpy to 115 kJ/kg. With this initial condition the temperature in the tank is about 30 K at the beginning.
In all sources I read about storing liquid H2 at a pressure of 5 to 8 bar and 20 K temperature. To get 20 K as starting temperature in your model, I need to set the initial specific enthalpy to approx 0 kJ/kg. I understood from your first system, the the pressure drop in the fully liquid region will occour very fast, but that would mean, that in every liquid H2 tank (with the mentioned conditions regarding the sources I found) a rapid pressure drop to the outlet pressure happends. To be honest its a bit hard for me to refer that to "real" LH2 systems. I just attached a screenshot from your LiqH2Tank system where I set the initial specific enthalpy to 0 kJ/kg. Here again the same behaviour of the pressure drop occurs...
So conclude this thread; even it looks strange to me, you would agree that this is the way it is and I need to change the way I was thinking about this behavior before.
If it looks strange, it's probably because we haven't included something that's important :)
That initial pressure drop is the right behavior for the system represented by the model, BUT does the model represents the most important effects in the real system?
What I don't know, due to my lack of knowledge on the liquid hydrogen systems, is that how the system/tank "natually" maintains its pressure. It's usually VERY hard to complete fill a tank with liquid, with no volume for gas at all. How does that part of the gas/vapor interact with the liquid? They must exist at the same pressure as the liquid, but does the vapor part have to have the temperature, like in a saturated mixture? How should the heat transfer between the liquid and vapor be handled? The information you provided and some pictures I saw on goolge search (e.g. a half-filled tank with Liq. H2 at -253 degC) seem to suggest that the vapor part can have a higher temperature because otherwise it wouldn't be in vapor phase that high pressure.
I have some idea on how to separately model the initial state of the vapor and the liquid in the tank, so they don't have to be both at saturation when pressure drops. Let me give it a try first can get back to you.
Hi Marcel,
Do you have access to R2024b pre-release? The Receiver block in this newest release has a feature that allow you to set the initial liquid and vapor state seperately. See below.
This way you'll be able to keep the liquid hydrogen at 20K while the vapor can be at a higher temperature so it can stay in vapor phase at higher pressure (say 7 bar).
Also, if you have access to R2024b, you can check out this example on liquid hydrogen storage and transportation.
Fortunaltelly I have access to the pre-release version. So I tried the option to have different temperatures for the vapor and liquid phase, respectively.
Furthermore I extednded the system a little bit. So I added an evaporator and a pipe, with proper heat transfer, to model some not perfectly isolated pipes in the system. I dont't want to hide this system from the community, so I attached it here (the additional script is only for some variable, don't care about this to much, just run it in advance).
Unfortunatelly, there is still 'this drop', as one can see in the picture below. Even if it is not as fast, as bevore. I used following Initial temperatures for this simulation: 20K liquid and 30K vapor.
The first plot shows the fill level. It starts, as desired at about 90%.
The second plot shows the pressure, before (blue) and after (orange) the pressure controlling valve. There, one can observe, that the pressure drops down from 7 bar to 1 bar in less than 1000s, but the tank is still over 80% full of liqid. Yes, liquid is not compressible (drop on left side of boiling line), but to modell properly, therefore there are roughtly 10% vapor at the beginning. Even when I decrease the initial fill level to 70% liquid, this drop occurs in more or less the same time. Additionally, after a while the pressure goes bellow 1 bar, so the flow rate source produces a slight vaccum, but still the tank is full of liquid? Sounds wrong... I tried to increase the areas of the ports and the valve a bit, but that has no influence to this behavior. I tired arround with the initial temperature of the vapor (in range 30K...60K), but again no big influence.

Sign in to comment.

More Answers (1)

Hi Marcel,
To answer your question, yes, you are right about transition occurring in less than 1 second indicating a rapid response time. Such rapid changes can impact the overall system dynamics and may lead to issues such as pressure spikes or flow fluctuations.
In my opinion, it may be beneficial to analyze the system parameters, such as the flow rate, pressure drop across the restriction, and the material properties of the fluid. By adjusting these factors or introducing additional control measures, it may be possible to optimize the system's response time and ensure smoother operation.
Hope this helps you resolve your issue.

Categories

Find more on Fluid Network Interfaces Library in Help Center and File Exchange

Products

Release

R2024a

Community Treasure Hunt

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

Start Hunting!