C (c) CROWN COPYRIGHT 1995, METEOROLOGICAL OFFICE, All Rights Reserved.            RAD_ALL.25137 
C                                                                                  RAD_ALL.25138 
C Use, duplication or disclosure of this code is subject to the                    RAD_ALL.25139 
C restrictions as set forth in the contract.                                       RAD_ALL.25140 
C                                                                                  RAD_ALL.25141 
C                Meteorological Office                                             RAD_ALL.25142 
C                London Road                                                       RAD_ALL.25143 
C                BRACKNELL                                                         RAD_ALL.25144 
C                Berkshire UK                                                      RAD_ALL.25145 
C                RG12 2SZ                                                          RAD_ALL.25146 
C                                                                                  RAD_ALL.25147 
C If no contract has been raised with this copy of the code, the use,              RAD_ALL.25148 
C duplication or disclosure of it is strictly prohibited.  Permission              RAD_ALL.25149 
C to do so must first be obtained in writing from the Head of Numerical            RAD_ALL.25150 
C Modelling at the above address.                                                  RAD_ALL.25151 
C ******************************COPYRIGHT******************************            RAD_ALL.25152 
C                                                                                  RAD_ALL.25153 
!+ Subroutine to solve tridaigonal equations.                                      RAD_ALL.25154 
!                                                                                  RAD_ALL.25155 
! Method:                                                                          RAD_ALL.25156 
!       A set of tridiagonal equations is solved by Gaussian                       RAD_ALL.25157 
!       elimination. The eliminative step proceeds upward through                  RAD_ALL.25158 
!       the atmosphere.                                                            RAD_ALL.25159 
!                                                                                  RAD_ALL.25160 
! Current Owner of Code: J. M. Edwards                                             RAD_ALL.25161 
!                                                                                  RAD_ALL.25162 
! History:                                                                         RAD_ALL.25163 
!       Version         Date                    Comment                            RAD_ALL.25164 
!       4.0             27-07-95                Original Code                      RAD_ALL.25165 
!                                               (J. M. Edwards)                    RAD_ALL.25166 
!                                                                                  RAD_ALL.25167 
! Description of Code:                                                             RAD_ALL.25168 
!   FORTRAN 77  with extensions listed in documentation.                           RAD_ALL.25169 
!                                                                                  RAD_ALL.25170 
!- ---------------------------------------------------------------------           RAD_ALL.25171 
      SUBROUTINE TRIDIAG_SOLVER_UP(M, N                                            RAD_ALL.25172 
     &   , A3, B                                                                   RAD_ALL.25173 
     &   , X                                                                       RAD_ALL.25174 
     &   , PM, PN                                                                  RAD_ALL.25175 
     &   , RHO, SIGMA                                                              RAD_ALL.25176 
     &   )                                                                         RAD_ALL.25177 
!                                                                                  RAD_ALL.25178 
!                                                                                  RAD_ALL.25179 
      IMPLICIT NONE                                                                RAD_ALL.25180 
!                                                                                  RAD_ALL.25181 
!                                                                                  RAD_ALL.25182 
!     DUMMY VARIABLES.                                                             RAD_ALL.25183 
      INTEGER   !, INTENT(IN)                                                      RAD_ALL.25184 
     &     M                                                                       RAD_ALL.25185 
!             NUMBER OF SETS OF EQUATIONS                                          RAD_ALL.25186 
     &   , N                                                                       RAD_ALL.25187 
!             NUMBER OF EQUATIONS IN EACH SET                                      RAD_ALL.25188 
     &   , PM                                                                      RAD_ALL.25189 
!             ARRAY SIZE FOR NUMBER OF SETS                                        RAD_ALL.25190 
     &   , PN                                                                      RAD_ALL.25191 
!             ARRAY SIZE FOR NUMBER OF EQUATIONS                                   RAD_ALL.25192 
      REAL      !, INTENT(IN)                                                      RAD_ALL.25193 
     &     A3(PM, 3, PN)                                                           RAD_ALL.25194 
!             TRIDIAGONAL MATRICES                                                 RAD_ALL.25195 
     &   , B(PM, PN)                                                               RAD_ALL.25196 
!             RIGHT-HAND SIDES                                                     RAD_ALL.25197 
      REAL      !, INTENT(OUT)                                                     RAD_ALL.25198 
     &     X(PM, PN)                                                               RAD_ALL.25199 
!             SOLUTION VECTORS                                                     RAD_ALL.25200 
!                                                                                  RAD_ALL.25201 
!     LOCAL VARIABLES.                                                             RAD_ALL.25202 
      INTEGER                                                                      RAD_ALL.25203 
     &     I                                                                       RAD_ALL.25204 
!             LOOP VARIABLE                                                        RAD_ALL.25205 
     &   , L                                                                       RAD_ALL.25206 
!             LOOP VARIABLE                                                        RAD_ALL.25207 
      REAL                                                                         RAD_ALL.25208 
     &     RHO(PM, PN)                                                             RAD_ALL.25209 
!             COEFFICIENT IN RECURRENCE                                            RAD_ALL.25210 
     &   , SIGMA(PM, PN)                                                           RAD_ALL.25211 
!             TERM IN RECURRENCE                                                   RAD_ALL.25212 
     &   , TEMP                                                                    RAD_ALL.25213 
!             TEMPORARY VARIABLE                                                   RAD_ALL.25214 
!                                                                                  RAD_ALL.25215 
!                                                                                  RAD_ALL.25216 
!                                                                                  RAD_ALL.25217 
!     PROCEED BACKWARD THROUGH THE EQUATIONS PERFORMING GUASSIAN                   RAD_ALL.25218 
!     ELIMINATION TO FORM A RECURRENCE.                                            RAD_ALL.25219 
      DO L=1, M                                                                    RAD_ALL.25220 
         RHO(L, N-1)=-A3(L, 1, N)/A3(L, 2, N)                                      RAD_ALL.25221 
         SIGMA(L, N-1)=B(L, N)/A3(L, 2, N)                                         RAD_ALL.25222 
      ENDDO                                                                        RAD_ALL.25223 
      DO I=N-1, 2, -1                                                              RAD_ALL.25224 
         DO L=1, M                                                                 RAD_ALL.25225 
            TEMP=A3(L, 2, I)+A3(L, 3, I)*RHO(L, I)                                 RAD_ALL.25226 
            RHO(L, I-1)=-A3(L, 1, I)/TEMP                                          RAD_ALL.25227 
            SIGMA(L, I-1)=(B(L, I)-A3(L, 3, I)*SIGMA(L, I))/TEMP                   RAD_ALL.25228 
         ENDDO                                                                     RAD_ALL.25229 
      ENDDO                                                                        RAD_ALL.25230 
!                                                                                  RAD_ALL.25231 
!     FORWARD SUBSTITUTING LOOP.                                                   RAD_ALL.25232 
      DO L=1, M                                                                    RAD_ALL.25233 
         X(L, 1)=(B(L, 1)-A3(L, 3, 1)*SIGMA(L, 1))                                 RAD_ALL.25234 
     &      /(A3(L, 2, 1)+A3(L, 3, 1)*RHO(L, 1))                                   RAD_ALL.25235 
      ENDDO                                                                        RAD_ALL.25236 
      DO I=1, N-1                                                                  RAD_ALL.25237 
         DO L=1, M                                                                 RAD_ALL.25238 
            X(L, I+1)=RHO(L, I)*X(L, I)+SIGMA(L, I)                                RAD_ALL.25239 
         ENDDO                                                                     RAD_ALL.25240 
      ENDDO                                                                        RAD_ALL.25241 
!                                                                                  RAD_ALL.25242 
!                                                                                  RAD_ALL.25243 
      RETURN                                                                       RAD_ALL.25244 
      END     
