Let's consider a fully isolated room, no gas or heat flowing from it. We consider gases ($\ce{O2,N2,CO2}$) to follow the ideal gas law, and no chemical reaction occurs between them.

Pressure $p$, temperature $T$, volume $V$ and the amount of gas $n$ are known, and only $V$ is held constant.

What happens when $n$ suddenly changes? You can imagine it as compressed gas container leaking $\mathrm{d}n$ moles of gas.

According to my intuition, both $p$ and $T$ would increase.

I can use the ideal gas law if I consider either pressure or temperature to be constant in order to obtain the other one, but I have no clue about what would happen in reality to both temperature and pressure.

The purpose of this question is to build "kind of" a simulation.

  • $\begingroup$ Even though you will say temperature and pressure would change, for a given arbitrary set of ($P,V$), volume should change with change in $n$ according to Avogadro's law. $\endgroup$ Aug 9 at 18:21
  • $\begingroup$ I lack the knowledge but I assumed that Avogadro's law was only to be considered when setting temperature and pressure as constants. Could you help me understanding what is wrong in my reasoning ? $\endgroup$
    – Aya
    Aug 9 at 19:23
  • $\begingroup$ Are you familiar with the open system version of the 1st law of thermodynamics? $\endgroup$ Aug 9 at 20:59
  • $\begingroup$ Chem+Math Expression formatting reference: MathJax Basics / Chem+Math expressions/formulas/equations / Upright vs italic / Math SE Mathjax tutorial // MathJax is preferred not to be used in CH SE Q titles. $\endgroup$
    – Poutnik
    Aug 10 at 5:13

4 Answers 4


The question can be answered by solving the material and energy balance for this case.

  • The tank is the control volume CV, of a constant volumne $V_\mathrm{CV}$, and its variables will be referred with the index $\text{CV}$. A constant molar flow rate in $\pu{mol s^-1}$ is exiting the CV.
  • The outlet won't have any index.

The process is depicted as follows: enter image description here

1. Conservation of mass The rate of change of the amount of substance in the CV can only decrease due to the leaking \begin{align} \color{blue}{\frac{\mathrm{d}n_\mathrm{CV}}{\mathrm{d}t}} = -\dot{n} \tag{1} \\ \end{align} we have a decrease, hence the minus sign. The conservation of amount of substance here is valid, because we don't have a chemical reaction, so mass and amount are conserved quantities.

2. First law In its full form, where the index $i$ denote inlets and $o$ outlets, we have \begin{align} \frac{\mathrm{d}\left[n_\mathrm{CV}\left(u_\mathrm{CV} + \dfrac{v_\mathrm{CV}^2}{2} + gz_\mathrm{CV}\right)\right]}{\mathrm{d}t} =& \dot{Q} + \dot{W} \\ &+ \sum_{i} \dot{n}_\mathrm{i}\left(h_i + \frac{v_i^2}{2} + gz_i\right) \\ &- \sum_{o} \dot{n}_\mathrm{o}\left(h_o + \frac{v_o^2}{2} + gz_o\right) \tag{2} \end{align} where our assumptions are:

  1. We disregard the kinetic and gravitational potential energy vs the enthalpy.
  2. There is no transfer of work.
  3. There is no transfer of heat.

Thus, Eq. (2) with only one outlet of enthalpy yields \begin{align} \frac{\mathrm{d}(n_\mathrm{CV}u_\mathrm{CV})}{\mathrm{d}t} &= \color{blue}{-\dot{n}}h \qquad\qquad \text{[Use Eq. (1)]} \\ n_\mathrm{CV}\frac{\mathrm{d}u_\mathrm{CV}}{\mathrm{d}t} + u_\mathrm{CV}\frac{\mathrm{d}n_\mathrm{CV}}{\mathrm{d}t} &= h\frac{\mathrm{d}n_\mathrm{CV}}{\mathrm{d}t} \\ n_\mathrm{CV}\mathrm{d}u_\mathrm{CV} &= (h - u_\mathrm{CV})\mathrm{d}n_\mathrm{CV} \\ \frac{\mathrm{d}u_\mathrm{CV}}{h - u_\mathrm{CV}} &= \frac{\mathrm{d}n_\mathrm{CV}}{n_\mathrm{CV}} \tag{3} \\ \end{align} Eq. (3) is as far as we can go. We will make two more assumptions:

  • The fluid inside the CV has the same variables as the fluid leaving the CV. Thus, $P_\mathrm{CV} = P$ and $T_\mathrm{CV} = T$, so that $h_\mathrm{CV} = h$.
  • The fluid behaves as an ideal gas. Thus, the differential of internal energy can be written as $$ du_\mathrm{CV} = C_\mathrm{V}^\mathrm{ig} \, \mathrm{d}T_\mathrm{CV} \tag{4} $$

Combining both points we can simplify the nasty denominator in Eq. (3) \begin{align} \require{cancel} h - u_\mathrm{CV} &= h_\mathrm{CV} - u_\mathrm{CV} \\ h - u_\mathrm{CV} &= (\cancel{u_\mathrm{CV}} + P_\mathrm{CV}v_\mathrm{CV}) - \cancel{u_\mathrm{CV}} \\ h - u_\mathrm{CV} &= P_\mathrm{CV}v_\mathrm{CV} \\ h - u_\mathrm{CV} &= RT_\mathrm{CV} \tag{5} \\ \end{align} Combining Eqs. (3), (4), and (5) and integrating \begin{align} \frac{C_\mathrm{V}^\mathrm{ig}\mathrm{d}T_\mathrm{CV}} {RT_\mathrm{CV}} = \frac{\mathrm{d}n_\mathrm{CV}}{n_\mathrm{CV}} \\ \frac{1}{R}\int_{T_\mathrm{CV1}}^{T_\mathrm{CV2}} \frac{C_\mathrm{V}^\mathrm{ig}\mathrm{d}T_\mathrm{CV}}{T_\mathrm{CV}} &= \int_{n_\mathrm{CV1}}^{n_\mathrm{CV2}} \frac{\mathrm{d}n_\mathrm{CV}}{n_\mathrm{CV}} \tag{6} \\ \end{align} Strictly, even for an ideal gas, $C_\mathrm{V}^\mathrm{ig}$ is a function of temperature. We will analyze, for simplicity, the case where this magnitude is constant. The integration is not that hard if we consider a function like a polynomial, but we will get a result that is not analytic in terms of the final temperature $T_\mathrm{CV2}$.

Continuing with Eq. (6) \begin{align} \frac{C_\mathrm{V}^\mathrm{ig}}{R}\int_{T_\mathrm{CV1}}^{T_\mathrm{CV2}} \frac{\mathrm{d}T_\mathrm{CV}}{T_\mathrm{CV}} &= \int_{n_\mathrm{CV1}}^{n_\mathrm{CV2}} \frac{\mathrm{d}n_\mathrm{CV}}{n_\mathrm{CV}} \\ \frac{C_\mathrm{V}^\mathrm{ig}}{R} \ln\left(\frac{T_\mathrm{CV2}}{T_\mathrm{CV1}}\right) &= \ln\left(\frac{n_\mathrm{CV2}}{n_\mathrm{CV1}}\right) \rightarrow \boxed{\frac{T_\mathrm{CV2}}{T_\mathrm{CV1}} = \left(\frac{n_\mathrm{CV2}}{n_\mathrm{CV1}}\right) ^{R/C_\mathrm{V}^\mathrm{ig}}} \tag{7} \end{align} Now consider the ideal gas law in two situations \begin{align} \require{cancel} \frac{P_\mathrm{CV2}\cancel{V_\mathrm{CV}}} {n_\mathrm{CV2}\cancel{R}T_\mathrm{CV2}} &= \frac{P_\mathrm{CV1}\cancel{V_\mathrm{CV}}} {n_\mathrm{CV1}\cancel{R}T_\mathrm{CV1}} \\ \frac{P_\mathrm{CV2}}{n_\mathrm{CV2}T_\mathrm{CV2}} &= \frac{P_\mathrm{CV1}}{n_\mathrm{CV1}T_\mathrm{CV1}} \\ \frac{P_\mathrm{CV2}}{P_\mathrm{CV1}} &= \frac{n_\mathrm{CV2}T_\mathrm{CV2}}{n_\mathrm{CV1}T_\mathrm{CV1}} \qquad \text{[Use Eq. (7)]} \\ \frac{P_\mathrm{CV2}}{P_\mathrm{CV1}} &= \frac{n_\mathrm{CV2}}{n_\mathrm{CV1}} \left(\frac{n_\mathrm{CV2}}{n_\mathrm{CV1}}\right) ^{R/C_\mathrm{V}^\mathrm{ig}} \\ \frac{P_\mathrm{CV2}}{P_\mathrm{CV1}} &= \left(\frac{n_\mathrm{CV2}}{n_\mathrm{CV1}}\right) ^{(R/C_\mathrm{V}^\mathrm{ig}) + 1} \\ \frac{P_\mathrm{CV2}}{P_\mathrm{CV1}} &= \left(\frac{n_\mathrm{CV2}}{n_\mathrm{CV1}}\right) ^{(R + C_\mathrm{V}^\mathrm{ig})/C_\mathrm{V}^\mathrm{ig}} \rightarrow \boxed{\frac{P_\mathrm{CV2}}{P_\mathrm{CV1}} = \left(\frac{n_\mathrm{CV2}}{n_\mathrm{CV1}}\right) ^{C_\mathrm{p}^\mathrm{ig}/C_\mathrm{V}^\mathrm{ig}}} \tag{8} \end{align}

3. Remarks Eqs. (7) and (8) are the end. Final observations:

  • According to Eq. (7), as the tank is depleted, the temperature decreases as a power function.
  • According to Eq. (8), as the tank is depleted, the pressure decreases as a power function.
  • The pressure decreases, for the same level of depletion of the CV, more than the temperature does.
  • The total depletion of the tank, i.e. $n_\mathrm{CV2} \approx 0$, should not be evaluated with these equations. As temperature and pressure go down, a phase transition may occur in the fluid, so the equations are no longer valid because we don't have an ideal gas anymore.
  • $\begingroup$ Thank you SO MUCH for your answer ! It must have taken you some time to deliver that demonstration ! So methodic and detailed..! I feel priviledged that you put so much of your time for my question ! I'm really astonished by the community of this StackExchange! About the complexity, it could have been too much if I didn't have enough algebra background. I admit I wasn't expecting a complete demonstration but I suppose this is a more common kind of answer in the scientist world ahah ! Thanks again ! $\endgroup$
    – Aya
    Aug 11 at 14:21
  • $\begingroup$ Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on Chemistry Meta, or in Chemistry Chat. Comments continuing discussion may be removed. $\endgroup$
    – Karsten
    Aug 14 at 6:19

Suppose you are adding dn moles of gas to the tank. From the open system version of the first law of thermodynamics, we have $$dU=d(nu)=h_{in}dn$$where U is the internal energy of the tank contents, u is the internal energy per mole, and $h_{in}$ is the enthalpy of the inlet stream. (There is no heat transfer and no shaft work). $$u=C_v(T-T_{ref})$$and $$h_{in}=u_{in}+P_{in}v_{in}=C_v(T_{in}-T_{ref})+RT_{in}$$where $T_{ref}$ is a reference temperature (of zero molar internal energy). Substituting, we have $$nC_vdT+[C_v(T-T_{in})-RT_{in}]dn=0$$So, $$\frac{dT}{(T-\gamma T_{in})}=-\frac{dn}{n}$$Integraton gives: $$\frac{T-\gamma T_{in}}{T_0-\gamma T_{in}}=\frac{n_0}{n}$$or$$T=T_0\frac{n_0}{n}+\gamma T_{in}\left(1-\frac{n_0}{n}\right)= \frac{T_{0}n_0+(\gamma T_{in})\Delta n}{n_0+\Delta n}$$The pressure follows from application of the ideal gas law to the initial and final states: $$\frac{P}{P_0}=1+\frac{\gamma T_{in}}{T_0}\left(\frac{n}{n_0}-1\right)$$If $(\gamma T_{in})\gt T_0$, both temperature and pressure increase with increase in the number of moles.

  • $\begingroup$ I gave the final answers for the temperature and pressure in terms of the number of moles at the end and at the beginning. Isn't that what you asked for? $\endgroup$ Aug 11 at 11:10
  • $\begingroup$ Yes thank ! I'm sorry, I didn't have time to study the answer yesterday ! And since I have very detailed answers it's difficult to pick ONE solution "winner". Thank you very much for you answer !! $\endgroup$
    – Aya
    Aug 11 at 14:38
  • $\begingroup$ The question asks: "You can imagine it as compressed gas container leaking"... versus the answer has to do "with increase in the number of moles"; so for those applying these results from the question, just be careful with the sign of $n$, which should be negative for "leaking" and positive for "addition". Also, I am not sure what assumption is made to come up with $\gamma$. Is it reasonable just to symbolically reference whatever it is, or even assume an ideal monotonic gas where $C_v=\frac{5}{2}\times R$ and $C_p-C_v=R$ giving $\gamma=\frac{C_p}{C_v}=7/5$ when there is $\ce{O2,N2,CO2}$? $\endgroup$ Aug 13 at 8:48
  • $\begingroup$ @StephenElliottThe title says "whenever mols of gas are added..." $\endgroup$ Aug 13 at 11:35
  • $\begingroup$ @StephenElliott Your equation for Cv is for a diatomic gas $\endgroup$ Aug 13 at 18:21

IF the system is isolated and the source of the gas part of the room at the same T and V of the room constant the expanding gas can do no work and there will be no change in T from the simple mixing. The massive Kinetic energy from the directed air stream will eventually turn into heat. This can be eliminated by constraining the gas to diffuse randomly. There will be a Joule-Thompson effect either releasing or absorbing heat depending on the temperature. Finally, the entropy of the expanding, released, gas will increase, this means the entropy of the Universe will increase.

I imagine a pressurized helium balloon with a non-plastic wall but porous to helium, so no polymer crystal effects, slowly releasing the helium until the partial pressures equalize increasing the overall pressure at constant volume.

A correction: The compressed gas has potential energy equal to the work done in filling the tank. Upon release this is converted to KE, the wind generated. Eventually, as the wind is stilled, this becomes heat. This cannot be eliminated by a diffusion process if there is a pressure difference.


From the problem statement, we can have an initial $P_1, V_1, \text{ and } T_1$ with no gas or heat heat flowing from it, and the model of the Ideal gas Law and the Universal Gas Constant so that: $$P_1 \times V_1 = n_1 \times R \times T_1$$ And quoting from the Reference 2 Universal Gas Constant, then

The universal gas constant, also known as the molar or ideal gas constant, is:

$$ R^* = 8.3144621\text{ }(75)\text{ } \frac{J}{\text{mol} \times K} $$

The gas constant for a particular gas is

$$ R = \frac{R^*}{m} $$

where m is the molecular weight of the gas. For a mixture, the "molecular weight" is a weighted mean of the molecular weights of the components:

$$m=\left( \frac{f_1}{m_1} + · · · + \frac{f_n}{m_n} \right)^{-1}$$

$$\text{where } m_1, · · ·, m_n$$

are the molecular weights of the n gases,

$$\text{and } f_1, · · ·, f_n$$

are their masses relative to the total mass of the mixture. The gas constant for dry air is

$$R_d = 287 \frac{J}{K \times kg}$$

The problem statement, "They don't create any chemical reaction (it would be O², N² and CO²)" is not precisely stated dry air. This is a difficulty with the problem statement which may affect the answer quality, because when $R_d$ is used in the ideal gas law it may different from $R_\text{1 for the question}$ in the context of the question presentation.

Technically we do not have everything required to calculate the R value for the gas mixture in the room. Hence, the answer needs to be conceptual about how to proceed (and I am amending the question a little with more detail to make it solvable), and then the actual Gas Constant for the room can perhaps be obtained later to follow the similar procedure to arrive at the desired answer, starting with the assumption that all the gasses are dry air and using the corresponding gas constant $R_d$ as:

$$R_d = 287 \frac{J}{K \times kg}$$ $$\text{and initially } P_1 \times V_1 = n_1 \times R_{1\text{ d}} \times T_1$$ $$\text{and finally } P_2 \times V_2 = n_2 \times R_{2\text{ d}} \times T_2$$

Now what happens with the next event in the question statement, "What happens when n suddenly changes?" The usual meaning of "suddenly changes" is a model of an Adiabatic Process, and from this reference:

If the gas is ideal, the internal energy depends only on the temperature. Therefore, when an ideal gas expands freely, its temperature does not change; this is also called a Joule expansion.

The question here states: "You can picture a compressed gas container leaking n moles of gas". When I imagine this, I see a picture of a gas container at very high pressure compared to its environment, and just a little bit of gas leaking. This is not the scenario where the gas container is almost empty and at equilibrium with the atmosphere that it leaks to since that entity is completely outside of the problem statement.

Ideal Gas Thermodynamics: Specific Heats, Isotherms, Adiabats has the following illustration which shows what I envision from the problem statement. Some gas is let out of the gas container quickly resulting is a situation similar to that pictured here. When the high pressure gas from the container is let out, the volume of the gas inside the container and that outside of the container suddenly increases without additional significant release of heat (beyond that already in the gas that is leaked) to the environment.

Also, since this is a small and sudden leak, the work can be estimated as a relatively constant pressure times a small change in volume as:

$$\delta W_{\text{work from the container}}= P \times \delta V_{\text{volume of container and environment}}$$ $$=\delta n \times R_d \times T_{\text{Adiabatic constant in the gas container}}$$

Adiabatic Joule Heating and Cooling Diagram

Keep in mind in the above picture, that there is a sudden motion of the piston, dividing the molecules below the initial piston position and the molecules above the initial piston position finally into two separate regions (not shown in the picture). With Adiabatic expansion, those molecules above do not have enough time to influence the molecules below. And thus, those with a certain average energy before the sudden piston movement, below the piston, retain their average energies, independent of the molecules above the sudden piston movement.

Answer Author's Diagram Showing Adiabatic Expansion

From this equation one can see that the average internal energy of each molecule does not change, and rather it is the loss of molecules $\delta n$ during the gas release from the container that changes the complete energy stored in the container. The temperature $T$ is related to the average energy of each ideal gas molecule in the gas container, not to how many gas molecules there are. Thus, $T$ is constant, and total energy loss in the container is just the average energy per molecule times the number of molecules.

The initial temperature $T_1$ of course needs to be independent of the environment temperature that the gas is leaking to $T_\text{environment}$ because this is envisioned as a high-pressure gas container with nominal influence of the environment that it is leaking to (where the details of the environment's temperature and so forth are not given in the question statement).

So finally,

$$\delta W_{\text{work from the container to the environment}}= $$ $$= P \times \delta V_{\text{volume of container and environment}}$$ $$=\delta n \times R_d \times T_{\text{Adiabatic constant in the gas container}}$$


$$\delta \left(P \times V_{\text{container}}\right) = \delta P \times V_{\text{fixed size gas container}}$$ $$=\delta \left( n \times R_d \times T_{\text{Adiabatic constant for Joule heating in the gas container}}\right)$$

$$=\delta \left( n_2-n \right) \times R_d \times T_{\text{Adiabatic constant in the gas container}}$$

Just like a natural gas container of high pressure gas, the pressure starts out high and slowly decreases according to how much gas

$$\left( n_2- n \right)$$

is suddenly used, while the natural gas or $CO_2$ container volume remains constant, like in the Adiabatic Expansion of Carbon Dioxide, where work is done by the gas after expansion, where its pressure is lowered to atmospheric pressure, and the pressure inside the canister of gas is proportional to the amount of $CO_2$, with the temperature of the canister being nearly constant, according to Adiabatic expansion.

Diagram of Adiabatic Expansion from a CO2 Canister

Thus, contrary to the initial perception that: "According to my intuition both Pressure P and Temperature T would increase." It is quite different. Think like it is a metal high pressure gas canister for a fixed volume of gas, like for soda production. A release of gas decreases pressure in the tank and the volume remains fixed. Of course the room is large and its temperature is not changed significantly with a small leak of gas from the canister. Rather the pressure inside the room increases if the room is sealed (aside from the gas leak of the gas canister) in a proportional manner to how many moles of gas are added to the room from the gas canister.

Also, Temperature does not increase. Rather, because this is Joule work that the gas performs, and each molecule inside the container retains its average energy, the Temperature remains the same.

Finally then, for compressed dry air (with no liquid component inside the tank, we have):

$$R_d = 287 \frac{J}{K \times kg}$$ $$P \times V_{\text{in the container}} = $$ $$=n_{\text{inside the container}} \times R_{1\text{ d}} \times T_{\text{essentially constant due to Joule expansion from the container}}$$

Thus, taking account that $n_2=n_1-\delta n$ and $V$ is essentially constant and also $T$ is essentially constant, we have:

$$P_{\text{inside the gas container}} \times V_{\text{essentially constant in the container}} = $$ $$=\left(n_1 - \delta n \right)_{\text{inside the container}} \times R_{1\text{ d}} \times T_{\text{essentially constant in the container due to Joule expansion from the container}}$$

I am only calculating the parameters of the gas inside the tank because the relatively low pressure of the room are not deemed by the question to be significant enough to include there within. And for most gas tanks at high pressure, the atmospheric pressure and temperature only have a nominal influence, like in the case of gas (only gas, no liquid) for cooking food, for instance.

  • $\begingroup$ Same as for Metal Storm, thank you VERY MUCH for the detailed answer ! This is amazing, you quoted every part of my question to justify every step. Even though you both took my question under different angles (because I clumsily mentioned compressed gas container ^^'), you have a different conclusion being : - MetalStorm conclusion is that temperature vary along pressure. - You consider temperature remains the same. Nonetheless, the only reason I don't upvote your answer is because my account is too recent for voting. ^^' $\endgroup$
    – Aya
    Aug 11 at 14:35
  • $\begingroup$ How can 2 answers with diametric results be correct? Your isolated constant volume room allows no work and Q and U do not change. It is essentially a free expansion of the added gas into the open space between molecules. You specify ideal gas behavior, so the only additional energy is the potential to kinetic energy of the compressed gas that is released. The change in entropy is important. What you have described is a gas chamber. $\endgroup$
    – jimchmst
    Aug 12 at 0:42
  • $\begingroup$ @jimchmst The problem statement says: "You can imagine it as compressed gas container leaking dn moles of gas." From the problem statement I understand that the question is essentially similar to that of a gas chamber, which leaks after its initial conditions of as you stated "Your isolated constant volume room allows no work and Q and U do not change". It is only later that $\delta n$ moles escape, they take with later their kinetic energy with them, lowering the total energy in the container, but not significantly the average energy from the problem statement of Adiabatic expansion. $\endgroup$ Aug 13 at 7:32

Your Answer

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

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