Changeset 5965 for branches/2014/dev_r4650_UKMO14.5_SST_BIAS_CORRECTION/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
- Timestamp:
- 2015-12-01T16:35:30+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2014/dev_r4650_UKMO14.5_SST_BIAS_CORRECTION/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
r4334 r5965 22 22 USE iom ! I/O module 23 23 USE eosbn2 ! equation of state (eos bn2 routine) 24 USE trdm ld_oce ! ocean active mixed layer tracers trends variables24 USE trdmxl_oce ! ocean active mixed layer tracers trends variables 25 25 USE divcur ! hor. divergence and curl (div & cur routines) 26 USE sbc_ice, ONLY : lk_lim327 26 28 27 IMPLICIT NONE … … 57 56 !! 58 57 CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character 59 CHARACTER(LEN=50) :: clname ! ice output restart file name 58 CHARACTER(LEN=50) :: clname ! ocean output restart file name 59 CHARACTER(lc) :: clpath ! full path to ocean output restart file 60 60 !!---------------------------------------------------------------------- 61 61 ! 62 62 IF( kt == nit000 ) THEN ! default definitions 63 63 lrst_oce = .FALSE. 64 nitrst = nitend 65 ENDIF 66 IF( MOD( kt - 1, nstock ) == 0 ) THEN 64 IF( ln_rst_list ) THEN 65 nrst_lst = 1 66 nitrst = nstocklist( nrst_lst ) 67 ELSE 68 nitrst = nitend 69 ENDIF 70 ENDIF 71 72 ! frequency-based restart dumping (nn_stock) 73 IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nstock ) == 0 ) THEN 67 74 ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment 68 75 nitrst = kt + nstock - 1 ! define the next value of nitrst for restart writing … … 73 80 ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1 74 81 IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN 75 ! beware of the format used to write kt (default is i8.8, that should be large enough...) 76 IF( nitrst > 999999999 ) THEN ; WRITE(clkt, * ) nitrst 77 ELSE ; WRITE(clkt, '(i8.8)') nitrst 78 ENDIF 79 ! create the file 80 clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out) 81 IF(lwp) THEN 82 WRITE(numout,*) 83 SELECT CASE ( jprstlib ) 84 CASE ( jprstdimg ) ; WRITE(numout,*) ' open ocean restart binary file: '//clname 85 CASE DEFAULT ; WRITE(numout,*) ' open ocean restart NetCDF file: '//clname 86 END SELECT 87 IF ( snc4set%luse ) WRITE(numout,*) ' opened for NetCDF4 chunking and compression' 88 IF( kt == nitrst - 1 ) THEN ; WRITE(numout,*) ' kt = nitrst - 1 = ', kt 89 ELSE ; WRITE(numout,*) ' kt = ' , kt 82 IF( nitrst <= nitend .AND. nitrst > 0 ) THEN 83 ! beware of the format used to write kt (default is i8.8, that should be large enough...) 84 IF( nitrst > 999999999 ) THEN ; WRITE(clkt, * ) nitrst 85 ELSE ; WRITE(clkt, '(i8.8)') nitrst 90 86 ENDIF 91 ENDIF 92 ! 93 CALL iom_open( clname, numrow, ldwrt = .TRUE., kiolib = jprstlib ) 94 lrst_oce = .TRUE. 87 ! create the file 88 clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out) 89 clpath = TRIM(cn_ocerst_outdir) 90 IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 91 IF(lwp) THEN 92 WRITE(numout,*) 93 SELECT CASE ( jprstlib ) 94 CASE ( jprstdimg ) ; WRITE(numout,*) & 95 ' open ocean restart binary file: ',TRIM(clpath)//clname 96 CASE DEFAULT ; WRITE(numout,*) & 97 ' open ocean restart NetCDF file: ',TRIM(clpath)//clname 98 END SELECT 99 IF ( snc4set%luse ) WRITE(numout,*) ' opened for NetCDF4 chunking and compression' 100 IF( kt == nitrst - 1 ) THEN ; WRITE(numout,*) ' kt = nitrst - 1 = ', kt 101 ELSE ; WRITE(numout,*) ' kt = ' , kt 102 ENDIF 103 ENDIF 104 ! 105 CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 106 lrst_oce = .TRUE. 107 ENDIF 95 108 ENDIF 96 109 ! … … 132 145 CALL iom_rstput( kt, nitrst, numrow, 'rhd' , rhd ) 133 146 #endif 134 IF( lk_lim3 ) THEN135 CALL iom_rstput( kt, nitrst, numrow, 'iatte' , iatte ) !clem modif136 CALL iom_rstput( kt, nitrst, numrow, 'oatte' , oatte ) !clem modif137 ENDIF138 147 IF( kt == nitrst ) THEN 139 148 CALL iom_close( numrow ) ! close the restart file (only at last time step) 140 IF( .NOT. lk_trdmld ) lrst_oce = .FALSE. 149 !!gm IF( .NOT. lk_trdmld ) lrst_oce = .FALSE. 150 !!gm not sure what to do here ===>>> ask to Sebastian 151 lrst_oce = .FALSE. 152 IF( ln_rst_list ) THEN 153 nrst_lst = MIN(nrst_lst + 1, SIZE(nstocklist,1)) 154 nitrst = nstocklist( nrst_lst ) 155 ENDIF 156 lrst_oce = .FALSE. 141 157 ENDIF 142 158 ! 143 159 END SUBROUTINE rst_write 160 144 161 145 162 SUBROUTINE rst_read_open … … 152 169 !! the file has already been opened 153 170 !!---------------------------------------------------------------------- 154 INTEGER :: jlibalt = jprstlib 155 LOGICAL :: llok 156 !!---------------------------------------------------------------------- 157 158 IF( numror .LE. 0 ) THEN 171 INTEGER :: jlibalt = jprstlib 172 LOGICAL :: llok 173 CHARACTER(lc) :: clpath ! full path to ocean output restart file 174 !!---------------------------------------------------------------------- 175 ! 176 IF( numror <= 0 ) THEN 159 177 IF(lwp) THEN ! Contol prints 160 178 WRITE(numout,*) … … 167 185 ENDIF 168 186 187 clpath = TRIM(cn_ocerst_indir) 188 IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 169 189 IF ( jprstlib == jprstdimg ) THEN 170 190 ! eventually read netcdf file (monobloc) for restarting on different number of processors 171 191 ! if {cn_ocerst_in}.nc exists, then set jlibalt to jpnf90 172 INQUIRE( FILE = TRIM(cn_ocerst_in )//'.nc', EXIST = llok )192 INQUIRE( FILE = TRIM(cn_ocerst_indir)//'/'//TRIM(cn_ocerst_in)//'.nc', EXIST = llok ) 173 193 IF ( llok ) THEN ; jlibalt = jpnf90 ; ELSE ; jlibalt = jprstlib ; ENDIF 174 194 ENDIF 175 CALL iom_open( cn_ocerst_in, numror, kiolib = jlibalt )195 CALL iom_open( TRIM(clpath)//cn_ocerst_in, numror, kiolib = jlibalt ) 176 196 ENDIF 177 197 END SUBROUTINE rst_read_open … … 245 265 hdivb(:,:,:) = hdivn(:,:,:) 246 266 sshb (:,:) = sshn (:,:) 247 ENDIF 248 ! 249 IF( lk_lim3 ) THEN 250 CALL iom_get( numror, jpdom_autoglo, 'iatte' , iatte ) ! clem modif 251 CALL iom_get( numror, jpdom_autoglo, 'oatte' , oatte ) ! clem modif 267 268 IF( lk_vvl ) THEN 269 DO jk = 1, jpk 270 fse3t_b(:,:,jk) = fse3t_n(:,:,jk) 271 END DO 272 ENDIF 273 252 274 ENDIF 253 275 !
Note: See TracChangeset
for help on using the changeset viewer.