Cannot find the Temperature Change inside of a Tank

AI Thread 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.
  • #51
treddie said:
If I simultaneously solve the two, I get what would appear to be an intersection of them, not an equality. But in the process found that for that special case,
##(Pv)_{in} = T_{in}(C_p - C_v)##

And since, for an ideal gas,

##C_v = C_p - nR##

Then

##(Pv)_{in} = T_{in}(nR)##
Actually, there shouldn’t be an n. v is volume per mole.
 
  • Like
Likes treddie
Science news on Phys.org
  • #52
Arghh! Those damn moles and units! I am becoming constantpated. :)

Here we go,

##(Pv)_{in}=T_{in}(R)##

I am looking at what's going on here. Strange things are going on with ##m_o## and ##\Delta m## in order for (a) to grow from zero to 1. Don't have it straight in my mind yet. I think it has to do with ##C_p## and ##C_v## affecting ##m_o##.
 
  • #53
treddie said:
Arghh! Those damn moles and units! I am becoming constantpated. :)

Here we go,

##(Pv)_{in}=T_{in}(R)##

I am looking at what's going on here. Strange things are going on with ##m_o## and ##\Delta m## in order for (a) to grow from zero to 1. Don't have it straight in my mind yet. I think it has to do with ##C_p## and ##C_v## affecting ##m_o##.
No way. m zero is just the original number of moles of gas in the tank.
 
  • Like
Likes treddie
  • #54
I know. I realized that last night when I went to bed, as I was getting ready to drop off to sleep.

This is a very intriguing problem. Not giving up yet.
 
  • #55
Ok...I got something very close to your equation. Here was the path I took:

My equation for an ideal gas transient system was,
##T_f = T_o + a(T_{in} - T_o) + \frac{a(Pv)_{in}}{C_v} \space \space \space \space \space \space\space\space\space## Equ.1

Your equation for the problem is,
##T_f = T_o + a(\gamma T_{in} - T_o)\space \space \space \space \space \space\space\space\space## Equ.2

Solving simultaneously,
##T_{in}(C_p - C_v) = (Pv)_{in}\space \space \space \space \space \space\space\space\space## Equ.3

Now, in general, ##C_v = C_p - R##, so
##R = C_p - C_v\space \space \space \space \space \space\space\space\space## Equ.4

Substituting Equ.4 into Equ.3,
##T_{in}R = (Pv)_{in}\space \space \space \space \space \space\space\space\space## Equ.5

With this result, we can replace the Pv term in Equ.1:
##T_f = T_o + a(T_{in} - T_o) + \frac{aT_{in}R}{C_v}\space \space \space \space \space \space\space\space\space## Equ.6

But I need to reverse course here with, ##R = C_p - C_v##, so:
##T_f = T_o + a(T_{in} - T_o) + \frac{aT_{in}(C_p - C_v)}{C_v}\space \space \space \space \space \space\space\space\space## Equ.7

Simplifying,
##T_f = T_o + aT_{in} - aT_o + \frac{aT_inC_p}{C_v} - 1\space \space \space \space \space \space\space\space\space## Equ.8

##T_f = T_o + aT_{in} - aT_o + a\gamma T_{in} - 1\space \space \space \space \space \space\space\space\space## Equ.9

Finally,
##T_f = T_o + a(\gamma T_{in} - T_o) + aT_{in} - 1\space \space \space \space \space \space\space\space\space## Equ.10

This final equation differs from yours (Equ.2) in that mine has 2 additional terms at the end. And I didn't actually prove your equation because I used it right off the bat to simultaneously solve with (I cheated! :) ). Nonetheless, I have checked my math and I can find no mistakes.
 
Last edited:
  • #56
treddie said:
But I need to reverse course here with, ##R = C_p - C_v##, so:
##T_f = T_o + a(T_{in} - T_o) + \frac{aT_{in}(C_p - C_v)}{C_v}\space \space \space \space \space \space\space\space\space## Equ.7

Simplifying,
##T_f = T_o + aT_{in} - aT_o + \frac{aT_inC_p}{C_v} - 1\space \space \space \space \space \space\space\space\space## Equ.8
There is an algebraic error in the transition between Eqns. 7 and 8.
 
  • Like
Likes treddie
  • #57
Ohhhhh. Damn right! That might work in an alternate universe, but obviously it doesn't work here.

Starting with Equ.7,
##T_f = T_o + a(T_{in} - T_o) + \frac{aT_{in}(C_p - C_v)}{C_v}\space \space \space \space \space \space\space\space\space## Equ.7
##T_f = T_o + aT_{in} - aT_o + \frac{aT_{in}C_p-aT_{in}C_v}{C_v}\space \space \space \space \space \space\space\space\space## Equ.8rev1
##T_f = T_o + aT_{in} - aT_o + \frac{aT_{in}C_p}{C_v} - aT_{in}\space \space \space \space \space \space\space\space\space## Equ.9rev1
##T_f = T_o - aT_o + a \gamma T_{in}\space \space \space \space \space \space\space\space\space## Equ.10rev1
##T_f = T_o + a(\gamma T_{in} - T_o)\space \space \space \space \space \space\space\space\space## Equ.11

So by doing all of this, I came to realize that important little principal, that for an ideal gas, ##(Pv)_{in} = T_{in}(C_p - C_v)##. That was the glue that brought equations, Equ.1 and Equ.2 together.
 
  • #58
Here is a test run for the ideal case:

I am surprised that the pressure is linear. That is, if the program is running correctly. Overall. the values seem to be in the correct ballpark, considering these are high pressures and outside the ideal gas regime.
The target gas is Methane (CH4).

Test 1.jpg
 

Attachments

  • Test 1.jpg
    Test 1.jpg
    27.5 KB · Views: 353
  • #59
Are those pound moles or gram moles? What value of gamma did you use? What does the volume of the inlet gas refer to, and why is it equal to pi? What is the abscissa on the plot?
 
  • Like
Likes treddie
  • #60
What you see in that image is a quick run before I had made final fixes to the display of information. I went to bed before I could finish things up. To sum up:

"Are those pound moles or gram moles?"
Just gram-moles...Number of moles...6.02 X 10-23 molecules/per mole.

"What value of gamma did you use?"
Gamma = 1.4

"What does the volume of the inlet gas refer to, and why is it equal to pi?"
The two fields referring to volume of inlet gas and inlet pressure are unused...They showed up in the program because I was referring to old notes when I was building the program form, and I was still expecting to use ##(Pv)_{in}## instead of ##T_{in}(C_p - C_v)##. Those fields have now been deleted. Volume was equal to pi because it just happened to coincidentally come out that way. My unit inlet volume was a portion of the supply line enclosing a gas volume, 4" long X 1" dia., at 3600psi, 60 degF and held about .6 mole of molecules. Each one of those volumes would enter the tank at each time step. But with the ##(Pv)_{in}## approach now history, all of that stuff is now irrelevant.

"What is the abscissa on the plot?"
Abscissa is "Moles".
 
  • #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
  • #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: 279
  • #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: 279
  • #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: 847
  • Test 4 Ideal UpR.jpg
    Test 4 Ideal UpR.jpg
    27.3 KB · Views: 854
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: 495
  • #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).
 
  • #91
Are you confident that you are getting the correct answer now? If so, I think were done here, right?
 
  • #92
Yes! I notice that I get some elevated values from yours, but from my experience in programming, and the fact that I approached a part of the code slightly different than yours, that there is just a final little "something" I need to nail down. But I am confident that I will have this solved on my own very shortly.

So, sir...I want to thank you for your tremendous help on all of this. Thermo is one of my weak points, and I have a good grasp now on a portion of it. I had hoped that I would not have had to stretch this out so long, but my work schedule has been really tight these last months. Thanks for hanging in there with me!
 
  • #93
...and a little update. I found the cause of the disparity between your results and mine this afternoon. I had used the wrong coefficient in C_v = c * R. I had it set to the diatomic value of 2.5, and have changed it to 3.3. Now our results are identical to many decimal places.
 
  • Like
Likes Chestermiller
Back
Top