/[MITgcm]/MITgcm/eesupp/src/gather_2d.F
ViewVC logotype

Annotation of /MITgcm/eesupp/src/gather_2d.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Tue Feb 18 05:33:53 2003 UTC (21 years, 4 months ago) by dimitri
Branch: MAIN
CVS Tags: checkpoint48f_post, checkpoint51k_post, checkpoint51l_post, checkpoint51j_post, checkpoint48i_post, checkpoint50d_pre, checkpoint50e_post, checkpoint50c_post, checkpoint48h_post, checkpoint50c_pre, branchpoint-genmake2, checkpoint50h_post, checkpoint51a_post, checkpoint51i_post, checkpoint50b_pre, checkpoint51e_post, checkpoint51b_post, checkpoint51l_pre, checkpoint51c_post, checkpoint49, checkpoint51f_pre, checkpoint50i_post, checkpoint48g_post, checkpoint51, checkpoint50, checkpoint50d_post, checkpoint51b_pre, checkpoint51h_pre, checkpoint50g_post, checkpoint51g_post, checkpoint51f_post, checkpoint50b_post, checkpoint50f_post, checkpoint50f_pre, checkpoint51d_post, checkpoint50a_post, checkpoint51m_post, checkpoint50e_pre, checkpoint51i_pre
Branch point for: branch-genmake2, tg2-branch, ecco-branch
Changes since 1.1: +89 -0 lines
Merging from release1_p12:
o Modifications for using pkg/exf with pkg/seaice
  - improved description of the various forcing configurations
  - added basic radiation bulk formulae to pkg/exf
  - units/sign fix for evap computation in exf_getffields.F
  - updated verification/global_with_exf/results/output.txt
o Added pkg/sbo for computing IERS Special Bureau for the Oceans
  (SBO) core products, including oceanic mass, center-of-mass,
  angular, and bottom pressure (see pkg/sbo/README.sbo).
o Lower bound for viscosity/diffusivity in pkg/kpp/kpp_routines.F
  to avoid negative values in shallow regions.
  - updated verification/natl_box/results/output.txt
  - updated verification/lab_sea/results/output.txt
o MPI gather, scatter: eesupp/src/gather_2d.F and scatter_2d.F
o Added useSingleCpuIO option (see PARAMS.h).
o Updated useSingleCpuIO option in mdsio_writefield.F to
  work with multi-field files, e.g., for single-file pickup.
o pkg/seaice:
  - bug fix in growth.F: QNET for no shortwave case
  - added HeffFile for specifying initial sea-ice thickness
  - changed SEAICE_EXTERNAL_FLUXES wind stress implementation
o Added missing /* */ to CPP comments in pkg/seaice, pkg/exf,
  kpp_transport_t.F, forward_step.F, and the_main_loop.F
o pkg/seaice:
  - adjoint-friendly modifications
  - added a SEAICE_WRITE_PICKUP at end of the_model_main.F

1 dimitri 1.2 #include "CPP_OPTIONS.h"
2    
3     SUBROUTINE GATHER_2D( global, local, myThid )
4     C Gather elements of a 2-D array from all mpi processes to process 0.
5     IMPLICIT NONE
6     #include "SIZE.h"
7     #include "EEPARAMS.h"
8     #include "EESUPPORT.h"
9     C mythid - thread number for this instance of the routine.
10     C global,local - working arrays used to transfer 2-D fields
11     INTEGER mythid
12     Real*8 global(Nx,Ny)
13     _RL local(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
14    
15     #ifdef ALLOW_USE_MPI
16     COMMON /GlobalLo/ mpi_myXGlobalLo, mpi_myYGlobalLo
17     INTEGER mpi_myXGlobalLo(nPx*nPy)
18     INTEGER mpi_myYGlobalLo(nPx*nPy)
19    
20     _RL temp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
21     INTEGER istatus(MPI_STATUS_SIZE), ierr
22     INTEGER idest, itag, npe, ready_to_receive
23     INTEGER iP, jP, iG,jG, i, j, bi, bj, lbuff
24    
25     C-- Make everyone wait except for master thread.
26     _BARRIER
27     _BEGIN_MASTER( myThid )
28     lbuff = (sNx+2*OLx)*nSx*(sNy+2*OLy)*nSy
29     idest = 0
30     itag = 0
31     ready_to_receive = 0
32    
33     IF( mpiMyId .EQ. 0 ) THEN
34    
35     C-- Process 0 fills-in its local data
36     npe = 0
37     DO bj=1,nSy
38     DO bi=1,nSx
39     DO j=1,sNy
40     DO i=1,sNx
41     iP = (bi-1)*sNx+i
42     jP = (bj-1)*sNy+j
43     iG = mpi_myXGlobalLo(npe+1)-1+(bi-1)*sNx+i
44     jG = mpi_myYGlobalLo(npe+1)-1+(bj-1)*sNy+j
45     global(iG,jG) = local(i,j,bi,bj)
46     ENDDO
47     ENDDO
48     ENDDO
49     ENDDO
50    
51     C-- Process 0 polls and receives data from each process in turn
52     DO npe = 1, numberOfProcs-1
53     CALL MPI_SEND (ready_to_receive, 1, MPI_INTEGER,
54     & npe, itag, MPI_COMM_MODEL, ierr)
55     CALL MPI_RECV (temp, lbuff, MPI_DOUBLE_PRECISION,
56     & npe, itag, MPI_COMM_MODEL, istatus, ierr)
57    
58     C-- Process 0 gathers the local arrays into a global array.
59     DO bj=1,nSy
60     DO bi=1,nSx
61     DO j=1,sNy
62     DO i=1,sNx
63     iP = (bi-1)*sNx+i
64     jP = (bj-1)*sNy+j
65     iG = mpi_myXGlobalLo(npe+1)-1+(bi-1)*sNx+i
66     jG = mpi_myYGlobalLo(npe+1)-1+(bj-1)*sNy+j
67     global(iG,jG) = temp(i,j,bi,bj)
68     ENDDO
69     ENDDO
70     ENDDO
71     ENDDO
72     ENDDO
73    
74     ELSE
75    
76     C-- All proceses except 0 wait to be polled then send local array
77     CALL MPI_RECV (ready_to_receive, 1, MPI_INTEGER,
78     & idest, itag, MPI_COMM_MODEL, istatus, ierr)
79     CALL MPI_SEND (local, lbuff, MPI_DOUBLE_PRECISION,
80     & idest, itag, MPI_COMM_MODEL, ierr)
81    
82     ENDIF
83    
84     _END_MASTER( myThid )
85     _BARRIER
86    
87     #endif /* ALLOW_USE_MPI */
88     RETURN
89     END

  ViewVC Help
Powered by ViewVC 1.1.22