      SUBROUTINE SOLBT (M, N, A, B, C, Y, IP)
      INTEGER M, N, IP(M,N)
      REAL A(M,M,N), B(M,M,N), C(M,M,N), Y(M,N)
C-----------------------------------------------------------------------
C SOLUTION OF BLOCK-TRIDIAGONAL LINEAR SYSTEM.
C COEFFICIENT MATRIX MUST HAVE BEEN PREVIOUSLY PROCESSED BY DECBT.
C M, N, A, B, C, AND IP  MUST NOT HAVE BEEN CHANGED SINCE CALL TO DECBT.
C WRITTEN BY A. C. HINDMARSH.
C INPUT..
C     M = ORDER OF EACH BLOCK.
C     N = NUMBER OF BLOCKS IN EACH DIRECTION OF MATRIX.
C A,B,C = M BY M BY N ARRAYS CONTAINING BLOCK LU DECOMPOSITION
C         OF COEFFICIENT MATRIX FROM DECBT.
C    IP = M BY N INTEGER ARRAY OF PIVOT INFORMATION FROM DECBT.
C     Y = ARRAY OF LENGTH M*N CONTAINING THE RIGHT-HAND SIDE VECTOR
C         (TREATED AS AN M BY N ARRAY HERE).
C OUTPUT..
C     Y = SOLUTION VECTOR, OF LENGTH M*N.
C SOLBT MAKES CALLS TO SUBROUTINE SOL(M,M0,A,Y,IP)
C FOR SOLUTION OF M BY M LINEAR SYSTEMS.
C-----------------------------------------------------------------------
C
      INTEGER NM1, NM2, KM1, I, J, K
      REAL DP
      NM1 = N - 1
      NM2 = N - 2
C FORWARD SOLUTION SWEEP. ----------------------------------------------
      CALL SOL (M, M, A, Y, IP)
      DO 30 K = 2,NM1
        KM1 = K - 1
        DO 20 I = 1,M
          DP = 0.
          DO 10 J = 1,M
 10         DP = DP + C(I,J,K)*Y(J,KM1)
          Y(I,K) = Y(I,K) - DP
 20       CONTINUE
        CALL SOL (M, M, A(1,1,K), Y(1,K), IP(1,K))
 30     CONTINUE
      DO 50 I = 1,M
        DP = 0.
        DO 40 J = 1,M
 40       DP = DP + C(I,J,N)*Y(J,NM1) + B(I,J,N)*Y(J,NM2)
        Y(I,N) = Y(I,N) - DP
 50     CONTINUE
      CALL SOL (M, M, A(1,1,N), Y(1,N), IP(1,N))
C BACKWARD SOLUTION SWEEP. ---------------------------------------------
      DO 80 KB = 1,NM1
        K = N - KB
        KP1 = K + 1
        DO 70 I = 1,M
          DP = 0.
          DO 60 J = 1,M
 60         DP = DP + B(I,J,K)*Y(J,KP1)
          Y(I,K) = Y(I,K) - DP
 70       CONTINUE
 80     CONTINUE
      DO 100 I = 1,M
        DP = 0.
        DO 90 J = 1,M
 90       DP = DP + C(I,J,1)*Y(J,3)
        Y(I,1) = Y(I,1) - DP
 100    CONTINUE
      RETURN
C-----------------------  END OF SUBROUTINE SOLBT  ---------------------
      END
