I am trying to understand why the pressure for adiabatic process is given for an ideal gas as the following.
$$ p = - \frac{\partial E}{\partial V} (V, X_1, ..., X_k) $$
where $p$ is pressure, $E$ is the total internal energy of the gas and $V$ is volume, and $X_i$ are some parameters on which $E$ could depend as well.
To model this I choose a two-dimensional problem in which I consider box of $N$ particles of ideal gas initially in box of size $a$ times $L$. I assume that due to effective potential these $N$ particles are being confined inside this box (potential could be, for example, $0$ inside the box and modeled by some parabolic potential where I let coefficient of the potential tend to infinity). I also assume that one of the walls of the box is replaced by a piston which is a macroscopic object consisting of $M$ constituents.
My Hamiltonian for the system then is chosen to be the following. Let $p = (p_1, ..., p_N)$ be $p \in \mathbb{R}^{3N}$ momentum vector of gas molecules, $P = (P_1, ..., P_M)$ be $P \in \mathbb{R}^{3M}$ momentum vector of constituents of the piston. Let $q, Q$ be respective coordinate vectors for gas and piston.
$$ H_{total} = H_{gas} (q,p) + H_{piston}(Q,P) + H_{interaction}(q,p,Q,P) $$
In this case, I think the model is being adiabatic because I am neglecting all of the possible influences with other objects except the one that is supposed to transmit work.
Force on the piston $F_{piston}$ is then given by the following:
$$ F_{piston} = \frac{d}{dt} (\sum \limits_{i=1}^M P_i) = -\sum \limits_{i=1}^M \frac{\partial H_{total}(q,p,Q,P)}{\partial Q_i} = $$ $$= -\sum \limits_{i=1}^M \frac{\partial H_{piston}(Q,P)}{\partial Q_i} -\sum \limits_{i=1}^M \frac{\partial H_{interaction}(q,p,Q,P)}{\partial Q_i}$$
Now, if we assume that internal potential between constituents of the piston is of the form $U(|Q_i - Q_j|)$ then I think you can show the following.
$$ \sum \limits_{i=1}^M \frac{\partial H_{piston}(Q,P)}{\partial Q_i} = 0 $$
In that case we have that the force on the piston is the following.
$$F_{piston} = -\sum \limits_{i=1}^M \frac{\partial H_{interaction}(q,p,Q,P)}{\partial Q_i}$$
I guess to make force sufficiently nice behaving we have to average interaction terms over some time which is smaller in scale than the macroscopic dynamics of the piston but larger than the time scale in which force due to gas particles seems not sufficiently constant. In that case if by $\langle, \rangle$ one denotes averaging in time, we have the following.
$$F_{piston} = - \langle \sum \limits_{i=1}^M \frac{\partial H_{interaction}(q,p,Q,P)}{\partial Q_i} \rangle$$
In thermodynamics, as mentioned previously, as far as I can understand the definition of pressure in my variables is something like this and it relates to the previous calculation in the following way.
$$ p = -\frac{\partial H_{gas}}{\partial V} = \frac{1}{L} \left( - \langle \sum \limits_{i=1}^M \frac{\partial H_{interaction}(q,p,Q,P)}{\partial Q_i} \rangle \right) $$
First of all, I do not understand how to interpret the fact that $H_{gas}$ is a function of volume when in microscopic picture it is not. Also, I do not understand under what kind of arguments the two things mentioned previously for the pressure agree. Should I make more modeling in a sense to assume some form for $H_{interaction}$ ?
I think one could assume that phenomenologically averaged interaction depends on the volume in a sense that the following formula holds.
$$ - \langle \sum \limits_{i=1}^M \frac{\partial H_{interaction}(q,p,Q,P)}{\partial Q_i} \rangle \approx f(V) $$
But even if we assume this effective theory it is still not clear to me how one concludes or approximates that the pressure is related to change of internal energy of gas molecules. In a sense, I do not understand the following equation.
$$ p = -\frac{\partial H_{gas}}{\partial V} = \frac{1}{L} f(V)$$
Please let me know what do you think about this and I would very much appreciate that!