3. NUMERICAL ALGORITHMS 



3.1 External Mode Algorithm 



Treating implicitly all the terms in the continuity equation (2.36) while 

 only the time derivatives and the surface slopes in the momentum equations 

 (2.37) and (2.38), one can obtain the following finite-difference equations: 



(I-ht)Xj.+(t>A„)W""^l = [I + (I-(j))X„+(I-(t))X„]W" + AtD" (3.1) 



where 



AAt . _ BAt 



e \ /o 



Hooj looo 



/• "\ 



000/ \Hoo, 



where I is the identity matrix, (Ax, Ay) are the horizontal grid spacings, At 

 is the time step, D^^ and Dy are terms in Eqs. (2.37) and (2.38) excluding the 

 time derivatives and the surface slopes, superscripts n+1 and n indicate 

 present and previous time step of integration, 6^ and i5y are central 

 difference spatial operators, and (J) is a weighting factor, 0<4i<l. If <f=0, 

 Eq. (3.1) reduces to a two-step explicit scheme. If ij>>0 the resulting schemes 

 are implicit, with i|)=l/2 corresponding to the Crank-Nicholson scheme and (J)=l 

 corresponding to the fully implicit scheme. Factorizing equation (3.1) and 



2 



neglecting terms of 0(At ) yields the following equations: 



x-sweep: (I+<^X^) W* = [I + (I-(^)X^+(I-2(t.)X ] w"+AtD" (3.3) 



y-sweep: (I+^X^) W""^^ = W* + (j-X^ w" (3.4) 



44 



