# How can I calculate the speed at which a gas flows from one volume to another?

Suppose that there are two rigid Volumes A and B. Each of these contains a gas with know properties (pressure, temperature, number of moles, volume, composition). Suppose also that there is a pipe with a valve that connects the two Volumes.
How can I calculate the speed at which gas goes from one volume to the other. Using the ideal gas laws, I can calculate the final properties of the gases in each volume, but that isn't what I'm looking for.
I'd imagine that the rate of flow is dependent on the difference of pressure in the two volumes or the ratio of pressure; in real life, when a high pressure volume is punctured, gases flow out of it quickly, and when a volume at room temperature is punctured, the gases flow out of it more slowly.

The key to making this calculations is to get the pressure-drop-flow-rate relationship for the piping system between the two tanks. The form of the Bernoulli equation based purely on the Euler equation (alluded to by AtmosphericPrisonEscapade) is inadequate for this purpose because it neglects the typically dominant effects of viscous friction in piping, valves, and fittings. However, a methodology for including this within the general framework of the Bernoulli equation does exist. This approach is discussed in detail in Transport Phenomena by Bird, Stewart, and Lightfoot (as well, of course, in many other books on fluid mechanics). In straight sections of piping, the behavior is captured by the Darcy-Weisbach friction factor correlation (which includes the effects of turbulence and and pipe roughness), and the resistance of valves and fittings is described by equivalent velocity head loss factors.

If the piping is insulated, the change in enthalpy per unit mass of fluid passing through the piping network is equal to zero. In the limit of ideal gas behavior, this means that the flow will be isothermal so that the gas viscosity can be considered constant.

If the gas flow rate through the piping system is low enough (and the tanks are insulated and the mass holdup in the piping is negligible compared to the tanks), the gas expansion in the higher pressure tank can be regarded as adiabatic and reversible. Therefore, for any specified decrease in the mass of gas in the tank, one can determine the temperature and pressure in the tank (both of which will be decreasing as time progresses). Application of the first law of thermodynamics to the overall system of tanks and piping can then be used to get the temperature and pressure in the lower pressure tank as a function of time.

So, this is all a doable problem. But, the calculation isn't simple and will probably need to be done numerically. And, like I said, the starting point for all this is describing the pressure-drop-flow-rate relationship for the piping system.

The ideal gas law is

$$\mathbf{S}T = n\mathbf{R}T = dPV + PdV$$

and you want to know, the flow rate of one volume to another? The rate of change of a volume is found from a derivative

$$\mathbf{S}\dot{T} = n\mathbf{R}\dot{T} = \dot{P}V + P\dot{V}$$

But I feel like you need more information, like heat flow, perhaps a geometric heat flow (Ricci flow). The Ricci flow is the heat equation for a Riemannian manifold. Here is an article on heat flow

https://en.wikipedia.org/wiki/Heat_transfer

and if you are interested to see how that translates into four dimensional space and general relativity, follow my own articles:

https://ricciflow.quora.com/Curvature-Flows

https://ricciflow.quora.com/The-Entropy-of-Heat-Flow

Ah, in my link provided from my blog, I do have an equation which describes the flow in and out of a system which may prove useful:

$$\dot{S}_2 - \dot{S}_1 = \dot{Q}(\frac{1}{T_2} - \frac{1}{T_1}) = \frac{\dot{Q}(T_1 - T_2)}{T_1T_2}$$

It only applies to classical systems though. We can state the mass remains constant (m=1) and so the variation can be found by differentiating the velocity, I get

$$\dot{S}_2 - \dot{S}_1 = 2v\dot{v}(\frac{1}{T_2} - \frac{1}{T_1}) = 2v\frac{\dot{v}(T_1 - T_2)}{T_1T_2}$$

And also take into account we can write

$$\frac{\dot{S}}{2}(\frac{1}{v_2} - \frac{1}{v_1}) = \dot{v}(\frac{1}{T_2} - \frac{1}{T_1}) = \frac{\dot{v}(T_1 - T_2)}{T_1T_2}$$

The ideal gas equation of state that you've mentioned or the equation of heat transfer provided in the other 2(!) self-advertising answers don't help in this case. Heat transfer only talks about.. well the heat of the fluid, not its bulk movement.

For your problem, you need a variant of the Euler equations, which control the acceleration of fluid or gas flow under the action of forces, like pressure gradients.

Those equations might look scary, but fortunately for your problem, there is a beautiful simplification of the Euler equations, into just one equation, which is the Bernoulli equation. You're interested in the part about compressible flows.

If you're only interested in plugging in some numbers, then you're already there. Otherwise if you're interested in further reading, I can answer some questions.