Page 134 - Computational Fluid Dynamics for Engineers
P. 134

120               4.  Numerical  Methods  for  Model  Parabolic  and  Elliptic  Equations


                                      an  a\2   aij  • •  a in
                                      Q>21  «22     •  Cl2n
                                A  =                                       (4.5.24)
                                      an  &i2   a ij   '  din
                                      a„A      a„A  • •  a„„

                 (
         and  x  = # i , . . . , Xi,...,  x n) T  and  b=  (&i,..., b{,...,  b n) T  with  T  denoting  the
         transpose.  According to the  Gaussian  elimination  method,  the elements  of  x  are
         given  by


                              k('-l)        (i-l)
                                                           n
                  Xi  —               E                i  == , . . . ,  1  (4.5.25)
                       ,(*-!)
                                     .7=2+1
         where
                                                 fc =  1, ..  ,71  —  1
                                                        .
                                 (fc-i)
                  (fc)  _  (fc-i)  _  <hk  (k-i)  j  — k  +  1,...,  n
                                      a
                                                               ,
                 %   ~%          (k-l) kj   '     i  — k  +  1,... n      (4.5.26a)
                                a  kk
                                                (o)  _
                                                          ,
                                 (fc-i)          k  —  1,... n  —  1
                  ,  (fc)  _  , (*-l)  _  <hk  , (fc-i)
                                                              ,
                                                 i  —  k  +  1,... n     (4.5.26b)
                                a l             {0)
                                 ^ kk          b   =  6.
         Table  4.2  gives the FORTRAN  listing  based  an the  Gaussian  elimination.  Thus,
         the  block-elimination  method  together  with  the  Gaussian  elimination  method
         Table  4.2.  FORTRAN  Listing  of  Subroutine  GAUSS

              SUBROUTINE GAUSS  (N.M.A.B)
              DIMENSION  A(100,100),B(100,100)
              DO  100  K = l.N-1
              KP    = K + 1
              DO  100  I = KP,N
              R     = A(I,K)/A(K,K)
              DO 200  J = KP,N
         200  A(I,J)  = A(I,J) - R*A(K,J)
              DO 100 J =  1,M
         100  B(I,J)  = B(I,J) - R*B(K,J)
              DO 300  K =  1,M
              B(N,K)  = B(N,X)/A(N,N)
              DO 300  I = N-1,1,-1
              IP   = 1 + 1
              DO 400  J = IP,N
         400  B(I,K)  = B(I,K) - A(I,J)*B(J,K)
         300  B(I,K)  = B(I,K)/A(I,I)
              RETURN
              END
   129   130   131   132   133   134   135   136   137   138   139