Work done by gases on each other in the process of mixing them

I was wondering if gases, which are in the process of mixing, do any work on each other. I haven’t found many resources on this.

We all know that gases, which have a higher pressure than their surroundings, expand. For example, suppose a (approx. massless) piston divides an ideal gas and the ambient $$\pu{1 atm}$$ pressure. If we heat the ideal gas, the pressure rises, and the piston gets displaced so that the ideal gas can re-equilibriate to $$\pu{1 atm}$$ pressure, so outside pressure and inside pressure are the same.

But what is up with the case when two gases at different pressure mix? For example, an ideal gas is in a closed container at $$p_1 (\lt p_2), V_1 (\gt V_2),$$ and $$\pu{273 K}$$. Now this container is connected to a smaller one, inside is a different ideal gas at $$V_2$$, $$p_2$$, and $$\pu{273 K}$$. Now, of course the gases will mix with each other, to maximize entropy by mixing.

But does the higher pressure gas perform work against the lower pressure gas while expanding into the other container, like the first example I gave? Or is it like a free expansion (a.k.a no work done), because ideal gases don't occupy volume by themselves? And how would we calculate the work?

• "to maximize entropy by mixing" sounds like the gases have free-will, desires, and goals. Apr 4, 2022 at 0:34
• In ideal gas context, work is done/absorbed by expansion/compression of regions with different pressure. It is irrelevant if they are filled by different gases or the same gas. Spontaneous mixing of 2 different gases of the same pressure does not do any work, it just increases entropy and decreases Gibbs energy. Apr 4, 2022 at 8:21