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.