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

Contents of /MITgcm/eesupp/src/scatter_2d.F

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


Revision 1.2 - (show annotations) (download)
Tue Feb 18 05:33:53 2003 UTC (21 years, 1 month ago) by dimitri
Branch: MAIN
CVS Tags: checkpoint48f_post, checkpoint51k_post, checkpoint51l_post, checkpoint51j_post, checkpoint48i_post, checkpoint50d_pre, checkpoint51o_pre, checkpoint50e_post, checkpoint50c_post, checkpoint51n_pre, checkpoint52d_pre, checkpoint48h_post, checkpoint50c_pre, branchpoint-genmake2, checkpoint51q_post, checkpoint50h_post, branch-netcdf, checkpoint51r_post, checkpoint52b_pre, checkpoint51i_post, checkpoint50b_pre, checkpoint51e_post, checkpoint51b_post, checkpoint51l_pre, checkpoint51c_post, checkpoint49, checkpoint51f_pre, checkpoint50i_post, checkpoint51o_post, checkpoint48g_post, checkpoint51, checkpoint50, checkpoint52, checkpoint50d_post, checkpoint51b_pre, checkpoint52a_post, checkpoint52b_post, checkpoint52c_post, checkpoint51h_pre, checkpoint50g_post, checkpoint51g_post, ecco_c52_e35, checkpoint51f_post, checkpoint50b_post, checkpoint50f_post, checkpoint50f_pre, checkpoint52a_pre, checkpoint51d_post, checkpoint50a_post, checkpoint51m_post, checkpoint51t_post, checkpoint51a_post, checkpoint50e_pre, checkpoint51p_post, checkpoint51n_post, checkpoint51i_pre, checkpoint51u_post, checkpoint51s_post
Branch point for: branch-nonh, branch-genmake2, tg2-branch, ecco-branch, checkpoint51n_branch
Changes since 1.1: +85 -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 #include "CPP_OPTIONS.h"
2
3 SUBROUTINE SCATTER_2D( global, local, myThid )
4 C Scatter elements of a 2-D array from mpi process 0 to all processes.
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 isource, itag, npe
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 isource = 0
30 itag = 0
31
32 IF( mpiMyId .EQ. 0 ) THEN
33
34 C-- Process 0 fills-in its local data
35 npe = 0
36 DO bj=1,nSy
37 DO bi=1,nSx
38 DO j=1,sNy
39 DO i=1,sNx
40 iP = (bi-1)*sNx+i
41 jP = (bj-1)*sNy+j
42 iG = mpi_myXGlobalLo(npe+1)-1+(bi-1)*sNx+i
43 jG = mpi_myYGlobalLo(npe+1)-1+(bj-1)*sNy+j
44 local(i,j,bi,bj) = global(iG,jG)
45 ENDDO
46 ENDDO
47 ENDDO
48 ENDDO
49
50 C-- Process 0 sends local arrays to all other processes
51 DO npe = 1, numberOfProcs-1
52 DO bj=1,nSy
53 DO bi=1,nSx
54 DO j=1,sNy
55 DO i=1,sNx
56 iP = (bi-1)*sNx+i
57 jP = (bj-1)*sNy+j
58 iG = mpi_myXGlobalLo(npe+1)-1+(bi-1)*sNx+i
59 jG = mpi_myYGlobalLo(npe+1)-1+(bj-1)*sNy+j
60 temp(i,j,bi,bj) = global(iG,jG)
61 ENDDO
62 ENDDO
63 ENDDO
64 ENDDO
65 CALL MPI_SEND (temp, lbuff, MPI_DOUBLE_PRECISION,
66 & npe, itag, MPI_COMM_MODEL, ierr)
67 ENDDO
68
69 ELSE
70
71 C-- All proceses except 0 receive local array from process 0
72 CALL MPI_RECV (local, lbuff, MPI_DOUBLE_PRECISION,
73 & isource, itag, MPI_COMM_MODEL, istatus, ierr)
74
75 ENDIF
76
77 _END_MASTER( myThid )
78 _BARRIER
79
80 C-- Fill in edges.
81 _EXCH_XY_R8( local, myThid )
82
83 #endif /* ALLOW_USE_MPI */
84 RETURN
85 END

  ViewVC Help
Powered by ViewVC 1.1.22