Energy Balance on Pressurizing a Tank

CaptionResourceCreateNotebook

A gas flows through a pipe into an insulated tank (0.1 (m^3)) that is initially at a lower pressure and at a different temperature. Click the "valve (open)" play button to start gas flow into the tank; the valve closes when the pressures equalize. The tank initially contains either an ideal gas ((Subscript[N, 2])) and more (Subscript[N, 2]) is added, or it contains a vapor-liquid mixture of water and superheated steam is added. Sliders change the pipe pressure and temperature and the initial tank pressure. The initial mass of water in the tank is 1 kg and that does not change when the initial tank pressure is changed with the slider. Initially the tank is at the saturation temperature of water at the initial pressure. Use the "valve (reset)" button to go back to the initial conditions before the valve was opened.

Initialization CodeResourceCreateNotebook

VL=Interpolation[{(*{"Pressure (bar)","volume L (m3/kg)"},*){0.01,0.001},{0.011,0.0010024},{0.014,0.0010048},{0.016,0.0010072},{0.018,0.0010096},{0.02,0.0010120},{0.03,0.0010144},{0.04,0.0010168},{0.06,0.0010192},{0.08,0.0010216},{0.1,0.001024},{0.12,0.0010264},{0.14,0.0010288},{0.16,0.0010312},{0.18,0.0010336},{0.2,0.001036},{0.3,0.0010384},{0.4,0.0010408},{0.6,0.0010432},{0.8,0.0010456},{1.,0.001048},{1.2,0.0010504},{1.40,0.0010528},{1.6,0.0010552},{1.7999,0.0010576},{2.,0.00106},{3.,0.00107},{4.,0.00108},{6.,0.0011},{8.,0.00112},{10.,0.00113},{12.,0.00114},{14.,0.00115},{16.,0.00116},{18.,0.00117},{20.,0.00118},{30.,0.00122},{40.,0.00125},{60.,0.00132},{80.,0.00139},{100.,0.00145},{120.,0.00153},{140.,0.00161},{160.,0.00171},{180.,0.00184},{200.,0.00204}}];
VV=Interpolation[{(*{"Pressure (bar)","volume V (m3/kg)"},*){0.01,129.18},{0.011999,108.67},{0.014,93.9},{0.016,82.74},{0.018,74.01},{0.02,66.99},{0.03,45.65},{0.04,34.79},{0.06,23.73},{0.08,18.1},{0.1,14.67},{0.12,12.36},{0.14,10.69},{0.16,9.431},{0.18,8.443},{0.2,7.648},{0.3,5.228},{0.4,3.993},{0.6,2.732},{0.8,2.087},{1.,1.694},{1.2,1.428},{1.4,1.2366},{1.6,1.0914},{1.7998,0.9775},{2.,0.8857},{3.,0.6058},{4.,0.4624},{6.,0.3156},{8.,0.2403},{10.,0.1944},{12.,0.1633},{14.,0.1408},{16.,0.1237},{18.,0.1104},{20.,0.0996},{30.,0.0667},{40.,0.0498},{60.,0.0325},{80.,0.0235},{100.,0.018},{120.,0.0143},{140.,0.0115},{160.,0.0093},{180.,0.0075},{200.,0.0059}}];

TP=Interpolation[{(*{"P (bar)","T (degC)"},*){1(*.0142*),100.},{1.4338,110.},{1.9867,120.},{2.7028,130.},{3.6154,140.},{4.7616,150.},{6.1823,160.},{7.9219,170.},{10.028,180.},{12.552,190.},{15.549,200.},{19.077,210.},{23.196,220.},{27.971,230.},{33.469,240.},{39.762,250.}}];

UL=Interpolation[{(*{"P (bar)","UL (kJ/kg)"},*){1.,417.4},{1.2,439.2},{1.4,458.3},{1.6,475.2},{1.7998,490.5},{2.,504.5},{3.,561.1},{4.,604.2},{6.,669.7},{8.,720.},{10.,761.4},{12.,797.},{14.,828.4},{16.,856.6}}];
UV=Interpolation[{(*{"P (bar)","UV (kJ/kg)"},*){1.,2505.6},{1.2,2511.7},{1.4,2516.9},{1.6,2521.4},{1.7998,2525.5},{2.,2529.1},{3.,2543.2},{4.,2553.1},{6.,2566.8},{8.,2576.},{10.,2582.7},{12.,2587.8},{14.,2591.8},{16.,2594.8}}];

H5=Interpolation[{(*{"T (degC)_5","H (kJ/kg)"},*){155.,2755.7},{160.,2767.4},{165.,2778.9},{170.,2790.2},{175.,2801.4},{180.,2812.4},{185.,2823.4},{190.,2834.3},{195.,2845.1},{200.,2855.8},{210.,2877.2},{220.,2898.3},{230.,2919.3},{240.,2940.2},{250.,2961.}}];
H6=Interpolation[{(*{"T (degC)_6","H (kJ/kg)"},*){155.,653.82},{160.,2759.},{165.,2771.},{170.,2783.},{175.,2794.},{180.,2806.},{185.,2817.},{190.,2828.},{195.,2839.},{200.,2850.},{210.,2872.},{220.,2893.},{230.,2915.},{240.,2936.},{250.,2957.}}];
H7=Interpolation[{(*{"T (degC)_7","H (kJ/kg)"},*){155.,653.88},{160.,675.52},{165.,2762.9},{170.,2775.4},{175.,2787.5},{180.,2799.4},{185.,2811.1},{190.,2822.6},{195.,2834.},{200.,2845.3},{210.,2867.5},{220.,2889.5},{230.,2911.2},{240.,2932.7},{250.,2954.}}];
H8=Interpolation[{(*{"T (degC)_8","H (kJ/kg)"},*){155.,653.94},{160.,675.58},{165.,697.29},{170.,719.09},{175.,2780.},{180.,2792.4},{185.,2804.6},{190.,2816.5},{195.,2828.2},{200.,2839.7},{210.,2862.5},{220.,2884.9},{230.,2907.},{240.,2928.8},{250.,2950.4}}];
H9=Interpolation[{(*{"T (degC)_9","H (kJ/kg)"},*){155.,654.},{160.,675.64},{165.,697.35},{170.,719.14},{175.,741.02},{180.,2785.2},{185.,2797.8},{190.,2810.1},{195.,2822.2},{200.,2834.1},{210.,2857.4},{220.,2880.3},{230.,2902.7},{240.,2924.9},{250.,2946.8}}];
H10=Interpolation[{(*{"T (degC)_10","H (kJ/kg)"},*){155.,654.06},{160.,675.7},{165.,697.41},{170.,719.2},{175.,741.08},{180.,2777.4},{185.,2790.7},{190.,2803.5},{195.,2816.},{200.,2828.3},{210.,2852.2},{220.,2875.5},{230.,2898.4},{240.,2920.9},{250.,2943.1}}];
H11=Interpolation[{(*{"T (degC)_11","H (kJ/kg)"},*){155.,654.12},{160.,675.75},{165.,697.46},{170.,719.25},{175.,741.13},{180.,763.1},{185.,2783.2},{190.,2796.6},{195.,2809.6},{200.,2822.3},{210.,2846.8},{220.,2870.7},{230.,2894.},{240.,2916.8},{250.,2939.4}}];
H12=Interpolation[{(*{"T (degC)_12","H (kJ/kg)"},*){155.,654.18},{160.,675.81},{165.,697.52},{170.,719.31},{175.,741.18},{180.,763.15},{185.,785.23},{190.,2789.4},{195.,2803.},{200.,2816.1},{210.,2841.3},{220.,2865.7},{230.,2889.5},{240.,2912.7},{250.,2935.6}}];
H13=Interpolation[{(*{"T (degC)_13","H (kJ/kg)"},*){155.,654.24},{160.,675.87},{165.,697.57},{170.,719.36},{175.,741.23},{180.,763.2},{185.,785.27},{190.,807.45},{195.,2796.},{200.,2809.6},{210.,2835.7},{220.,2860.7},{230.,2884.9},{240.,2908.5},{250.,2931.8}}];
H14=Interpolation[{(*{"T (degC)_14","H (kJ/kg)"},*){155.,654.3},{160.,675.93},{165.,697.63},{170.,719.42},{175.,741.29},{180.,763.25},{185.,785.32},{190.,807.5},{195.,829.79},{200.,2803.},{210.,2829.9},{220.,2855.5},{230.,2880.2},{240.,2904.3},{250.,2927.9}}];
H15=Interpolation[{(*{"T (degC)_15","H (kJ/kg)"},*){155.,654.36},{160.,675.99},{165.,697.69},{170.,719.47},{175.,741.34},{180.,763.3},{185.,785.37},{190.,807.54},{195.,829.83},{200.,2796.},{210.,2823.9},{220.,2850.2},{230.,2875.5},{240.,2900.},{250.,2923.9}}];

fspring[r0_,y10_,y20_]:=Module[{n,h,xvalues,yvalues},
n=100;
h=(y20-y10)/n;
xvalues=Table[k,{k,y10,y20,h}];
yvalues=Table[r0 Sin[m Pi/2],{m,0,n}];
Line[Transpose@{xvalues,yvalues}]];

ManipulateResourceCreateNotebook

Manipulate[
Module[{go,V1,q1,T1r,U1,Vf,qf,Tfr,Uf,H2,mf,qfinal,R,V,ni,Tref,Cv,Ui,Hin,Ufi,nf,Tfinal,spring,rg,ig,tank,MCR},
go=If[bmth==1,go1,go2];
(*NON-IDEAL*)
V1=0.1;(*m3/kg*)
q1=(V1-VL[P1r])/(VV[P1r]-VL[P1r]);(*initial quality in tank*)

T1r=TP[P1r];(*°C*)
U1=q1*UV[P1r]+(1-q1)*UL[P1r];

Vf=V1/(1+m2);(*final specific volume*)
qf=(Vf-VL[P2r])/(VV[P2r]-VL[P2r]);(*final steam quality in tank*)
Tfr=TP[P2r];(*saturation temp at P2*)
Uf=qf*UV[P2r]+(1-qf)*UL[P2r];

H2=Which[P2r==5,H5[T2r],P2r==6,H6[T2r],P2r==7,H7[T2r],P2r==8,H8[T2r],P2r==9,H9[T2r],P2r==10,H10[T2r],P2r==11,H11[T2r],P2r==12,H12[T2r],P2r==13,H13[T2r],P2r==14,H14[T2r],P2r==15,H15[T2r]];

mf=m2/.FindRoot[(1+m2)*Uf-U1==m2*H2,{m2,0}];

qfinal=q1+Abs[(q1-Evaluate[qf/.m2->mf])]*go;

(*IDEAL*)
R=0.08314;(*bar L/mol/K*)
V=5;(*L*)
ni=((P1i*V)/(R*(T1i+273)));
Tref=T2i;
Cv=21.7;
Ui=Cv*(T1i-Tref);
Hin=R*100*(T2i+273);
Ufi=Cv*(tf-T2i);
nf=((P2i*V)/(R*(tf+273)));
Tfinal=Quiet[tf/.FindRoot[ni*Ui+(nf-ni)*Hin==nf*Ufi,{tf,100}]];

spring=Graphics[{Thick,Darker[Gray,0.5],fspring[0.04,0,1.5]},PlotRange->{{0,2.25},{-1,1}}];

rg=Graphics[{
Text[Style[Column[{
Row[{Subscript[Style["P",Italic],2]," = ",NumberForm[P2r,2]," bar"}],
Row[{Subscript[Style["T",Italic],2]," = ",NumberForm[T2r,3]," °C"}]
}],18],{-1.15,-0.75}],
Text[Style[Column[{
Row[{Subscript[Style["P",Italic],1]," = ",NumberForm[P1r+(P2r-P1r)*go,2]," bar"}],
Row[{Subscript[Style["T",Italic],1]," = ",NumberForm[T1r+(Tfr-T1r)*go,3]," °C"}]
}],18],{0,-4}]}];

ig=Graphics[{
Text[Style[Column[{
Row[{Subscript[Style["P",Italic],2]," = ",P2i," bar"}],
Row[{Subscript[Style["T",Italic],2]," = ",T2i," °C"}]
}],18],{-1.15,-0.75}],
Text[Style[Column[{
Row[{Subscript[Style["P",Italic],1]," = ",NumberForm[P1i+(P2i-P1i)*go,{2,0}]," bar"}],
Row[{Subscript[Style["T",Italic],1]," = ",NumberForm[T1i+(Tfinal-T1i)*go,3]," °C"}]
}],18],{2.75,-4}]}];

tank=Rasterize@Graphics3D[{
{Opacity[0.6],Cylinder[{{0,0,0},{0,0,3}},2]},
{Darker[Gray,0.3],Cylinder[{{0,0,2.75},{0,0,3}},2]},
If[bmth==1,
{{Opacity[0.6],Lighter[RGBColor[0,0.52,0.8],0.2],Cylinder[{{0,0,0},{0,0,(1-qfinal)*2.75}},2]},
{Opacity[0.6],Lighter[RGBColor[0,0.8,0.2],0.2],Cylinder[{{0,0,(1-qfinal)*2.75},{0,0,2.75}},2]}},
{Opacity[0.6],RGBColor[0.99,1.,0.16],Cylinder[{{0,0,0},{0,0,2.75}},2]}],
If[bmth==1,
{If[qfinal<0.99,Text[Style[Row[{NumberForm[100*(1-qfinal),2],"% liquid"}],18],{0,0,0.5*(1-qfinal)*2.75}]],
If[qfinal>0.2,If[qfinal>0.001,Text[Style[Row[{NumberForm[100*qfinal,2],"% vapor"}],18],{0,0,2.75-0.25*qfinal*2.75}]]]}]
},ImageSize->2.3 225,Boxed->False,ViewPoint->Front,Lighting->{{"Ambient",LightGray}},PlotRange->{All,All,{0,3}}];

MCR=Graphics[{
{Opacity[0.2],RGBColor[0,0.87,0.48],
Polygon[{{0,-0.5},{5,-0.5},{5,-1},{0,-1}}],Polygon[{{3,-1},{3,-1.5},{4,-1.5},{4,-2.25},{3,-2.25},{3,-3},{2.5,-3},{2.5,-1}}]},
If[go==1,Text[Style["pressure equalized",18],{2.75,-0.75}]],
{Thick,Arrowheads[0.03],Arrow[{{-0.25,-0.75},{1,-0.75}}],Arrow[{{4,-0.75},{5.25,-0.75}}]},
Inset[spring,{If[go≤0.5,4.05+go,4.55-0.5*go],-1.85}],
{Gray,Polygon[{{If[go≤0.5,2.85+go,3.35-0.5*go],-2.025},{If[go≤0.5,2.85+go,3.35-0.5*go],-1.675},{If[go≤0.5,2.55+go,3.05-0.5*go],-1.775},{If[go≤0.5,2.55+go,3.05-0.5*go],-1.925}}]},
{Gray,Thickness[0.013],Line[{{If[go≤0.5,4.49+go,4.99-0.5*go],-2.25},{If[go≤0.5,4.49+go,4.99-0.5*go],-1.5}}]},
{Darker[Gray,0.3],Thickness[0.015],
Line[{{0,-0.5},{5,-0.5}}],Line[{{5,-1},{3,-1},{3,-1.5},{4,-1.5},{4,-2.25},{3,-2.25},{3,-3}}],Line[{{2.5,-3},{2.5,-1},{0,-1}}],Line[{{3,-1.5},{2.75,-1.5},{2.75,-1.65}}],Line[{{2.5,-2.25},{2.75,-2.25},{2.75,-2.05}}]},
Inset[tank,{2.75,-4}]
}];

Show[MCR,Switch[bmth,1,rg,2,ig],PlotRange->{{-2.25,5.25},{-5.25,0.05}},ImageSize->{600,380}]
],
PaneSelector[{
1->Grid[{
{Control[{{bmth,1,""},{1->" water ",2->Row@{" ideal gas (",Subscript["N",2],") "}},Setter}],
Control[{{go1,0,"valve (open/reset)"},0,1,Trigger,AnimationRate->0.5}]},
{Control[{{P2r,10,Row[{"pipe pressure ",Subscript[Style["P",Italic],2]," (bar)"}]},5,15,1,Appearance->"Labeled",ImageSize->Small}],Control[{{P1r,4,Row[{"initial tank pressure ",Subscript[Style["P",Italic],1]," (bar)"}]},1,4,0.1,Appearance->"Labeled",ImageSize->Small}]},
{Control[{{T2r,200,Row[{"pipe temperature ",Subscript[Style["T",Italic],2]," (°C)"}]},200,250,1,Appearance->"Labeled",ImageSize->Small}]}
},Alignment->Left],
2->Grid[{
{Control[{{bmth,1,""},{1->" water ",2->Row@{" ideal gas (",Subscript["N",2],") "}},SetterBar}],
Control[{{go2,0,"valve (open/reset)"},0,1,Trigger,AnimationRate->0.5}]},
{Control[{{P2i,15,Row[{"pipe pressure ",Subscript[Style["P",Italic],2]," (bar)"}]},5,15,1,Appearance->"Labeled",ImageSize->Small}],
Control[{{P1i,1,Row[{"initial tank pressure ",Subscript[Style["P",Italic],1]," (bar)"}]},1,4,0.1,Appearance->"Labeled",ImageSize->Small}]},
{Control[{{T2i,150,Row[{"pipe temperature ",Subscript[Style["T",Italic],2]," (°C)"}]},150,250,5,Appearance->"Labeled",ImageSize->Small}],
Control[
{{T1i,200,Row[{"initial tank temperature ",Subscript[Style["T",Italic],1]," (°C)"}]},155,250,5,Appearance->"Labeled",ImageSize->Small}]}
},Alignment->Left]
},Dynamic@bmth],
SaveDefinitions->True]

SnapshotsResourceCreateNotebook

Source & Additional Information

Contributed By:ResourceCreateNotebook

Rachael L. Baumann

John L. Falconer

Derek Machalek

DetailsResourceCreateNotebook

Energy Balance

(Subscript[m, 1]) (Subscript[U, 1])+(Subscript[m, 2]) (Subscript[H, 2])=(Subscript[m, final]) (Subscript[U, final])=((Subscript[m, 1])+(Subscript[m, 2])) (Subscript[U, final]),

where the subscript 1 refers to what is initially inside the tank, 2 refers to what is added or in the line, m is mass (kg), U is the internal energy (kJ/kg), and H is enthalpy (kJ/kg).

For a Non-Ideal System, Using Water

(Subscript[m, final])=(Subscript[m, 1])+(Subscript[m, 2]).

Since two phases are present in the tank at all times, the quality of the steam needs to be calculated:

(Subscript[q, 1])=((((Subscript[V, 1])/(Subscript[m, 1]))-(Subscript[V, 1]^L))/((Subscript[V, 1]^V)-(Subscript[V, 1]^L))),

(Subscript[U, 1])=(Subscript[q, 1]) (Subscript[U, 1]^V)+(1-(Subscript[q, 1])) (Subscript[U, 1]^L),

(Subscript[m, 2]) (Subscript[H, 2])=(Subscript[m, 2]) (Subscript[H, 2]^V),

where the superscripts L and V refer to the specific liquid and vapor properties (per kg), (Subscript[V, 1]) is the volume of the tank ((m^3)), (Subscript[m, 2]) is the mass of steam added to the tank from the line, and (Subscript[H, 2]) is the enthalpy at the line temperature (Subscript[T, 2]) and pressure (Subscript[P, 2]). The value (Subscript[m, 2]) is unknown; it has to be solved for in order to evaluate the conditions of the system.

(Subscript[q, final])=(((((Subscript[V, 1])/((Subscript[m, 1])+(Subscript[m, 2]))))-(Subscript[V, 2]^L))/((Subscript[V, 2]^V)-(Subscript[V, 2]^L))),

(Subscript[U, final])=(Subscript[q, final]) (Subscript[U, 2]^V)+(1-(Subscript[q, final])) (Subscript[U, 2]^L).

Now these expressions can be substituted into the energy balance (remember (Subscript[m, final])=(Subscript[m, 1])+(Subscript[m, 2])) and solved for (Subscript[m, 2]).

Since two phases are present in the tank, the final temperature of the system is the saturation temperature at the final pressure (Subscript[P, 2]).

For an Ideal Gas System

The number of moles (Subscript[n, 1]) initially in the tank can be calculated using the ideal gas law:

(Subscript[n, 1])=(((Subscript[P, 1]) V)/(R (Subscript[T, 1]))).

The internal energy and enthalpy are found by defining a reference point (Subscript[T, ref]).

At (Subscript[T, ref]), (Subscript[U, ref])=0,

(Subscript[U, 1])=(Subscript[U, ref])+Cv ((Subscript[T, 1])-(Subscript[T, ref]))=Cv ((Subscript[T, 1])-(Subscript[T, ref])),

(Subscript[U, final])=(Subscript[U, ref])+Cv ((Subscript[T, final])-(Subscript[T, 2]))=Cv ((Subscript[T, final])-(Subscript[T, 2])),

(Subscript[H, 2])=(Subscript[H, ref])=(Subscript[U, ref])+R (Subscript[T, 2]).

The number of moles in the tank at equilibrium (Subscript[n, final]) can also be calculated using the ideal gas law:

(Subscript[n, final])=(((Subscript[P, final]) V)/(R (Subscript[T, final])))=(((Subscript[P, 2]) V)/(R (Subscript[T, final]))).

This equation can be substituted into the energy balance to solve for the final temperature (Subscript[T, final]).

(Subscript[n, 1]) (Subscript[U, 1])+((Subscript[n, final])-(Subscript[n, 1])) (Subscript[H, 2])=(Subscript[n, final]) (Subscript[U, 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 line, 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 (°C), U is internal energy (J/mol), Cv is the constant-volume heat capacity for an ideal gas (J/[mol K]), and H is enthalpy (J/mol).

The screencast video at[1] explains how to use this Demonstration.

References & CitationsResourceCreateNotebook

[1] Energy Balance on Pressurizing a Tank. www.colorado.edu/learncheme/thermodynamics/EnergyBalancePressurizingTank.html.

Submission NotesResourceCreateNotebook

Additional information for the reviewer.

KeywordsResourceCreateNotebook

chemical engineering

mechanical engineering

thermodynamics

vapor-liquid equilibrium

ideal gas

fill tank

unsteady-state energy balance

CategoriesResourceCreateNotebook

Related DemonstrationsResourceCreateNotebook

Link to a related Demonstration

LinksResourceCreateNotebook

Link to other related material

CompatibilityResourceCreateNotebook

Wolfram Language VersionResourceCreateNotebook

14.3+

Cloud SupportResourceCreateNotebook

AR SupportResourceCreateNotebook