* PACKAGE P2MISC   !" 物理過程(2) 雑
*
**********************************************************************
      SUBROUTINE TGINTG      !" 地面温度の積分
     M         ( GDTG  ,
     I           GTTG  , DELT  )
*
*   [PARAM]
#ifdef SYS_IBMS
      INCLUDE   (ZCDIM)                      !" 格子点数，波数
#else
#include        "zcdim.F"                    !" 格子点数，波数
#endif
*
*   [MODIFY]
      REAL       GDTG  ( IDIM, JDIM )        !" 地表面温度
*
*   [INPUT]
      REAL       GTTG  ( IDIM, JDIM )        !" 地表温度変化率
      REAL       DELT                        !" 時間刻みΔt
*
*   [INTERNAL WORK]
      INTEGER    I, J
*
      DO 1100 I = 1, IMAX
         DO 1110 J = 1, JMAX
            GDTG( I,J ) = GDTG( I,J ) + GTTG( I,J ) * DELT
 1110    CONTINUE
 1100 CONTINUE
*
      RETURN
      END
**********************************************************************
      SUBROUTINE TINTP    !" 温度の鉛直補間
     O         ( GDTM  ,
     I           GDT   ,
     C           SIG   , SIGM  )
*
*   [PARAM]
#ifdef SYS_IBMS
      INCLUDE   (ZCDIM)                       !" 格子点数，波数
#else
#include        "zcdim.F"                     !" 格子点数，波数
#endif
*
*   [OUTPUT]
      REAL       GDTM  ( IDIM*JDIM, KMAX+1 )  !" 温度(半整数)
*
*   [INPUT]
      REAL       GDT   ( IDIM*JDIM, KMAX )    !" 温度  Ｔ
*
      REAL       SIG   ( KMAX )               !" σレベル(整数)
      REAL       SIGM  (KMAX+1)               !" σレベル(半整数)
*
*   [INTERNAL WORK]
      REAL       FTINT ( KMAX )                !" 補間係数
      REAL       FTINTM( KMAX )                !" 補間係数
*
      INTEGER    IJ, K
*
*
*"         < 1. 温度補間係数 >
*
      DO 100 K = 2, KMAX
         FTINTM( K ) = (  LOG( SIGM( K )  ) - LOG( SIG( K )  )  )
     &               / (  LOG( SIG( K-1 ) ) - LOG( SIG( K )  )  )
         FTINT ( K ) = (  LOG( SIG( K-1 ) ) - LOG( SIGM( K ) )  )
     &               / (  LOG( SIG( K-1 ) ) - LOG( SIG( K )  )  )
  100 CONTINUE
*
*"         < 2. 温度の補間 >
*
      DO 200 K = 2, KMAX
         DO 200 IJ = 1, IDIM*JDIM
            GDTM ( IJ,K ) = FTINTM( K ) * GDT ( IJ,K-1 )
     &                    + FTINT ( K ) * GDT ( IJ,K   )
  200 CONTINUE
*
      DO 210 IJ = 1, IDIM*JDIM
            GDTM ( IJ,KMAX+1 ) = GDT ( IJ,KMAX )
            GDTM ( IJ,1      ) = GDT ( IJ,1 )
  210 CONTINUE
*
      RETURN
      END
**********************************************************************
      SUBROUTINE PZLEVS      !" 気圧・高度の計算
     O         ( GDP   , GDPM , GDZ   , GDZM  ,
     I           GDPS  , GDT  , GDTM  ,
     C           SIG   , SIGM , DSIG  , DSIGM   )
*
*   [PARAM]
#ifdef SYS_IBMS
      INCLUDE   (ZCDIM)                       !" 格子点数，波数
      INCLUDE   (ZCCOM)                       !" 標準物理定数
#else
#include        "zcdim.F"                     !" 格子点数，波数
#include        "zccom.F"                     !" 標準物理定数
#endif
*
*   [OUTPUT]
      REAL       GDP    ( IDIM*JDIM, KMAX )   !" 気圧  Ｐ
      REAL       GDPM   ( IDIM*JDIM, KMAX+1 ) !" 気圧（半整数）
      REAL       GDZ    ( IDIM*JDIM, KMAX )   !" 高度
      REAL       GDZM   ( IDIM*JDIM, KMAX+1 ) !" 高度（半整数）
*
*   [INPUT]
      REAL       GDPS   ( IDIM*JDIM         ) !" 地表気圧Ｐｓ
      REAL       GDT    ( IDIM*JDIM, KMAX   ) !" 温度 Ｔ
      REAL       GDTM   ( IDIM*JDIM, KMAX+1 ) !" 温度(半整数)
*
      REAL       SIG    ( KMAX )              !" σレベル(整数)
      REAL       SIGM   (KMAX+1)              !" σレベル(半整数)
      REAL       DSIG   ( KMAX )              !" Δσ    (整数)
      REAL       DSIGM  (KMAX+1)              !" Δσ    (半整数)
*
*   [INTERNAL WORK]
      INTEGER    IJ, K
*
*
*"         < 1. 気圧 in Pa >
*
      DO 1100 K = 1, KMAX
         DO 1110 IJ = 1, IDIM*JDIM
            GDP ( IJ,K ) = GDPS( IJ ) * SIG ( K ) * 100.
 1110    CONTINUE
 1100 CONTINUE
*
      DO 1200 K = 1, KMAX+1
         DO 1210 IJ = 1, IDIM*JDIM
            GDPM( IJ,K ) = GDPS( IJ ) * SIGM( K ) * 100.
 1210    CONTINUE
 1200 CONTINUE
*
*"         < 2. 高度 >
*
      DO 2100 IJ = 1, IDIM*JDIM
         GDZ ( IJ,1 ) = RAIR * GDT( IJ,1 ) / GRAV * ( 1.  -SIG(1) )
 2100 CONTINUE
      DO 2200 K = 2, KMAX
         DO 2210 IJ = 1, IDIM*JDIM
            GDZ ( IJ,K ) = GDZ ( IJ,K-1 )
     &                   + RAIR / GRAV * GDTM( IJ,K )
     &                     * DSIGM( K )   / SIGM( K )
 2210    CONTINUE
 2200 CONTINUE
*
      CALL RESET ( GDZM, IDIM*JDIM )
      DO 2300 K = 2, KMAX+1
         DO 2310 IJ = 1, IDIM*JDIM
            GDZM( IJ,K ) = GDZM( IJ,K-1 )
     &                   + RAIR / GRAV * GDT ( IJ,K-1 )
     &                     * DSIG ( K-1 ) / SIG ( K-1 )
 2310    CONTINUE
 2300 CONTINUE
*
      RETURN
      END