With the flux components and at all mid interval points and (see in Figure 3.4-3) we are ready to discretize the divergence expression (3.4-39). We apply first order difference approximations (3.4-11) for the partial derivatives and get (3.4-40) for the divergence at point .
We have already mentioned that the truncation error in (3.4-40) grows linearly with the grid spacing and the second derivative of the flux components (3.4-41) [Sel84].
A small implementation detail deserves attention. Of course, we do not evaluate (3.4-40) for each grid point for the calculation of the divergence, this would waste a lot of computational expenses. Actually, we calculate for each mid interval point the contribution , which is identical to the contribution for the grid point .
Then, this contribution , weighted by , is added to the divergence at point , and the same weighted by is added to the divergence at point . After that, for each mid interval point the contributions are added accordingly.