In this simulation, a gas flows through a pipe into an insulated tank. The tank is initially at a lower pressure than the gas in the pipe and at a different temperature. When the valve to the tank is opened, the gas flows into the tank until the pressures equalize, and the valve is then closed. The tank can initially contain nitrogen, treated as an ideal gas, with additional nitrogen added from the pipe. Alternatively, the tank can initially contain a water vapor/liquid mixture with superheated steam added from the pipe. With water in the tank, both the volume of the tank (0.1 \(m^3\)) and the initial mass of water (1 kg) are fixed, and thus as the initial tank pressure is changed, the initial water quality (vapor mass fraction) in the tank changes. When the valve is opened, the mass in the tank increases. The initial pressures and temperatures in the flowing gas and in the tank can be changed with sliders. For the water system, the temperature of the vapor/liquid mixture in the tank cannot be independently changed because the tank is at the saturation temperature for the selected pressure. Click "play" to let the gas flow into the tank, and use the "reset" button to go back to the initial conditions.
For an ideal gas system, the number of moles \(n_1\) initially in the tank can be calculated using the ideal gas law: $$\qquad n_1=\frac{P_1V}{RT_1} $$ The internal energy and enthalpy are found by defining a reference temperature \(T_\text{ref}=T_2\).
At \(T_\text{ref}\), \(U_\text{ref}=0\), $$\qquad U_1 = U_\text{ref}+C_v (T_1-T_\text{ref}) = C_v (T_1-T_2) $$ $$\qquad U_\text{final} = U_\text{ref} + C_v (T_\text{final}-T_2) = C_v (T_\text{final}-T_2) $$ $$\qquad H_2 = H_\text{ref} = U_\text{ref} + R T_2 $$ The number of moles in the tank at equilibrium (\(n_\text{final}\)) can also be calculated using the ideal gas law: $$\qquad n_\text{final} = \frac{P_\text{final}V}{R T_\text{final}} = \frac{P_2 V}{R T_\text{final}} $$ This equation can be substituted into the energy balance to solve for the final temperature \(T_\text{final}\). $$\qquad n_1 U_1 + (n_\text{final}-n_1)H_2 = n_\text{final}U_\text{final} $$ The subscript 1 refers to the gas in the tank before more gas is added, the subscript 2 refers to the gas in the pipe, the subscript ref denotes a reference state, P is pressure (bar), V is volume (L), R is the ideal gas constant (L-bar/mol-K), T is temperature (K), U is internal energy (J/mol), \(C_v\) is the constant-volume heat capacity for an ideal gas (J/mol-K), and H is enthalpy (J/mol).
This simulation was created in the Department of Chemical and Biological Engineering at University of Colorado Boulder for LearnChemE.com by Drew Smith under the direction of Professor John L. Falconer and Michelle Medlin. It is a JavaScript/HTML5 implementation of a Mathematica simulation by Rachael L. Baumann. It was prepared with financial support from the National Science Foundation (DUE 2336987 and 2336988) in collaboration with Washington State University. Address any questions or comments to LearnChemE@gmail.com. If this simulation is too big or too small for your screen, zoom out or in using command - or command + on Mac or ctrl - or ctrl + on Windows.