How to determine if a mixing process is spontaneous at constant temperature but variable pressure This is a conceptual question.
Many times we work with the gibbs energy of mixing under conditions of constant temperature but not pressure.
In a problem like this:


  Suppose that 2.0 mol H2 at 2.0 atm and 25 ∘C and 4.0 mol N2 at 3.0 atm and 25 ∘C are mixed at constant volume. Calculate ΔmixG. 


Is easy to calculate that the Gibbs mixing energy is -9,7 kJ.
But we also know that we cannot use gibbs' spontaneity criterion because it only works on constant pressure and temperature.

Is there any way to determine the entropy of the universe in this case to establish a criterion of spontaneity?
*For example if we know that the total volume is 10L and the division is even.
Volume of H2 = $\frac{nRT}{P}=\frac{(2)R(298)}{2}$

Volume of N2 = $\frac{nRT}{P}=\frac{(4)R(298)}{3}$

Total volume = $\frac{7}{3}(298)R$

Final pressure = $\frac{nRT}{V}=\frac{(6)R(298)}{(\frac{7}{3})R(298)}=\frac{18}{7}\ atm$

Final partial pressure H2 = $\frac{18}{(7)(3)}=\frac{6}{7}\ atm$

Final partial pressure N2 = $\frac{18}{7}\frac{2}{3}=\frac{12}{7}\ atm$

$$\Delta S=-n_{H_2}R\ln{\frac{\frac{6}{7}}{2}}-n_{N_2}R\ln{\frac{\frac{12}{7}}{4}}=-(2)R(-0.8473)-(4)R(-0.8473)=5.08R$$

For ideal gas mixing, $$\Delta H = 0$$

Therefore, $$\Delta G=\Delta H-T\Delta S$$

Another way of doing this is to (a) first allow the divider to float so that the two chambers equilibrate in pressure and then (b) remove the divider and allow the gases to mix.  You calculate $\Delta G$ for each step, and then add them.  In the end, you get the same answer I got.