*DECK PRO4P4
      SUBROUTINE INITAL
C...
C...  SUBROUTINE INITAL IS CALLED BY MAIN PROGRAM PRO4P4 TO DEFINE THE
C...  INITIAL CONDITION IN THE NUMOL SOLUTION OF EQUATIONS (1.21) TO
C...  (1.24)
C...
      COMMON/T/   TIME
     1      /Y/  T(51)
     2      /F/ TT(51)
C...
C...  TYPE SELECTED VARIABLES AS REAL
      REAL L, X(51)
C...
C...  CALCULATE PI FOR USE IN DO LOOP 1
      PI=ACOS(-1.0)
C...
C...  LENGTH
      L=1.0
C...
C...  GRID SPACING
      N=51
      DX=L/FLOAT(N-1)
C...
C...  INITIAL CONDITION (1.22)
      DO 1 I=1,N
         X(I)=FLOAT(I-1)*DX
         T(I)=SIN(PI*X(I)/L)
1     CONTINUE
      RETURN
      END
      SUBROUTINE DERV
C...
C...  SUBROUTINE DERV IS CALLED BY INTEGRATOR SDRIV2 TO DEFINE THE
C...  ODES IN THE NUMOL SOLUTION OF EQUATIONS (1.21) TO (1.24)
C...
      COMMON/T/   TIME
     1      /Y/  T(51)
     2      /F/ TT(51)
C...
C...  TYPE SELECTED VARIABLES AS REAL
      REAL L, TX(51), TXX(51)
C...
C...  BOUNDARY CONDITION (1.23)
      T(1)=0.
C...
C...  BOUNDARY CONDITION (1.24)
      N=51
      T(N)=0.
C...
C...  LENGTH
      L=1.
C...
C...  DERIVATIVE TX
      CALL DSS002(0.,L,N,T,TX)
C...
C...  DERIVATIVE TXX
      CALL DSS002(0.,L,N,TX,TXX)
C...
C...  EQUATION (1.21)
      DO 2 I=1,N
      TT(I)=TXX(I)
2     CONTINUE
C...
C...  ZERO THE BOUNDARY TIME DERIVATIVES (IN ACCORDANCE WITH BOUNDARY
C...  CONDITIONS (1.23) AND (1.24))
      TT(1)=0.
      TT(N)=0.
      RETURN
      END
      SUBROUTINE PRINT(NI,NO)
C...
C...  SUBROUTINE PRINT IS CALLED BY MAIN PROGRAM PRO4P4 TO PRINT THE
C...  NUMOL SOLUTION OF EQUATIONS (1.21) TO (1.24)
C...
      COMMON/T/   TIME
     1      /Y/  T(51)
     2      /F/ TT(51)
C...
C...  TYPE SELECTED VARIABLES AS REAL
      REAL TE(51), DIFF(51)
C...
C...  CALCULATE THE EXACT SOLUTION, AND THE DIFFERENCE BETWEEN THE
C...  NUMOL AND EXACT SOLUTIONS
      N=51
      DO 3 I=1,N,10
      TE(I)=EXACT(I,TIME)
      DIFF(I)=T(I)-TE(I)
3     CONTINUE
C...
C...  PRINT THE NUMOL SOLUTION TO EQUATIONS (1.21) TO (1.24)
      WRITE(NO,2)TIME,(T(I),I=1,N,10),
     1               (TE(I),I=1,N,10),
     2             (DIFF(I),I=1,N,10)
2     FORMAT(' TIME = ',F6.2,/,15X,'  X=0',5X,'X=0.2',5X,'X=0.4',5X,
     1                             'X=0.6',5X,'X=0.8',5X,'  X=1',/,
     2                         '    T(X,T)',6F10.6,/,
     3                         '   TE(X,T)',6F10.6,/,
     4                         ' DIFF(X,T)',6F10.6,/)
      RETURN
      END
      REAL FUNCTION EXACT(I,T)
C...
C...  FUNCTION EXACT COMPUTES THE EXACT SOLUTION TO EQUATIONS (1.21)
C...  TO (1.24), I.E., EQUATION (1.25), AT GRID INDEX I AND TIME T
C...
C...  NUMBER OF GRID POINTS
      PARAMETER (N=51)
C...
C...  TYPE SELECTED VARIABLES AS REAL
      REAL L
C...
C...  PI FOR USE IN THE EXACT SOLUTION
      PI=ACOS(-1.)
C...
C...  LENGTH
      L=1.
C...
C...  GRID SPACING
      DX=L/FLOAT(N-1)
C...
C...  X FOR WHICH THE EXACT SOLUTION IS TO BE COMPUTED
      X=FLOAT(I-1)*DX
C...
C...  EXACT SOLUTION AT X AND T
      EXACT=EXP((-PI**2/L**2)*T)*SIN(PI*X/L)
      RETURN
      END
