Changeset 5989 for branches/2014/dev_r4650_UKMO10_Tidally_Meaned_Diagnostics/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
- Timestamp:
- 2015-12-03T09:10:32+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2014/dev_r4650_UKMO10_Tidally_Meaned_Diagnostics/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
r5260 r5989 9 9 !! 3.3 ! 2010-04 (M. Leclair, G. Madec) modified LF-RA 10 10 !! - - ! 2010-10 (C. Ethe, G. Madec) TRC-TRA merge (T-S in 4D) 11 !! 3.7 ! 2014-01 (G. Madec) suppression of curl and hdiv from the restart 12 !! - ! 2014-12 (G. Madec) remove KPP scheme 11 13 !!---------------------------------------------------------------------- 12 14 … … 18 20 USE oce ! ocean dynamics and tracers 19 21 USE dom_oce ! ocean space and time domain 22 USE sbc_ice ! only lk_lim3 20 23 USE phycst ! physical constants 24 USE eosbn2 ! equation of state (eos bn2 routine) 25 USE trdmxl_oce ! ocean active mixed layer tracers trends variables 26 ! 21 27 USE in_out_manager ! I/O manager 22 28 USE iom ! I/O module 23 USE eosbn2 ! equation of state (eos bn2 routine)24 USE trdmxl_oce ! ocean active mixed layer tracers trends variables25 USE divcur ! hor. divergence and curl (div & cur routines)26 USE sbc_ice, ONLY : lk_lim327 29 28 30 IMPLICIT NONE … … 57 59 !! 58 60 CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character 59 CHARACTER(LEN=50) :: clname ! ice output restart file name 61 CHARACTER(LEN=50) :: clname ! ocean output restart file name 62 CHARACTER(lc) :: clpath ! full path to ocean output restart file 60 63 !!---------------------------------------------------------------------- 61 64 ! 62 65 IF( kt == nit000 ) THEN ! default definitions 63 66 lrst_oce = .FALSE. 64 nitrst = nitend 65 ENDIF 66 IF( MOD( kt - 1, nstock ) == 0 ) THEN 67 IF( ln_rst_list ) THEN 68 nrst_lst = 1 69 nitrst = nstocklist( nrst_lst ) 70 ELSE 71 nitrst = nitend 72 ENDIF 73 ENDIF 74 75 ! frequency-based restart dumping (nn_stock) 76 IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nstock ) == 0 ) THEN 67 77 ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment 68 78 nitrst = kt + nstock - 1 ! define the next value of nitrst for restart writing … … 73 83 ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1 74 84 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 85 IF( nitrst <= nitend .AND. nitrst > 0 ) THEN 86 ! beware of the format used to write kt (default is i8.8, that should be large enough...) 87 IF( nitrst > 999999999 ) THEN ; WRITE(clkt, * ) nitrst 88 ELSE ; WRITE(clkt, '(i8.8)') nitrst 90 89 ENDIF 91 ENDIF 92 ! 93 CALL iom_open( clname, numrow, ldwrt = .TRUE., kiolib = jprstlib ) 94 lrst_oce = .TRUE. 90 ! create the file 91 clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out) 92 clpath = TRIM(cn_ocerst_outdir) 93 IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 94 IF(lwp) THEN 95 WRITE(numout,*) 96 SELECT CASE ( jprstlib ) 97 CASE ( jprstdimg ) ; WRITE(numout,*) & 98 ' open ocean restart binary file: ',TRIM(clpath)//clname 99 CASE DEFAULT ; WRITE(numout,*) & 100 ' open ocean restart NetCDF file: ',TRIM(clpath)//clname 101 END SELECT 102 IF ( snc4set%luse ) WRITE(numout,*) ' opened for NetCDF4 chunking and compression' 103 IF( kt == nitrst - 1 ) THEN ; WRITE(numout,*) ' kt = nitrst - 1 = ', kt 104 ELSE ; WRITE(numout,*) ' kt = ' , kt 105 ENDIF 106 ENDIF 107 ! 108 CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 109 lrst_oce = .TRUE. 110 ENDIF 95 111 ENDIF 96 112 ! … … 117 133 CALL iom_rstput( kt, nitrst, numrow, 'tb' , tsb(:,:,:,jp_tem) ) 118 134 CALL iom_rstput( kt, nitrst, numrow, 'sb' , tsb(:,:,:,jp_sal) ) 119 CALL iom_rstput( kt, nitrst, numrow, 'rotb' , rotb )120 CALL iom_rstput( kt, nitrst, numrow, 'hdivb' , hdivb )121 135 CALL iom_rstput( kt, nitrst, numrow, 'sshb' , sshb ) 122 !123 IF( lk_lim3 ) CALL iom_rstput( kt, nitrst, numrow, 'fse3t_b', fse3t_b(:,:,:) )124 136 ! 125 137 CALL iom_rstput( kt, nitrst, numrow, 'un' , un ) ! now fields … … 127 139 CALL iom_rstput( kt, nitrst, numrow, 'tn' , tsn(:,:,:,jp_tem) ) 128 140 CALL iom_rstput( kt, nitrst, numrow, 'sn' , tsn(:,:,:,jp_sal) ) 129 CALL iom_rstput( kt, nitrst, numrow, 'rotn' , rotn )130 CALL iom_rstput( kt, nitrst, numrow, 'hdivn' , hdivn )131 141 CALL iom_rstput( kt, nitrst, numrow, 'sshn' , sshn ) 132 142 CALL iom_rstput( kt, nitrst, numrow, 'rhop' , rhop ) 133 #if defined key_zdfkpp134 CALL iom_rstput( kt, nitrst, numrow, 'rhd' , rhd )135 #endif136 IF( lk_lim3 ) THEN137 CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev' , fraqsr_1lev ) !clem modif138 ENDIF139 143 IF( kt == nitrst ) THEN 140 144 CALL iom_close( numrow ) ! close the restart file (only at last time step) … … 142 146 !!gm not sure what to do here ===>>> ask to Sebastian 143 147 lrst_oce = .FALSE. 148 IF( ln_rst_list ) THEN 149 nrst_lst = MIN(nrst_lst + 1, SIZE(nstocklist,1)) 150 nitrst = nstocklist( nrst_lst ) 151 ENDIF 152 lrst_oce = .FALSE. 144 153 ENDIF 145 154 ! … … 156 165 !! the file has already been opened 157 166 !!---------------------------------------------------------------------- 158 INTEGER :: jlibalt = jprstlib 159 LOGICAL :: llok 167 INTEGER :: jlibalt = jprstlib 168 LOGICAL :: llok 169 CHARACTER(lc) :: clpath ! full path to ocean output restart file 160 170 !!---------------------------------------------------------------------- 161 171 ! … … 171 181 ENDIF 172 182 183 clpath = TRIM(cn_ocerst_indir) 184 IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 173 185 IF ( jprstlib == jprstdimg ) THEN 174 186 ! eventually read netcdf file (monobloc) for restarting on different number of processors 175 187 ! if {cn_ocerst_in}.nc exists, then set jlibalt to jpnf90 176 INQUIRE( FILE = TRIM(cn_ocerst_in )//'.nc', EXIST = llok )188 INQUIRE( FILE = TRIM(cn_ocerst_indir)//'/'//TRIM(cn_ocerst_in)//'.nc', EXIST = llok ) 177 189 IF ( llok ) THEN ; jlibalt = jpnf90 ; ELSE ; jlibalt = jprstlib ; ENDIF 178 190 ENDIF 179 CALL iom_open( cn_ocerst_in, numror, kiolib = jlibalt )191 CALL iom_open( TRIM(clpath)//cn_ocerst_in, numror, kiolib = jlibalt ) 180 192 ENDIF 181 193 END SUBROUTINE rst_read_open 194 182 195 183 196 SUBROUTINE rst_read … … 211 224 CALL iom_get( numror, jpdom_autoglo, 'tb' , tsb(:,:,:,jp_tem) ) 212 225 CALL iom_get( numror, jpdom_autoglo, 'sb' , tsb(:,:,:,jp_sal) ) 213 CALL iom_get( numror, jpdom_autoglo, 'rotb' , rotb )214 CALL iom_get( numror, jpdom_autoglo, 'hdivb' , hdivb )215 226 CALL iom_get( numror, jpdom_autoglo, 'sshb' , sshb ) 216 IF( lk_lim3 ) CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )217 227 ELSE 218 228 neuler = 0 … … 224 234 CALL iom_get( numror, jpdom_autoglo, 'sn' , tsn(:,:,:,jp_sal) ) 225 235 CALL iom_get( numror, jpdom_autoglo, 'sshn' , sshn ) 226 IF( iom_varid( numror, 'rotn', ldstop = .FALSE. ) > 0 ) THEN227 CALL iom_get( numror, jpdom_autoglo, 'rotn' , rotn )228 CALL iom_get( numror, jpdom_autoglo, 'hdivn' , hdivn )229 ELSE230 CALL div_cur( 0 ) ! Horizontal divergence & Relative vorticity231 ENDIF232 236 IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN 233 237 CALL iom_get( numror, jpdom_autoglo, 'rhop' , rhop ) ! now potential density … … 235 239 CALL eos ( tsn, rhd, rhop, fsdept_n(:,:,:) ) 236 240 ENDIF 237 #if defined key_zdfkpp238 IF( iom_varid( numror, 'rhd', ldstop = .FALSE. ) > 0 ) THEN239 CALL iom_get( numror, jpdom_autoglo, 'rhd' , rhd ) ! now in situ density anomaly240 ELSE241 CALL eos( tsn, rhd, fsdept_n(:,:,:) ) ! compute rhd242 ENDIF243 #endif244 241 ! 245 242 IF( neuler == 0 ) THEN ! Euler restart (neuler=0) … … 247 244 ub (:,:,:) = un (:,:,:) 248 245 vb (:,:,:) = vn (:,:,:) 249 rotb (:,:,:) = rotn (:,:,:)250 hdivb(:,:,:) = hdivn(:,:,:)251 246 sshb (:,:) = sshn (:,:) 252 247 ! 253 248 IF( lk_vvl ) THEN 254 249 DO jk = 1, jpk … … 256 251 END DO 257 252 ENDIF 258 259 IF( lk_lim3 .AND. .NOT. lk_vvl ) THEN 260 DO jk = 1, jpk 261 fse3t_b(:,:,jk) = fse3t_n(:,:,jk) 262 END DO 263 ENDIF 264 265 ENDIF 266 ! 267 IF( lk_lim3 ) THEN 268 CALL iom_get( numror, jpdom_autoglo, 'fraqsr_1lev' , fraqsr_1lev ) 253 ! 269 254 ENDIF 270 255 !
Note: See TracChangeset
for help on using the changeset viewer.