Cannot find the Temperature Change inside of a Tank

Click For Summary
The discussion revolves around the challenge of determining the internal temperature change in a pressurized tank containing real gas when additional gas is added at a different temperature. The original poster expresses frustration over the lack of clear solutions and references, particularly regarding the application of the Van der Waals equation of state instead of the ideal gas law. Key points include the complexities of energy transfer, mixing dynamics, and the need for an understanding of the open-system version of the first law of thermodynamics. Participants discuss the relationship between internal energy, enthalpy, and the effects of specific volume on these properties. The conversation highlights the need for further research and clarification on thermodynamic principles to address the problem effectively.
  • #61
I basically confirmed your results, although I worked with volume in ft^3, mass in lb-moles, and R=10.73159.

Note also that your final pressure is higher than the supply line pressure. This is, of course, not possible and means that you won't be able to get as many moles as you think into the tank.
 
  • Like
Likes treddie
Science news on Phys.org
  • #62
"Note also that your final pressure is higher than the supply line pressure. This is, of course, not possible and means that you won't be able to get as many moles as you think into the tank."

I am assuming that the supply line always has a positive delta pressure over the tank pressure so that moles/time going in remains constant. So if I simply put the same amount of moles into the tank per iteration, I assume that implies a constant delta pressure.

Here is an updated screen:

Test 2.jpg
 

Attachments

  • Test 2.jpg
    Test 2.jpg
    27.2 KB · Views: 289
  • #63
Now that I am working the Van der Waals case, that Pv term is coming back to bite me. There is no easy way to get it in ##T_{in}## terms. But cannot I simply use the initial conditions for ##(Pv)_{in}## and then let the solution for ##T_f## be an input into the EOS to get tank pressure, then use that tank pressure as the reference for my change in inlet pressure? Since I am making the assumption that since the mole rate into the tank is constant, then the inlet pressure is always a constant ##\Delta P## over the tank pressure? But it seems that does not take into account the changes in inlet pressure between each iteration. Between each mole "chunk" I add to the tank at each iteration, there has been a continuous change in tank and inlet pressures between the moment of the last chunk, and the current one. In that case, it looks like another integral is involved.
 
  • #64
treddie said:
Now that I am working the Van der Waals case, that Pv term is coming back to bite me. There is no easy way to get it in ##T_{in}## terms. But cannot I simply use the initial conditions for ##(Pv)_{in}## and then let the solution for ##T_f## be an input into the EOS to get tank pressure, then use that tank pressure as the reference for my change in inlet pressure? Since I am making the assumption that since the mole rate into the tank is constant, then the inlet pressure is always a constant ##\Delta P## over the tank pressure? But it seems that does not take into account the changes in inlet pressure between each iteration. Between each mole "chunk" I add to the tank at each iteration, there has been a continuous change in tank and inlet pressures between the moment of the last chunk, and the current one. In that case, it looks like another integral is involved.
I don't follow every detail of what you are saying here. But, you can't have a constant pressure difference and, at the same time, have a constant molar flow rate. And, if the pressure in the supply line is increasing with time, you need to specify how that affects the temperature and specific volume of the gas in the supply line.

The easiest, and closest-to-reality, thing to do is hold the conditions in the supply line constant, and specify the relationship between the molar (or mass) flow rate into the tank and the pressure difference between the supply line and the tank (at a given supply line specific volume). Then you could carry out the transient calculation until the tank pressure approaches the supply line pressure. Or, you could do the transient part after you determine the solution to your equations for the conditions inside the tank as a function of the number of moles of supply line gas added, holding the conditions in the supply constant (as you have done in the previous calculations).
 
  • #65
Here's what I would do: I would want to specify the (constant) temperature and (constant) pressure in the inlet line and the initial temperature and pressure in the tank, and then determine the conditions in the tank as a function of the number of moles of gas added to the tank. So,

1. Using the van der Waals equation, solve for the initial specific volume of the gas in the tank and the (constant) specific volume of the gas in the inlet line. This will also give you the initial number of moles of gas in the tank.

2. Using the equations you derived, then solve for the conditions in the tank as a function of the number of moles of gas added. This may require you to solve the van der Waals equation for the specific volume of the gas in conjunction with the temperature (so you may have 2 nonlinear equations in two unknowns at each increment of moles).
 
  • #66
I have manipulated your relationship in Post #34 in the following way:
$$T_f = \frac{\Delta m}{m_o + \Delta m} \left( T_{in} - T_o + \frac{a}{v_oC_v} - \frac{a}{v_{in}C_v} \right) + \frac{\Delta m}{m_o + \Delta m} \left( \frac{(Pv)_{in}}{C_v} \right) - \frac{a}{v_oC_v} + \frac{a}{v_fC_v} + T_o$$
First:
$$\frac{a}{v_f}-\frac{a}{v_0}=\frac{aV}{v_f}-\frac{aV}{v_0}=\frac{a\Delta m}{V}=\frac{\Delta m}{m_0+\Delta m}\frac{a}{v_f}$$
And: $$(Pv)_{in}=-\frac{a}{v_{in}}+\frac{RT_{in}v_{in}}{(v_{in}-b)}=-\frac{a}{v_{in}}+RT_{in}+\frac{bRT_{in}}{(v_{in}-b)}$$
If I combine these equations, I obtain:
$$T_f = \frac{\Delta m}{m_o + \Delta m}\left[\gamma T_{in}-T_0+\frac{a}{C_V}\left(\frac{1}{v_0}-\frac{2}{v_{in}}+\frac{1}{v_f}\right)+\frac{bRT_{in}}{C_V(v_{in}-b)}\right]+T_0$$
The terms involving a and b in brackets are the corrections for non-ideal behavior.
 
  • #67
My program must have a problem. I am getting linear pressure change and temperatures that rise sharply and then level off. I need to go over it and look for problems.

Test 3.jpg
 

Attachments

  • Test 3.jpg
    Test 3.jpg
    30.9 KB · Views: 301
  • #68
Chester,
I just noticed that your graphs disappeared, and some posts from you about a week and a half ago, that I never saw! This is weird.
I am going over your posts from June 5, which for some reason never showed up on my side.
 
  • #69
In post #66, you have:
##\frac{a}{v_f}-\frac{a}{v_0}=\frac{aV}{v_f}-\frac{aV}{v_0}##

That is not possible unless V only = 1.
 
  • #70
treddie said:
In post #66, you have:
##\frac{a}{v_f}-\frac{a}{v_0}=\frac{aV}{v_f}-\frac{aV}{v_0}##

That is not possible unless V only = 1.
How did that middle term get in there? Skip that term. It's wrong, and move on to the third equality.
 
  • #71
treddie said:
Chester,
I just noticed that your graphs disappeared, and some posts from you about a week and a half ago, that I never saw! This is weird.
I am going over your posts from June 5, which for some reason never showed up on my side.
My graphs are in that private conversation that we have been having in parallel with this.
 
  • #72
Mystery solved. Thank you Sherlock!

Watson
 
  • #73
Chestermiller said:
How did that middle term get in there? Skip that term. It's wrong, and move on to the third equality.

Quantum uncertainty may have thrown it in. :)
 
  • Like
Likes Chestermiller
  • #74
Would it help if I provided my C# code?
 
  • #75
Yes, that might help, thanks!

One thing I notice is that our curves do not show the Joule-Thompson Effect when the tank starts at low pressures, but moderate temperatures.
 
  • #76
treddie said:
Yes, that might help, thanks!

One thing I notice is that our curves do not show the Joule-Thompson Effect when the tank starts at low pressures, but moderate temperatures.
This is not a Joule-Thompson situation.
 
  • #77
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;
namespace Tank_Temperature_Problem

{

class Program

{

static void Main(string[] args)

{

double vdw_a = 8541.0;

double vdw_b = 0.685;

double[] lb_moles = new double[20];

double[] sp_vol = new double[20];

double[] temperature = new double[20];

double[] pressure = new double[20];

double tank_vol = 7.068; double R = 10.731573;

double C_v = 3.3 * R;

double gamma = 4.3 / 3.3;
double dm = 0.3;
//Initialization of Tank Contents

//*******************************
lb_moles[0] = 1.55;

temperature[0] = 582.0;

sp_vol[0] = tank_vol / lb_moles[0];

double term = (R * temperature[0]) / (sp_vol[0] - vdw_b);

pressure[0] = -vdw_a / (sp_vol[0]*sp_vol[0]) + term;

Console.WriteLine("The initial pressure is " + pressure[0]+ " psi");
//Initialization of Inlet Line

//****************************

double v_in = 1.3;

double T_in = 552.0;

term= (R * T_in) / (v_in - vdw_b);

double p_in= -vdw_a / (v_in * v_in) + term;

Console.WriteLine("The inlet line pressure is " + p_in + " psi");
double term1 = gamma * T_in - temperature[0]

+ (1 / sp_vol[0] - 2 / v_in) * vdw_a / C_v;

term1 = term1 + vdw_b * R * T_in / C_v / (v_in - vdw_b);

double term2 = vdw_a / C_v / tank_vol;
for (int i = 1; i < 12; i++)

{

lb_moles = lb_moles[i - 1] + dm;

temperature = temperature[0]+ term1 * (lb_moles - lb_moles[0]) / lb_moles + (lb_moles-lb_moles[0]) * term2;

sp_vol = tank_vol / lb_moles;

term = (R * temperature) / (sp_vol - vdw_b);

pressure = -vdw_a / (sp_vol * sp_vol) + term;

Console.WriteLine(lb_moles + " " + temperature+" "+pressure);

}
Console.WriteLine();

Console.WriteLine("reduced temperature, reduced pressure, z facto");

for (int i = 1; i < 12; i++)

{

double tr = temperature / 344;

double pr = pressure / 673.3;

double z_factor = pressure * sp_vol / R / temperature;

Console.WriteLine(tr + " " + pr + " " + z_factor);

}

Console.ReadKey();
}

}

}
 
  • #78
Chestermiller said:
This is not a Joule-Thompson situation.

I thought that whenever a gas moved from a high pressure volume to a low pressure volume that that gas cooled as it expanded, but that when it encounters more and more collisions in the tank, it quickly heats up?

Thanks again for your code. I will compare your output with mine for the same initial conditions.
 
  • #79
treddie said:
I thought that whenever a gas moved from a high pressure volume to a low pressure volume that that gas cooled as it expanded, but that when it encounters more and more collisions in the tank, it quickly heats up?
There are two things happening here, and it is important to understand the basic physical mechanisms that apply to each.

The first thing is that the entering gas goes through the inlet valve from the high pressure feed line to the lower pressure in the tank. From the open system version of the first law of thermodynamics, we know that this change (taking place strictly in the inlet value) occurs at constant enthalpy. For an ideal gas, this means that the temperature of the entering gas does not change across the inlet valve. This is basically the Joule-Thompson effect. But how can this be? After all, the gas has expanded, so, as you pointed out, it should be cooling. However, the pressure drop in the inlet value is caused by viscous friction, which is a dissipative process, involving so-called "viscous heating" of the gas. As it turns out, the cooling effect from expansion is exactly canceled out by the heating effect from viscous dissipation. So the net effect is no temperature change for an ideal gas passing through the inlet valve.

The second thing that happens is that the gas entering the tank is causing the gas already present within the tank to compress adiabatically. So it is doing work on the gas already in the tank. This causes the gas in the tank to heat up. This adiabatic compression results in a temperature rise of the gas in the tank.
 
  • #80
But what is different then, between the inlet valve in our discussion, and the expansion valve in an air-conditioning system? Is it the liquid state of the refrigerant vs. the gas state of the tank fill model? Both are still regarded as "fluids".
 
  • #81
treddie said:
But what is different then, between the inlet valve in our discussion, and the expansion valve in an air-conditioning system? Is it the liquid state of the refrigerant vs. the gas state of the tank fill model? Both are still regarded as "fluids".
A liquid refrigerant and an ideal gas are quite different in their behavior (even though the change in enthalpy for each in passing through a valve is zero).
 
  • #82
True, true.

Update:
FINALLY got my code running now. I forgot to switch my VdW constants over to ##ft^3, atm, mol## units. Took me a while to track it down via process of elimination.

At any rate, I find it interesting that the curves for real gas vs. ideal gas show that they are switched relative to which ones are linear. For the real gas, temperature was linear, and pressure rose non-linearly. For the ideal gas, the situation was reversed.

Test 4 Real UpR.jpg

Test 4 Ideal UpR.jpg
 

Attachments

  • Test 4 Real UpR.jpg
    Test 4 Real UpR.jpg
    27.2 KB · Views: 863
  • Test 4 Ideal UpR.jpg
    Test 4 Ideal UpR.jpg
    27.3 KB · Views: 880
Last edited:
  • #83
treddie said:
True, true.

Update:
FINALLY got my code running now. I forgot to switch my VdW constants over to ##ft^3, atm, mol## units. Took me a while to track it down via process of elimination.

At any rate, I find it interesting that the curves for real gas vs. ideal gas show that they are switched relative to which ones are linear. For the real gas, temperature was linear, and pressure rose non-linearly. For the ideal gas, the situation was reversed.

View attachment 227554
View attachment 227555
It's got to be just a coincidence. Try the calculation with a and b halved and see how the shapes of the curves compare.
 
  • #84
You're right:

Test 5.jpg
 

Attachments

  • Test 5.jpg
    Test 5.jpg
    31.3 KB · Views: 515
  • #85
I also tested for pressures down in the ideal range, and both the ideal and real curves were almost coincident, which is what would be expected.
 
  • #86
treddie said:
I also tested for pressures down in the ideal range, and both the ideal and real curves were almost coincident, which is what would be expected.
Another way to test this is just to set a and b equal to zero.
 
  • #87
Tried a = 0 and b = 0, and as expected, the pressure curves and temperature curves were respectively coincident.

Also tried inlet temperature around 35 degF and initial tank temperature at about 90 degF (press = 100psi). There was a dip as the cold air filled the tank. After a time, of course, the temp went up to about 208 degF (5301 psi) (real case).
 
  • #88
I forgot to mention that the final test with cold inlet gas was with VdW a&b set to methane (not zero, or other).
 
  • #89
treddie said:
Tried a = 0 and b = 0, and as expected, the pressure curves and temperature curves were respectively coincident.

Also tried inlet temperature around 35 degF and initial tank temperature at about 90 degF (press = 100psi). There was a dip as the cold air filled the tank. After a time, of course, the temp went up to about 208 degF (5301 psi) (real case).
I confirm the small initial dip in temperature.
 
  • #90
At this point, I am going to get my graphics looking better. My current ones were just to get things displaying so I could see something. Now I just need to make them more traditional looking with tic marks and relative to a common origin (all my curves have been anchored to the origin at this point).
 

Similar threads

  • · Replies 109 ·
4
Replies
109
Views
7K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 69 ·
3
Replies
69
Views
7K
Replies
15
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
3
Views
2K
Replies
3
Views
1K
  • · Replies 60 ·
3
Replies
60
Views
9K