Does a vacuum, suddenly opened, become hotter than its surroundings? Suppose you have an insulated container that is equipped with a valve to let air in. Initially the container is evacuated. You then quickly open the valve, allowing air to rush in. What is the temperature of the air inside the container after the internal pressure has equalized?
This is a homework problem I was assigned a while back, but I still can't wrap my mind around the solution that was given. The solution runs as follows:

The pressure and temperature of the atmosphere are taken to be $p_0$ and $T_0$, and the volume of the container is taken to be $V$.  The work done by the atmosphere in expanding into the container is then $W = p_0 V$.  The change in energy of the container equals this work, so that $$\Delta U = n C_V \Delta T = p_0 V.$$  Hence the change in temperature can be written as $$T_f - T_0 = \frac{1}{C_V} \left( \frac{p_0 V}{n} \right) = \frac{R T_0}{C_V}.$$  It follows that $$T_f = T_0 \left( 1 + \frac{R}{C_V} \right) = \gamma T_0.$$  Evidently the temperature of the air inside the container ends up being hotter than the air outside.

This conclusion defies my intuition that if you wait until the pressures have equalized, then the temperatures will also be equal.  After all, it seems that the argument would run the same if instead of turning a valve we just removed one whole wall of the container.  In this case it seems ridiculous to imagine the air inside being hotter.
So: Is the solution above correct?  If so, why are the particles in the container hotter? 
 A: This is a great question. Actually, the temperature of the gas in the cylinder will increase. This isn't equivalent to a Joule expansion, because the cylinder is specified to be "insulated." I will assume that this means that there is no thermal contact between the surrouding atmosphere and the inside of the cylinder. In the case of Joule expansion, we have two chambers, one which starts with a gas inside (chamber A) and one which is initally a vacuum (chamber B). The two chambers are in good thermal contact with each other. Upon opening a valve between the two chambers, the gas from A will freely expand into B. It's internal energy and temperature will remain constant. However, what we are dealing with here is a fundamentally different situation. In the case of Joule expansion, we can treat the two chambers as one system because of the good thermal contact between them. We are just increasing the volume of the system when we open the boundary between A and B. Additionally, the gas must be sufficiently dilute to avoid non-idealities from fluidic expansion. In this case, as the cylinder is thermally isolated from its surroundings, we must treat it as an isolated system. Additionally, the gas is not dilute. This is where the difference arises.
$$ $$
I will treat the problem in what I hope is a slightly clearer way than the solution, which I think obscures what is actually occurring here. First of all, the atmosphere does not do any work on the container - the container's volume does not change. Also, since the container is insulated, no heat is exchanged. Thus, the container itself does not experience a change in energy, as stated in the solution. So, what's actually happening here? The key is that we have to be clear about what our system actually is. Our system does not consist of a constant mass of gas. It begins with zero mass (Pi = 0, Vi = 0) and ends with a mass of gas that equalizes the pressures between the container and the outside (Pf = 1 atm, Vf = V). We are in fact adding gas to our system, and this gas has some internal energy U. Assume that all gases are ideal, constant heat capacity, and that the initial vacuum is perfect. The initial energy of the system is zero. The final energy of the system will be equal to the internal energy of the added gas plus the work done by the gas on the system. The internal energy is simply given by $$U = CT_{o}$$ It's the work done by the gas on the system that is tricky. You can think of it this way: as the volume of gas flows into the cylinder through the valve, the surrounding atmosphere actually does work ("flow work") on the gas. This adds energy to the system. This work process is actually a non-ideality (our only non-ideality) - in the case of free expansion of a gas, remember, we also have the criterion that the gas be sufficiently dilute. In this case, we have a fluidic process on our hands. The work done is then of course equal to $$W = p_{0}V$$ So, the final energy of our system is given by $$E_{f} = U + W = CT_{o} + p_{0}V$$ For an ideal gas, we have also have $$E_{f} = CT_{f}$$ and thus:
$$C(T_{f} - T_{0}) = p_{0}V$$ From there, the rest of the solution is the same (I have ignored the number of molecules - you can use molar heat capacities if you want). By the way, you can observe this effect in the real world, filling a tank of helium for example, or even filling scuba tanks, as both of these containers have good thermal insulation. So, intuitively, the temperature of the gas rises because it does not freely expand into the container. Work is done on the entering gas and thus the temperature rises. See the links below for some more information:
$$ $$
Flow work
$$ $$
Unsteady flow process
