Changeset 3294 for trunk/NEMOGCM/NEMO/TOP_SRC/trcrst.F90
- Timestamp:
- 2012-01-28T17:44:18+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMOGCM/NEMO/TOP_SRC/trcrst.F90
r2715 r3294 39 39 PUBLIC trc_rst_read ! called by ??? 40 40 PUBLIC trc_rst_wri ! called by ??? 41 PUBLIC trc_rst_cal 41 42 42 43 INTEGER, PUBLIC :: numrtr, numrtw !: logical unit for trc restart (read and write) … … 60 61 ! 61 62 IF( lk_offline ) THEN 62 IF( kt == nit 000 ) THEN63 IF( kt == nittrc000 ) THEN 63 64 lrst_trc = .FALSE. 64 65 nitrst = nitend … … 66 67 67 68 IF( MOD( kt - 1, nstock ) == 0 ) THEN 68 ! we use kt - 1 and not kt - nit 000 to keep the same periodicity from the beginning of the experiment69 ! we use kt - 1 and not kt - nittrc000 to keep the same periodicity from the beginning of the experiment 69 70 nitrst = kt + nstock - 1 ! define the next value of nitrst for restart writing 70 71 IF( nitrst > nitend ) nitrst = nitend ! make sure we write a restart at the end of the run 71 72 ENDIF 72 73 ELSE 73 IF( kt == nit 000 ) lrst_trc = .FALSE.74 IF( kt == nittrc000 ) lrst_trc = .FALSE. 74 75 ENDIF 75 76 … … 77 78 ! we open and define the tracer restart file one tracer time step before writing the data (-> at nitrst - 2*nn_dttrc + 1) 78 79 ! 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 79 IF( kt == nitrst - 2*nn_dttrc + 1 .OR. nstock == nn_dttrc .OR. ( kt == nitend - nn_dttrc + 1.AND. .NOT. lrst_trc ) ) THEN80 IF( kt == nitrst - 2*nn_dttrc .OR. nstock == nn_dttrc .OR. ( kt == nitend - nn_dttrc .AND. .NOT. lrst_trc ) ) THEN 80 81 ! beware of the format used to write kt (default is i8.8, that should be large enough) 81 82 IF( nitrst > 1.0e9 ) THEN ; WRITE(clkt,* ) nitrst … … 99 100 !!---------------------------------------------------------------------- 100 101 INTEGER :: jn 101 INTEGER :: jlibalt = jprstlib 102 LOGICAL :: llok 103 104 !!---------------------------------------------------------------------- 105 102 103 !!---------------------------------------------------------------------- 104 ! 106 105 IF(lwp) WRITE(numout,*) 107 IF(lwp) WRITE(numout,*) 'trc_rst_read : read the TOP restart file'106 IF(lwp) WRITE(numout,*) 'trc_rst_read : read data in the TOP restart file' 108 107 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' 109 110 IF ( jprstlib == jprstdimg ) THEN111 ! eventually read netcdf file (monobloc) for restarting on different number of processors112 ! if {cn_trcrst_in}.nc exists, then set jlibalt to jpnf90113 INQUIRE( FILE = TRIM(cn_trcrst_in)//'.nc', EXIST = llok )114 IF ( llok ) THEN ; jlibalt = jpnf90 ; ELSE ; jlibalt = jprstlib ; ENDIF115 ENDIF116 117 CALL iom_open( cn_trcrst_in, numrtr, kiolib = jlibalt )118 119 ! Time domain : restart120 ! ---------------------121 CALL trc_rst_cal( nit000, 'READ' ) ! calendar122 108 123 109 ! READ prognostic variables and computes diagnostic variable … … 151 137 REAL(wp) :: zarak0 152 138 !!---------------------------------------------------------------------- 153 154 139 ! 155 140 CALL trc_rst_cal( kt, 'WRITE' ) ! calendar 156 141 CALL iom_rstput( kt, nitrst, numrtw, 'rdttrc1', rdttrc(1) ) ! surface passive tracer time step … … 196 181 !! 197 182 !! According to namelist parameter nrstdt, 198 !! nn_rsttr = 0 no control on the date (nit 000 is arbitrary).199 !! nn_rsttr = 1 we verify that nit 000 is equal to the last183 !! nn_rsttr = 0 no control on the date (nittrc000 is arbitrary). 184 !! nn_rsttr = 1 we verify that nittrc000 is equal to the last 200 185 !! time step of previous run + 1. 201 186 !! In both those options, the exact duration of the experiment 202 187 !! since the beginning (cumulated duration of all previous restart runs) 203 !! is not stored in the restart and is assumed to be (nit 000-1)*rdt.188 !! is not stored in the restart and is assumed to be (nittrc000-1)*rdt. 204 189 !! This is valid is the time step has remained constant. 205 190 !! … … 210 195 CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag 211 196 ! 197 INTEGER :: jlibalt = jprstlib 198 LOGICAL :: llok 212 199 REAL(wp) :: zkt, zrdttrc1 213 200 REAL(wp) :: zndastp … … 217 204 218 205 IF( TRIM(cdrw) == 'READ' ) THEN 206 207 IF(lwp) WRITE(numout,*) 208 IF(lwp) WRITE(numout,*) 'trc_rst_cal : read the TOP restart file for calendar' 209 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' 210 211 IF ( jprstlib == jprstdimg ) THEN 212 ! eventually read netcdf file (monobloc) for restarting on different number of processors 213 ! if {cn_trcrst_in}.nc exists, then set jlibalt to jpnf90 214 INQUIRE( FILE = TRIM(cn_trcrst_in)//'.nc', EXIST = llok ) 215 IF ( llok ) THEN ; jlibalt = jpnf90 ; ELSE ; jlibalt = jprstlib ; ENDIF 216 ENDIF 217 218 CALL iom_open( cn_trcrst_in, numrtr, kiolib = jlibalt ) 219 219 220 CALL iom_get ( numrtr, 'kt', zkt ) ! last time-step of previous run 220 221 IF(lwp) THEN … … 223 224 WRITE(numout,*) ' *** restart option' 224 225 SELECT CASE ( nn_rsttr ) 225 CASE ( 0 ) ; WRITE(numout,*) ' nn_rsttr = 0 : no control of nit 000'226 CASE ( 1 ) ; WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nit 000 (use ndate0 read in the namelist)'226 CASE ( 0 ) ; WRITE(numout,*) ' nn_rsttr = 0 : no control of nittrc000' 227 CASE ( 1 ) ; WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nittrc000 (use ndate0 read in the namelist)' 227 228 CASE ( 2 ) ; WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' 228 229 END SELECT … … 230 231 ENDIF 231 232 ! Control of date 232 IF( nit 000 - NINT( zkt ) /= 1.AND. nn_rsttr /= 0 ) &233 & CALL ctl_stop( ' ===>>>> : problem with nit 000 for the restart', &233 IF( nittrc000 - NINT( zkt ) /= nn_dttrc .AND. nn_rsttr /= 0 ) & 234 & CALL ctl_stop( ' ===>>>> : problem with nittrc000 for the restart', & 234 235 & ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 235 236 IF( lk_offline ) THEN ! set the date in offline mode … … 246 247 ELSE 247 248 ndastp = ndate0 - 1 ! ndate0 read in the namelist in dom_nam 248 adatrj = ( REAL( nit 000-1, wp ) * rdttra(1) ) / rday249 adatrj = ( REAL( nittrc000-1, wp ) * rdttra(1) ) / rday 249 250 ! note this is wrong if time step has changed during run 250 251 ENDIF … … 283 284 !! ** purpose : Compute tracers statistics 284 285 !!---------------------------------------------------------------------- 285 286 INTEGER :: jn 287 REAL(wp) :: zdiag_var, zdiag_varmin, zdiag_varmax, zdiag_tot 288 REAL(wp) :: zder 289 !!---------------------------------------------------------------------- 290 286 INTEGER :: jk, jn 287 REAL(wp) :: ztraf, zmin, zmax, zmean, zdrift 288 !!---------------------------------------------------------------------- 291 289 292 290 IF( lwp ) THEN … … 295 293 WRITE(numout,*) 296 294 ENDIF 297 298 zdiag_tot = 0.e0 299 DO jn = 1, jptra 300 # if defined key_degrad 301 zdiag_var = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) 302 # else 303 zdiag_var = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 304 # endif 305 zdiag_varmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 306 zdiag_varmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 295 ! 296 DO jn = 1, jptra 297 ztraf = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 298 zmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 299 zmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 307 300 IF( lk_mpp ) THEN 308 CALL mpp_min( z diag_varmin ) ! min over the global domain309 CALL mpp_max( z diag_varmax ) ! max over the global domain301 CALL mpp_min( zmin ) ! min over the global domain 302 CALL mpp_max( zmax ) ! max over the global domain 310 303 END IF 311 zdiag_tot = zdiag_tot + zdiag_var 312 zdiag_var = zdiag_var / areatot 313 IF(lwp) WRITE(numout,*) ' MEAN NO ', jn, ctrcnm(jn), ' = ', zdiag_var, & 314 & ' MIN = ', zdiag_varmin, ' MAX = ', zdiag_varmax 315 END DO 316 317 zder = ( ( zdiag_tot - trai ) / ( trai + 1.e-12 ) ) * 100._wp 318 IF(lwp) WRITE(numout,*) ' Integral of all tracers over the full domain = ', zdiag_tot 319 IF(lwp) WRITE(numout,*) ' Drift of the sum of all tracers =', zder, ' %' 320 304 zmean = ztraf / areatot 305 zdrift = ( ( ztraf - trai(jn) ) / ( trai(jn) + 1.e-12 ) ) * 100._wp 306 IF(lwp) WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), zmean, zmin, zmax, zdrift 307 END DO 308 WRITE(numout,*) 309 9000 FORMAT(' tracer nb :',i2,' name :',a10,' mean :',e18.10,' min :',e18.10, & 310 & ' max :',e18.10,' drift :',e18.10, ' %') 311 ! 321 312 END SUBROUTINE trc_rst_stat 322 313
Note: See TracChangeset
for help on using the changeset viewer.