I've tried to simplify the problem, hopefully retaining its essence, and do an analysis, but I ran into some difficulties. Maybe someone can tell me how to proceed.
If I have a closed cylinder as in the sketch but only 1 piston between gas A and gas B, so no vacuum, then I don't need to think about collisions between pistons.
Initially I have the following situation:
Gas A occupies 1/3 of the cylinder on the left, gas B occupies 2/3 on the right and they are separated by a piston. The number of moles (n) is the same for both and remains constant.
For the starting values of volume, pressure and temperature we have:
VB = 2 VA
PA = 2 PB
TA = TB = T
There is no heat transfer between a gas and anything else (piston, cylinder or the other gas).
The piston is extremely heavy so that expansion and compression will be quasi-static.
If I release the piston gas A will expand very slowly and gas B will be compressed. The sum of volumes is constant.
This process should stop when the pressures of gas A and B are the same.
Gas A will have cooled off and gas B will have heated up.
Here's my problem:
If I treat the expansion of A and the compression of B as reversible adiabatic, then the whole process will be reversible since nothing happens in the surroundings.
(I checked that analytically, just to be sure, and if I use expressions for reversible adiabatic processes ( P Vγ = constant, for example), I get ΔS = 0 for both gases (with some rounding errors).
However, by just looking at it, I would swear the process must be irreversible.
How would you calculate the final temperatures and volumes of the gases and the entropy-changes?