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:

  1. Initialize. Set In=0.

  2. 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.

  3. Is there gas in this compressible volume? Is ITYPCV(Io) = 2,3,4,5, or 8? If so, go to step 5.

  4. 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.

  5. Gas in this compressible volume.

    In=In+1

    INEW(Io)=In

    IOLD(In)=Io

    p3(In)=p3(Io),m3(In)=m3(Io) ,

    V3(In)=V3(Io),V4(In)=V4(Io) ,

    τ(In)=τ(Io)

  6. End of loop on Io. Loop back to step 3 for the next value of Io.

  7. Inmax=In

  8. 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).

  1. Re-calculate p3(Io) giving.

    p3(In)=p3(In){1γ[V4(In)V3(In)V4(In)]}

    Calculate T3(In).

    Set c(In)=p3(In)γΔtsm3(In)T3(In)

    Also set c(I,J)=0, with c(In,In)=0,

    and d(In)=0.

  2. End of loop on In. Loop back to step 9 for the next value of In.

  3. Is there more than one gas compressible volume? Is Inmax>1? If so, go to step 13.

  4. Go to step 25.

  5. Start loop on I for I = 1, …, Inmax1.

Initialize eij, F1ij, F2ij.

  1. Start loop on J for J=In+1, …, Inmax

  2. 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

  3. End of loop on J. Loop back to step 11 for additional values of J.

  4. End of loop on I. Loop back to step 14 for additional values of I.

  5. Are there any gas segments? Is ISG1>0?

If not, go to step 25.

  1. Start loop on Is for Is = ISG1, …, ISG2.

Compute gas flow between compressible volumes.

  1. Find Ini and Ino, the inlet and outlet compressible volumes for gas segment Is.

    Ini=INEW(JNODG(1,Is))

    Ino=INEW(JNODG(2,Is))

  2. Iterate routine to obtain Fo, F1, F2, Tij (See remarks after Eq. (5.7-12)).

  3. F1(Ini,Ino)=F1(Ini,Ino)+F1

    F1(Ino,Ini)=F1(Ino,Ini)+F1

    F2(Ini,Ino)=F2(Ini,Ino)+F2

    F2(Ino,Ini)=F2(Ino,Inio)+F2

    c(Ino,Ino)=c(Ino,Ino)e(Ino)TijF1

    c(Ino,Ini)=c(Ino,Ini)e(Ino)TijF1

    c(Ini,Ini)=c(Ini,Ini)e(Ini)TijF2

    c(Ini,Ino)=c(Ini,Ino)e(Ini)TijF2

    d(Ino)=d(Ino)+e(Ino)TijF0

    d(Ini)=d(Ini)e(Ini)TijF0

    Fos(Ini)=Fos(Ino)+F0

    Fos(Ini)=Fos(Ino)F0

    Fos(Is)=F0

    Fs1(Is)=F1

    Fs2(Is)=F2

  4. End of loop on Is. Loop back to step 20 for the next value of Is.

  5. Solve the matrix equation for Δp(i) (see Eq. (5.7-20)).

  6. Start loop on In for In=1, … Inmax

  7. p4(I)=p3(I)+Δpi

    m4(I)=m3(I)+ΔtxFos(I)

  8. End of loop on In. Loop back to step 26 for additional values of In.

  9. If Inmax=1, go to step 34.

  10. Start loop on I for I = 1, …, Inmax1.

  11. Start loop on J for J = I+1, Inmax.

  12. m4(I)=m4(I)+Δts[F1(J,I)Δp(I)+F2(J,I)Δp(J)]

    m4(J)=m4(J)+Δts[F1(I,J)Δp(J)+F2(I,J)Δp(J)]

  13. End of loop on J. Loop back to step 31 for additional values of J.

  14. End of loop on I. Loop back to step 30 for additional values of I.

  15. For I=1, …, Inmax set

    T4(I)=p4(I)V4(I)n4(I)R

  16. Start loop on In for In=1, …, Inmax

  17. Io=IOLD(In)

    p3(Io)=p3(In)

    m3(Io)=m3(In)

    T3(Io)=T3(In)

  18. End of loop on In. Loop back to step 36 for additional values of Io.

  19. If ISG1=0, go to step 40.

  20. 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)

  21. Optional debugging print-out.

  22. Return