We know that the internal energy for an ideal gas depends only on its temperature.
What confused me was the correct defination of the internal energy for the ideal gas.
Is it:
$dU = nC_vdT$
OR
$U = nC_vT$ . Here the $nC_vT$ term comes from the kinetic energy of the ideal gas which would imply $dU = Cv(dnT+ndT)$ ?
NOTE:
This confusion arised while considering a thought experiment in which there is an insulated container consisting of two chambers A and B as shown in the figure , seperated by an insulated rigid rod with a valve. (You may choose to ignore this thought experiment)
The two chambers consist of air with the initial pressure of air in chamber A being higher than that in chamber B. The valve is opened allowing air in chamber A to move slowly to B. The valve is closed when the pressures in both chambers become equal. I wanted to calculate the final temperature and pressure in each container.
Here is what I did:
Our control mass system is taken as the whole container as shown by dotted lines in the figure.
Since the container is insulated and the displacement work is zero (container is rigid), we get $\Delta U = 0$ for our control mass system for the process.
$\Delta U$ = $\Delta U_a + \Delta U_b = 0$
$\implies U_a,initial +U_b,initial = U_a,final +U_b,final $
We can consider $2$ ways of proceeding:
First:
If we define $U$ as $U=nC_vT$ and proceed which would result in:
$n_{a,init}C_vT_{a,init} +$ $n_{b,init}C_vT_{b,init} =$
$n_{a,final}C_vT_{a,final}+$ $n_{b,final}C_vT_{b,final}$
Second:
If we define $U$ as $dU=nCvdT$, which means we'll take $dU_a = n_aCvdT_a$ and $dU_b = n_bCvdT_b$ and then set $dU_a+dU_b = 0$ and integrate on both sides. Here $n_a$ and $n_b$ are varying with time as the air diffuses through the valve.
So which defination is correct?