37 |
INTEGER i,j,k,bi,bj,iTracer,iMonth,iUnit,iRec |
INTEGER i,j,k,bi,bj,iTracer,iMonth,iUnit,iRec |
38 |
CHARACTER*(10) suff |
CHARACTER*(10) suff |
39 |
_RL SumPtracer |
_RL SumPtracer |
40 |
|
|
41 |
|
#ifdef OCEAN_INVERSION_NETCDF |
42 |
|
Real*8 global(Nx,Ny) |
43 |
|
_RL local(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
44 |
|
Real lon(Nx,Ny),bounds_lon(Nx,Ny,2,2) |
45 |
|
Real lat(Nx,Ny),bounds_lat(Nx,Ny,2,2) |
46 |
|
Real depth(Nr),bounds_depth(Nr,2) |
47 |
|
Real MASK(Nx,Ny,Nr) |
48 |
|
Real AREA(Nx,Ny) |
49 |
|
Real BATHY(Nx,Ny) |
50 |
|
Real REGION_MASK(Nx,Ny,PTRACERS_num) |
51 |
|
Real REGION_AREA(PTRACERS_num) |
52 |
|
#endif /* OCEAN_INVERSION_NETCDF */ |
53 |
|
|
54 |
CEOP |
CEOP |
55 |
|
|
56 |
C Loop over tracers |
C Loop over tracers |
147 |
close(iUnit) |
close(iUnit) |
148 |
#endif /* OCEAN_INVERSION_PROJECT_TIME_DEPENDENT */ |
#endif /* OCEAN_INVERSION_PROJECT_TIME_DEPENDENT */ |
149 |
|
|
150 |
|
#ifdef OCEAN_INVERSION_NETCDF |
151 |
|
|
152 |
|
C-- lon |
153 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
154 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
155 |
|
DO j=1,sNy |
156 |
|
DO i=1,sNx |
157 |
|
local (i,j,bi,bj) = xC (i,j,bi,bj) |
158 |
|
ENDDO |
159 |
|
ENDDO |
160 |
|
ENDDO |
161 |
|
ENDDO |
162 |
|
call gather_2d ( global, local, myThid ) |
163 |
|
DO j=1,Ny |
164 |
|
DO i=1,Nx |
165 |
|
if ( global(i,j) .gt. 180. ) then |
166 |
|
lon (i,j) = global(i,j) - 360. |
167 |
|
else |
168 |
|
lon (i,j) = global(i,j) |
169 |
|
endif |
170 |
|
ENDDO |
171 |
|
ENDDO |
172 |
|
|
173 |
|
C-- bounds_lon |
174 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
175 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
176 |
|
DO j=1,sNy |
177 |
|
DO i=1,sNx |
178 |
|
local (i,j,bi,bj) = xG (i,j,bi,bj) |
179 |
|
ENDDO |
180 |
|
ENDDO |
181 |
|
ENDDO |
182 |
|
ENDDO |
183 |
|
call gather_2d ( global, local, myThid ) |
184 |
|
DO j=1,Ny |
185 |
|
DO i=1,Nx |
186 |
|
if ( global(i,j) .gt. 180. ) then |
187 |
|
bounds_lon (i,j,1,1) = global(i,j) - 360. |
188 |
|
bounds_lon (i,j,1,2) = global(i,j) - 360. |
189 |
|
else |
190 |
|
bounds_lon (i,j,1,1) = global(i,j) |
191 |
|
bounds_lon (i,j,1,2) = global(i,j) |
192 |
|
endif |
193 |
|
ENDDO |
194 |
|
ENDDO |
195 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
196 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
197 |
|
DO j=1,sNy |
198 |
|
DO i=1,sNx |
199 |
|
local (i,j,bi,bj) = xG (i+1,j,bi,bj) |
200 |
|
ENDDO |
201 |
|
ENDDO |
202 |
|
ENDDO |
203 |
|
ENDDO |
204 |
|
call gather_2d ( global, local, myThid ) |
205 |
|
DO j=1,Ny |
206 |
|
DO i=1,Nx |
207 |
|
if ( global(i,j) .gt. 180. ) then |
208 |
|
bounds_lon (i,j,2,1) = global(i,j) - 360. |
209 |
|
bounds_lon (i,j,2,2) = global(i,j) - 360. |
210 |
|
else |
211 |
|
bounds_lon (i,j,2,1) = global(i,j) |
212 |
|
bounds_lon (i,j,2,2) = global(i,j) |
213 |
|
endif |
214 |
|
ENDDO |
215 |
|
ENDDO |
216 |
|
|
217 |
|
C-- lat |
218 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
219 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
220 |
|
DO j=1,sNy |
221 |
|
DO i=1,sNx |
222 |
|
local (i,j,bi,bj) = yC (i,j,bi,bj) |
223 |
|
ENDDO |
224 |
|
ENDDO |
225 |
|
ENDDO |
226 |
|
ENDDO |
227 |
|
call gather_2d ( global, local, myThid ) |
228 |
|
DO j=1,Ny |
229 |
|
DO i=1,Nx |
230 |
|
lat (i,j) = global(i,j) |
231 |
|
ENDDO |
232 |
|
ENDDO |
233 |
|
|
234 |
|
C-- bounds_lat |
235 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
236 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
237 |
|
DO j=1,sNy |
238 |
|
DO i=1,sNx |
239 |
|
local (i,j,bi,bj) = yG (i,j,bi,bj) |
240 |
|
ENDDO |
241 |
|
ENDDO |
242 |
|
ENDDO |
243 |
|
ENDDO |
244 |
|
call gather_2d ( global, local, myThid ) |
245 |
|
DO j=1,Ny |
246 |
|
DO i=1,Nx |
247 |
|
bounds_lat (i,j,1,1) = global(i,j) |
248 |
|
bounds_lat (i,j,2,1) = global(i,j) |
249 |
|
ENDDO |
250 |
|
ENDDO |
251 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
252 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
253 |
|
DO j=1,sNy |
254 |
|
DO i=1,sNx |
255 |
|
local (i,j,bi,bj) = yG (i,j+1,bi,bj) |
256 |
|
ENDDO |
257 |
|
ENDDO |
258 |
|
ENDDO |
259 |
|
ENDDO |
260 |
|
call gather_2d ( global, local, myThid ) |
261 |
|
DO j=1,Ny |
262 |
|
DO i=1,Nx |
263 |
|
bounds_lat (i,j,1,2) = global(i,j) |
264 |
|
bounds_lat (i,j,2,2) = global(i,j) |
265 |
|
ENDDO |
266 |
|
ENDDO |
267 |
|
|
268 |
|
C-- AREA |
269 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
270 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
271 |
|
DO j=1,sNy |
272 |
|
DO i=1,sNx |
273 |
|
local (i,j,bi,bj) = rA (i,j,bi,bj) |
274 |
|
ENDDO |
275 |
|
ENDDO |
276 |
|
ENDDO |
277 |
|
ENDDO |
278 |
|
call gather_2d ( global, local, myThid ) |
279 |
|
DO j=1,Ny |
280 |
|
DO i=1,Nx |
281 |
|
AREA (i,j) = global(i,j) |
282 |
|
ENDDO |
283 |
|
ENDDO |
284 |
|
|
285 |
|
C-- BATHY |
286 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
287 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
288 |
|
DO j=1,sNy |
289 |
|
DO i=1,sNx |
290 |
|
local (i,j,bi,bj) = R_low (i,j,bi,bj) |
291 |
|
ENDDO |
292 |
|
ENDDO |
293 |
|
ENDDO |
294 |
|
ENDDO |
295 |
|
call gather_2d ( global, local, myThid ) |
296 |
|
DO j=1,Ny |
297 |
|
DO i=1,Nx |
298 |
|
BATHY (i,j) = abs ( global(i,j) ) |
299 |
|
ENDDO |
300 |
|
ENDDO |
301 |
|
|
302 |
|
C-- MASK |
303 |
|
DO k=1,Nr |
304 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
305 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
306 |
|
DO j=1,sNy |
307 |
|
DO i=1,sNx |
308 |
|
local (i,j,bi,bj) = hFacC (i,j,k,bi,bj) |
309 |
|
ENDDO |
310 |
|
ENDDO |
311 |
|
ENDDO |
312 |
|
ENDDO |
313 |
|
call gather_2d ( global, local, myThid ) |
314 |
|
DO j=1,Ny |
315 |
|
DO i=1,Nx |
316 |
|
MASK (i,j,k) = global(i,j) |
317 |
|
ENDDO |
318 |
|
ENDDO |
319 |
|
ENDDO |
320 |
|
|
321 |
|
C-- REGION_MASK |
322 |
|
DO iTracer = 1, PTRACERS_num |
323 |
|
DO bj = myByLo(myThid), myByHi(myThid) |
324 |
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
325 |
|
DO j=1,sNy |
326 |
|
DO i=1,sNx |
327 |
|
local (i,j,bi,bj) = pTracerMasks(i,j,iTracer,bi,bj) |
328 |
|
ENDDO |
329 |
|
ENDDO |
330 |
|
ENDDO |
331 |
|
ENDDO |
332 |
|
call gather_2d ( global, local, myThid ) |
333 |
|
DO j=1,Ny |
334 |
|
DO i=1,Nx |
335 |
|
REGION_MASK (i,j,iTracer) = global(i,j) |
336 |
|
ENDDO |
337 |
|
ENDDO |
338 |
|
ENDDO |
339 |
|
|
340 |
|
C-- depth, bounds_depth |
341 |
|
DO k=1,Nr |
342 |
|
depth (k ) = abs ( rC (k) ) |
343 |
|
bounds_depth (k,1) = abs ( rF (k+1) ) |
344 |
|
bounds_depth (k,2) = abs ( rF (k) ) |
345 |
|
ENDDO |
346 |
|
|
347 |
|
DO iTracer = 1, PTRACERS_num |
348 |
|
REGION_AREA (iTracer) = 0. |
349 |
|
DO j=1,Ny |
350 |
|
DO i=1,Nx |
351 |
|
REGION_AREA (iTracer) = REGION_AREA (iTracer) + |
352 |
|
& REGION_MASK (i,j,iTracer) * AREA (i,j) |
353 |
|
ENDDO |
354 |
|
ENDDO |
355 |
|
ENDDO |
356 |
|
|
357 |
|
C-- Master thread of process 0 writes netcdf output file |
358 |
|
_BEGIN_MASTER( myThid ) |
359 |
|
#ifdef ALLOW_USE_MPI |
360 |
|
IF( mpiMyId .EQ. 0 ) THEN |
361 |
|
#endif |
362 |
|
call WRITE_NC_MaskAreaBathy( |
363 |
|
& 'ECCO','MIT GCM Release 1', |
364 |
|
& Nx,Ny,Nr,PTRACERS_num, |
365 |
|
& lon,bounds_lon,lat,bounds_lat,depth,bounds_depth, |
366 |
|
& MASK,AREA,BATHY,REGION_MASK,REGION_AREA) |
367 |
|
#ifdef ALLOW_USE_MPI |
368 |
|
ENDIF |
369 |
|
#endif |
370 |
|
_END_MASTER( myThid ) |
371 |
|
|
372 |
|
#endif /* OCEAN_INVERSION_NETCDF */ |
373 |
|
|
374 |
#endif /* ALLOW_PTRACERS */ |
#endif /* ALLOW_PTRACERS */ |
375 |
|
|
376 |
RETURN |
RETURN |