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 \(I_{\text{n}} = 0\).

  2. Start a loop on \(I_{\text{o}}\) for \(I_{\text{o}}\) = \(\text{ICV}1\), …, \(\text{ICV}2\). Set up \(\text{INEW} \left( I_{\text{o}} \right)\), \(\text{IOLD} \left( I_{\text{n}} \right)\), where \(I_{\text{o}}\) is the old compressible volume number and \(I_{\text{n}}\) is the new compressible volume number for the compressed arrays.

  3. Is there gas in this compressible volume? Is \(\text{ITYPCV} \left( I_{\text{o}} \right)\) = 2,3,4,5, or 8? If so, go to step 5.

  4. No gas in this compressible volume. \(\text{INEW} \left( I_{\text{o}} \right) = 0\),

    \(p_{4} \left( I_{\text{o}} \right) = p_{3} \left( I_{\text{o}} \right)\),

    \(T_{4} \left( I_{\text{o}} \right) = T_{3} \left( I_{\text{o}} \right)\),

    \(m_{4} \left( I_{\text{o}} \right) = 0\). Go to the end of the loop, step 6.

  5. Gas in this compressible volume.

    \(I_{\text{n}} = I_{\text{n}} + 1\)

    \(\text{INEW} \left(I_{\text{o}} \right) = I_{\text{n}}\)

    \(\text{IOLD} \left(I_{\text{n}} \right) = I_{\text{o}}\)

    \({p'}_{3} \left( I_{\text{n}} \right) = p_{3} \left( I_{\text{o}} \right), {m'}_{3} \left( I_{\text{n}} \right) = m_{3} \left( I_{\text{o}} \right)\) ,

    \({V'}_{3} \left( I_{\text{n}} \right) = V_{3} \left( I_{\text{o}} \right), {V'}_{4} \left( I_{\text{n}} \right) = V_{4} \left( I_{\text{o}} \right)\) ,

    \(\tau' \left( I_{\text{n}} \right) = \tau \left( I_{\text{o}} \right)\)

  6. End of loop on \(I_{\text{o}}\). Loop back to step 3 for the next value of \(I_{\text{o}}\).

  7. \(I_{\text{nmax}} = I_{\text{n}}\)

  8. Start a loop on \(I_{\text{n}}\) for \(I_{\text{n}}\) = 1, …, \(I_{\text{nmax}}\)

Compute the adiabatic expansion and heat flow, as well as a temporary array \(c \left( i \right)\) (see below).

  1. Re-calculate \({p'}_{3} \left( I_{\text{o}} \right)\) giving.

    \({p'}_{3} \left( I_{\text{n}} \right) = {p'}_{3} \left( I_{\text{n}} \right) \left\{ 1 - \gamma \left\lbrack \frac{{V'}_{4} \left( I_{\text{n}} \right) - {V'}_{3} \left( I_{\text{n}} \right)}{{V'}_{4} \left( I_{\text{n}} \right)} \right\rbrack \right\}\)

    Calculate \({T'}_{3} \left( I_{\text{n}} \right)\).

    Set \(c \left( I_{\text{n}} \right) = \frac{{p'}_{3} \left( I_{\text{n}} \right)\gamma \Delta t_{\text{s}}}{{m'}_{3} \left( I_{\text{n}} \right) {T'}_{3} \left( I_{\text{n}} \right)}\)

    Also set \(c \left( I, J \right) = 0\), with \(c \left( I_{\text{n}}, I_{\text{n}} \right) = 0\),

    and \(d \left( I_{\text{n}} \right) = 0\).

  2. End of loop on \(I_{\text{n}}\). Loop back to step 9 for the next value of \(I_{\text{n}}\).

  3. Is there more than one gas compressible volume? Is \(I_{\text{nmax}} > 1\)? If so, go to step 13.

  4. Go to step 25.

  5. Start loop on I for I = 1, …, \(I_{\text{nmax}}-1\).

Initialize \(e_{\text{ij}}\), \(F_{1\text{ij}}\), \(F_{2\text{ij}}\).

  1. Start loop on \(J\) for \(J = I_{\text{n}} + 1\), …, \(I_{\text{nmax}}\)

  2. Set \(c \left( I,J \right) = 0.0\), \(c \left( J,I \right) = 0.0\), \(F_{1} \left( I,J \right) = 0.0\), \(F_{1} \left( J,I \right) = 0.0\), \(F_{2} \left( I,J \right) = 0.0\), \(F_{2} \left( J,I \right) = 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 \(\text{ISG} 1 > 0\)?

If not, go to step 25.

  1. Start loop on \(I_{\text{s}}\) for \(I_{\text{s}}\) = \(\text{ISG}1\), …, \(\text{ISG}2\).

Compute gas flow between compressible volumes.

  1. Find \(I_{\text{ni}}\) and \(I_{\text{no}}\), the inlet and outlet compressible volumes for gas segment \(I_{\text{s}}\).

    \(I_{\text{ni}} = \text{INEW} \left( \text{JNODG} \left( 1,I_{\text{s}} \right) \right)\)

    \(I_{\text{no}} = \text{INEW} \left( \text{JNODG} \left( 2,I_{\text{s}} \right) \right)\)

  2. Iterate routine to obtain \({F'}_{\text{o}},\ {F'}_{1},\ {F'}_{2},\ T_{\text{ij}}\) (See remarks after Eq. (5.7-12)).

  3. \(F_{1} \left( I_{\text{ni}},I_{\text{no}} \right) = F_{1} \left( I_{\text{ni}},I_{\text{no}} \right) + {F'}_{1}\)

    \(F_{1} \left( I_{\text{no}},I_{\text{ni}} \right) = F_{1} \left( I_{\text{no}},I_{\text{ni}} \right) + {F'}_{1}\)

    \(F_{2} \left( I_{\text{ni}},I_{\text{no}} \right) = F_{2} \left( I_{\text{ni}},I_{\text{no}} \right) + {F'}_{2}\)

    \(F_{2} \left( I_{\text{no}},I_{\text{ni}} \right) = F_{2} \left( I_{\text{no}},I_{\text{nio}} \right) + {F'}_{2}\)

    \(c \left( I_{\text{no}},I_{no} \right) = c \left( I_{\text{no}},I_{\text{no}} \right) - e\left( I_{\text{no}} \right) T_{\text{ij}} {F'}_{1}\)

    \(c \left( I_{\text{no}},I_{\text{ni}} \right) = c \left( I_{\text{no}},I_{\text{ni}} \right) - e\left( I_{\text{no}} \right) T_{\text{ij}} {F'}_{1}\)

    \(c \left( I_{\text{ni}},I_{\text{ni}} \right) = c \left( I_{\text{ni}},I_{\text{ni}} \right) - e\left( I_{\text{ni}} \right) T_{\text{ij}} {F'}_{2}\)

    \(c \left( I_{\text{ni}},I_{\text{no}} \right) = c \left( I_{\text{ni}},I_{\text{no}} \right) - e\left( I_{\text{ni}} \right) T_{\text{ij}} {F'}_{2}\)

    \(d \left( I_{\text{no}} \right) = d \left( I_{\text{no}} \right) + e\left( I_{\text{no}} \right) T_{\text{ij}} {F'}_{0}\)

    \(d \left( I_{\text{ni}} \right) = d \left( I_{\text{ni}} \right) - e\left( I_{\text{ni}} \right) T_{\text{ij}} {F'}_{0}\)

    \(F_{\text{os}} \left( I_{\text{ni}} \right) = F_{\text{os}} \left( I_{\text{no}} \right) + {F'}_{0}\)

    \(F_{\text{os}} \left( I_{\text{ni}} \right) = F_{\text{os}} \left( I_{\text{no}} \right) - {F'}_{0}\)

    \(F_{\text{os}} \left( I_{\text{s}} \right) = {F'}_{0}\)

    \(F_{\text{s}1} \left( I_{\text{s}} \right) = {F'}_{1}\)

    \(F_{\text{s}2} \left( I_{\text{s}} \right) = {F'}_{2}\)

  4. End of loop on \(I_{\text{s}}\). Loop back to step 20 for the next value of \(I_{\text{s}}\).

  5. Solve the matrix equation for \(\Delta p \left( i \right)\) (see Eq. (5.7-20)).

  6. Start loop on \(I_{\text{n}}\) for \(I_{\text{n}} = 1\), … \(I_{\text{nmax}}\)

  7. \({p'}_{4}\left( I \right) = {p'}_{3}\left( I \right) + \Delta p_{\text{i}}\)

    \({m'}_{4}\left( I \right) = {m'}_{3}\left( I \right) + \Delta t_{\text{x}} F_{\text{os}}\left( I \right)\)

  8. End of loop on \(I_{\text{n}}\). Loop back to step 26 for additional values of \(I_{\text{n}}\).

  9. If \(I_{\text{nmax}} = 1\), go to step 34.

  10. Start loop on \(I\) for \(I\) = 1, …, \(I_{\text{nmax}}-1\).

  11. Start loop on \(J\) for \(J\) = \(I + 1\), \(I_{\text{nmax}}\).

  12. \({m'}_{4} \left( I \right) = {m'}_{4} \left( I \right) + \Delta t_{\text{s}} \left\lbrack F_{1}\left( J,I \right)\Delta p\left( I \right) + F_{2}\left( J,I \right)\Delta p\left( J \right) \right\rbrack\)

    \({m'}_{4} \left( J \right) = {m'}_{4} \left( J \right) + \Delta t_{\text{s}} \left\lbrack F_{1}\left( I,J \right)\Delta p\left( J \right) + F_{2}\left( I,J \right)\Delta p\left( J \right) \right\rbrack\)

  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\), …, \(I_{\text{nmax}}\) set

    \({T'}_{4} \left( I \right) = \frac{{p'}_{4} \left( I \right) {V'}_{4} \left( I \right)}{{n'}_{4} \left( I \right)R}\)

  16. Start loop on \(I_{\text{n}}\) for \(I_{\text{n}} = 1\), …, \(I_{\text{nmax}}\)

  17. \(I_{o} = \text{IOLD}\left( I_{n} \right)\)

    \(p_{3}\left( I_{o} \right) = {p'}_{3} \left( I_{n} \right)\)

    \(m_{3}\left( I_{o} \right) = {m'}_{3} \left( I_{n} \right)\)

    \(T_{3}\left( I_{o} \right) = {T'}_{3} \left( I_{n} \right)\)

  18. End of loop on \(I_{\text{n}}\). Loop back to step 36 for additional values of \(I_{\text{o}}\).

  19. If \(\text{ISG}1 = 0\), go to step 40.

  20. For \(I_{\text{s}} = \text{ISG}1\), …, \(\text{ISG}2\)

    \(I_{1} = \text{INEW}\left( \text{JNODG}\left( 1,I_{\text{s}} \right) \right)\)

    \(I_{2} = \text{INEW}\left( \text{JNODG}\left( 2,I_{\text{s}} \right) \right)\)

    \(F_{\text{g}4}\left( I_{\text{s}} \right) = F_{\text{so}}\left( I_{\text{s}} \right) + F_{\text{s}1}\left( I_{\text{s}} \right)\Delta p\left( I_{2} \right) = F_{\text{s}2}\left( I_{\text{s}} \right)\Delta p\left( I_{1} \right)\)

  21. Optional debugging print-out.

  22. Return