Cannot find the Temperature Change inside of a Tank

In summary: If the pressure is greater, then the volume of gas will be greater, and the pressure-volume product (PV) will be greater. Since the PV is a positive number, then the internal energy (U) will be increased.3. At some point, just like diffusion of dye in clear water, I would assume that mixing of high pressure gases would act similarly, but perhaps much quicker Diffusion of gases is a slow process. However, once the gases are mixed, the heat of gas exchange will cause the temperature of the gas mixture to rise.
  • #36
Interesting...I have gone through my steps and cannot find anything wrong. I ran it through Maple, but of course it went about it differently and came up with an equivalent to mine, if mine is indeed correct. Perhaps mine and yours are equivalent. At any rate, here is what I did:

##u_f - u_o = \frac{\Delta m}{m_o + \Delta m}(u_{in} - u_o) + \frac{\Delta m}{m_o + \Delta m}(Pv)_{in}##

The substitutions were:

##u_f - u_o = C_v(T_f - T_o) + a \left( \frac{1}{v_o} - \frac{1}{v_f} \right)##

##u_{in} - u_o = C_v(T_{in} - T_o) + a \left( \frac{1}{v_o} - \frac{1}{v_{in}} \right)##

Substituting,

##C_v(T_f - T_o) + a \left( \frac{1}{v_o} - \frac{1}{v_f} \right) = \frac{\Delta m}{m_o + \Delta m} \left(C_v(T_{in} - T_o) + a \left( \frac{1}{v_o} - \frac{1}{v_{in}} \right) \right)+ \frac{\Delta m}{m_o + \Delta m}(Pv)_{in}##

Simplifying,

##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##

I can show the intermediate steps if you want.
 
Science news on Phys.org
  • #37
treddie said:
Interesting...I have gone through my steps and cannot find anything wrong. I ran it through Maple, but of course it went about it differently and came up with an equivalent to mine, if mine is indeed correct. Perhaps mine and yours are equivalent. At any rate, here is what I did:

##u_f - u_o = \frac{\Delta m}{m_o + \Delta m}(u_{in} - u_o) + \frac{\Delta m}{m_o + \Delta m}(Pv)_{in}##

The substitutions were:

##u_f - u_o = C_v(T_f - T_o) + a \left( \frac{1}{v_o} - \frac{1}{v_f} \right)##

##u_{in} - u_o = C_v(T_{in} - T_o) + a \left( \frac{1}{v_o} - \frac{1}{v_{in}} \right)##

Substituting,

##C_v(T_f - T_o) + a \left( \frac{1}{v_o} - \frac{1}{v_f} \right) = \frac{\Delta m}{m_o + \Delta m} \left(C_v(T_{in} - T_o) + a \left( \frac{1}{v_o} - \frac{1}{v_{in}} \right) \right)+ \frac{\Delta m}{m_o + \Delta m}(Pv)_{in}##

Simplifying,

##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##

I can show the intermediate steps if you want.
Sorry. You're right. The two are equivalent. But, you also need to eliminate v0 and vf by using ##v_0=V/m_0## and ##v_f=V/m_v##, where V is the volume of the tank.
 
  • Like
Likes treddie
  • #38
DoH!

##T_f = \frac{\Delta m}{m_o + \Delta m} \left( T_{in} - T_o + \frac{a}{\frac{V}{m_o}C_v} - \frac{a}{v_{in}C_v} \right) + \frac{\Delta m}{m_o + \Delta m} \left( \frac{(Pv)_{in}}{C_v} \right) - \frac{a}{\frac{V}{m_o}C_v} + \frac{a}{\frac{V}{m_f}C_v} + T_o##

Now, in the Pv term, is "v" the specific volume of the inlet mass?
 
  • #39
treddie said:
DoH!

##T_f = \frac{\Delta m}{m_o + \Delta m} \left( T_{in} - T_o + \frac{a}{\frac{V}{m_o}C_v} - \frac{a}{v_{in}C_v} \right) + \frac{\Delta m}{m_o + \Delta m} \left( \frac{(Pv)_{in}}{C_v} \right) - \frac{a}{\frac{V}{m_o}C_v} + \frac{a}{\frac{V}{m_f}C_v} + T_o##

Now, in the Pv term, is "v" the specific volume of the inlet mass?
T_in, P_in and v_in are the values in the inlet line to the tank, upstream of the inlet valve. The change in gas enthalpy per mole across the inlet valve is zero.
 
  • Like
Likes treddie
  • #40
Cool. Thanks!
 
  • #41
treddie said:
Cool. Thanks!
Please solve for the ideal gas case first so that you have something to compare with. Just a good modeling practice.
 
  • Like
Likes treddie
  • #42
Chet, one thing. As I am preparing my variables and initial conditions (making sure my units are all consistent and correct) I have come to the term ##v_f##, the final specific volume, where ##v_f = \frac{V}{m_f}##. My confusion is about the nature of ##m_f##. I would assume that ##m_o + \Delta m## IS ##m_f##, unless we are iterating through from initial state to a final state in increments of ##\Delta m##. This would mean that ##m_f## is my stopping point. From the perspective of a programmer, that makes sense to me, but from a pure math point and the fact that we are dealing with an equation here, it bugs me. I feel I am missing something subtle here.
 
  • #43
treddie said:
Chet, one thing. As I am preparing my variables and initial conditions (making sure my units are all consistent and correct) I have come to the term ##v_f##, the final specific volume, where ##v_f = \frac{V}{m_f}##. My confusion is about the nature of ##m_f##. I would assume that ##m_o + \Delta m## IS ##m_f##, unless we are iterating through from initial state to a final state in increments of ##\Delta m##. This would mean that ##m_f## is my stopping point. From the perspective of a programmer, that makes sense to me, but from a pure math point and the fact that we are dealing with an equation here, it bugs me. I feel I am missing something subtle here.
##\Delta m## is the change in moles through any arbitrary time, not just the final time.
 
  • Like
Likes treddie
  • #44
I thought "m" and "##\Delta m##" were mass, and change in mass.

At any rate, this is what bugs me...It seems I could make ##m_f## arbitrarily high as well, thus "bracketing" the whole process into a specific final amount , ##m_f## that could get really huge, thus affecting the outcome. It seems like an irrelevant term in that I should not have to worry about ##m_f##...##\Delta m## should be able to get me as far as I want to go, meaning that ##m_o + \Delta m## would always equal ##m_f##. I know this does not have anything to do with the ideal case, but it IS going to be important in the real case.
 
  • #45
You can work in terms of m being mass, but it's easier to work in terms of moles. Of course, the two differ only by the molecular weight. But, if you are working in terms of moles, then, from the ideal gas law (i.e., at least for the case of an ideal gas), ##(Pv)_{in}=RT_{in}##. There is no need to bring molecular weight into the calculation if you work the problem in terms of moles.

Regarding the final mass (or moles) in the tank, there is an additional constraint on this problem that we haven't discussed. The pressure buildup in the tank can not be higher than the pressure in the inlet line. So you need a relationship describing the relationship between the molar (or mass) flow rate into the tank and the pressure drop across the inlet valve. I was sure you were aware of this.
 
  • Like
Likes treddie
  • #46
Your first point makes perfect sense. The second one makes sense in that, yes, the flow rate will drop as the back pressure increases if the line pressure remains constant, but that would be true for the ideal case as well. Yet no ##m_f## term exists in the ideal equation for ##T_f##.
 
  • #47
treddie said:
Your first point makes perfect sense. The second one makes sense in that, yes, the flow rate will drop as the back pressure increases if the line pressure remains constant, but that would be true for the ideal case as well. Yet no ##m_f## term exists in the ideal equation for ##T_f##.
Of course it does. mf is not just the moles inside the tank in the final state. It is the number of moles in the tank at any instant of time. And Tf is not just the moles inside the tank in the final state. it is the temperature in the tank at any time.
 
  • Like
Likes treddie
  • #48
Ahhhh, yes! Of course.

And I forgot to mention that I had always assumed in my model, a constant differential pressure between the line and the tank, so that the flow rate would remain constant. I went with that case only because filling, say a vehicle CNG tank, would get preposterously slow near the end of the tank fill, if the line pressure was constant and close to the final desired tank pressure. So I simplified my thought experiment by simply letting the delta pressure remain constant, and when a limit was given for the final tank pressure, the inlet valve would close.
 
  • #49
treddie said:
Let
##a = \frac{\Delta m} {m_o + \Delta m}##

Then,
##T_f = a(T_{in} - T_o) + \frac{a(Pv)_{in}}{C_v} + T_o##
Show that the solution to this is:
$$T_f=T_0+a(\gamma T_{in}-T_0)$$ where ##\gamma = C_p/C_v##, so that if you plot a graph of ##T_f## vs a, the value of Tf at a = 0 is To, and the value of Tf at a = 1 is ##\gamma T_{in}##.
 
  • Like
Likes treddie
  • #50
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)##
 
  • #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
  • #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: 330
  • #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: 255
  • #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: 255
  • #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.
 
Back
Top