# Physics of filling a tank with compressed air to a certain pressure setpoint

Let's say we have this situation:

There is a known volume tank, that is empty and its pressure is atmospheric. It has an inlet, that lets in compressed air. The goal is to reach 2 bars of absolute pressure (or ~1 bar over atmospheric pressure) inside the tank, while letting the air in through the inlet. After the pressure is reached, the inlet is then closed. The system is completely airtight.

My question is, how would one calculate the airflow, especially of mass, that is coming through the inlet? Knowing all the variables such as pressure inside the tank, its volume, temperature. Same with the inlet air (temperature, pressure, etc.)

I know there is the Bernoulli equation but the popular examples that show its applications are mostly with emptying the tank, that has fluid in it. I suppose this also has something to do with the ideal gas law, where one could calculate the mass change of the air inside the tank. But I'm also interested in the dynamics that happen while the air fills in the tank.

• You'll probably get more help here if you explain what you've tried and where you got stuck Aug 25 '21 at 17:49
• Do you want it at 2 bars when first filled or after its temperature has cooled to equilibrium with external temperature? Aug 25 '21 at 18:00
• I'm interested in the calculations of the mass airflow. What happens after the goal is reached is not that important for me, just wrote it to better understand the idea. The air would be supplied from an air compressor, regulating the speed with a valve, for example. But throughout the filling, the airflow is constant. My thoughts were calculating the the mass that filled the tank with the ideal gas law, and dividing it by the time it took to fill the tank to two bars. But I wonder if there is something more at play and I'm missing something Aug 25 '21 at 18:51
• @kemdeveloper, If you pump air into the tank, that will make the air get warmer. If you stop when the pressure of the warm air is two bar, then the pressure will slowly drop as the air in the tank cools down to room temperature again. The mass of air needed to achieve a certain pressure depends not only on the volume of the tank, but also, on the temperature of the air when you take the pressure measurement. See en.wikipedia.org/wiki/Ideal_gas_law . Aug 25 '21 at 19:42