Follow up from my previous question,
I am not sure if a partition function for a system should be constant or not. If not, what are examples of constrained systems with partition function that varies with the system's state?
Here is a particular example that came to mind:
Consider a closed rigid container of temperature $T$, the total number of particles $N$ and volume $V$ in contact with a reservoir of temperature $T$. This container is divided into two sections $A$ and $B$, separated by a barrier that does not allow particles to pass through. The volumes of two sections $V_A$ and $V_B$ can vary as long as $V_A+V_B=V$. Section $A$ is filled with ideal gas of one kind and section $B$ is filled with ideal gas of another kind.
The partition function for section $A$ is
$$Z_A=e^{N_A} \left(\frac{V_A}{N_A}\right)^{N_A} \left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 N_A}$$
The partition function for section $B$ is
$$Z_B=e^{N_B} \left(\frac{V_B}{N_B}\right)^{N_B} \left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 N_B}$$
The partition function for the container is
$$Z=Z_AZ_B=e^{N_A+N_B}\left(\frac{V_A}{N_A}\right)^{N_A}\left(\frac{V_B}{N_B}\right)^{N_B}\left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 (N_A+N_B)}=e^{N}\left(\frac{V_A}{N_A}\right)^{N_A}\left(\frac{V_B}{N_B}\right)^{N_B}\left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 N}$$
Since the barrier does not allow particle flow, in order to maintain chemical equilibrium, assume that $N_A+N_B=\frac{N}{2}$,
$$Z=e^{N}V_A^{\frac{N}{2}}V_B^{\frac{N}{2}}\left(\frac{2}{N}\right)^{N}\left(\frac{2\pi m}{h^2 \beta}\right)^{\frac32 N}$$
It seems like the partition function $Z$ varies with values of $V_A$ and $V_B$ and is maximized when $V_A=V_B=\frac{V}{2}$.
Does my example qualify as a constrained system with varying partition function?