System in mechanical but not thermal equilibrium

Let's say there are two systems which can interact by a moving wall but cannot exchange heat. Then the system will be in mechanical, but not necessarily in thermal equilibrium.

The maximality of entropy in mechanical equilibrium requires only the ratio p/T to be equal. So there is a possible equilibrium state where one system has double pressure and double temperature...

Where is my mistake?

• Why would a mechanical system, i.e. one whose dynamics are governed by Newton's laws, obey an entropy maximum principle?
– webb
Mar 27, 2014 at 16:27
• I don't know why but the entropy is maximal in equilibrium. Mar 27, 2014 at 16:38
• webb, it would because the mechanical system is also a thermodynamical system and mechanical equilibrium is necessary condition for thermodynamic equilibrium. Mar 27, 2014 at 19:15
• SImilar question with great answers: physics.stackexchange.com/a/258592/123183. Jul 31 at 16:16

If the systems are allowed to change their volumes, they are allowed to change their internal energies as well. When the wall moves, transfer of energy from one system to another occurs in the form of work. The maximum entropy principle then implies that for equilibrium, both temperature $T$ and the ratio $P/T$ have to be the same for both systems, hence $P$ has to be the same.