* PACKAGE LRCWRT   !" $BNW3&%l%$%j!<?t%U%!%$%k=q$-$3$_(B
*
*"  [HIS] 93/01/20(takepiro)
*
*******************************************************************
      SUBROUTINE LRCWRT     !" $B%Q%i%a%?!<6u4V$X$NNW3&%l%$%j!<?t=PNO(B
     I             (  RAYLC  , 
     I                MFIX   , 
     I                REND   , TEND   , PEND   ) 
*
*   [PARAM] 
#ifdef SYS_IBMS
      INCLUDE   (ZCDIM)                      !" $B3J;RE@?t(B, $BGH?t(B
      INCLUDE   (ZHDIM)                      !" $BJ8;z?t(B
      INCLUDE   (ZLDIM)                      !" $B%Q%i%a%?!<?t(B, $B78?t9TNs(B
#else
#include        "zcdim.F"                    !" $B3J;RE@?t(B, $BGH?t(B
#include        "zhdim.F"                    !" $BJ8;z?t(B
#include        "zldim.F"                    !" $B%Q%i%a%?!<?t(B, $B78?t9TNs(B
#endif
*
*   [INPUT]
      REAL       RAYLC ( TDIM*PDIM )         !" $B@.D9N((B
*
      INTEGER    MFIX                        !" $BEl@>GH?t(B
      INTEGER    REND                        !" $B%l%$%j!<?t$N7W;;?t(B
      INTEGER    TEND                        !" $B%F%$%i!<?t$N7W;;?t(B
      INTEGER    PEND                        !" $B%W%i%s%I%k?t$N7W;;?t(B
*
*   [INTERNAL PARM] 
      INTEGER    JFRC
      INTEGER    JFRCD
      DATA       JFRCD / 50 /
*
      INTEGER    IDATE ( 6 )             !" $BF|IU(B( $B%@%_!<(B ) 
      INTEGER    ISTEP
      INTEGER    ITDUR
      DATA       IDATE / 1990, 1, 1, 0, 0, 0 /
      DATA       ISTEP / 0 /
      DATA       ITDUR / 1 /
*
      CHARACTER  HDFMT *(NCC)                !" $B%G!<%?%U%)!<%^%C%H(B
      DATA       HDFMT / 'UR4' /
      REAL       VMISS                       !" $B7gB;CM$NCM(B
*
*   [INTERNAL WORK] 
      CHARACTER  HHRAYL( NDC )*(NCC)         !" $BNW3&%l%$%j!<?t%X%C%@!<(B
*
      INTEGER    IFPAR , JFPAR               !" NAMELIST $BFI$_=q$-(B
*
      CHARACTER  FNCRAY * (NFILN)            !" $BNW3&%l%$%j!<?t=PNO%U%!%$%kL>(B
*
      NAMELIST   / NMCRAY / FNCRAY
*
      INTEGER    IERR                   !" $B%U%!%$%k%*!<%W%s%(%i!<5-=R;R(B
*
      LOGICAL    OFIRST
      DATA       OFIRST / .TRUE. /
*
      SAVE
*
      IF( OFIRST )THEN
         OFIRST = .FALSE. 
*
*"         < 1.$B%U%!%$%kL>(B >
*
         CALL   REWNML ( IFPAR , JFPAR )
         READ   ( IFPAR, NMCRAY , END=1190 )
 1190    WRITE  ( JFPAR, NMCRAY )
*
         CALL IFLOPN
     O         ( JFRC  , IERR  ,
     I           FNCRAY, JFRCD , 'WRITE', 'UNFORMATTED' )
*
         IF( IERR .GT. 0 )THEN
            CALL MSGDMP( 'E', 'LRCWRT', 'CANNOT OPEN FILE' )
         ENDIF
      ENDIF
*
*"         < 2. $B%X%C%@!<:n@.(B >
*
      CALL GZDBGT( 'MISS' , VMISS )
*
      CALL RCHEAD
     O       (  HHRAYL , 
     I          MFIX   , 
     I          REND   , TEND   , PEND  , 
     I          HDFMT  , VMISS  , 
     I          VMISS  , VMISS  , VMISS  , VMISS  , 1 )
*
*"         < 4. $B%U%!%$%k=q$-9~$_(B >
*
      CALL GZDBWX  !" $B@:EYJQ49=q$-9~$_(B ; $BEl@>GH?t$r;~4V(B(day)$B$H$7$F=q$-$3$`(B
     I         ( HHRAYL , RAYLC  ,
     I           MFIX   , IDATE  , ISTEP , ITDUR ,
     I           JFRC   , 1      , 0     , HDFMT   )
*
      RETURN
      END
*******************************************************************
      SUBROUTINE RCHEAD               !" $B%Q%i%a%?!<6u4V%X%C%@!<:n@.(B
     O             (  HHRAYL , 
     I                MFIX   , 
     I                REND   , TEND   , PEND  , 
     I                HDFMT  , VMISS  , 
     I                DMIN   , DMAX   , DIVS   , DIVL , ISTYP )
*
*   [PARAM] 
#ifdef SYS_IBMS
      INCLUDE   (ZCDIM)                      !" $B3J;RE@?t(B, $BGH?t(B
      INCLUDE   (ZHDIM)                      !" $BJ8;z?t(B
      INCLUDE   (ZLDIM)                      !" $B%Q%i%a%?!<?t(B, $B78?t9TNs(B
#else
#include        "zcdim.F"                    !" $B3J;RE@?t(B, $BGH?t(B
#include        "zhdim.F"                    !" $BJ8;z?t(B
#include        "zldim.F"                    !" $B%Q%i%a%?!<?t(B, $B78?t9TNs(B
#endif
*
*
*   [OUTPUT]
      CHARACTER  HHRAYL( NDC )*(NCC)         !" $BNW3&%l%$%j!<?t%X%C%@!<(B
*
*   [INPUT]
      INTEGER    MFIX                        !" $BEl@>GH?t(B
      INTEGER    REND                        !" $B%l%$%j!<?t$N7W;;?t(B
      INTEGER    TEND                        !" $B%F%$%i!<?t$N7W;;?t(B
      INTEGER    PEND                        !" $B%W%i%s%I%k?t$N7W;;?t(B
*
      CHARACTER  HDFMT  *(*)                 !" $B%G!<%?%U%)!<%^%C%H(B
      REAL       VMISS                       !" $B7gB;CM$NCM(B
      REAL       DMIN                        !" $B%l%s%8(B($B:G>.(B)
      REAL       DMAX                        !" $B%l%s%8(B($B:GBg(B)
      REAL       DIVS                        !" $B4V3V(B($B>.(B)
      REAL       DIVL                        !" $B4V3V(B($BBg(B)
      INTEGER    ISTYP                       !" $B%9%1!<%j%s%0%?%$%W(B
*
*   [INTERNAL WORK] 
      INTEGER    GRDIM                       !" $BG[Ns$NBg$-$5(B
*
      CHARACTER  HUNIT*(NCC)                 !" $BC10L(B
      DATA       HUNIT / '1/s' /
      CHARACTER  HUTIM*(NCC)                 !" $B;~9oC10L(B
      DATA       HUTIM / 'DAY' /
*
      CHARACTER  HAITM1*(NCC)                !" $B<4(B1$B$N3J;RL>>N(B
      CHARACTER  HAITM2*(NCC)                !" $B<4(B2$B$N3J;RL>>N(B
      CHARACTER  HAITM3*(NCC)                !" $B<4(B3$B$N3J;RL>>N(B
      CHARACTER  HAITMR*(NCC)                !" $B<4(B1$B$N3J;RL>>N(B
      CHARACTER  HAITMT*(NCC)                !" $B<4(B2$B$N3J;RL>>N(B
      CHARACTER  HAITMP*(NCC)                !" $B<4(B3$B$N3J;RL>>N(B
      DATA         HAITMR , HAITMT , HAITMP 
     &           / '.RAYL' , '.TAYL' , '.PRND' /        
*
      CHARACTER  HRUN *(NCC)                !" $B<B83L>(B
      INTEGER    NHR
      LOGICAL    OFIRST
      DATA       OFIRST / .TRUE. /
*
*   [EXTERNAL FUNC] 
      INTEGER    LENC
*
      SAVE
*
*"        < 0. $B<4L>>N@_Dj(B >
*
      IF ( OFIRST ) THEN
         OFIRST = .FALSE.
         CALL GTCGET( 'DDSET' , HRUN    )
         NHR = LENC( HRUN )
         HAITM1 = HRUN(1:NHR) // HAITMR
         HAITM2 = HRUN(1:NHR) // HAITMT
         HAITM3 = HRUN(1:NHR) // HAITMP
      ENDIF
*         
*"         < 1. $B%Q%i%a%?!<@_Dj(B >
*
      GRDIM = TEND * PEND
      CALL GTOPEN
      CALL GTSIZE ( HHRAYL , GRDIM )
*
*"         < 3. $B%X%C%@!<@_Dj(B >
*
      CALL GZDBHP               !" $B<1JL5-=R;R$N%Q%C%/(B
     O        (  HHRAYL ,
     I           ' '   , 'RAYL', 1     , 1     ,
     I           'C. Rayleigh Number' , HUNIT ,
     I           MFIX  , ' '   , HUTIM , 1     ,
     I           HAITM1, 1     , REND  ,
     I           HAITM2, 1     , TEND  ,
     I           HAITM3, 1     , PEND  ,
     I           HDFMT , VMISS ,
     I           DMIN  , DMAX  , DIVS  , DIVL  ,
     I           ISTYP ,
     I           ' '   , ' '                             )
*
      RETURN
      END
