Changeset 2528 for trunk/NEMOGCM/NEMO/TOP_SRC/trcrst.F90
- Timestamp:
- 2010-12-27T18:33:53+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEMOGCM/NEMO/TOP_SRC/trcrst.F90
- Property svn:eol-style deleted
r1836 r2528 25 25 USE oce_trc 26 26 USE trc 27 USE trc trp_lec27 USE trcnam_trp 28 28 USE lib_mpp 29 USE lib_fortran 29 30 USE iom 30 31 USE trcrst_cfc ! CFC … … 33 34 USE trcrst_c14b ! C14 bomb restart 34 35 USE trcrst_my_trc ! MY_TRC restart 35 #if defined key_off_tra 36 USE daymod 37 #endif 36 USE daymod 38 37 IMPLICIT NONE 39 38 PRIVATE … … 47 46 !! * Substitutions 48 47 # include "top_substitute.h90" 49 !!----------------------------------------------------------------------50 !! NEMO/TOP 1.0 , LOCEAN-IPSL (2005)51 !! $Id$52 !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)53 !!----------------------------------------------------------------------54 48 55 49 CONTAINS … … 67 61 !!---------------------------------------------------------------------- 68 62 ! 69 # if ! defined key_off_tra 70 IF( kt == nit000 ) lrst_trc = .FALSE. 71 # else 72 IF( kt == nit000 ) THEN 73 lrst_trc = .FALSE. 74 nitrst = nitend 75 ENDIF 76 77 IF( MOD( kt - 1, nstock ) == 0 ) THEN 78 ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment 79 nitrst = kt + nstock - 1 ! define the next value of nitrst for restart writing 80 IF( nitrst > nitend ) nitrst = nitend ! make sure we write a restart at the end of the run 81 ENDIF 82 # endif 83 ! to get better performances with NetCDF format: 84 ! we open and define the tracer restart file one tracer time step before writing the data (-> at nitrst - 2*ndttrc + 1) 85 ! except if we write tracer restart files every tracer time step or if a tracer restart file was writen at nitend - 2*ndttrc + 1 86 IF( kt == nitrst - 2*ndttrc + 1 .OR. nstock == ndttrc .OR. ( kt == nitend - ndttrc + 1 .AND. .NOT. lrst_trc ) ) THEN 63 IF( lk_offline ) THEN 64 IF( kt == nit000 ) THEN 65 lrst_trc = .FALSE. 66 nitrst = nitend 67 ENDIF 68 69 IF( MOD( kt - 1, nstock ) == 0 ) THEN 70 ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment 71 nitrst = kt + nstock - 1 ! define the next value of nitrst for restart writing 72 IF( nitrst > nitend ) nitrst = nitend ! make sure we write a restart at the end of the run 73 ENDIF 74 ELSE 75 IF( kt == nit000 ) lrst_trc = .FALSE. 76 ENDIF 77 78 ! to get better performances with NetCDF format: 79 ! we open and define the tracer restart file one tracer time step before writing the data (-> at nitrst - 2*nn_dttrc + 1) 80 ! 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 81 IF( kt == nitrst - 2*nn_dttrc + 1 .OR. nstock == nn_dttrc .OR. ( kt == nitend - nn_dttrc + 1 .AND. .NOT. lrst_trc ) ) THEN 87 82 ! beware of the format used to write kt (default is i8.8, that should be large enough) 88 83 IF( nitrst > 1.0e9 ) THEN ; WRITE(clkt,* ) nitrst … … 106 101 !!---------------------------------------------------------------------- 107 102 INTEGER :: jn 108 INTEGER :: iarak0109 REAL(wp) :: zarak0110 103 INTEGER :: jlibalt = jprstlib 111 104 LOGICAL :: llok … … 128 121 ! Time domain : restart 129 122 ! --------------------- 130 CALL trc_rst_cal( nittrc000, 'READ' ) ! calendar 131 132 IF( ln_trcadv_cen2 .OR. ln_trcadv_tvd ) THEN ; iarak0 = 1 133 ELSE ; iarak0 = 0 134 ENDIF 135 CALL iom_get( numrtr, 'arak0', zarak0 ) 136 137 IF( iarak0 /= NINT( zarak0 ) ) & ! Control of the scheme 138 & CALL ctl_stop( ' ===>>>> : problem with advection scheme', & 139 & ' it must be the same type for both restart and previous run', & 140 & ' centered or euler ' ) 141 IF(lwp) WRITE(numout,*) 142 IF(lwp) WRITE(numout,*) ' arakawa option : ', NINT( zarak0 ) 123 CALL trc_rst_cal( nit000, 'READ' ) ! calendar 143 124 144 125 ! READ prognostic variables and computes diagnostic variable … … 175 156 176 157 CALL trc_rst_cal( kt, 'WRITE' ) ! calendar 177 178 IF( ln_trcadv_cen2 .OR. ln_trcadv_tvd ) THEN ; zarak0 = 1. 179 ELSE ; zarak0 = 0. 180 ENDIF 181 CALL iom_rstput( kt, nitrst, numrtw, 'arak0', zarak0 ) 182 158 CALL iom_rstput( kt, nitrst, numrtw, 'rdttrc1', rdttrc(1) ) ! surface passive tracer time step 183 159 ! prognostic variables 184 160 ! -------------------- … … 222 198 !! 223 199 !! According to namelist parameter nrstdt, 224 !! n rsttr = 0 no control on the date (nittrc000 is arbitrary).225 !! n rsttr = 1 we verify that nit000 is equal to the last200 !! nn_rsttr = 0 no control on the date (nit000 is arbitrary). 201 !! nn_rsttr = 1 we verify that nit000 is equal to the last 226 202 !! time step of previous run + 1. 227 203 !! In both those options, the exact duration of the experiment … … 230 206 !! This is valid is the time step has remained constant. 231 207 !! 232 !! n rsttr = 2 the duration of the experiment in days (adatrj)208 !! nn_rsttr = 2 the duration of the experiment in days (adatrj) 233 209 !! has been stored in the restart file. 234 210 !!---------------------------------------------------------------------- … … 236 212 CHARACTER(len=*), INTENT(in) :: cdrw ! "READ"/"WRITE" flag 237 213 ! 238 REAL(wp) :: zkt 239 #if defined key_off_tra 214 REAL(wp) :: zkt, zrdttrc1 240 215 REAL(wp) :: zndastp 241 #endif242 216 243 217 ! Time domain : restart … … 250 224 WRITE(numout,*) ' previous time-step : ', NINT( zkt ) 251 225 WRITE(numout,*) ' *** restart option' 252 SELECT CASE ( n rsttr )253 CASE ( 0 ) ; WRITE(numout,*) ' n rsttr = 0 : no control of nittrc000'254 CASE ( 1 ) ; WRITE(numout,*) ' n rsttr = 1 : no control the date at nit000 (use ndate0 read in the namelist)'255 CASE ( 2 ) ; WRITE(numout,*) ' n rsttr = 2 : calendar parameters read in restart'226 SELECT CASE ( nn_rsttr ) 227 CASE ( 0 ) ; WRITE(numout,*) ' nn_rsttr = 0 : no control of nit000' 228 CASE ( 1 ) ; WRITE(numout,*) ' nn_rsttr = 1 : no control the date at nit000 (use ndate0 read in the namelist)' 229 CASE ( 2 ) ; WRITE(numout,*) ' nn_rsttr = 2 : calendar parameters read in restart' 256 230 END SELECT 257 231 WRITE(numout,*) 258 232 ENDIF 259 233 ! Control of date 260 IF( nit trc000 - NINT( zkt ) /= 1 .AND. nrsttr /= 0 ) &234 IF( nit000 - NINT( zkt ) /= 1 .AND. nn_rsttr /= 0 ) & 261 235 & CALL ctl_stop( ' ===>>>> : problem with nit000 for the restart', & 262 & ' verify the restart file or rerun with nrsttr = 0 (namelist)' ) 263 #if defined key_off_tra 264 ! define ndastp and adatrj 265 IF ( nrsttr == 2 ) THEN 266 CALL iom_get( numrtr, 'ndastp', zndastp ) 267 ndastp = NINT( zndastp ) 268 CALL iom_get( numrtr, 'adatrj', adatrj ) 269 ELSE 270 ndastp = ndate0 - 1 ! ndate0 read in the namelist in dom_nam 271 adatrj = ( REAL( nittrc000-1, wp ) * rdttra(1) ) / rday 272 ! note this is wrong if time step has changed during run 236 & ' verify the restart file or rerun with nn_rsttr = 0 (namelist)' ) 237 IF( lk_offline ) THEN ! set the date in offline mode 238 ! Check dynamics and tracer time-step consistency and force Euler restart if changed 239 IF( iom_varid( numrtr, 'rdttrc1', ldstop = .FALSE. ) > 0 ) THEN 240 CALL iom_get( numrtr, 'rdttrc1', zrdttrc1 ) 241 IF( zrdttrc1 /= rdttrc(1) ) neuler = 0 242 ENDIF 243 ! ! define ndastp and adatrj 244 IF ( nn_rsttr == 2 ) THEN 245 CALL iom_get( numrtr, 'ndastp', zndastp ) 246 ndastp = NINT( zndastp ) 247 CALL iom_get( numrtr, 'adatrj', adatrj ) 248 ELSE 249 ndastp = ndate0 - 1 ! ndate0 read in the namelist in dom_nam 250 adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday 251 ! note this is wrong if time step has changed during run 252 ENDIF 253 ! 254 IF(lwp) THEN 255 WRITE(numout,*) ' *** Info used values : ' 256 WRITE(numout,*) ' date ndastp : ', ndastp 257 WRITE(numout,*) ' number of elapsed days since the begining of run : ', adatrj 258 WRITE(numout,*) 259 ENDIF 260 ! 261 CALL day_init ! compute calendar 262 ! 273 263 ENDIF 274 264 ! 275 IF(lwp) THEN276 WRITE(numout,*) ' *** Info used values : '277 WRITE(numout,*) ' date ndastp : ', ndastp278 WRITE(numout,*) ' number of elapsed days since the begining of run : ', adatrj279 WRITE(numout,*)280 ENDIF281 !282 CALL day_init ! compute calendar283 !284 #endif285 286 265 ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN 287 266 ! … … 291 270 IF(lwp) WRITE(numout,*) '~~~~~~~' 292 271 ENDIF 293 ! calendar control294 272 CALL iom_rstput( kt, nitrst, numrtw, 'kt' , REAL( kt , wp) ) ! time-step 295 273 CALL iom_rstput( kt, nitrst, numrtw, 'ndastp' , REAL( ndastp, wp) ) ! date … … 308 286 !!---------------------------------------------------------------------- 309 287 310 INTEGER :: j i, jj, jk, jn288 INTEGER :: jn 311 289 REAL(wp) :: zdiag_var, zdiag_varmin, zdiag_varmax, zdiag_tot 312 REAL(wp) :: zder , zvol290 REAL(wp) :: zder 313 291 !!---------------------------------------------------------------------- 314 292 … … 322 300 zdiag_tot = 0.e0 323 301 DO jn = 1, jptra 324 zdiag_var = 0.e0 325 zdiag_varmin = 0.e0 326 zdiag_varmax = 0.e0 327 DO jk = 1, jpk 328 DO jj = 1, jpj 329 DO ji = 1, jpi 330 zvol = cvol(ji,jj,jk) 331 # if defined key_off_degrad 332 zvol = zvol * facvol(ji,jj,jk) 302 # if defined key_degrad 303 zdiag_var = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) * facvol(:,:,:) ) 304 # else 305 zdiag_var = glob_sum( trn(:,:,:,jn) * cvol(:,:,:) ) 333 306 # endif 334 zdiag_var = zdiag_var + trn(ji,jj,jk,jn) * zvol335 END DO336 END DO337 END DO338 339 307 zdiag_varmin = MINVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) 340 308 zdiag_varmax = MAXVAL( trn(:,:,:,jn), mask= ((tmask*SPREAD(tmask_i,DIM=3,NCOPIES=jpk).NE.0.)) ) … … 342 310 CALL mpp_min( zdiag_varmin ) ! min over the global domain 343 311 CALL mpp_max( zdiag_varmax ) ! max over the global domain 344 CALL mpp_sum( zdiag_var ) ! sum over the global domain345 312 END IF 346 313 zdiag_tot = zdiag_tot + zdiag_var … … 369 336 #endif 370 337 338 !!---------------------------------------------------------------------- 339 !! NEMO/TOP 3.3 , NEMO Consortium (2010) 340 !! $Id$ 341 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 371 342 !!====================================================================== 372 343 END MODULE trcrst
Note: See TracChangeset
for help on using the changeset viewer.