The assembled matrix starts with ki=1 (Section 4.3), when boundary condition to the West, see figure 6.1, is of level type. In that case, the first equation employed is (4.15) along with coefficients (4.17),
When boundary condition to the West is of flow type the matrix starts with ki=2. The first equation employed is then (4.16), along with coefficients (4.18).
Similarly, when we are at the East boundary ,kf=2m+1, where m is the total number of cells in the row, or kf=2m, corresponding to level and flow boundary conditions respectively.
As an example, the tridiagonal system to be solved looks like (4.27) for the case when East and West sides have both level boundary-condition.
The tridiagonal system to solve is (4.28), for the case when East and West borders sides have both flow boundary-condition.
What follows are the matrix layouts for the others two possible BC: level-flow (4.29) and flow-level (4.30).