C
C
      SUBROUTINE  KALPHA (TMST,TM,FX,CP,I,KR)
C
C     -----------------------------------------------------------------
C
C       SUBROUTINE PURPOSE:
C       EVALUATION OF "COEFF. OF AGE" ASSUMING DRY CASE.
C
C     -----------------------------------------------------------------
C
      INCLUDE 'CMMNW.DAT'
C
      DIMENSION  HC(NMX)
C
C     HC(NMX): HEAT TRANSFER COEFFICIENT.
C     KR=0: SUB IS CALLED FROM TEMP. PART OF THE PROGRAM.
C     KR=1: SUB IS CALLED FROM DYNAMIC SIMULATION PART.
C
      PI=3.1415926
      IF (KR.EQ.0) THEN
         TMX=TM
         QX=Q(I)
         TX=TIME
      ELSE
         TMX=TMM(I)
         QX=QQ(I)
         TX=TMST/3600.
      ENDIF
C
C     WT: TEMP. CORRECTED AIR DENSITY, LBM/FT**3.
C     VISC: KINETIC VISCOSITY OF AIR, FT/HR.
C     HKA: THERMAL CONDUCTIVITY OF ROCK, BTU/HR*FT*F.
C     FO: FOURIER NUMBER.  BI: BIOT NUMBER.  RN: REYNOULD NUMBER.
C
      WT=DR*(TR+460.)/(TMX+460.)
      VISC=0.000145*((460.+TMX)/492.)**1.75
      CP=0.2376+0.000024*TMX
      HKA=0.014*((460.+TMX)/492.)**0.81
      RN=QX*DR/(15.*WT*O(I)*VISC)
      FR0=0.0032+0.221/RN**0.237
      POT=(100./RN)**0.125
      COR=((KF(I)*0.075)/(809*DR*FR0))**POT
C     IF (KR.EQ.0) HC(I)=0.005*HKA*O(I)*RN**0.8*COR/A(I)
      HC(I)=0.005*HKA*O(I)*RN**0.8*COR/A(I)
      FO=TX*HA(I)*O(I)*O(I)/(4.*A(I)**2)
      BI(I)=HC(I)*2.*A(I)/(O(I)*HK(I))
      X=(0.375+BI(I))*SQRT(FO)
C
C     EVALUATION OF ERROR FUNCTIONS.
C
      IF (X.LT.2.5) THEN
         N=0
         SUMT=0.0
         ADDT=X
10       SUMT=SUMT+ADDT
         N=N+1
         ADDT=-ADDT*X*X*(2.*N-1)/(N*(2.*N+1))
         IF (ABS(ADDT).GE.0.00001) GO TO 10
         FX=1.0-(EXP(X*X))*(1.0-(2.0/SQRT(PI))*SUMT)
      ELSE
         N=0
         SUMT=0.0
         ADDT=1.0
20       SUMT=SUMT+ADDT
         N=N+1
         OLADDT=ADDT
         ADDT=-ADDT*(2*N-1)/(2.0*X*X)
         IF (ABS(ADDT).LT.0.00001) GO TO 30
         IF (ABS(OLADDT).GT.ABS(ADDT)) GO TO 20
30       FX=1.0-1.0*SUMT/(SQRT(PI)*X)
      ENDIF
C
      RETURN
      END
