/[MITgcm]/MITgcm_contrib/ocean_inversion_project/code/ptracers_init.F
ViewVC logotype

Diff of /MITgcm_contrib/ocean_inversion_project/code/ptracers_init.F

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

revision 1.6 by dimitri, Tue Oct 21 07:31:11 2003 UTC revision 1.8 by dimitri, Thu Dec 18 06:11:14 2003 UTC
# Line 39  C  i,j,k,bi,bj,iTracer  :: loop indices Line 39  C  i,j,k,bi,bj,iTracer  :: loop indices
39        _RL SumPtracer        _RL SumPtracer
40    
41  #ifdef OCEAN_INVERSION_NETCDF  #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)        Real lon(Nx,Ny),bounds_lon(Nx,Ny,2,2)
45        Real lat(Nx,Ny),bounds_lat(Nx,Ny,2,2)        Real lat(Nx,Ny),bounds_lat(Nx,Ny,2,2)
46        Real depth(Nr),bounds_depth(Nr,2)        Real depth(Nr),bounds_depth(Nr,2)
# Line 100  C     Initialize pTracerTakahashi Line 102  C     Initialize pTracerTakahashi
102    
103  C     Normalize pTracerTakahashi so that 1e18 mol/yr is released  C     Normalize pTracerTakahashi so that 1e18 mol/yr is released
104  C     from each model region defined in pTracerMasks.  C     from each model region defined in pTracerMasks.
105  C     It is assumed that each year is 365.25 days (31557600 s)  C     It is assumed that each year is 365.24167 days (31556880 s)
106  C     long and that each month is 2629800 s.  C     long and that each month is 2629740 s.
107    
108        DO iTracer = 1, PTRACERS_num        DO iTracer = 1, PTRACERS_num
109         SumPtracer = 0.         SumPtracer = 0.
# Line 110  C     long and that each month is 262980 Line 112  C     long and that each month is 262980
112           DO j=1,sNy           DO j=1,sNy
113            DO i=1,sNx            DO i=1,sNx
114             DO iMonth=1,12             DO iMonth=1,12
115              SumPtracer = SumPtracer + 2629800. * rA(I,J,bi,bj) *              SumPtracer = SumPtracer + 2629740. * rA(I,J,bi,bj) *
116       &             pTracerMasks    (I,J,iTracer,bi,bj) *       &             pTracerMasks    (I,J,iTracer,bi,bj) *
117       &             pTracerTakahashi(I,J,iMonth ,bi,bj)       &             pTracerTakahashi(I,J,iMonth ,bi,bj)
118             ENDDO             ENDDO
# Line 146  cdb      print*, '###', iRec, pTracerAtm Line 148  cdb      print*, '###', iRec, pTracerAtm
148  #endif /* OCEAN_INVERSION_PROJECT_TIME_DEPENDENT */  #endif /* OCEAN_INVERSION_PROJECT_TIME_DEPENDENT */
149    
150  #ifdef OCEAN_INVERSION_NETCDF  #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        DO j=1,Ny
280           DO i=1,Nx         DO i=1,Nx
281              lon           (i,j        ) = 0.          AREA (i,j) = global(i,j)
282              bounds_lon    (i,j,1,1    ) = 0.         ENDDO
283              bounds_lon    (i,j,1,2    ) = 0.        ENDDO
284              bounds_lon    (i,j,2,1    ) = 0.  
285              bounds_lon    (i,j,2,2    ) = 0.  C--   BATHY
286              lat           (i,j        ) = 0.        DO bj = myByLo(myThid), myByHi(myThid)
287              bounds_lat    (i,j,1,1    ) = 0.         DO bi = myBxLo(myThid), myBxHi(myThid)
288              bounds_lat    (i,j,1,2    ) = 0.          DO j=1,sNy
289              bounds_lat    (i,j,2,1    ) = 0.           DO i=1,sNx
290              bounds_lat    (i,j,2,2    ) = 0.            local (i,j,bi,bj) = R_low (i,j,bi,bj)
291              AREA          (i,j        ) = 0.           ENDDO
292              BATHY         (i,j        ) = 0.          ENDDO
293              DO k=1,Nr         ENDDO
294                 MASK       (i,j,k      ) = 0.        ENDDO
295              ENDDO        call gather_2d ( global, local, myThid )
296              DO iTracer = 1, PTRACERS_num        DO j=1,Ny
297                 REGION_MASK(i,j,iTracer) = 0.         DO i=1,Nx
298              ENDDO          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           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        ENDDO
339    
340    C--   depth, bounds_depth
341        DO k=1,Nr        DO k=1,Nr
342           depth            (    k      ) = 0.         depth        (k  ) = abs ( rC (k)   )
343           bounds_depth     (    k,1    ) = 0.         bounds_depth (k,1) = abs ( rF (k+1) )
344           bounds_depth     (    k,2    ) = 0.         bounds_depth (k,2) = abs ( rF (k)   )
345        ENDDO        ENDDO
346    
347        DO iTracer = 1, PTRACERS_num        DO iTracer = 1, PTRACERS_num
348           REGION_AREA      (      iTracer) = 0.         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        ENDDO
356        call WRITE_NC_MaskAreaBathy(  
357       &     'ECCO','MIT GCM Release 1',  C--   Master thread of process 0 writes netcdf output file
358       &     Nx,Ny,Nr,PTRACERS_num,        _BEGIN_MASTER( myThid )
359       &     lon,bounds_lon,lat,bounds_lat,depth,bounds_depth,  #ifdef ALLOW_USE_MPI
360       &     MASK,AREA,BATHY,REGION_MASK,REGION_AREA)         IF( mpiMyId .EQ. 0 ) THEN
361        stop  #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 */  #endif /* OCEAN_INVERSION_NETCDF */
373    
374  #endif /* ALLOW_PTRACERS */  #endif /* ALLOW_PTRACERS */

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.22