Consider the system as shown in the picture. It consists of two chambers filled with a gas and connected with a tube. One chamber is closed with a piston. Everything is thermally insulated.

enter image description here

We make two assumptions:

  • The total amount of gas is constant;
  • The connecting tube is such that the pressure in both chambers gets equilibrated.

The initial state is such that the pressures are equal, i.e., $p_1=p_2$ and the temperatures are different: $T_1\neq T_2$.

Let the piston move s.t. the volume in the second chamber changes by $\delta V$. So, we have (here the prime $'$ denotes the state after the transition)

$$V_1'=V_1,\, V_2'=V_2+\delta V,\, N_1'=N_1+\delta N,\, N_2'=N_2-\delta N,$$ and $\delta N$ is determined from the condition $p_1=p_2=p$.

So, my question is

How to describe the change in entropy: $S_1'=?, S_2'=?$

Let $S_1'=S_1+\delta S_1, S_2'=S_2+\delta S_2$. We can compute the change in total energy: $$(U_1'+U_2')-(U_1+U_2)=T_1\delta S_1 +\mu_1\delta N + T_2\delta S_2 -p\delta V -\mu_2\delta N,$$ which is equal to work done on the system, $\Delta W=-p\delta V$. So, we conclude that it must hold that $$0=T_1\delta S_1 +\mu_1\delta N + T_2\delta S_2 -\mu_2\delta N.$$ The terms $\delta S_1$ and $\delta S_2$ should satisfy this equality. However, I'm still not clear what would be the exact form of these terms. I tried several options, but couldn't convince myself.

Any help on this problem will be very much appreciated.

EDIT1: First let me note that this is a simplified version of a more complex system, so it might look somehow artificial at first sight. Let me know if something is missing. I'll try to refine my assumptions to make the problem more tractable.

So, we assume that

  • the time interval is finite, i.e., we do not consider any slow processes like, e.g., heat transfer through the tube.
  • the piston moves sufficiently slowly$^*$ so that pressure equilibrates immediately.
  • the section of the tube is sufficiently small so that we can neglect the heat transfer through the tube.
  • the only heat transfer source is due to the mass transfer associated with the move of piston.
  • the transferred amount of gas mixes ideally with the contents of the chamber thus resulting in some entropy production.

$^*$ according to Callen it should be at most 0.1 of sound speed.

  • 2
    $\begingroup$ Are the temperatures allowed to equilibrate before you start moving the piston? Is the piston moved slowly? Are the pressures in the two chambers essentially equal at all times? $\endgroup$ Commented Mar 2, 2018 at 17:10
  • 2
    $\begingroup$ Can heat be conducted through the tube from one chamber to the other, or is "mass flow" the only method of transferring thermal energy between the chambers? $\endgroup$ Commented Mar 3, 2018 at 1:57
  • $\begingroup$ @Chester-Miller, I edited my question to address your comments. Please let me know if something else is missing. Thanks. $\endgroup$
    – Dmitry
    Commented Mar 3, 2018 at 9:34
  • 1
    $\begingroup$ Is this a problem from Callen? If so, you should give the reference (book+chapter+page and/or number). $\endgroup$
    – valerio
    Commented Mar 3, 2018 at 23:52
  • 1
    $\begingroup$ Related and useful: physics.stackexchange.com/q/677501/226902 $\endgroup$
    – Quillo
    Commented Mar 14, 2023 at 8:32

2 Answers 2


What we are dealing with here is an irreversible process, where some of the gas from chamber 2 at temperature $T_2$ flows through the intervening tube and mixes with the gas already present in chamber 1 at temperature $T_1$. This mixing gives rise to irreversibility present in the process. Accordingly, to establish the entropy change for this irreversible process, we must follow the standard procedure of first employing the first law of thermodynamics to establish the final state of the system, and then determining the entropy difference between the initial and final states. (Without establishing the final state of the system, it is not possible to determine the entropy change)

Were are told that at each stage of this process, the pressures within the two chambers are equal. This enables us to establish relationships for the number of moles in each chamber and for the pressure. Let the total number of moles in the two chambers be N, and let the initial number of moles in each chamber be $N_{10}$ and $N_{20}$. And let then number of moles in the two chamber at any other stage of the process be $N_1$ and $N_2$, such that $$N_1+N_2=N_{10}+N_{20}=N\tag{1}$$The condition of equal pressure in the two chambers requires that $$\frac{N_1T_1}{V_1}=\frac{N_2T_2}{V_2}\tag{2}$$If we combine Eqns. 1 and 2, we obtain: $$N_1=\frac{V_1T_2}{(V_1T_2+V_2T_1)}N\tag{3a}$$and$$N_2=\frac{V_2T_1}{(V_1T_2+V_2T_1)}N\tag{3b}$$ And, for the pressure, we obtain: $$P=\frac{NRT_1T_2}{(V_1T_2+V_2T_1)}\tag{4}$$

Since each of the chambers is an open system, with gas flowing in or out, we must use the open system (control volume) version of the first law of thermodynamics to describe the energy balances. For chambers 1 and 2, these read respectively:

$$d(N_1u_1)=h_2dN_1\tag{5a}$$ $$d(N_2u_2)=h_2dN_2-PdV_2\tag{5b}$$where u and h represent internal energy and enthalpy per mole of gas. The terms $h_2dN_1$ and $h_2dN_2$ in these equations represent enthalpy flow from chamber 2 into chamber 1 and enthalpy flow out of chamber 2, respectively. If we combine Eqns. 3-5, we obtain two equations in two unknowns for the changes in $T_1$ and $T_2$ as functions of the changes in $V_2$.

Let us first work with Eqn. 5b. If we apply the product rule to the left hand side of this equation, we obtain: $$N_2du_2=(h_2-u_2)dN_2-PdV_2\tag{6}$$But, for an ideal gas, we have: $du_2=C_vdT_2$, $h_2-u_2=RT_2$, and $P=N_2RT_2/V_2$; making these substitutions into Eqn. 6 yields: $$N_2C_vdT_2=RT_2dN_2-\frac{N_2RT_2}{V_2}dV_2\tag{7}$$Dividing this equation by $N_2T_2$yields an exact differential: $$d\ln{\left[T_2\left(\frac{V_2}{N_2}\right)^{R/C_v}\right]}=0\tag{8}$$or, combining this with Eqn. 3b yields:$$T_2\left(\frac{V_1T_2+V_2T_1}{T_1}\right)^{R/C_v}=T_{20}\left(\frac{V_1T_{20}+V_{20}T_{10}}{T_{10}}\right)^{R/C_v}\tag{9}$$

Once $V_2$ is specified, the only unknowns in Eqn. 9 are $T_1$ and $T_2$. Another equation relating these unknowns is provided by Eqn. 5a, the first law open system energy balance on chamber 1. Unfortunately, I have not been able to arrive at an analytic integration of this equation the way I have for Eqn. 5b. However, I will report on what I have obtained so far.

If we employ ideal gas relationships to Eqn. 5a similar to those used for Eqn. 5b, we obtain: $$C_vdT_1=[C_v(T_2-T_2)+RT_2]d\ln{N_1}\tag{10a}$$with $$d\ln{N_1}=d\ln{\left(\frac{T_2}{V_1T_2+V_2T_1}\right)}\tag{10b}$$

Maybe someone else can figure out a way of analytically integrating Eqns. 10, subject to Eqns. 9 to obtain $T_1$ and $T_2$ as functions of $V_2$. So far this has eluded me. As noted previously, we need to obtain these functional relationships in order to determine the change in entropy of the system as a unique function of $V_2$. In practice, if I could not carry out the integration of the equations analytically, I would resort to numerical integration.

ADDENDUM I did some additional analysis on this problem and was able to simplify Eqns. 10 by combining them with Eqn. 9 to obtain: $$\frac{dT_1}{dT_2}=\frac{C_v}{R}\frac{T_1}{T_2}\left(\frac{C_p}{C_v}-\frac{T_1}{T_2}\right)\tag{11}$$Note that this equation no longer contains the volumes, and thus describes how $T_1$ must vary in tandem with $T_2$, starting with specified initial values of these parameters, for any arbitrary variation in $V_2$.

GOOD NEWS. (3/5/18)

I've finally been successful in integrating Eqn. 11 analytically to obtain $T_1$ as an explicit function of $T_2$. The result is:

$$T_1=\frac{T_2}{\left[1+\left(\frac{T_{20}}{T_{10}}-1\right)\left(\frac{T_{20}}{T_2}\right)^{C_v/R}\right]}\tag{11a}$$ Note from this that, as would be expected, if $T_{10}=T_{20}$, $T_1=T_2$


The change in entropy for this system is given by: $$\Delta S=(N_1s_1+N_2s_2)-(N_{10}s_{10}+N_{20}s_{20})\tag{12}$$ where the s's are molar entropies:

$$s=C_v\ln{(T/T_{ref})}+R\ln{(v/v_{ref})}\tag{13}$$where $T_{ref}$ and $v_{ref}$ are the temperature and molar volume at some arbitrary reference state; these parameters cancel out of the calculations. The specific volume $v_j$ for chamber j is given by $v_j=V_j/N_j$.


Intuitively, and, based on Eqns. 8 and 9 of the present analysis, we know that the gas remaining in chamber 2 at any time during this process has experienced an adiabatic reversible compression, such that its final entropy per unit mass is equal to its initial entropy per unit mass: $$s_2=s_{20}$$If we substitute this into Eqn. 12, this yields:

$$\Delta S=N_1s_1-N_{10}s_{10}-(N_{20}-N_2)s_{20}\tag{14}$$

Unfortunately, the same kind of simplification can not be made for chamber 1. However, further simplification is possible in the following way: We can substitute the identity $N_1=N_{10}+(N_1-N_{10}$ Into Eqn. 14 to obtain: $$\Delta S=N_{10}(s_1-s_{10})+(N_1-N_{10})s_1-(N_{20}-N_2)s_2\tag{15}$$But, from the material balance, we have, $$(N_1-N_{10})=(N_{20}-N_2)$$Substituting this into equation 15 then yields: $$\Delta S=N_{10}(s_1-s_{10})-(N_{20}-N_2)(s_2-s_1)\tag{16}$$But, since the pressures are equal in chambers 1 and 2, the term $(s_2-s_1)$ is just: $(s_2-s_1)=C_p\ln{(T_2/T_1)}$. Therefore, Eqn. 16 becomes: $$\Delta S=N_{10}(s_1-s_{10})-(N_{20}-N_2)C_p\ln{(T_2/T_1)}\tag{17}$$


  1. Specify a value for $T_2$
  2. Use Eqn. 11 to calculate the corresponding value of $T_1$
  3. Use Eqn. 9 to calculate the corresponding value of $V_2$
  4. Use Eqns. 3 to calculate the values of $N_1$, $N_2$, $N_{10}$, and $N_{20}$
  5. Plug values into Eqn. for entropy change
  • $\begingroup$ Dear @ChesterMiller, this is just great! Thanks a lot! Let me ask a quick follow up question (there could be more later): when going from (6) to (7) you seems to use the Joule law. But it also depends on N, no? Shouldn't it be $du=с_VRTdN+c_VNRdT$? $\endgroup$
    – Dmitry
    Commented Mar 5, 2018 at 14:58
  • $\begingroup$ OK, here comes another question: if I wish to compute the change in entropy for each chamber separately, this would be $S_1-S_{10}=N_1(C_V\ln (T_1/T_{ref})+R\ln(v_1/v_{ref}))-N_{10}(C_V\ln (T_{10}/T_{ref})+R\ln(v_{10}/v_{ref}))$ for the first chamber and the same for the second one. Here, $T_{ref}$ and $v_{ref}$ do not cancel. So, I wonder if it is possible to choose $T_{ref}=T_{10}$ and $v_{ref}=v_{10}$? This would greatly simplify the expressions. $\endgroup$
    – Dmitry
    Commented Mar 5, 2018 at 15:27
  • 1
    $\begingroup$ No. The reference values cancel in the equation for the overall entropy change, not in the equation for each chamber individually. But, see my new comment in my answer regarding chamber 2 (which I am about to write) $\endgroup$ Commented Mar 5, 2018 at 16:02
  • 1
    $\begingroup$ The answer to your first comment question is that u is the internal energy per mole (which depends only on temperature and specific volume). We have already accounted for what you are asking in Eqns. 5a and 5b. $\endgroup$ Commented Mar 5, 2018 at 16:15
  • 1
    $\begingroup$ Thanks for your candidness. A key to being able to solve this problem is having a good understanding of the derivation of the open system version of the 1st law of thermodynamics, and how to apply it. Here are some good references: Fundamentals of Engineering Thermodynamics by Moran et al and Introduction to Chemical Engineering thermodynamics by Smith and Van Ness (and Abbott). I particularly like Moran et al. $\endgroup$ Commented Mar 14, 2018 at 14:21

The total entropy of the two volume $S=S_1+S_2$ . The entropy will not change because it is insulated, $\Delta Q=0$. In the other word, assuming the piston moves really slow, $\Delta S = 0$ or $S_1+S_2 =0$.

We know that volume 1 received gas from volume 2 at different temperature. When it receives gas, its entropy increases. And from the above equation, the entropy of volume 2 will decrease.

I guess I need to use this equation to do the work.

$$dS = \frac{dU}T+\frac PTdV-\frac{\mu}TdN$$

If there is no piston motion, the above equation becomes

$$dS = \frac{dU}T-\frac{\mu}TdN$$

Initially, there is no flow between the two volumes because the pressures equal to each other. Thus, $dN=0$.

The above process has heat transfer through the pipe. Therefore, the internal energy changes. Assuming $T_1>T_2$, then $U_1$ decreases and $U_2$ increases with the same amount. The entropies change accordingly. Because of the temperature difference, the entropy changes are different. (So I was wrong saying that the total entropy is constant. It should be $dQ(-\frac 1 {T_1} + \frac 1 {T_2})$, where dQ is the amount of heat transferred from volume 1 to volume 2.)

Now back to the original question. Let's use the following equation again for volume 1 and volume 2.

$$dS = \frac{dU}T+\frac PTdV-\frac{\mu}TdN$$

For volume 1,

$$dS_1 = \frac{dU_1}{T_1}-\frac{\mu_1}{T_2}dN_1$$

And for volume 2,

$$dS_2 = \frac{dU_2}{T_2}+\frac {P_2}{T_2}dV_2-\frac{\mu_2}{T_2}dN_2$$

So we know that $dN_1=-dN_2$ and $dN_1>0$ because the flow is from volume 2 to volume 1. This will reduce $S1$ and increase $S_2$.

We also know that $dV_2<0$, which will reduce $S_2$.

On the internal energy change, it is complicated and depends on $T_1$ and $T_2$. Using an iterative method and equation of state, we may get final pressure and temperature. But so far, I would say the problem is undetermined.

  • 2
    $\begingroup$ Are you saying that the entropy of an insulated system can't change, even if two parts of the system start out at different temperatures and then thermally equilibrate? $\endgroup$ Commented Mar 2, 2018 at 23:52
  • $\begingroup$ Thanks, good point. For a mixing process, the entropy does change till $dS_{total}/dU_1=0$ and $dS_{total}/dN_1=0$ . I will take another look. $\endgroup$
    – user115350
    Commented Mar 3, 2018 at 0:51
  • 1
    $\begingroup$ Can you at least first solve the problem without the piston moving (assuming that heat can be transferred between the chambers through the tube)? $\endgroup$ Commented Mar 3, 2018 at 1:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.