C*********************************************************************
C *** 水蒸気量の基本場＝０．全ては DEVIATION. *** 19881222 ***
C     Ｕ（Ｚ）　入り　*** 19890107 ***
C*********************************************************************
C
      SUBROUTINE DAINIT
     I   (  IROUT,
     O      TIME,
     O      U, V, W, TPOT, QVAP, QCLW, QRAI, CDTURB,
     B      PRES0, DENS0, TEMP0, TPOT0, PPAI0, QVAP0, RVAP0, ZGRID,
     C      RMVAP,
     D      NX, NZ, NXB, NZB, NROT           )
C
C*********************************************************************
      IMPLICIT REAL*8 ( A-H, O-Z )
C*********************************************************************
C
      DIMENSION
     \   U   ( -2:NXB, -2:NZB, NROT ),
     \   V   ( -2:NXB, -2:NZB, NROT ),
     \   W   ( -2:NXB, -2:NZB, NROT ),
     \   TPOT( -2:NXB, -2:NZB, NROT ),
     \   QVAP( -2:NXB, -2:NZB, NROT ),
     \   QCLW( -2:NXB, -2:NZB, NROT ),
     \   QRAI( -2:NXB, -2:NZB, NROT ),
     \ CDTURB( -2:NXB, -2:NZB, NROT )
C
      DIMENSION
     \   PRES0(-2:NZB), DENS0(-2:NZB), TEMP0(-2:NZB), TPOT0(-2:NZB),
     \   PPAI0(-2:NZB), QVAP0(-2:NZB), RVAP0(-2:NZB), ZGRID(-2:NZB)
C
C=====================================================================
C
      DO 5 IRCLR = 1, NROT
         CALL ACLEAR( U   ,  NXB, NZB, NROT, IRCLR )
         CALL ACLEAR( V   ,  NXB, NZB, NROT, IRCLR )
         CALL ACLEAR( W   ,  NXB, NZB, NROT, IRCLR )
         CALL ACLEAR( TPOT,  NXB, NZB, NROT, IRCLR )
         CALL ACLEAR( QVAP,  NXB, NZB, NROT, IRCLR )
         CALL ACLEAR( QCLW,  NXB, NZB, NROT, IRCLR )
         CALL ACLEAR( QRAI,  NXB, NZB, NROT, IRCLR )
         CALL ACLEAR( CDTURB,  NXB, NZB, NROT, IRCLR )
    5 CONTINUE

C     TP00 = 2.0D0
C     IXC = 32
C     IZC = 3
C     FXC = 4.0
C     FZC = 4.0
C
C     DO 10 ICC = -5, 5
C        IXCC = IXC + ICC*NX
C     DO 11 IX = 1, NX
C     DO 11 IZ = 0, NZ-1
C        TPOT(IX,IZ,IROUT) = TPOT(IX,IZ,IROUT) +
C    \     TP00 * EXP ( - (    ((IX-IXCC)/FXC)**2
C    \                    +  ((IZ-IZC)/FZC)**2 )  / 2.0D0 )
C  11 CONTINUE
C  10 CONTINUE

C     PAI = 4.0D0 * ATAN( 1.0D0 )
C     FKX = 1.0D0
C     FKZ = 1.0D0
C     AMP = 1.0D0
C
C     DO 12 IX = 1, NX
C     DO 12 IZ = 0, NZ-1
C        THX = 2.0D0 * PAI * ( IX + 0.5D0 ) / NX
C        THZ = 1.0D0 * PAI * ( IZ + 0.5D0 ) / NZ
C        TPOT(IX,IZ,IROUT) = AMP * SIN ( FKX * THX )
C    1                           * SIN ( FKZ * THZ )
C  12 CONTINUE

C
      ARANDM = 0.3D0
      IZRDM = 0
c      IZRDM = 5
C
      DO 15 IX=1,NX
         read(21,*) JJRDM1
            TPOT(IX,IZRDM,IROUT)
     \   = ( 2.0D0*0.4656613D-9*JJRDM1 - 1.0D0 ) * ARANDM
   15 CONTINUE
C
C---------------水蒸気混合比の初期化（相対湿度を一定値にする）-----
C
      DO 21 IZ = 0, NZ-1
      DO 21 IX = 1, NX
         QVAP(IX,IZ,IROUT) =
     \      EVSAT( (TPOT(IX,IZ,IROUT)*PPAI0(IZ) + TEMP0(IZ)) )
     \    * HUMID( ZGRID(IZ) ) * RMVAP / PRES0(IZ)
   21 CONTINUE
C
C--------------局所的に飽和させる---------------------------------
C
c      icent = NX/4 * 3
c      iwidth = NX / 32
c
c      DO 31 IZ = 2, 6
c      DO 31 IX = icent-iwidth, icent+iwidth
c         QVAP(IX,IZ,IROUT) =
c     \      EVSAT( (TPOT(IX,IZ,IROUT)*PPAI0(IZ) + TEMP0(IZ)) )
c     \    * 1.0 * RMVAP / PRES0(IZ)
c   31 CONTINUE
C
C-----------------------------------------------------------------
C *** シアーを含むＵ（Ｚ） ***
C-----------------------------------------------------------------
C
      DO 41 IZ = 0, NZ-1
         UINIT = UBAR ( ZGRID(IZ) )
      DO 41 IX = 1, NX
         U(IX,IZ,IROUT) = UINIT
   41 CONTINUE
C
C-----------------------------------------------------------
C
      CALL BOUND( U   , NX, NZ, NXB, NZB, NROT, 1, 1, IROUT )
      CALL BOUND( V   , NX, NZ, NXB, NZB, NROT, 1, 1, IROUT )
      CALL BOUND( W   , NX, NZ, NXB, NZB, NROT,-1, 0, IROUT )
      CALL BOUND( TPOT, NX, NZ, NXB, NZB, NROT, 1, 1, IROUT )
      CALL BOUND( QVAP, NX, NZ, NXB, NZB, NROT, 1, 1, IROUT )
      CALL BOUND( QCLW, NX, NZ, NXB, NZB, NROT, 1, 1, IROUT )
      CALL BOUND( QRAI, NX, NZ, NXB, NZB, NROT, 1, 1, IROUT )
C
      TIME = 0.0D0
C=====================================================================
C
      RETURN
      E N D
