21 |
c ================================================================== |
c ================================================================== |
22 |
c SUBROUTINE mds_read_whalos |
c SUBROUTINE mds_read_whalos |
23 |
c ================================================================== |
c ================================================================== |
24 |
c o Read file that includes halos. The main purpose is for |
c o Read file that includes halos. The main purpose is for |
25 |
c adjoint related "tape I/O". The secondary purpose is debugging. |
c adjoint related "tape I/O". The secondary purpose is debugging. |
26 |
c ================================================================== |
c ================================================================== |
27 |
c SUBROUTINE mds_read_whalos |
c SUBROUTINE mds_read_whalos |
56 |
integer fid |
integer fid |
57 |
integer filePrec |
integer filePrec |
58 |
integer n2d |
integer n2d |
|
integer length |
|
59 |
integer irec |
integer irec |
60 |
_RL fldRL(1-Olx:sNx+Olx,1-Oly:sNy+Oly,n2d,nSx,nSy) |
_RL fldRL(1-Olx:sNx+Olx,1-Oly:sNy+Oly,n2d,nSx,nSy) |
61 |
CEOP |
CEOP |
76 |
PARAMETER ( sNyWh = sNy+2*Oly ) |
PARAMETER ( sNyWh = sNy+2*Oly ) |
77 |
PARAMETER ( procNyWh = sNyWh*nSy*nSx ) |
PARAMETER ( procNyWh = sNyWh*nSy*nSx ) |
78 |
PARAMETER ( gloNyWh = procNyWh*nPy*nPx ) |
PARAMETER ( gloNyWh = procNyWh*nPy*nPx ) |
79 |
|
|
80 |
character*(MAX_LEN_FNAM) pfName |
character*(MAX_LEN_FNAM) pfName |
81 |
character*(MAX_LEN_MBUF) msgBuf |
character*(MAX_LEN_MBUF) msgBuf |
82 |
integer IL,pIL |
integer IL,pIL |
83 |
integer bx,by |
integer bx,by |
84 |
|
|
85 |
integer length2d, length3d, length_of_rec |
integer length2d, length3d, length_of_rec |
86 |
integer i2d, i3d |
integer i2d, i3d |
87 |
integer i,j,k,bi,bj,ii |
integer i,j,k,bi,bj,ii |
100 |
|
|
101 |
c == end of interface == |
c == end of interface == |
102 |
|
|
103 |
length2d=sNxWh*procNyWh |
length2d=sNxWh*procNyWh |
104 |
length3d=length2d*nr |
length3d=length2d*nr |
105 |
|
|
106 |
C Only do I/O if I am the master thread (and mpi process 0 IF useSingleCpuIO): |
C Only do I/O if I am the master thread (and mpi process 0 IF useSingleCpuIO): |
139 |
ELSE |
ELSE |
140 |
READ(dUnit,rec=irec2d) fld2d_procbuff_r8 |
READ(dUnit,rec=irec2d) fld2d_procbuff_r8 |
141 |
ENDIF |
ENDIF |
142 |
ELSE |
ELSE |
143 |
IF (filePrec .EQ. precFloat32) THEN |
IF (filePrec .EQ. precFloat32) THEN |
144 |
READ(dUnit,rec=irec2d) fld2d_globuff_r4 |
READ(dUnit,rec=irec2d) fld2d_globuff_r4 |
145 |
ELSE |
ELSE |
146 |
READ(dUnit,rec=irec2d) fld2d_globuff_r8 |
READ(dUnit,rec=irec2d) fld2d_globuff_r8 |
147 |
ENDIF |
ENDIF |
148 |
ENDIF |
ENDIF |
149 |
ENDIF |
ENDIF |
150 |
_BARRIER |
_BARRIER |
151 |
|
|
152 |
IF (filePrec .EQ. precFloat32) THEN |
IF (filePrec .EQ. precFloat32) THEN |
153 |
IF ( useSingleCpuIO ) then |
IF ( useSingleCpuIO ) then |
154 |
CALL SCATTER_2D_WH_R4 ( fld2d_globuff_r4, |
CALL SCATTER_2D_WH_R4 ( fld2d_globuff_r4, |
155 |
& fld2d_procbuff_r4,myThid) |
& fld2d_procbuff_r4,myThid) |
156 |
CALL BAR2( myThid ) |
CALL BAR2( myThid ) |
157 |
ENDIF |
ENDIF |
159 |
& 1, i2d, n2d, 0, 0, .TRUE., myThid ) |
& 1, i2d, n2d, 0, 0, .TRUE., myThid ) |
160 |
ELSE |
ELSE |
161 |
IF ( useSingleCpuIO ) then |
IF ( useSingleCpuIO ) then |
162 |
CALL SCATTER_2D_WH_R8 ( fld2d_globuff_r8, |
CALL SCATTER_2D_WH_R8 ( fld2d_globuff_r8, |
163 |
& fld2d_procbuff_r8,myThid) |
& fld2d_procbuff_r8,myThid) |
164 |
CALL BAR2( myThid ) |
CALL BAR2( myThid ) |
165 |
ENDIF |
ENDIF |
168 |
ENDIF |
ENDIF |
169 |
|
|
170 |
enddo |
enddo |
171 |
|
|
172 |
IF ( iAmDoingIO ) THEN |
IF ( iAmDoingIO ) THEN |
173 |
CLOSE( dUnit ) |
CLOSE( dUnit ) |
174 |
ENDIF |
ENDIF |