NAME

       FMWRIT - write an article to a FM-file



SYNOPSIS

       USE MODI_FMWRIT_ll

       CALL  FMWRIT(  HFILEM, HRECFM, HFIPRI, HDIR, FIELD, KGRID,
       KLENCH, HCOMMENT, KRESP)



ARGUMENTS

       IN

              CHARACTER*    ::    HFILEM
              CHARACTER*    ::    HRECFM
              CHARACTER*    ::    HFIPRI
              CHARACTER*    ::    HDIR
              GENERIC       ::    FIELD
              INTEGER       ::    KGRID
              INTEGER       ::    KLENCH
              CHARACTER*    ::    HCOMMENT


       OUT

              INTEGER    ::    KRESP




DESCRIPTION

       The FMWRIT routine writes an article with HRECFM  name  to
       the  binary LFI part of a FM-File. The FM-file whose base­
       name is hold in HFILEM must have  been  previously  opened
       with  the  FMOPEN_ll  routine. The data associated with an
       article are the C-grid indicator KGRID, the comment string
       HCOMMENT  (with  a  KLENCH size) and the data array FIELD.
       FMWRIT is a generic routine that can write different kinds
       of  data array FIELD: integer, real, logical, character or
       type(DATE_TIME).  The following types are allowed for  the
       FIELD argument :

       REAL : scalar, 1D, 2D, 3D, 4D, 5D or 6D arrays

       INTEGER : scalar, 1D and 2D arrays

       LOGICAL : scalar and 1D array

       CHARACTER : string data

       type(DATE_TIME) : scalar data
              FMWRIT  is  intended to work in a parallel environ­
              ment where  multiple  processors  handle  different
              sub-parts  of the MésoNH domain.  Consequently, the
              HDIR argument must be carefully specified. It helps
              the  FMWRIT  routine in ordering the field array in
              order to write the complete array from each proces­
              sor  sub-section FIELD array. The writing operation
              must take into account that  the  MesoNH  computing
              domain is split along the x and y axes according to
              the number of processors used. The following string
              values are allowed for HDIR:

       ´XY´   when  the  FIELD  array  is of the form (x,y, ...),
              where (x,y,...)   denotes an array  of  rank  >=  2
              with the two first dimensions that spread along the
              X and Y axes of the MésoNH domain,

       ´XX´   when the FIELD array is of the form (x,  ...),where
              (x,...)   denotes  an  array  of rank >= 1 with the
              first dimension that spreads along the X axe of the
              MésoNH domain,

       ´YY´   when  the  FIELD array is of the form (y,...),where
              (y,...)denotes an array of rank >= 1 with the first
              dimension  that  spreads  along  the  Y  axe of the
              MésoNH domain,

       ´--´   for all other scalar or array fields.

       Note that specifying a wrong HDIR value may  cause  unpre­
       dictable results.

       Internally,  the  FMWRIT statement causes only one proces­
       sor, the so-called I/O processor, to write the whole  data
       associated  with the HRECFM article. The I/O processor can
       deduce from the HDIR specifier and  the  domain  splitting
       what  are  the  relevant  data to receive (with MPI opera­
       tions) from the other processors in  order  to  build  and
       write  the  complete array. When HDIR is set to ´XY´, ´XX´
       or ´YY´, each non I/O processor will send its  array  sec­
       tion  (associated with the HRECFM article) to the I/O pro­
       cessor. When HDIR = ´--´ then the I/O processor write  its
       data  array to the file (because all other processors hold
       the same data array).  Note  that  all  the  communication
       processes are transparent to the user.



RETURN VALUES

       Upon  successful  completion,  the informations associated
       with the HRECFM article are written to  the  FM  file  and
       KRESP  is  set  to 0. Otherwise KRESP is set to a non zero
       value and an error message is printed in the HFIPRI  file.



NOTES

       The  FMWRIT  operation handles only the binary LFI part of
       an  FM-file.   The  other  part   (the   so-called   ASCII
       descriptive part) is written with the fortran WRITE state­
       ment.

       The FMWRIT routine doesn´t handle the LB  (Lateral  Bound­
       ary)  nor  the  Budget  field  :  use the FMWRIT_LB or the
       FMWRITBOX routines instead.



SEE ALSO

       FMREAD(3f), FMOPEN_ll(3f), FMWRIT_LB(3f), FMWRITBOX(3f)













































Man(1) output converted with man2html