1 | MODULE trcrst |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE trcrst *** |
---|
4 | !! TOP : Manage the passive tracer restart |
---|
5 | !!====================================================================== |
---|
6 | !! History : - ! 1991-03 () original code |
---|
7 | !! 1.0 ! 2005-03 (O. Aumont, A. El Moussaoui) F90 |
---|
8 | !! - ! 2005-10 (C. Ethe) print control |
---|
9 | !! 2.0 ! 2005-10 (C. Ethe, G. Madec) revised architecture |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | #if defined key_top |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | !! 'key_top' TOP models |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | !!---------------------------------------------------------------------- |
---|
16 | !! trc_rst : Restart for passive tracer |
---|
17 | !! trc_rst_opn : open restart file |
---|
18 | !! trc_rst_read : read restart file |
---|
19 | !! trc_rst_wri : write restart file |
---|
20 | !!---------------------------------------------------------------------- |
---|
21 | USE oce_trc |
---|
22 | USE trc |
---|
23 | USE iom |
---|
24 | USE daymod |
---|
25 | USE lib_mpp |
---|
26 | USE sms_medusa |
---|
27 | |
---|
28 | IMPLICIT NONE |
---|
29 | PRIVATE |
---|
30 | |
---|
31 | PUBLIC trc_rst_opn ! called by ??? |
---|
32 | PUBLIC trc_rst_read ! called by ??? |
---|
33 | PUBLIC trc_rst_wri ! called by ??? |
---|
34 | PUBLIC trc_rst_cal |
---|
35 | PUBLIC trc_rst_stat |
---|
36 | PUBLIC trc_rst_conserve ! Conservation Checks |
---|
37 | |
---|
38 | |
---|
39 | !!---------------------------------------------------------------------- |
---|
40 | !! NEMO/TOP 4.0 , NEMO Consortium (2018) |
---|
41 | !! $Id$ |
---|
42 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
43 | !!---------------------------------------------------------------------- |
---|
44 | CONTAINS |
---|
45 | |
---|
46 | SUBROUTINE trc_rst_opn( kt ) |
---|
47 | !!---------------------------------------------------------------------- |
---|
48 | !! *** trc_rst_opn *** |
---|
49 | !! |
---|
50 | !! ** purpose : output of sea-trc variable in a netcdf file |
---|
51 | !!---------------------------------------------------------------------- |
---|
52 | INTEGER, INTENT(in) :: kt ! number of iteration |
---|
53 | ! |
---|
54 | CHARACTER(LEN=20) :: clkt ! ocean time-step define as a character |
---|
55 | CHARACTER(LEN=50) :: clname ! trc output restart file name |
---|
56 | CHARACTER(LEN=256) :: clpath ! full path to ocean output restart file |
---|
57 | !!---------------------------------------------------------------------- |
---|
58 | ! |
---|
59 | IF( l_offline ) THEN |
---|
60 | IF( kt == nittrc000 ) THEN |
---|
61 | lrst_trc = .FALSE. |
---|
62 | IF( ln_rst_list ) THEN |
---|
63 | nrst_lst = 1 |
---|
64 | nitrst = nn_stocklist( nrst_lst ) |
---|
65 | ELSE |
---|
66 | nitrst = nitend |
---|
67 | ENDIF |
---|
68 | ENDIF |
---|
69 | |
---|
70 | IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nn_stock ) == 0 ) THEN |
---|
71 | ! we use kt - 1 and not kt - nittrc000 to keep the same periodicity from the beginning of the experiment |
---|
72 | nitrst = kt + nn_stock - 1 ! define the next value of nitrst for restart writing |
---|
73 | IF( nitrst > nitend ) nitrst = nitend ! make sure we write a restart at the end of the run |
---|
74 | ENDIF |
---|
75 | ELSE |
---|
76 | IF( kt == nittrc000 ) lrst_trc = .FALSE. |
---|
77 | ENDIF |
---|
78 | |
---|
79 | IF( .NOT. ln_rst_list .AND. nn_stock == -1 ) RETURN ! we will never do any restart |
---|
80 | |
---|
81 | ! to get better performances with NetCDF format: |
---|
82 | ! we open and define the tracer restart file one tracer time step before writing the data (-> at nitrst - 2*nn_dttrc + 1) |
---|
83 | ! except if we write tracer restart files every tracer time step or if a tracer restart file was writen at nitend - 2*nn_dttrc + 1 |
---|
84 | IF( kt == nitrst - 2*nn_dttrc .OR. nn_stock == nn_dttrc .OR. ( kt == nitend - nn_dttrc .AND. .NOT. lrst_trc ) ) THEN |
---|
85 | ! beware of the format used to write kt (default is i8.8, that should be large enough) |
---|
86 | IF( nitrst > 1.0e9 ) THEN ; WRITE(clkt,* ) nitrst |
---|
87 | ELSE ; WRITE(clkt,'(i8.8)') nitrst |
---|
88 | ENDIF |
---|
89 | ! create the file |
---|
90 | IF(lwp) WRITE(numout,*) |
---|
91 | clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_trcrst_out) |
---|
92 | clpath = TRIM(cn_trcrst_outdir) |
---|
93 | IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' |
---|
94 | IF(lwp) WRITE(numout,*) & |
---|
95 | ' open trc restart.output NetCDF file: ',TRIM(clpath)//clname |
---|
96 | CALL iom_open( TRIM(clpath)//TRIM(clname), numrtw, ldwrt = .TRUE. ) |
---|
97 | lrst_trc = .TRUE. |
---|
98 | ENDIF |
---|
99 | ! |
---|
100 | END SUBROUTINE trc_rst_opn |
---|
101 | |
---|
102 | SUBROUTINE trc_rst_read |
---|
103 | !!---------------------------------------------------------------------- |
---|
104 | !! *** trc_rst_opn *** |
---|
105 | !! |
---|
106 | !! ** purpose : read passive tracer fields in restart files |
---|
107 | !!---------------------------------------------------------------------- |
---|
108 | INTEGER :: jn |
---|
109 | |
---|
110 | !!---------------------------------------------------------------------- |
---|
111 | ! |
---|
112 | IF(lwp) WRITE(numout,*) |
---|
113 | IF(lwp) WRITE(numout,*) 'trc_rst_read : read data in the TOP restart file' |
---|
114 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' |
---|
115 | |
---|
116 | ! READ prognostic variables and computes diagnostic variable |
---|
117 | DO jn = 1, jptra |
---|
118 | CALL iom_get( numrtr, jpdom_autoglo, 'TRN'//ctrcnm(jn), trn(:,:,:,jn) ) |
---|
119 | END DO |
---|
120 | |
---|
121 | DO jn = 1, jptra |
---|
122 | CALL iom_get( numrtr, jpdom_autoglo, 'TRB'//ctrcnm(jn), trb(:,:,:,jn) ) |
---|
123 | END DO |
---|
124 | ! |
---|
125 | CALL iom_delay_rst( 'READ', 'TOP', numrtr ) ! read only TOP delayed global communication variables |
---|
126 | |
---|
127 | END SUBROUTINE trc_rst_read |
---|
128 | |
---|
129 | SUBROUTINE trc_rst_wri( kt ) |
---|
130 | !!---------------------------------------------------------------------- |
---|
131 | !! *** trc_rst_wri *** |
---|
132 | !! |
---|
133 | !! ** purpose : write passive tracer fields in restart files |
---|
134 | !!---------------------------------------------------------------------- |
---|
135 | INTEGER, INTENT( in ) :: kt ! ocean time-step index |
---|
136 | !! |
---|
137 | INTEGER :: jn |
---|
138 | !!---------------------------------------------------------------------- |
---|
139 | ! |
---|
140 | CALL iom_rstput( kt, nitrst, numrtw, 'rdttrc1', rdttrc ) ! passive tracer time step |
---|
141 | ! prognostic variables |
---|
142 | ! -------------------- |
---|
143 | DO jn = 1, jptra |
---|
144 | CALL iom_rstput( kt, nitrst, numrtw, 'TRN'//ctrcnm(jn), trn(:,:,:,jn) ) |
---|
145 | END DO |
---|
146 | |
---|
147 | DO jn = 1, jptra |
---|
148 | CALL iom_rstput( kt, nitrst, numrtw, 'TRB'//ctrcnm(jn), trb(:,:,:,jn) ) |
---|
149 | END DO |
---|
150 | ! |
---|
151 | CALL iom_delay_rst( 'WRITE', 'TOP', numrtw ) ! save only TOP delayed global communication variables |
---|
152 | |
---|
153 | IF( kt == nitrst ) THEN |
---|
154 | CALL trc_rst_stat ! statistics |
---|
155 | CALL trc_rst_conserve ! Conservation Checks |
---|
156 | CALL iom_close( numrtw ) ! close the restart file (only at last time step) |
---|
157 | #if ! defined key_trdmxl_trc |
---|
158 | lrst_trc = .FALSE. |
---|
159 | #endif |
---|
160 | IF( l_offline .AND. ln_rst_list ) THEN |
---|
161 | nrst_lst = nrst_lst + 1 |
---|
162 | nitrst = nn_stocklist( nrst_lst ) |
---|
163 | ENDIF |
---|
164 | ENDIF |
---|
165 | ! |
---|
166 | END SUBROUTINE trc_rst_wri |
---|
167 | |
---|
168 | |
---|
169 | SUBROUTINE trc_rst_cal( kt, cdrw ) |
---|
170 | !!--------------------------------------------------------------------- |
---|
171 | !! *** ROUTINE trc_rst_cal *** |
---|
172 | !! |
---|
173 | !! ** Purpose : Read or write calendar in restart file: |
---|
174 | !! |
---|
175 | !! WRITE(READ) mode: |
---|
176 | !! kt : number of time step since the begining of the experiment at the |
---|
177 | !! end of the current(previous) run |
---|
178 | !! adatrj(0) : number of elapsed days since the begining of the experiment at the |
---|
179 | !! end of the current(previous) run (REAL -> keep fractions of day) |
---|
180 | !! ndastp : date at the end of the current(previous) run (coded as yyyymmdd integer) |
---|
181 | !! |
---|
182 | !! According to namelist parameter nrstdt, |
---|
183 | !! nn_rsttr = 0 no control on the date (nittrc000 is arbitrary). |
---|
184 | !! nn_rsttr = 1 we verify that nittrc000 is equal to the last |
---|
185 | !! time step of previous run + 1. |
---|
186 | !! In both those options, the exact duration of the experiment |
---|
187 | !! since the beginning (cumulated duration of all previous restart runs) |
---|
188 | !! is not stored in the restart and is assumed to be (nittrc000-1)*rdt. |
---|
189 | !! This is valid is the time step has remained constant. |
---|
190 | !! |
---|
191 | !! nn_rsttr = 2 the duration of the experiment in days (adatrj) |
---|
192 | !! has been stored in the restart file. |
---|
193 | !!---------------------------------------------------------------------- |
---|
194 | INTEGER , INTENT(in) :: kt ! ocean time-step |
---|
195 | CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag |
---|
196 | ! |
---|
197 | LOGICAL :: llok |
---|
198 | REAL(wp) :: zrdttrc1, zkt, zndastp, zdayfrac, ksecs, ktime |
---|
199 | INTEGER :: ihour, iminute |
---|
200 | |
---|
201 | ! Time domain : restart |
---|
202 | ! --------------------- |
---|
203 | |
---|
204 | IF( TRIM(cdrw) == 'READ' ) THEN |
---|
205 | |
---|
206 | IF(lwp) WRITE(numout,*) |
---|
207 | IF(lwp) WRITE(numout,*) 'trc_rst_cal : read the TOP restart file for calendar' |
---|
208 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' |
---|
209 | |
---|
210 | IF( ln_rsttr ) THEN |
---|
211 | CALL iom_open( TRIM(cn_trcrst_indir)//'/'//cn_trcrst_in, numrtr ) |
---|
212 | CALL iom_get ( numrtr, 'kt', zkt ) ! last time-step of previous run |
---|
213 | |
---|
214 | IF(lwp) THEN |
---|
215 | WRITE(numout,*) ' *** Info read in restart : ' |
---|
216 | WRITE(numout,*) ' previous time-step : ', NINT( zkt ) |
---|
217 | WRITE(numout,*) ' *** restart option' |
---|
218 | SELECT CASE ( nn_rsttr ) |
---|
219 | CASE ( 0 ) ; WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' |
---|
220 | CASE ( 1 ) ; WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' |
---|
221 | CASE ( 2 ) ; WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' |
---|
222 | END SELECT |
---|
223 | WRITE(numout,*) |
---|
224 | ENDIF |
---|
225 | ! Control of date |
---|
226 | IF( nittrc000 - NINT( zkt ) /= nn_dttrc .AND. nn_rsttr /= 0 ) & |
---|
227 | & CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart', & |
---|
228 | & ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) |
---|
229 | ENDIF |
---|
230 | ! |
---|
231 | IF( l_offline ) THEN |
---|
232 | ! ! set the date in offline mode |
---|
233 | IF( ln_rsttr .AND. nn_rsttr == 2 ) THEN |
---|
234 | CALL iom_get( numrtr, 'ndastp', zndastp ) |
---|
235 | ndastp = NINT( zndastp ) |
---|
236 | CALL iom_get( numrtr, 'adatrj', adatrj ) |
---|
237 | CALL iom_get( numrtr, 'ntime' , ktime ) |
---|
238 | nn_time0=INT(ktime) |
---|
239 | ! calculate start time in hours and minutes |
---|
240 | zdayfrac=adatrj-INT(adatrj) |
---|
241 | ksecs = NINT(zdayfrac*86400) ! Nearest second to catch rounding errors in adatrj |
---|
242 | ihour = INT(ksecs/3600) |
---|
243 | iminute = ksecs/60-ihour*60 |
---|
244 | |
---|
245 | ! Add to nn_time0 |
---|
246 | nhour = nn_time0 / 100 |
---|
247 | nminute = ( nn_time0 - nhour * 100 ) |
---|
248 | nminute=nminute+iminute |
---|
249 | |
---|
250 | IF( nminute >= 60 ) THEN |
---|
251 | nminute=nminute-60 |
---|
252 | nhour=nhour+1 |
---|
253 | ENDIF |
---|
254 | nhour=nhour+ihour |
---|
255 | IF( nhour >= 24 ) THEN |
---|
256 | nhour=nhour-24 |
---|
257 | adatrj=adatrj+1 |
---|
258 | ENDIF |
---|
259 | nn_time0 = nhour * 100 + nminute |
---|
260 | adatrj = INT(adatrj) ! adatrj set to integer as nn_time0 updated |
---|
261 | ELSE |
---|
262 | ! parameters corresponding to nit000 - 1 (as we start the step |
---|
263 | ! loop with a call to day) |
---|
264 | ndastp = ndate0 - 1 ! ndate0 read in the namelist in dom_nam |
---|
265 | nhour = nn_time0 / 100 |
---|
266 | nminute = ( nn_time0 - nhour * 100 ) |
---|
267 | IF( nhour*3600+nminute*60-ndt05 .lt. 0 ) ndastp=ndastp-1 ! Start hour is specified in the namelist (default 0) |
---|
268 | adatrj = ( REAL( nit000-1, wp ) * rdt ) / rday |
---|
269 | ! note this is wrong if time step has changed during run |
---|
270 | ENDIF |
---|
271 | IF( ABS(adatrj - REAL(NINT(adatrj),wp)) < 0.1 / rday ) adatrj = REAL(NINT(adatrj),wp) ! avoid truncation error |
---|
272 | ! |
---|
273 | IF(lwp) THEN |
---|
274 | WRITE(numout,*) ' *** Info used values : ' |
---|
275 | WRITE(numout,*) ' date ndastp : ', ndastp |
---|
276 | WRITE(numout,*) ' number of elapsed days since the begining of run : ', adatrj |
---|
277 | WRITE(numout,*) ' nn_time0 : ', nn_time0 |
---|
278 | WRITE(numout,*) |
---|
279 | ENDIF |
---|
280 | ! |
---|
281 | IF( ln_rsttr ) THEN ; neuler = 1 |
---|
282 | ELSE ; neuler = 0 |
---|
283 | ENDIF |
---|
284 | ! |
---|
285 | CALL day_init ! compute calendar |
---|
286 | ! |
---|
287 | ENDIF |
---|
288 | ! |
---|
289 | ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN |
---|
290 | ! |
---|
291 | IF( kt == nitrst ) THEN |
---|
292 | IF(lwp) WRITE(numout,*) |
---|
293 | IF(lwp) WRITE(numout,*) 'trc_wri : write the TOP restart file (NetCDF) at it= ', kt, ' date= ', ndastp |
---|
294 | IF(lwp) WRITE(numout,*) '~~~~~~~' |
---|
295 | ENDIF |
---|
296 | CALL iom_rstput( kt, nitrst, numrtw, 'kt' , REAL( kt , wp) ) ! time-step |
---|
297 | CALL iom_rstput( kt, nitrst, numrtw, 'ndastp' , REAL( ndastp, wp) ) ! date |
---|
298 | CALL iom_rstput( kt, nitrst, numrtw, 'adatrj' , adatrj ) ! number of elapsed days since |
---|
299 | ! ! the begining of the run [s] |
---|
300 | CALL iom_rstput( kt, nitrst, numrtw, 'ntime' , REAL( nn_time0, wp)) ! time |
---|
301 | ENDIF |
---|
302 | |
---|
303 | END SUBROUTINE trc_rst_cal |
---|
304 | |
---|
305 | |
---|
306 | SUBROUTINE trc_rst_stat |
---|
307 | !!---------------------------------------------------------------------- |
---|
308 | !! *** trc_rst_stat *** |
---|
309 | !! |
---|
310 | !! ** purpose : Compute tracers statistics |
---|
311 | !!---------------------------------------------------------------------- |
---|
312 | INTEGER :: jk, jn |
---|
313 | REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift |
---|
314 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: zvol |
---|
315 | !!---------------------------------------------------------------------- |
---|
316 | |
---|
317 | IF( lwp ) THEN |
---|
318 | WRITE(numout,*) |
---|
319 | WRITE(numout,*) ' ----TRACER STAT---- ' |
---|
320 | WRITE(numout,*) |
---|
321 | ENDIF |
---|
322 | ! |
---|
323 | DO jk = 1, jpk |
---|
324 | zvol(:,:,jk) = e1e2t(:,:) * e3t_a(:,:,jk) * tmask(:,:,jk) |
---|
325 | END DO |
---|
326 | ! |
---|
327 | DO jn = 1, jptra |
---|
328 | ztraf = glob_sum( 'trcrst', trn(:,:,:,jn) * zvol(:,:,:) ) |
---|
329 | zmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) |
---|
330 | zmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) |
---|
331 | IF( lk_mpp ) THEN |
---|
332 | CALL mpp_min( 'trcrst', zmin ) ! min over the global domain |
---|
333 | CALL mpp_max( 'trcrst', zmax ) ! max over the global domain |
---|
334 | END IF |
---|
335 | zmean = ztraf / areatot |
---|
336 | zdrift = ( ( ztraf - trai(jn) ) / ( trai(jn) + 1.e-12 ) ) * 100._wp |
---|
337 | IF(lwp) WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), zmean, zmin, zmax, zdrift |
---|
338 | END DO |
---|
339 | IF(lwp) WRITE(numout,*) |
---|
340 | 9000 FORMAT(' tracer nb :',i2,' name :',a10,' mean :',e18.10,' min :',e18.10, & |
---|
341 | & ' max :',e18.10,' drift :',e18.10, ' %') |
---|
342 | ! |
---|
343 | END SUBROUTINE trc_rst_stat |
---|
344 | |
---|
345 | SUBROUTINE trc_rst_conserve |
---|
346 | !!---------------------------------------------------------------------- |
---|
347 | !! *** trc_rst_conserve *** |
---|
348 | !! |
---|
349 | !! ** purpose : Compute tracers conservation statistics |
---|
350 | !! |
---|
351 | !! AXY (17/11/2017) |
---|
352 | !! This routine calculates the "now" inventories of the elemental |
---|
353 | !! cycles of MEDUSA and compares them to those calculate when the |
---|
354 | !! model was initialised / restarted; the cycles calculated are: |
---|
355 | !! nitrogen, silicon, iron, carbon, alkalinity and oxygen |
---|
356 | !!---------------------------------------------------------------------- |
---|
357 | INTEGER :: ji, jj, jk, jn |
---|
358 | REAL(wp) :: zsum3d, zsum2d, zinvt, zdelta, zratio |
---|
359 | REAL(wp), DIMENSION(jpi,jpj,jpk) :: z3d, zvol |
---|
360 | REAL(wp), DIMENSION(jpi,jpj) :: z2d, zarea |
---|
361 | REAL(wp), DIMENSION(6) :: loc_cycletot3, loc_cycletot2 |
---|
362 | !!---------------------------------------------------------------------- |
---|
363 | ! |
---|
364 | IF( lwp ) THEN |
---|
365 | WRITE(numout,*) |
---|
366 | WRITE(numout,*) ' ----TRACER CONSERVATION---- ' |
---|
367 | WRITE(numout,*) |
---|
368 | ENDIF |
---|
369 | ! |
---|
370 | ! ocean volume |
---|
371 | DO jk = 1, jpk |
---|
372 | zvol(:,:,jk) = e1e2t(:,:) * e3t_a(:,:,jk) * tmask(:,:,jk) |
---|
373 | END DO |
---|
374 | ! |
---|
375 | ! ocean area (for sediments) |
---|
376 | zarea(:,:) = e1e2t(:,:) * tmask(:,:,1) |
---|
377 | ! |
---|
378 | !---------------------------------------------------------------------- |
---|
379 | ! nitrogen |
---|
380 | z3d(:,:,:) = trn(:,:,:,jpphn) + trn(:,:,:,jpphd) + trn(:,:,:,jpzmi) + & |
---|
381 | trn(:,:,:,jpzme) + trn(:,:,:,jpdet) + trn(:,:,:,jpdin) |
---|
382 | z2d(:,:) = zn_sed_n(:,:) |
---|
383 | zsum3d = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) |
---|
384 | zsum2d = glob_sum( z2d(:,:) * zarea(:,:) ) |
---|
385 | ! total tracer, and delta |
---|
386 | zinvt = zsum3d + zsum2d |
---|
387 | zdelta = zinvt - cycletot(1) |
---|
388 | zratio = 1.0e2 * zdelta / cycletot(1) |
---|
389 | ! |
---|
390 | IF ( lwp ) WRITE(numout,9010) 'nitrogen', zsum3d, zsum2d, zinvt, & |
---|
391 | cycletot(1), zdelta, zratio |
---|
392 | IF ( lwp ) WRITE(numout,*) |
---|
393 | ! |
---|
394 | !---------------------------------------------------------------------- |
---|
395 | ! silicon |
---|
396 | z3d(:,:,:) = trn(:,:,:,jppds) + trn(:,:,:,jpsil) |
---|
397 | z2d(:,:) = zn_sed_si(:,:) |
---|
398 | zsum3d = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) |
---|
399 | zsum2d = glob_sum( z2d(:,:) * zarea(:,:) ) |
---|
400 | ! total tracer, and delta |
---|
401 | zinvt = zsum3d + zsum2d |
---|
402 | zdelta = zinvt - cycletot(2) |
---|
403 | zratio = 1.0e2 * zdelta / cycletot(2) |
---|
404 | ! |
---|
405 | IF ( lwp ) WRITE(numout,9010) 'silicon', zsum3d, zsum2d, zinvt, & |
---|
406 | cycletot(2), zdelta, zratio |
---|
407 | IF ( lwp ) WRITE(numout,*) |
---|
408 | ! |
---|
409 | !---------------------------------------------------------------------- |
---|
410 | ! iron |
---|
411 | z3d(:,:,:) = ((trn(:,:,:,jpphn) + trn(:,:,:,jpphd) + trn(:,:,:,jpzmi) + & |
---|
412 | trn(:,:,:,jpzme) + trn(:,:,:,jpdet)) * xrfn) + trn(:,:,:,jpfer) |
---|
413 | z2d(:,:) = zn_sed_fe(:,:) |
---|
414 | zsum3d = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) |
---|
415 | zsum2d = glob_sum( z2d(:,:) * zarea(:,:) ) |
---|
416 | ! total tracer, and delta |
---|
417 | zinvt = zsum3d + zsum2d |
---|
418 | zdelta = zinvt - cycletot(3) |
---|
419 | zratio = 1.0e2 * zdelta / cycletot(3) |
---|
420 | ! |
---|
421 | IF ( lwp ) WRITE(numout,9010) 'iron', zsum3d, zsum2d, zinvt, & |
---|
422 | cycletot(3), zdelta, zratio |
---|
423 | IF ( lwp ) WRITE(numout,*) |
---|
424 | ! |
---|
425 | !---------------------------------------------------------------------- |
---|
426 | ! carbon |
---|
427 | z3d(:,:,:) = (trn(:,:,:,jpphn) * xthetapn) + (trn(:,:,:,jpphd) * xthetapd) + & |
---|
428 | (trn(:,:,:,jpzmi) * xthetazmi) + (trn(:,:,:,jpzme) * xthetazme) + & |
---|
429 | trn(:,:,:,jpdtc) + trn(:,:,:,jpdic) |
---|
430 | z2d(:,:) = zn_sed_c(:,:) + zn_sed_ca(:,:) |
---|
431 | zsum3d = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) |
---|
432 | zsum2d = glob_sum( z2d(:,:) * zarea(:,:) ) |
---|
433 | ! total tracer, and delta |
---|
434 | zinvt = zsum3d + zsum2d |
---|
435 | zdelta = zinvt - cycletot(4) |
---|
436 | zratio = 1.0e2 * zdelta / cycletot(4) |
---|
437 | ! |
---|
438 | IF ( lwp ) WRITE(numout,9010) 'carbon', zsum3d, zsum2d, zinvt, & |
---|
439 | cycletot(4), zdelta, zratio |
---|
440 | IF ( lwp ) WRITE(numout,*) |
---|
441 | ! |
---|
442 | !---------------------------------------------------------------------- |
---|
443 | ! alkalinity |
---|
444 | z3d(:,:,:) = trn(:,:,:,jpalk) |
---|
445 | z2d(:,:) = zn_sed_ca(:,:) * 2.0 |
---|
446 | zsum3d = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) |
---|
447 | zsum2d = glob_sum( z2d(:,:) * zarea(:,:) ) |
---|
448 | ! total tracer, and delta |
---|
449 | zinvt = zsum3d + zsum2d |
---|
450 | zdelta = zinvt - cycletot(5) |
---|
451 | zratio = 1.0e2 * zdelta / cycletot(5) |
---|
452 | ! |
---|
453 | IF ( lwp ) WRITE(numout,9010) 'alkalinity', zsum3d, zsum2d, zinvt, & |
---|
454 | cycletot(5), zdelta, zratio |
---|
455 | IF ( lwp ) WRITE(numout,*) |
---|
456 | ! |
---|
457 | !---------------------------------------------------------------------- |
---|
458 | ! oxygen |
---|
459 | z3d(:,:,:) = trn(:,:,:,jpoxy) |
---|
460 | z2d(:,:) = 0.0 |
---|
461 | zsum3d = glob_sum( z3d(:,:,:) * zvol(:,:,:) ) |
---|
462 | zsum2d = glob_sum( z2d(:,:) * zarea(:,:) ) |
---|
463 | ! total tracer, and delta |
---|
464 | zinvt = zsum3d + zsum2d |
---|
465 | zdelta = zinvt - cycletot(6) |
---|
466 | zratio = 1.0e2 * zdelta / cycletot(6) |
---|
467 | ! |
---|
468 | IF ( lwp ) WRITE(numout,9010) 'oxygen', zsum3d, zsum2d, zinvt, & |
---|
469 | cycletot(6), zdelta, zratio |
---|
470 | ! |
---|
471 | !---------------------------------------------------------------------- |
---|
472 | ! Check |
---|
473 | zsum3d = glob_sum( zvol(:,:,:) ) |
---|
474 | zsum2d = glob_sum( zarea(:,:) ) |
---|
475 | IF ( lwp ) THEN |
---|
476 | WRITE(numout,*) |
---|
477 | WRITE(numout,*) ' check : cvol : ', zsum3d |
---|
478 | WRITE(numout,*) ' check : carea : ', zsum2d |
---|
479 | WRITE(numout,*) |
---|
480 | ENDIF |
---|
481 | ! |
---|
482 | 9010 FORMAT(' element:',a10, & |
---|
483 | ' 3d sum:',e18.10,' 2d sum:',e18.10, & |
---|
484 | ' total:',e18.10,' initial:',e18.10, & |
---|
485 | ' delta:',e18.10,' %:',e18.10) |
---|
486 | ! |
---|
487 | END SUBROUTINE trc_rst_conserve |
---|
488 | |
---|
489 | #else |
---|
490 | !!---------------------------------------------------------------------- |
---|
491 | !! Dummy module : No passive tracer |
---|
492 | !!---------------------------------------------------------------------- |
---|
493 | CONTAINS |
---|
494 | SUBROUTINE trc_rst_read ! Empty routines |
---|
495 | END SUBROUTINE trc_rst_read |
---|
496 | SUBROUTINE trc_rst_wri( kt ) |
---|
497 | INTEGER, INTENT ( in ) :: kt |
---|
498 | WRITE(*,*) 'trc_rst_wri: You should not have seen this print! error?', kt |
---|
499 | END SUBROUTINE trc_rst_wri |
---|
500 | #endif |
---|
501 | |
---|
502 | !!---------------------------------------------------------------------- |
---|
503 | !! NEMO/TOP 4.0 , NEMO Consortium (2018) |
---|
504 | !! $Id$ |
---|
505 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
506 | !!====================================================================== |
---|
507 | END MODULE trcrst |
---|