[MITgcm-support] using gather/scatter to work with global fields

Katherine Quinn kquinn at aer.com
Thu Aug 23 13:40:55 EDT 2012


Hi all,
Within the MITgcm code (not matlab) I need to gather tiled variables 
into a global array, specifically I'm trying to gather XC and YC.  I'm 
using the subroutine gather_2d_r4, which suggests "barrier calls" before 
and after but it seems no matter what various barrier calls I use, when 
I look at the global array there's chunks of tiles missing.  Other 
relevant info - the MITgcm setup is for ecco version 4 runs, with 
all_exch2 turned on.
Here's the relevant portions of my code, please suggest what I'm doing 
wrong:

C     == Global variables ===
#include "SIZE.h"
#include "EEPARAMS.h"
#include "EESUPPORT.h"
#include "PARAMS.h"
#ifdef ALLOW_EXCH2
# include "W2_EXCH2_SIZE.h"
# include "W2_EXCH2_TOPOLOGY.h"
# include "W2_EXCH2_PARAMS.h"
#endif /* ALLOW_EXCH2 */
#include "EEBUFF_SCPU.h"
#include "GRID.h"

C     INPUT/OUTPUT PARAMETERS:
C     == Routine arguments ==
C     myThid - Thread number for this instance of the routine.
       INTEGER  myThid

C     LOCAL VARIABLES:
       LOGICAL zeroBuff, useExch2ioLayOut
       INTEGER xSize, ySize
#ifdef ALLOW_EXCH2
       _RL  XC_global(exch2_global_Nx,exch2_global_Ny)
       _RL  YC_global(exch2_global_Nx,exch2_global_Ny)
#else  /* ALLOW_EXCH2 */
       _RS  XC_global(Nx,Ny)
       _RS  YC_global(Nx,Ny)
#endif /* ALLOW_EXCH2 */

C Set dimensions and flags (e.g. mdsio_write_field.F)
       xSize = Nx
       ySize = Ny
       useExch2ioLayOut = .FALSE.
       zeroBuff = .TRUE.
#ifdef ALLOW_EXCH2
       IF ( W2_useE2ioLayOut ) THEN
          xSize = exch2_global_Nx
          ySize = exch2_global_Ny
          useExch2ioLayOut = .TRUE.
       ENDIF
#endif /* ALLOW_EXCH2 */

C gather XC and YC into global model grid

       CALL BAR2( myThid )
       _BEGIN_MASTER( myThid )
       CALL GATHER_2D_R4(
      O                  XC_global,
      I                  XC,
      I                  xSize, ySize,
      I                  useExch2ioLayOut,
      I                  zeroBuff,
      I                  myThid )
       _END_MASTER( myThid )
       CALL BAR2( myThid )

       _BEGIN_MASTER( myThid )
       CALL GATHER_2D_R4(
      O                  YC_global,
      I                  YC,
      I                  xSize, ySize,
      I                  useExch2ioLayOut,
      I                  zeroBuff,
      I                  myThid )
       _END_MASTER( myThid )
       CALL BAR2( myThid )



-- 
Katherine J. Quinn
Atmospheric and Environmental Research         voice: 781-761-2234
131 Hartwell Avenue                              fax: 781-761-2299
Lexington, MA  02421-3126                     e-mail: kquinn at aer.com



More information about the MITgcm-support mailing list