       subroutine etafld

       implicit none
       include 'param_o.h'
       include 'vrbls.comm'
       include 'extra.comm'
       include 'masks.comm'
       include 'dynam.comm'

       real,parameter::gi=1./9.80616,D608=0.608,H1=1. 
       integer::i,j,n,l
       real,dimension(0:im+1,0:jm+1,nm,2)::fi

      rd=287.04


      call blosfc
!
!     COMPUTE HEIGHT AT INTERFACES.
!     SET SURFACE VALUES.
      do n=1,nm
      DO J=1,jm
      DO I=1,IM
        ZINT(I,J,n,LP1)=FIS(I,J,n)*GI
        FI(I,J,n,1)=FIS(I,J,n)
!	if(i.eq.21.and.j.eq.20.and.n.eq.13)then
!	  print *,i,j,n,zint(i,j,n,lp1),fis(i,j,n)
!       endif
      ENDDO
      ENDDO
      ENDDO


      do n=1,nm
      DO J=1,jm
      DO I=1,IM
!
!     COMPUTE VALUES FROM THE SURFACE UP.
!
      DO 80 L=LM,1,-1
          FI(I,J,n,2)=htm(i,j,n,l)*T(I,J,n,L)*(Q(I,J,n,L)*D608+H1)*Rd*  &
                  (ALPINT(I,J,n,L+1)-ALPINT(I,J,n,L))+FI(I,J,n,1)
          ZINT(I,J,n,L)=FI(I,J,n,2)*GI
          FI(I,J,n,1)=FI(I,J,n,2)
!	if(i.eq.45.and.n.eq.2)then
!	if(l.eq.16)then
!	  print *,i,j,n,l,htm(i,j,n,l),t(i,j,n,l),alpint(i,j,n,l+1),alpint(i,j,n,l),zint(i,j,n,l)
!	  print *,i,j,n,zint(i,j,n,l)
!        endif
   80 CONTINUE
      ENDDO
      ENDDO
      ENDDO

      do n=1,nm
      DO J=1,jm
      DO I=1,IM
!
!     COMPUTE VALUES below THE SURFACE .
!
      DO L=lmh(i,j,n)+1,lm
          ZINT(I,J,n,L+1)=dfl(l+1)*GI
      ENDDO

      ENDDO
      ENDDO
      ENDDO


      end subroutine etafld
   
