Changeset 3294 for trunk/NEMOGCM/NEMO/TOP_SRC/trcdia.F90
- Timestamp:
- 2012-01-28T17:44:18+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMOGCM/NEMO/TOP_SRC/trcdia.F90
r2715 r3294 11 11 !! ! 2008-05 (C. Ethe re-organization) 12 12 !!---------------------------------------------------------------------- 13 #if defined key_top && ! defined key_iomput13 #if defined key_top 14 14 !!---------------------------------------------------------------------- 15 15 !! 'key_top' TOP models … … 25 25 USE par_trc 26 26 USE dianam ! build name of file (routine) 27 USE ioipsl 27 USE ioipsl ! I/O manager 28 USE iom ! I/O manager 29 USE lib_mpp ! MPP library 28 30 29 31 IMPLICIT NONE … … 31 33 32 34 PUBLIC trc_dia ! called by XXX module 33 PUBLIC trc_dia_alloc ! called by nemogcm.F9034 35 35 36 INTEGER :: nit5 !: id for tracer output file … … 41 42 INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) :: ndext50 !: integer arrays for ocean 3D index 42 43 INTEGER , ALLOCATABLE, SAVE, DIMENSION (:) :: ndext51 !: integer arrays for ocean surface index 43 # if defined key_diatrc 44 44 45 INTEGER :: nitd !: id for additional array output file 45 46 INTEGER :: ndepitd !: id for depth mesh 46 47 INTEGER :: nhoritd !: id for horizontal mesh 47 # endif 48 # if defined key_diabio 48 49 49 INTEGER :: nitb !: id. for additional array output file 50 50 INTEGER :: ndepitb !: id for depth mesh 51 51 INTEGER :: nhoritb !: id for horizontal mesh 52 # endif53 52 54 53 !! * Substitutions … … 67 66 !! ** Purpose : output passive tracers fields 68 67 !!--------------------------------------------------------------------- 69 INTEGER, INTENT(in) :: kt ! ocean time-step70 ! 71 INTEGER :: kindic! local integer68 INTEGER, INTENT(in) :: kt ! ocean time-step 69 ! 70 INTEGER :: ierr ! local integer 72 71 !!--------------------------------------------------------------------- 73 72 ! 74 CALL trcdit_wr( kt, kindic ) ! outputs for tracer concentration 75 CALL trcdii_wr( kt, kindic ) ! outputs for additional arrays 76 CALL trcdib_wr( kt, kindic ) ! outputs for biological trends 73 IF( kt == nittrc000 ) THEN 74 ALLOCATE( ndext50(jpij*jpk), ndext51(jpij), STAT=ierr ) 75 IF( ierr > 0 ) THEN 76 CALL ctl_stop( 'STOP', 'trc_diat: unable to allocate arrays' ) ; RETURN 77 ENDIF 78 ENDIF 79 ! 80 IF( .NOT.lk_iomput ) THEN 81 CALL trcdit_wr( kt ) ! outputs for tracer concentration 82 IF( ln_diatrc ) CALL trcdii_wr( kt ) ! outputs for additional arrays 83 IF( ln_diabio ) CALL trcdib_wr( kt ) ! outputs for biological trends 84 ENDIF 77 85 ! 78 86 END SUBROUTINE trc_dia 79 87 80 88 81 SUBROUTINE trcdit_wr( kt , kindic)89 SUBROUTINE trcdit_wr( kt ) 82 90 !!---------------------------------------------------------------------- 83 91 !! *** ROUTINE trcdit_wr *** … … 85 93 !! ** Purpose : Standard output of passive tracer : concentration fields 86 94 !! 87 !! ** Method : At the beginning of the first time step (nit 000), define all95 !! ** Method : At the beginning of the first time step (nittrc000), define all 88 96 !! the NETCDF files and fields for concentration of passive tracer 89 97 !! … … 91 99 !! Each nwritetrc time step, output the instantaneous or mean fields 92 100 !! 93 !! IF kindic <0, output of fields before the model interruption.94 !! IF kindic =0, time step loop95 !! IF kindic >0, output of fields before the time step loop96 101 !!---------------------------------------------------------------------- 97 102 INTEGER, INTENT(in) :: kt ! ocean time-step 98 INTEGER, INTENT(in) :: kindic ! indicator of abnormal termination99 103 ! 100 104 INTEGER :: jn … … 135 139 136 140 ! define time axis 137 itmod = kt - nit 000 + 1141 itmod = kt - nittrc000 + 1 138 142 it = kt 139 iiter = ( nit 000 - 1 ) / nn_dttrc143 iiter = ( nittrc000 - 1 ) / nn_dttrc 140 144 141 145 ! Define NETCDF files and fields at beginning of first time step 142 146 ! -------------------------------------------------------------- 143 147 144 IF(ll_print)WRITE(numout,*)'trcdit_wr kt=',kt ,' kindic ',kindic148 IF(ll_print)WRITE(numout,*)'trcdit_wr kt=',kt 145 149 146 IF( kt == nit000 ) THEN 150 IF( kt == nittrc000 ) THEN 151 152 IF(lwp) THEN ! control print 153 WRITE(numout,*) 154 WRITE(numout,*) ' frequency of outputs for passive tracers nn_writetrc = ', nn_writetrc 155 DO jn = 1, jptra 156 IF( ln_trc_wri(jn) ) WRITE(numout,*) ' ouput tracer nb : ', jn, ' short name : ', ctrcnm(jn) 157 END DO 158 WRITE(numout,*) ' ' 159 ENDIF 147 160 148 161 ! Compute julian date from starting date of the run … … 150 163 zjulian = zjulian - adatrj ! set calendar origin to the beginning of the experiment 151 164 IF(lwp)WRITE(numout,*)' ' 152 IF(lwp)WRITE(numout,*)' Date 0 used :', nit 000 &165 IF(lwp)WRITE(numout,*)' Date 0 used :', nittrc000 & 153 166 & ,' YEAR ', nyear, ' MONTH ', nmonth, ' DAY ', nday & 154 167 & ,'Julian day : ', zjulian … … 182 195 ! Declare all the output fields as NETCDF variables 183 196 DO jn = 1, jptra 184 IF( l utsav(jn) ) THEN197 IF( ln_trc_wri(jn) ) THEN 185 198 cltra = TRIM( ctrcnm(jn) ) ! short title for tracer 186 cltral = TRIM( ctrc nl(jn) ) ! long title for tracer199 cltral = TRIM( ctrcln(jn) ) ! long title for tracer 187 200 cltrau = TRIM( ctrcun(jn) ) ! UNIT for tracer 188 201 CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5, & … … 209 222 DO jn = 1, jptra 210 223 cltra = TRIM( ctrcnm(jn) ) ! short title for tracer 211 IF( l utsav(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 )224 IF( ln_trc_wri(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 ) 212 225 END DO 213 226 214 227 ! close the file 215 228 ! -------------- 216 IF( kt == nitend .OR. kindic < 0) CALL histclo( nit5 )229 IF( kt == nitend ) CALL histclo( nit5 ) 217 230 ! 218 231 END SUBROUTINE trcdit_wr 219 232 220 #if defined key_diatrc 221 222 SUBROUTINE trcdii_wr( kt, kindic ) 233 SUBROUTINE trcdii_wr( kt ) 223 234 !!---------------------------------------------------------------------- 224 235 !! *** ROUTINE trcdii_wr *** … … 226 237 !! ** Purpose : output of passive tracer : additional 2D and 3D arrays 227 238 !! 228 !! ** Method : At the beginning of the first time step (nit 000), define all239 !! ** Method : At the beginning of the first time step (nittrc000), define all 229 240 !! the NETCDF files and fields for concentration of passive tracer 230 241 !! … … 232 243 !! Each nn_writedia time step, output the instantaneous or mean fields 233 244 !! 234 !! IF kindic <0, output of fields before the model interruption.235 !! IF kindic =0, time step loop236 !! IF kindic >0, output of fields before the time step loop237 245 !!---------------------------------------------------------------------- 238 246 INTEGER, INTENT(in) :: kt ! ocean time-step 239 INTEGER, INTENT(in) :: kindic ! indicator of abnormal termination240 247 !! 241 248 LOGICAL :: ll_print = .FALSE. … … 275 282 276 283 ! define time axis 277 itmod = kt - nit 000 + 1284 itmod = kt - nittrc000 + 1 278 285 it = kt 279 iiter = ( nit 000 - 1 ) / nn_dttrc286 iiter = ( nittrc000 - 1 ) / nn_dttrc 280 287 281 288 ! 1. Define NETCDF files and fields at beginning of first time step 282 289 ! ----------------------------------------------------------------- 283 290 284 IF( ll_print ) WRITE(numout,*) 'trcdii_wr kt=', kt , ' kindic ', kindic285 286 IF( kt == nit 000 ) THEN291 IF( ll_print ) WRITE(numout,*) 'trcdii_wr kt=', kt 292 293 IF( kt == nittrc000 ) THEN 287 294 288 295 ! Define the NETCDF files for additional arrays : 2D or 3D … … 356 363 ! Closing all files 357 364 ! ----------------- 358 IF( kt == nitend .OR. kindic < 0) CALL histclo(nitd)365 IF( kt == nitend ) CALL histclo(nitd) 359 366 ! 360 367 361 368 END SUBROUTINE trcdii_wr 362 369 363 # else 364 SUBROUTINE trcdii_wr( kt, kindic ) ! Dummy routine 365 INTEGER, INTENT (in) :: kt, kindic 366 END SUBROUTINE trcdii_wr 367 # endif 368 369 # if defined key_diabio 370 371 SUBROUTINE trcdib_wr( kt, kindic ) 370 SUBROUTINE trcdib_wr( kt ) 372 371 !!---------------------------------------------------------------------- 373 372 !! *** ROUTINE trcdib_wr *** … … 375 374 !! ** Purpose : output of passive tracer : biological fields 376 375 !! 377 !! ** Method : At the beginning of the first time step (nit 000), define all376 !! ** Method : At the beginning of the first time step (nittrc000), define all 378 377 !! the NETCDF files and fields for concentration of passive tracer 379 378 !! … … 381 380 !! Each nn_writebio time step, output the instantaneous or mean fields 382 381 !! 383 !! IF kindic <0, output of fields before the model interruption.384 !! IF kindic =0, time step loop385 !! IF kindic >0, output of fields before the time step loop386 382 !!---------------------------------------------------------------------- 387 383 INTEGER, INTENT( in ) :: kt ! ocean time-step 388 INTEGER, INTENT( in ) :: kindic ! indicator of abnormal termination389 384 !! 390 385 LOGICAL :: ll_print = .FALSE. … … 424 419 425 420 ! define time axis 426 itmod = kt - nit 000 + 1421 itmod = kt - nittrc000 + 1 427 422 it = kt 428 iiter = ( nit 000 - 1 ) / nn_dttrc423 iiter = ( nittrc000 - 1 ) / nn_dttrc 429 424 430 425 ! Define NETCDF files and fields at beginning of first time step 431 426 ! -------------------------------------------------------------- 432 427 433 IF(ll_print) WRITE(numout,*)'trcdib_wr kt=',kt ,' kindic ',kindic434 435 IF( kt == nit 000 ) THEN428 IF(ll_print) WRITE(numout,*)'trcdib_wr kt=',kt 429 430 IF( kt == nittrc000 ) THEN 436 431 437 432 ! Define the NETCDF files for biological trends … … 481 476 ! Closing all files 482 477 ! ----------------- 483 IF( kt == nitend .OR. kindic < 0) CALL histclo( nitb )478 IF( kt == nitend ) CALL histclo( nitb ) 484 479 ! 485 480 END SUBROUTINE trcdib_wr 486 481 487 # else488 489 SUBROUTINE trcdib_wr( kt, kindic ) ! Dummy routine490 INTEGER, INTENT ( in ) :: kt, kindic491 END SUBROUTINE trcdib_wr492 493 # endif494 495 INTEGER FUNCTION trc_dia_alloc()496 !!---------------------------------------------------------------------497 !! *** ROUTINE trc_dia_alloc ***498 !!---------------------------------------------------------------------499 ALLOCATE( ndext50(jpij*jpk), ndext51(jpij), STAT=trc_dia_alloc )500 !501 IF( trc_dia_alloc /= 0 ) CALL ctl_warn('trc_dia_alloc : failed to allocate arrays')502 !503 END FUNCTION trc_dia_alloc504 482 #else 505 483 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.