- Timestamp:
- 2016-01-08T10:35:19+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
r4693 r6225 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 trdmld_oce ! ocean active mixed layer tracers trends variables 25 USE divcur ! hor. divergence and curl (div & cur routines) 26 USE sbc_ice, ONLY : lk_lim3 27 29 USE diurnal_bulk 30 28 31 IMPLICIT NONE 29 32 PRIVATE … … 35 38 36 39 !! * Substitutions 37 # include "domzgr_substitute.h90"38 40 # include "vectopt_loop_substitute.h90" 39 41 !!---------------------------------------------------------------------- … … 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 DEFAULT ; WRITE(numout,*) & 98 ' open ocean restart NetCDF file: ',TRIM(clpath)//clname 99 END SELECT 100 IF ( snc4set%luse ) WRITE(numout,*) ' opened for NetCDF4 chunking and compression' 101 IF( kt == nitrst - 1 ) THEN ; WRITE(numout,*) ' kt = nitrst - 1 = ', kt 102 ELSE ; WRITE(numout,*) ' kt = ' , kt 103 ENDIF 104 ENDIF 105 ! 106 CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 107 lrst_oce = .TRUE. 108 ENDIF 95 109 ENDIF 96 110 ! … … 110 124 !!---------------------------------------------------------------------- 111 125 112 CALL iom_rstput( kt, nitrst, numrow, 'rdt' , rdt ) ! dynamics time step113 CALL iom_rstput( kt, nitrst, numrow, 'rdttra1', rdttra(1) ) ! surface tracer time step 114 126 CALL iom_rstput( kt, nitrst, numrow, 'rdt' , rdt ) ! dynamics and tracer time step 127 128 IF ( .NOT. ln_diurnal_only ) THEN 115 129 CALL iom_rstput( kt, nitrst, numrow, 'ub' , ub ) ! before fields 116 130 CALL iom_rstput( kt, nitrst, numrow, 'vb' , vb ) 117 131 CALL iom_rstput( kt, nitrst, numrow, 'tb' , tsb(:,:,:,jp_tem) ) 118 132 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 133 CALL iom_rstput( kt, nitrst, numrow, 'sshb' , sshb ) 122 IF( lk_lim3 ) CALL iom_rstput( kt, nitrst, numrow, 'fse3t_b', fse3t_b(:,:,:) )123 134 ! 124 135 CALL iom_rstput( kt, nitrst, numrow, 'un' , un ) ! now fields … … 126 137 CALL iom_rstput( kt, nitrst, numrow, 'tn' , tsn(:,:,:,jp_tem) ) 127 138 CALL iom_rstput( kt, nitrst, numrow, 'sn' , tsn(:,:,:,jp_sal) ) 128 CALL iom_rstput( kt, nitrst, numrow, 'rotn' , rotn )129 CALL iom_rstput( kt, nitrst, numrow, 'hdivn' , hdivn )130 139 CALL iom_rstput( kt, nitrst, numrow, 'sshn' , sshn ) 131 140 CALL iom_rstput( kt, nitrst, numrow, 'rhop' , rhop ) 132 #if defined key_zdfkpp 133 CALL iom_rstput( kt, nitrst, numrow, 'rhd' , rhd ) 134 #endif 135 IF( lk_lim3 ) THEN 136 CALL iom_rstput( kt, nitrst, numrow, 'iatte' , iatte ) !clem modif 137 CALL iom_rstput( kt, nitrst, numrow, 'oatte' , oatte ) !clem modif 138 ENDIF 141 142 ! extra variable needed for the ice sheet coupling 143 IF ( ln_iscpl ) THEN 144 CALL iom_rstput( kt, nitrst, numrow, 'tmask' , tmask ) ! need to extrapolate T/S 145 CALL iom_rstput( kt, nitrst, numrow, 'umask' , umask ) ! need to correct barotropic velocity 146 CALL iom_rstput( kt, nitrst, numrow, 'vmask' , vmask ) ! need to correct barotropic velocity 147 CALL iom_rstput( kt, nitrst, numrow, 'smask' , ssmask ) ! need to correct barotropic velocity 148 CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t_n(:,:,:) ) ! need to compute temperature correction 149 CALL iom_rstput( kt, nitrst, numrow, 'e3u_n', e3u_n(:,:,:) ) ! need to compute bt conservation 150 CALL iom_rstput( kt, nitrst, numrow, 'e3v_n', e3v_n(:,:,:) ) ! need to compute bt conservation 151 CALL iom_rstput( kt, nitrst, numrow, 'gdepw_n', gdepw_n(:,:,:) ) ! need to compute extrapolation if vvl 152 END IF 153 ENDIF 154 155 IF (ln_diurnal) CALL iom_rstput( kt, nitrst, numrow, 'Dsst', x_dsst ) 156 139 157 IF( kt == nitrst ) THEN 140 158 CALL iom_close( numrow ) ! close the restart file (only at last time step) 141 IF( .NOT. lk_trdmld ) lrst_oce = .FALSE. 159 !!gm IF( .NOT. lk_trdmld ) lrst_oce = .FALSE. 160 !!gm not sure what to do here ===>>> ask to Sebastian 161 lrst_oce = .FALSE. 162 IF( ln_rst_list ) THEN 163 nrst_lst = MIN(nrst_lst + 1, SIZE(nstocklist,1)) 164 nitrst = nstocklist( nrst_lst ) 165 ENDIF 166 lrst_oce = .FALSE. 142 167 ENDIF 143 168 ! 144 169 END SUBROUTINE rst_write 170 145 171 146 172 SUBROUTINE rst_read_open … … 153 179 !! the file has already been opened 154 180 !!---------------------------------------------------------------------- 155 INTEGER :: jlibalt = jprstlib 156 LOGICAL :: llok 157 !!---------------------------------------------------------------------- 158 159 IF( numror .LE. 0 ) THEN 181 INTEGER :: jlibalt = jprstlib 182 LOGICAL :: llok 183 CHARACTER(lc) :: clpath ! full path to ocean output restart file 184 !!---------------------------------------------------------------------- 185 ! 186 IF( numror <= 0 ) THEN 160 187 IF(lwp) THEN ! Contol prints 161 188 WRITE(numout,*) 162 189 SELECT CASE ( jprstlib ) 163 190 CASE ( jpnf90 ) ; WRITE(numout,*) 'rst_read : read oce NetCDF restart file' 164 CASE ( jprstdimg ) ; WRITE(numout,*) 'rst_read : read oce binary restart file'165 191 END SELECT 166 192 IF ( snc4set%luse ) WRITE(numout,*) 'rst_read : configured with NetCDF4 support' … … 168 194 ENDIF 169 195 170 IF ( jprstlib == jprstdimg ) THEN 171 ! eventually read netcdf file (monobloc) for restarting on different number of processors 172 ! if {cn_ocerst_in}.nc exists, then set jlibalt to jpnf90 173 INQUIRE( FILE = TRIM(cn_ocerst_in)//'.nc', EXIST = llok ) 174 IF ( llok ) THEN ; jlibalt = jpnf90 ; ELSE ; jlibalt = jprstlib ; ENDIF 175 ENDIF 176 CALL iom_open( cn_ocerst_in, numror, kiolib = jlibalt ) 196 clpath = TRIM(cn_ocerst_indir) 197 IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' 198 CALL iom_open( TRIM(clpath)//cn_ocerst_in, numror, kiolib = jlibalt ) 177 199 ENDIF 178 200 END SUBROUTINE rst_read_open 201 179 202 180 203 SUBROUTINE rst_read … … 186 209 !! ** Method : Read in restart.nc file fields which are necessary for restart 187 210 !!---------------------------------------------------------------------- 188 REAL(wp) :: zrdt , zrdttra1211 REAL(wp) :: zrdt 189 212 INTEGER :: jk 190 LOGICAL :: llok191 213 !!---------------------------------------------------------------------- 192 214 … … 198 220 IF( zrdt /= rdt ) neuler = 0 199 221 ENDIF 200 IF( iom_varid( numror, 'rdttra1', ldstop = .FALSE. ) > 0 ) THEN 201 CALL iom_get( numror, 'rdttra1', zrdttra1 ) 202 IF( zrdttra1 /= rdttra(1) ) neuler = 0 203 ENDIF 204 ! 222 223 ! Diurnal DSST 224 IF( ln_diurnal ) CALL iom_get( numror, jpdom_autoglo, 'Dsst' , x_dsst ) 225 IF ( ln_diurnal_only ) THEN 226 IF(lwp) WRITE( numout, * ) & 227 & "rst_read:- ln_diurnal_only set, setting rhop=rau0" 228 rhop = rau0 229 CALL iom_get( numror, jpdom_autoglo, 'tn' , tsn(:,:,1,jp_tem) ) 230 RETURN 231 ENDIF 232 205 233 IF( iom_varid( numror, 'ub', ldstop = .FALSE. ) > 0 ) THEN 206 234 CALL iom_get( numror, jpdom_autoglo, 'ub' , ub ) ! before fields … … 208 236 CALL iom_get( numror, jpdom_autoglo, 'tb' , tsb(:,:,:,jp_tem) ) 209 237 CALL iom_get( numror, jpdom_autoglo, 'sb' , tsb(:,:,:,jp_sal) ) 210 CALL iom_get( numror, jpdom_autoglo, 'rotb' , rotb )211 CALL iom_get( numror, jpdom_autoglo, 'hdivb' , hdivb )212 238 CALL iom_get( numror, jpdom_autoglo, 'sshb' , sshb ) 213 IF( lk_lim3 ) CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )214 239 ELSE 215 240 neuler = 0 … … 221 246 CALL iom_get( numror, jpdom_autoglo, 'sn' , tsn(:,:,:,jp_sal) ) 222 247 CALL iom_get( numror, jpdom_autoglo, 'sshn' , sshn ) 223 IF( iom_varid( numror, 'rotn', ldstop = .FALSE. ) > 0 ) THEN224 CALL iom_get( numror, jpdom_autoglo, 'rotn' , rotn )225 CALL iom_get( numror, jpdom_autoglo, 'hdivn' , hdivn )226 ELSE227 CALL div_cur( 0 ) ! Horizontal divergence & Relative vorticity228 ENDIF229 248 IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN 230 249 CALL iom_get( numror, jpdom_autoglo, 'rhop' , rhop ) ! now potential density 231 250 ELSE 232 CALL eos ( tsn, rhd, rhop, fsdept_n(:,:,:) ) 233 ENDIF 234 #if defined key_zdfkpp 235 IF( iom_varid( numror, 'rhd', ldstop = .FALSE. ) > 0 ) THEN 236 CALL iom_get( numror, jpdom_autoglo, 'rhd' , rhd ) ! now in situ density anomaly 237 ELSE 238 CALL eos( tsn, rhd, fsdept_n(:,:,:) ) ! compute rhd 239 ENDIF 240 #endif 251 CALL eos( tsn, rhd, rhop, gdept_n(:,:,:) ) 252 ENDIF 241 253 ! 242 254 IF( neuler == 0 ) THEN ! Euler restart (neuler=0) … … 244 256 ub (:,:,:) = un (:,:,:) 245 257 vb (:,:,:) = vn (:,:,:) 246 rotb (:,:,:) = rotn (:,:,:)247 hdivb(:,:,:) = hdivn(:,:,:)248 258 sshb (:,:) = sshn (:,:) 249 IF( lk_lim3 ) THEN 259 ! 260 IF( .NOT.ln_linssh ) THEN 250 261 DO jk = 1, jpk 251 fse3t_b(:,:,jk) = fse3t_n(:,:,jk)262 e3t_b(:,:,jk) = e3t_n(:,:,jk) 252 263 END DO 253 264 ENDIF 254 ENDIF 255 ! 256 IF( lk_lim3 ) THEN 257 CALL iom_get( numror, jpdom_autoglo, 'iatte' , iatte ) ! clem modif 258 CALL iom_get( numror, jpdom_autoglo, 'oatte' , oatte ) ! clem modif 265 ! 259 266 ENDIF 260 267 !
Note: See TracChangeset
for help on using the changeset viewer.