# Trouble solving for end state of two control volumes in a rigid tank

• calzone41

#### calzone41

Thread moved from the technical forums to the schoolwork forums
TL;DR Summary: Struggling to structure the problem and derive an analytical solution for gas expanding into other gas in a rigid tank. Preferred formulation is fixed control volumes. This is not a homework problem.

The problem:
Two control volumes (A and B) are in a rigid tank filled with air. The initial state of each control volume is completely defined. There is a pressure differential between the control volumes so mass flows from A to B. Mass flows such that the pressure in each control volume is equal at time 2. There is no energy transfer or work to or from the tank; frictional losses are ignored. Mass and energy are conserved. There is no heat transfer between air masses except for mass transfer across the control volume boundary. Assume immediate and perfect mixing as mass moves into control volume B. I need to be able to calculate the final state of the air masses in the control volumes (P, m, T). This is straightforward to do numerically, I would like an analytical solution. Some Background:
This is not a homework assignment. Ultimately I am trying to build a discrete-time-step Stirling engine simulator that models each air mass separately (imagine a gamma configuration engine with hot and cold air masses in a displacer cylinder and a power air mass in a power cylinder.) At each time step, various air masses gain/lose energy and perform work, so will have different pressures. I need to balance these pressures at the end of each time step. Eventually, I will be modeling three connected air masses, but wanted to understand the two-airmass problem first before adding complexity.

Attempted solutions
Systems of Equations:

Using fixed-size control volumes, there are 5 unknowns at the final state (mA, mB, TA, TB, P2). I find 4 equations: conservation of mass, conservation of enthalpy ( that is; hA1mA1 + hB1mB1 = hA2mA2 + hB2mB2. Is this a valid equation?), and ideal gas law for both volumes at the end state. This would not be enough to solve for 5 unknowns. Is there another obvious one? I considered relationships for polytropic processes, but was not confident they apply for fixed control volumes. I did derive a 5th equation that relates internal energy to mass flow for control volume A (shown below) but I'm hesitant about it. Solving this non linear system of equations is beyond me. Perhaps you can point me in the right direction? Control volume energy balance, integral with respect to time:
Starting with the general energy balance equation for volume A, I eliminated terms for heat flux, work, and mass flow in. I then differentiated (chain rule) um with respect to t. The m-dot term here makes no physical sense (mass does not just disappear) so is zero. Using the definition of enthalpy, the ideal gas law, the specific heat relationship u = CvT, the definition of k = Cp/Cv, and integrating both sides of this separable differential equation. I arrive at internal energy as a function of mass flow and time. assuming mass flow is constant this can be re-written as internal energy as a function of mass in the control volume. (Note: It is possible to perform this integration as du/dm rather than du/dt. The result is the same.) This is an simple, elegant equation (which I cannot verify externally). However, when using this relationship to assemble a differential equation for control volume B, I get an unwieldy equation I cannot figure out how to integrate. Combined control mass and control volume:
I can also structure the problem as control masses instead of control volumes. Essentially, mass A pushes into mass B, doing work Imagine a piston between the air masses. Using polytropic relationships for isentropic flow, and the relationship of total volume being constant, I can solve for P2. I can then use this P2 and the control volume relationships to solve for the changes in mass, then find other equations of state. This is fine, but feels messy and kludged.

Questions:
Am I making this problem more complicated than it needs to be? Is there a simpler way to solve the problem of gas expanding into other gas in a rigid tank?

Side question: Is conservation of enthalpy a thing? When using this relationship I can get an equation for P2 that is essentially an arithmetic mean [P2 - (Pa1Va + Pb1Vb)/(Va + Vb)], which differs from the P2 found using control masses and polytropic relationships and seems too simple to be real.

As a first try I take it easy as follows.
Say B is vacuum, gas in A expands free adiabatically. Temperature does not change from ##T_A## . ##P_A## drops to ##\frac{V_A}{V_A+V_B}P_A##.
Say A is vacuum, gas in B expands free adiabatically. Temperature does not change from ##T_B##. ##P_B## drops to ##\frac{V_B}{V_A+V_B}P_B##.
In total the air has pressure ## \frac{V_A}{V_A+V_B}P_A+\frac{V_B}{V_A+V_B}P_B ##. The air consists of two temeratures air of ##T_A## and ##T_B##. I am not sure such coexistance of high temperature gas and low one is realistic.

Last edited:
As a first try I take it easy as follows.
Say B is vacuum, gas in A expands free adiabatically. Temperature does not change from ##T_A## . ##P_A## drops to ##\frac{V_A}{V_A+V_B}P_A##.
Say A is vacuum, gas in B expands free adiabatically. Temperature does not change from ##T_B##. ##P_B## drops to ##\frac{V_B}{V_A+V_B}P_B##.
In total the air has pressure ## \frac{V_A}{V_A+V_B}P_A+\frac{V_B}{V_A+V_B}P_B ##. The air consists of two temeratures air of ##T_A## and ##T_B##. I am not sure such coexistance of high temperature gas and low one is realistic.
Thank you for your quick response. I wish for such a simple solution, but in my case, the gas in one control volume is expanding into other gas, not a vacuum; work is done on or by another gas and temperature will not be constant between initial and end states. This is truly the root of the complexity of this problem.

Are you assuming that there is a valve that admits gas from A to B relatively slowly? If that is the case, then $$\frac{d(u_Am_A)}{dt}=+\dot{m}_Ah_A$$and$$\frac{d(u_Bm_B)}{dt}=-\dot{m}_Ah_A$$ with ##\dot{m}_A## negative.

The above is incorrect. Using my notation with ##\dot{m}_A=\frac{dm_A}{dt}##, we get: $$u_Adm_A+m_Adu_A=h_Adm_A$$then$$m_Adu_A=m_AC_vdT_A=(h_A-u_A)dm=P_Av_Adm=RT_Adm_A$$

Last edited: