5.16.3. Appendix 5.3: Cover Gas Flow and Pressure Algorithm
The main steps in the cover gas treatment in Section 5.7 may be summarized in the following algorithm:
Initialize. Set In=0.
Start a loop on Io for Io = ICV1, …, ICV2. Set up INEW(Io), IOLD(In), where Io is the old compressible volume number and In is the new compressible volume number for the compressed arrays.
Is there gas in this compressible volume? Is ITYPCV(Io) = 2,3,4,5, or 8? If so, go to step 5.
No gas in this compressible volume. INEW(Io)=0,
p4(Io)=p3(Io),
T4(Io)=T3(Io),
m4(Io)=0. Go to the end of the loop, step 6.
Gas in this compressible volume.
In=In+1
INEW(Io)=In
IOLD(In)=Io
p′3(In)=p3(Io),m′3(In)=m3(Io) ,
V′3(In)=V3(Io),V′4(In)=V4(Io) ,
τ′(In)=τ(Io)
End of loop on Io. Loop back to step 3 for the next value of Io.
Inmax=In
Start a loop on In for In = 1, …, Inmax
Compute the adiabatic expansion and heat flow, as well as a temporary array c(i) (see below).
Re-calculate p′3(Io) giving.
p′3(In)=p′3(In){1−γ[V′4(In)−V′3(In)V′4(In)]}
Calculate T′3(In).
Set c(In)=p′3(In)γΔtsm′3(In)T′3(In)
Also set c(I,J)=0, with c(In,In)=0,
and d(In)=0.
End of loop on In. Loop back to step 9 for the next value of In.
Is there more than one gas compressible volume? Is Inmax>1? If so, go to step 13.
Go to step 25.
Start loop on I for I = 1, …, Inmax−1.
Initialize eij, F1ij, F2ij.
Start loop on J for J=In+1, …, Inmax
Set c(I,J)=0.0, c(J,I)=0.0, F1(I,J)=0.0, F1(J,I)=0.0, F2(I,J)=0.0, F2(J,I)=0.0
End of loop on J. Loop back to step 11 for additional values of J.
End of loop on I. Loop back to step 14 for additional values of I.
Are there any gas segments? Is ISG1>0?
If not, go to step 25.
Start loop on Is for Is = ISG1, …, ISG2.
Compute gas flow between compressible volumes.
Find Ini and Ino, the inlet and outlet compressible volumes for gas segment Is.
Ini=INEW(JNODG(1,Is))
Ino=INEW(JNODG(2,Is))
Iterate routine to obtain F′o, F′1, F′2, Tij (See remarks after Eq. (5.7-12)).
F1(Ini,Ino)=F1(Ini,Ino)+F′1
F1(Ino,Ini)=F1(Ino,Ini)+F′1
F2(Ini,Ino)=F2(Ini,Ino)+F′2
F2(Ino,Ini)=F2(Ino,Inio)+F′2
c(Ino,Ino)=c(Ino,Ino)−e(Ino)TijF′1
c(Ino,Ini)=c(Ino,Ini)−e(Ino)TijF′1
c(Ini,Ini)=c(Ini,Ini)−e(Ini)TijF′2
c(Ini,Ino)=c(Ini,Ino)−e(Ini)TijF′2
d(Ino)=d(Ino)+e(Ino)TijF′0
d(Ini)=d(Ini)−e(Ini)TijF′0
Fos(Ini)=Fos(Ino)+F′0
Fos(Ini)=Fos(Ino)−F′0
Fos(Is)=F′0
Fs1(Is)=F′1
Fs2(Is)=F′2
End of loop on Is. Loop back to step 20 for the next value of Is.
Solve the matrix equation for Δp(i) (see Eq. (5.7-20)).
Start loop on In for In=1, … Inmax
p′4(I)=p′3(I)+Δpi
m′4(I)=m′3(I)+ΔtxFos(I)
End of loop on In. Loop back to step 26 for additional values of In.
If Inmax=1, go to step 34.
Start loop on I for I = 1, …, Inmax−1.
Start loop on J for J = I+1, Inmax.
m′4(I)=m′4(I)+Δts[F1(J,I)Δp(I)+F2(J,I)Δp(J)]
m′4(J)=m′4(J)+Δts[F1(I,J)Δp(J)+F2(I,J)Δp(J)]
End of loop on J. Loop back to step 31 for additional values of J.
End of loop on I. Loop back to step 30 for additional values of I.
For I=1, …, Inmax set
T′4(I)=p′4(I)V′4(I)n′4(I)R
Start loop on In for In=1, …, Inmax
Io=IOLD(In)
p3(Io)=p′3(In)
m3(Io)=m′3(In)
T3(Io)=T′3(In)
End of loop on In. Loop back to step 36 for additional values of Io.
If ISG1=0, go to step 40.
For Is=ISG1, …, ISG2
I1=INEW(JNODG(1,Is))
I2=INEW(JNODG(2,Is))
Fg4(Is)=Fso(Is)+Fs1(Is)Δp(I2)=Fs2(Is)Δp(I1)
Optional debugging print-out.
Return