[3] | 1 | MODULE restart |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE restart *** |
---|
| 4 | !! Ocean restart : write the ocean restart file |
---|
[508] | 5 | !!====================================================================== |
---|
[2528] | 6 | !! History : OPA ! 1999-11 (M. Imbard) Original code |
---|
| 7 | !! NEMO 1.0 ! 2002-08 (G. Madec) F90: Free form |
---|
| 8 | !! 2.0 ! 2006-07 (S. Masson) use IOM for restart |
---|
| 9 | !! 3.3 ! 2010-04 (M. Leclair, G. Madec) modified LF-RA |
---|
| 10 | !! - - ! 2010-10 (C. Ethe, G. Madec) TRC-TRA merge (T-S in 4D) |
---|
[5836] | 11 | !! 3.7 ! 2014-01 (G. Madec) suppression of curl and hdiv from the restart |
---|
| 12 | !! - ! 2014-12 (G. Madec) remove KPP scheme |
---|
[14139] | 13 | !! 4.1 ! 2020-11 (S. Techene, G. Madec) move ssh initiatlisation in rst_read_ssh |
---|
| 14 | !! - ! add restart in Shallow Water Eq. case |
---|
[508] | 15 | !!---------------------------------------------------------------------- |
---|
[3] | 16 | |
---|
| 17 | !!---------------------------------------------------------------------- |
---|
[14139] | 18 | !! rst_opn : open the ocean restart file for writting |
---|
| 19 | !! rst_write : write the ocean restart file |
---|
| 20 | !! rst_read_open : open the restart file for reading |
---|
| 21 | !! rst_read : read the ocean restart file |
---|
| 22 | !! rst_read_ssh : ssh set from restart or domcfg.nc file or usr_def_istat_ssh |
---|
[3] | 23 | !!---------------------------------------------------------------------- |
---|
[14139] | 24 | USE oce ! ocean dynamics and tracers |
---|
| 25 | USE dom_oce ! ocean space and time domain |
---|
| 26 | USE sbc_ice ! only lk_si3 |
---|
| 27 | USE phycst ! physical constants |
---|
| 28 | USE eosbn2 ! equation of state |
---|
| 29 | USE wet_dry ! Wetting/Drying flux limiting |
---|
| 30 | USE usrdef_istate, ONLY : usr_def_istate_ssh ! user defined ssh initial state |
---|
| 31 | USE trdmxl_oce ! ocean active mixed layer tracers trends variables |
---|
| 32 | USE diu_bulk ! ??? |
---|
[5836] | 33 | ! |
---|
[14139] | 34 | USE in_out_manager ! I/O manager |
---|
| 35 | USE iom ! I/O module |
---|
| 36 | USE lib_mpp ! distribued memory computing library |
---|
[9367] | 37 | |
---|
[3] | 38 | IMPLICIT NONE |
---|
| 39 | PRIVATE |
---|
| 40 | |
---|
[14139] | 41 | PUBLIC rst_opn ! called by step.F90 |
---|
| 42 | PUBLIC rst_write ! called by step.F90 |
---|
| 43 | PUBLIC rst_read_open ! called in rst_read_ssh |
---|
| 44 | PUBLIC rst_read ! called by istate.F90 |
---|
| 45 | PUBLIC rst_read_ssh ! called by domain.F90 |
---|
| 46 | |
---|
| 47 | !! * Substitutions |
---|
| 48 | # include "do_loop_substitute.h90" |
---|
[3] | 49 | !!---------------------------------------------------------------------- |
---|
[9598] | 50 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[888] | 51 | !! $Id$ |
---|
[10068] | 52 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[359] | 53 | !!---------------------------------------------------------------------- |
---|
[3] | 54 | CONTAINS |
---|
| 55 | |
---|
[508] | 56 | SUBROUTINE rst_opn( kt ) |
---|
| 57 | !!--------------------------------------------------------------------- |
---|
| 58 | !! *** ROUTINE rst_opn *** |
---|
[14072] | 59 | !! |
---|
| 60 | !! ** Purpose : + initialization (should be read in the namelist) of nitrst |
---|
[508] | 61 | !! + open the restart when we are one time step before nitrst |
---|
| 62 | !! - restart header is defined when kt = nitrst-1 |
---|
| 63 | !! - restart data are written when kt = nitrst |
---|
| 64 | !! + define lrst_oce to .TRUE. when we need to define or write the restart |
---|
| 65 | !!---------------------------------------------------------------------- |
---|
| 66 | INTEGER, INTENT(in) :: kt ! ocean time-step |
---|
| 67 | !! |
---|
| 68 | CHARACTER(LEN=20) :: clkt ! ocean time-step deine as a character |
---|
[5341] | 69 | CHARACTER(LEN=50) :: clname ! ocean output restart file name |
---|
| 70 | CHARACTER(lc) :: clpath ! full path to ocean output restart file |
---|
[9367] | 71 | CHARACTER(LEN=52) :: clpname ! ocean output restart file name including prefix for AGRIF |
---|
[9535] | 72 | CHARACTER(LEN=256) :: clinfo ! info character |
---|
[508] | 73 | !!---------------------------------------------------------------------- |
---|
| 74 | ! |
---|
[783] | 75 | IF( kt == nit000 ) THEN ! default definitions |
---|
[14072] | 76 | lrst_oce = .FALSE. |
---|
[5341] | 77 | IF( ln_rst_list ) THEN |
---|
| 78 | nrst_lst = 1 |
---|
[11536] | 79 | nitrst = nn_stocklist( nrst_lst ) |
---|
[5341] | 80 | ELSE |
---|
| 81 | nitrst = nitend |
---|
| 82 | ENDIF |
---|
[508] | 83 | ENDIF |
---|
[14072] | 84 | |
---|
[11536] | 85 | IF( .NOT. ln_rst_list .AND. nn_stock == -1 ) RETURN ! we will never do any restart |
---|
[5341] | 86 | |
---|
| 87 | ! frequency-based restart dumping (nn_stock) |
---|
[14072] | 88 | IF( .NOT. ln_rst_list .AND. MOD( kt - 1, nn_stock ) == 0 ) THEN |
---|
[783] | 89 | ! we use kt - 1 and not kt - nit000 to keep the same periodicity from the beginning of the experiment |
---|
[11536] | 90 | nitrst = kt + nn_stock - 1 ! define the next value of nitrst for restart writing |
---|
[783] | 91 | IF( nitrst > nitend ) nitrst = nitend ! make sure we write a restart at the end of the run |
---|
| 92 | ENDIF |
---|
| 93 | ! to get better performances with NetCDF format: |
---|
| 94 | ! we open and define the ocean restart file one time step before writing the data (-> at nitrst - 1) |
---|
| 95 | ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1 |
---|
[11536] | 96 | IF( kt == nitrst - 1 .OR. nn_stock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN |
---|
[14072] | 97 | IF( nitrst <= nitend .AND. nitrst > 0 ) THEN |
---|
[5341] | 98 | ! beware of the format used to write kt (default is i8.8, that should be large enough...) |
---|
| 99 | IF( nitrst > 999999999 ) THEN ; WRITE(clkt, * ) nitrst |
---|
| 100 | ELSE ; WRITE(clkt, '(i8.8)') nitrst |
---|
[611] | 101 | ENDIF |
---|
[5341] | 102 | ! create the file |
---|
| 103 | clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_ocerst_out) |
---|
| 104 | clpath = TRIM(cn_ocerst_outdir) |
---|
| 105 | IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' |
---|
| 106 | IF(lwp) THEN |
---|
| 107 | WRITE(numout,*) |
---|
[9367] | 108 | IF(.NOT.lwxios) THEN |
---|
[10425] | 109 | WRITE(numout,*) ' open ocean restart NetCDF file: ',TRIM(clpath)//TRIM(clname) |
---|
[9367] | 110 | IF ( snc4set%luse ) WRITE(numout,*) ' opened for NetCDF4 chunking and compression' |
---|
| 111 | IF( kt == nitrst - 1 ) THEN ; WRITE(numout,*) ' kt = nitrst - 1 = ', kt |
---|
| 112 | ELSE ; WRITE(numout,*) ' kt = ' , kt |
---|
| 113 | ENDIF |
---|
[5341] | 114 | ENDIF |
---|
| 115 | ENDIF |
---|
| 116 | ! |
---|
[9367] | 117 | IF(.NOT.lwxios) THEN |
---|
[10425] | 118 | CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE. ) |
---|
[9367] | 119 | ELSE |
---|
[9535] | 120 | #if defined key_iomput |
---|
[13970] | 121 | cw_ocerst_cxt = "rstw_"//TRIM(ADJUSTL(clkt)) |
---|
[9367] | 122 | IF( TRIM(Agrif_CFixed()) == '0' ) THEN |
---|
| 123 | clpname = clname |
---|
| 124 | ELSE |
---|
[14072] | 125 | clpname = TRIM(Agrif_CFixed())//"_"//clname |
---|
[9367] | 126 | ENDIF |
---|
[13970] | 127 | numrow = iom_xios_setid(TRIM(clpath)//TRIM(clpname)) |
---|
| 128 | CALL iom_init( cw_ocerst_cxt, kdid = numrow, ld_closedef = .false. ) |
---|
[9367] | 129 | CALL iom_swap( cxios_context ) |
---|
[9535] | 130 | #else |
---|
| 131 | clinfo = 'Can not use XIOS in rst_opn' |
---|
| 132 | CALL ctl_stop(TRIM(clinfo)) |
---|
| 133 | #endif |
---|
[9367] | 134 | ENDIF |
---|
[5341] | 135 | lrst_oce = .TRUE. |
---|
[611] | 136 | ENDIF |
---|
[508] | 137 | ENDIF |
---|
| 138 | ! |
---|
| 139 | END SUBROUTINE rst_opn |
---|
| 140 | |
---|
| 141 | |
---|
[12377] | 142 | SUBROUTINE rst_write( kt, Kbb, Kmm ) |
---|
[3] | 143 | !!--------------------------------------------------------------------- |
---|
| 144 | !! *** ROUTINE rstwrite *** |
---|
[14072] | 145 | !! |
---|
[10425] | 146 | !! ** Purpose : Write restart fields in NetCDF format |
---|
[3] | 147 | !! |
---|
[508] | 148 | !! ** Method : Write in numrow when kt == nitrst in NetCDF |
---|
[2528] | 149 | !! file, save fields which are necessary for restart |
---|
[14053] | 150 | !! |
---|
| 151 | !! NB: ssh is written here (rst_write) |
---|
[14139] | 152 | !! but is read or set in rst_read_ssh |
---|
[3] | 153 | !!---------------------------------------------------------------------- |
---|
[12377] | 154 | INTEGER, INTENT(in) :: kt ! ocean time-step |
---|
| 155 | INTEGER, INTENT(in) :: Kbb, Kmm ! ocean time level indices |
---|
[3] | 156 | !!---------------------------------------------------------------------- |
---|
[14139] | 157 | ! |
---|
| 158 | CALL iom_rstput( kt, nitrst, numrow, 'rdt' , rn_Dt ) ! dynamics time step |
---|
| 159 | ! |
---|
| 160 | IF( .NOT.lwxios ) CALL iom_delay_rst( 'WRITE', 'OCE', numrow ) ! save only ocean delayed global communication variables |
---|
| 161 | ! |
---|
| 162 | IF( .NOT.ln_diurnal_only ) THEN |
---|
| 163 | CALL iom_rstput( kt, nitrst, numrow, 'sshb' , ssh(:,: ,Kbb) ) ! before fields |
---|
| 164 | CALL iom_rstput( kt, nitrst, numrow, 'ub' , uu(:,:,: ,Kbb) ) |
---|
| 165 | CALL iom_rstput( kt, nitrst, numrow, 'vb' , vv(:,:,: ,Kbb) ) |
---|
| 166 | IF( .NOT.lk_SWE ) THEN |
---|
| 167 | CALL iom_rstput( kt, nitrst, numrow, 'tb' , ts(:,:,:,jp_tem,Kbb) ) |
---|
| 168 | CALL iom_rstput( kt, nitrst, numrow, 'sb' , ts(:,:,:,jp_sal,Kbb) ) |
---|
| 169 | ENDIF |
---|
| 170 | ! |
---|
| 171 | CALL iom_rstput( kt, nitrst, numrow, 'sshn' , ssh(:,: ,Kmm) ) ! now fields |
---|
| 172 | CALL iom_rstput( kt, nitrst, numrow, 'un' , uu(:,:,: ,Kmm) ) |
---|
| 173 | CALL iom_rstput( kt, nitrst, numrow, 'vn' , vv(:,:,: ,Kmm) ) |
---|
| 174 | IF( .NOT.lk_SWE ) THEN |
---|
| 175 | CALL iom_rstput( kt, nitrst, numrow, 'tn' , ts(:,:,:,jp_tem,Kmm) ) |
---|
| 176 | CALL iom_rstput( kt, nitrst, numrow, 'sn' , ts(:,:,:,jp_sal,Kmm) ) |
---|
| 177 | CALL iom_rstput( kt, nitrst, numrow, 'rhop', rhop ) |
---|
| 178 | ENDIF |
---|
[6140] | 179 | ENDIF |
---|
[14072] | 180 | |
---|
[14139] | 181 | IF( ln_diurnal ) CALL iom_rstput( kt, nitrst, numrow, 'Dsst', x_dsst ) |
---|
[508] | 182 | IF( kt == nitrst ) THEN |
---|
[14139] | 183 | IF( .NOT.lwxios ) THEN |
---|
[9367] | 184 | CALL iom_close( numrow ) ! close the restart file (only at last time step) |
---|
| 185 | ELSE |
---|
[13970] | 186 | CALL iom_context_finalize( cw_ocerst_cxt ) |
---|
| 187 | iom_file(numrow)%nfid = 0 |
---|
| 188 | numrow = 0 |
---|
[9367] | 189 | ENDIF |
---|
[4990] | 190 | !!gm IF( .NOT. lk_trdmld ) lrst_oce = .FALSE. |
---|
| 191 | !!gm not sure what to do here ===>>> ask to Sebastian |
---|
| 192 | lrst_oce = .FALSE. |
---|
[14139] | 193 | IF( ln_rst_list ) THEN |
---|
| 194 | nrst_lst = MIN(nrst_lst + 1, SIZE(nn_stocklist,1)) |
---|
| 195 | nitrst = nn_stocklist( nrst_lst ) |
---|
| 196 | ENDIF |
---|
[3] | 197 | ENDIF |
---|
[508] | 198 | ! |
---|
[3] | 199 | END SUBROUTINE rst_write |
---|
| 200 | |
---|
[4990] | 201 | |
---|
[4292] | 202 | SUBROUTINE rst_read_open |
---|
[14072] | 203 | !!---------------------------------------------------------------------- |
---|
[4292] | 204 | !! *** ROUTINE rst_read_open *** |
---|
[14072] | 205 | !! |
---|
[10425] | 206 | !! ** Purpose : Open read files for NetCDF restart |
---|
[14072] | 207 | !! |
---|
[4292] | 208 | !! ** Method : Use a non-zero, positive value of numror to assess whether or not |
---|
| 209 | !! the file has already been opened |
---|
| 210 | !!---------------------------------------------------------------------- |
---|
[13970] | 211 | LOGICAL :: llok |
---|
| 212 | CHARACTER(len=lc) :: clpath ! full path to ocean output restart file |
---|
| 213 | CHARACTER(len=lc+2) :: clpname ! file name including agrif prefix |
---|
[4292] | 214 | !!---------------------------------------------------------------------- |
---|
[4990] | 215 | ! |
---|
| 216 | IF( numror <= 0 ) THEN |
---|
[4292] | 217 | IF(lwp) THEN ! Contol prints |
---|
| 218 | WRITE(numout,*) |
---|
[10425] | 219 | WRITE(numout,*) 'rst_read : read oce NetCDF restart file' |
---|
[4292] | 220 | IF ( snc4set%luse ) WRITE(numout,*) 'rst_read : configured with NetCDF4 support' |
---|
| 221 | WRITE(numout,*) '~~~~~~~~' |
---|
| 222 | ENDIF |
---|
[9367] | 223 | lxios_sini = .FALSE. |
---|
[5341] | 224 | clpath = TRIM(cn_ocerst_indir) |
---|
| 225 | IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath) // '/' |
---|
[10425] | 226 | CALL iom_open( TRIM(clpath)//cn_ocerst_in, numror ) |
---|
[9367] | 227 | ! are we using XIOS to read the data? Part above will have to modified once XIOS |
---|
| 228 | ! can handle checking if variable is in the restart file (there will be no need to open |
---|
| 229 | ! restart) |
---|
[13970] | 230 | lrxios = lrxios.AND.lxios_sini |
---|
| 231 | |
---|
[9367] | 232 | IF( lrxios) THEN |
---|
[13970] | 233 | cr_ocerst_cxt = 'oce_rst' |
---|
| 234 | IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS' |
---|
| 235 | ! IF( TRIM(Agrif_CFixed()) == '0' ) THEN |
---|
| 236 | ! clpname = cn_ocerst_in |
---|
| 237 | ! ELSE |
---|
[14072] | 238 | ! clpname = TRIM(Agrif_CFixed())//"_"//cn_ocerst_in |
---|
[13970] | 239 | ! ENDIF |
---|
| 240 | CALL iom_init( cr_ocerst_cxt, kdid = numror, ld_closedef = .TRUE. ) |
---|
| 241 | CALL iom_swap( cxios_context ) |
---|
[9367] | 242 | ENDIF |
---|
[13970] | 243 | |
---|
[4292] | 244 | ENDIF |
---|
[9367] | 245 | |
---|
[4292] | 246 | END SUBROUTINE rst_read_open |
---|
| 247 | |
---|
[5836] | 248 | |
---|
[12377] | 249 | SUBROUTINE rst_read( Kbb, Kmm ) |
---|
[14072] | 250 | !!---------------------------------------------------------------------- |
---|
[3] | 251 | !! *** ROUTINE rst_read *** |
---|
[14072] | 252 | !! |
---|
[14053] | 253 | !! ** Purpose : Read velocity and T-S fields in the restart file |
---|
[14072] | 254 | !! |
---|
[14053] | 255 | !! ** Method : Read in restart.nc fields which are necessary for restart |
---|
| 256 | !! |
---|
| 257 | !! NB: restart file openned in DOM/domain.F90:dom_init |
---|
| 258 | !! before field in restart tested in DOM/domain.F90:dom_init |
---|
| 259 | !! (sshb) |
---|
| 260 | !! |
---|
[14139] | 261 | !! NB: ssh is read or set in rst_read_ssh |
---|
[3] | 262 | !!---------------------------------------------------------------------- |
---|
[14139] | 263 | INTEGER , INTENT(in) :: Kbb, Kmm ! ocean time level indices |
---|
[4292] | 264 | INTEGER :: jk |
---|
[9367] | 265 | REAL(wp), DIMENSION(jpi, jpj, jpk) :: w3d |
---|
[3] | 266 | !!---------------------------------------------------------------------- |
---|
[14053] | 267 | ! |
---|
[14139] | 268 | IF(.NOT.lrxios ) CALL iom_delay_rst( 'READ', 'OCE', numror ) ! read only ocean delayed global communication variables |
---|
[14053] | 269 | ! |
---|
[14072] | 270 | ! !* Diurnal DSST |
---|
| 271 | IF( ln_diurnal ) CALL iom_get( numror, jpdom_auto, 'Dsst' , x_dsst ) |
---|
[14139] | 272 | IF( ln_diurnal_only ) THEN |
---|
[6140] | 273 | IF(lwp) WRITE( numout, * ) & |
---|
[14072] | 274 | & "rst_read:- ln_diurnal_only set, setting rhop=rho0" |
---|
[12489] | 275 | rhop = rho0 |
---|
[14072] | 276 | CALL iom_get( numror, jpdom_auto, 'tn' , w3d ) |
---|
[12377] | 277 | ts(:,:,1,jp_tem,Kmm) = w3d(:,:,1) |
---|
[14072] | 278 | RETURN |
---|
| 279 | ENDIF |
---|
[14053] | 280 | ! |
---|
| 281 | ! !* Read Kmm fields |
---|
| 282 | IF(lwp) WRITE(numout,*) ' Kmm u, v and T-S fields read in the restart file' |
---|
[14139] | 283 | CALL iom_get( numror, jpdom_auto, 'un' , uu(:,:,: ,Kmm), cd_type = 'U', psgn = -1._wp ) |
---|
| 284 | CALL iom_get( numror, jpdom_auto, 'vn' , vv(:,:,: ,Kmm), cd_type = 'V', psgn = -1._wp ) |
---|
| 285 | IF( .NOT.lk_SWE ) THEN |
---|
| 286 | CALL iom_get( numror, jpdom_auto, 'tn', ts(:,:,:,jp_tem,Kmm) ) |
---|
| 287 | CALL iom_get( numror, jpdom_auto, 'sn', ts(:,:,:,jp_sal,Kmm) ) |
---|
| 288 | ENDIF |
---|
[14053] | 289 | ! |
---|
| 290 | IF( l_1st_euler ) THEN !* Euler restart |
---|
| 291 | IF(lwp) WRITE(numout,*) ' Kbb u, v and T-S fields set to Kmm values' |
---|
[14139] | 292 | uu(:,:,: ,Kbb) = uu(:,:,: ,Kmm) ! all before fields set to now values |
---|
[14053] | 293 | vv(:,:,: ,Kbb) = vv(:,:,: ,Kmm) |
---|
[14139] | 294 | IF( .NOT.lk_SWE ) ts(:,:,:,:,Kbb) = ts(:,:,:,:,Kmm) |
---|
| 295 | ! |
---|
[14053] | 296 | ELSE !* Leap frog restart |
---|
| 297 | IF(lwp) WRITE(numout,*) ' Kbb u, v and T-S fields read in the restart file' |
---|
[14139] | 298 | CALL iom_get( numror, jpdom_auto, 'ub' , uu(:,:,: ,Kbb), cd_type = 'U', psgn = -1._wp ) |
---|
| 299 | CALL iom_get( numror, jpdom_auto, 'vb' , vv(:,:,: ,Kbb), cd_type = 'V', psgn = -1._wp ) |
---|
| 300 | IF( .NOT.lk_SWE ) THEN |
---|
| 301 | CALL iom_get( numror, jpdom_auto, 'tb', ts(:,:,:,jp_tem,Kbb) ) |
---|
| 302 | CALL iom_get( numror, jpdom_auto, 'sb', ts(:,:,:,jp_sal,Kbb) ) |
---|
| 303 | ENDIF |
---|
[3680] | 304 | ENDIF |
---|
| 305 | ! |
---|
[14139] | 306 | IF( .NOT.lk_SWE ) THEN |
---|
| 307 | IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN |
---|
| 308 | CALL iom_get( numror, jpdom_auto, 'rhop' , rhop ) ! now potential density |
---|
| 309 | ELSE |
---|
| 310 | CALL eos( ts(:,:,:,:,Kmm), rhd, rhop, gdept(:,:,:,Kmm) ) |
---|
| 311 | ENDIF |
---|
[3680] | 312 | ENDIF |
---|
[2528] | 313 | ! |
---|
[508] | 314 | END SUBROUTINE rst_read |
---|
[473] | 315 | |
---|
[14139] | 316 | |
---|
| 317 | SUBROUTINE rst_read_ssh( Kbb, Kmm, Kaa ) |
---|
| 318 | !!--------------------------------------------------------------------- |
---|
| 319 | !! *** ROUTINE rst_read_ssh *** |
---|
| 320 | !! |
---|
| 321 | !! ** Purpose : ssh initialization of the sea surface height (ssh) |
---|
| 322 | !! |
---|
| 323 | !! ** Method : set ssh from restart or read configuration, or user_def |
---|
| 324 | !! * ln_rstart = T |
---|
| 325 | !! USE of IOM library to read ssh in the restart file |
---|
| 326 | !! Leap-Frog: Kbb and Kmm are read except for l_1st_euler=T |
---|
| 327 | !! |
---|
| 328 | !! * otherwise |
---|
| 329 | !! call user defined ssh or |
---|
| 330 | !! set to -ssh_ref in wet and drying case with domcfg.nc |
---|
| 331 | !! |
---|
| 332 | !! NB: ssh_b/n are written by restart.F90 |
---|
| 333 | !!---------------------------------------------------------------------- |
---|
| 334 | INTEGER, INTENT(in) :: Kbb, Kmm, Kaa ! ocean time level indices |
---|
| 335 | ! |
---|
| 336 | INTEGER :: ji, jj, jk |
---|
| 337 | !!---------------------------------------------------------------------- |
---|
| 338 | ! |
---|
| 339 | IF(lwp) THEN |
---|
| 340 | WRITE(numout,*) |
---|
| 341 | WRITE(numout,*) 'rst_read_ssh : ssh initialization' |
---|
| 342 | WRITE(numout,*) '~~~~~~~~~~~~ ' |
---|
| 343 | ENDIF |
---|
| 344 | ! |
---|
| 345 | ! !=============================! |
---|
| 346 | IF( ln_rstart ) THEN !== Read the restart file ==! |
---|
| 347 | ! !=============================! |
---|
| 348 | ! |
---|
| 349 | ! !* Read ssh at Kmm |
---|
| 350 | IF(lwp) WRITE(numout,*) |
---|
| 351 | IF(lwp) WRITE(numout,*) ' Kmm sea surface height read in the restart file' |
---|
| 352 | CALL iom_get( numror, jpdom_auto, 'sshn' , ssh(:,:,Kmm) ) |
---|
| 353 | ! |
---|
| 354 | IF( l_1st_euler ) THEN !* Euler at first time-step |
---|
| 355 | IF(lwp) WRITE(numout,*) |
---|
| 356 | IF(lwp) WRITE(numout,*) ' Euler first time step : ssh(Kbb) = ssh(Kmm)' |
---|
| 357 | ssh(:,:,Kbb) = ssh(:,:,Kmm) |
---|
| 358 | ! |
---|
| 359 | ELSE !* read ssh at Kbb |
---|
| 360 | IF(lwp) WRITE(numout,*) |
---|
| 361 | IF(lwp) WRITE(numout,*) ' Kbb sea surface height read in the restart file' |
---|
| 362 | CALL iom_get( numror, jpdom_auto, 'sshb', ssh(:,:,Kbb) ) |
---|
| 363 | ENDIF |
---|
| 364 | ! !============================! |
---|
| 365 | ELSE !== Initialize at "rest" ==! |
---|
| 366 | ! !============================! |
---|
| 367 | ! |
---|
| 368 | IF(lwp) WRITE(numout,*) |
---|
| 369 | IF(lwp) WRITE(numout,*) ' initialization at rest' |
---|
| 370 | ! |
---|
| 371 | IF( ll_wd ) THEN !* wet and dry |
---|
| 372 | ! |
---|
| 373 | IF( ln_read_cfg ) THEN ! read configuration : ssh_ref is read in domain_cfg file |
---|
| 374 | !!st why ssh is not masked : i.e. ssh(:,:,Kmm) = -ssh_ref*ssmask(:,:), |
---|
| 375 | !!st since at the 1st time step lbclnk will be applied on ssh at Kaa but not initially at Kbb and Kmm |
---|
| 376 | ssh(:,:,Kbb) = -ssh_ref |
---|
| 377 | ! |
---|
| 378 | DO_2D( 1, 1, 1, 1 ) |
---|
| 379 | IF( ht_0(ji,jj)-ssh_ref < rn_wdmin1 ) THEN ! if total depth is less than min depth |
---|
| 380 | ssh(ji,jj,Kbb) = rn_wdmin1 - ht_0(ji,jj) |
---|
| 381 | ENDIF |
---|
| 382 | END_2D |
---|
| 383 | ELSE ! user define configuration case |
---|
| 384 | CALL usr_def_istate_ssh( tmask, ssh(:,:,Kbb) ) |
---|
| 385 | ENDIF |
---|
| 386 | ! |
---|
| 387 | ELSE !* user defined configuration |
---|
| 388 | CALL usr_def_istate_ssh( tmask, ssh(:,:,Kbb) ) |
---|
| 389 | ! |
---|
| 390 | ENDIF |
---|
| 391 | ! |
---|
[14145] | 392 | ssh(:,:,Kmm) = ssh(:,:,Kbb) !* set now values from to before ones |
---|
[14139] | 393 | ENDIF |
---|
| 394 | ! |
---|
[14145] | 395 | ! !==========================! |
---|
| 396 | ssh(:,:,Kaa) = 0._wp !== Set to 0 for agrif ==! |
---|
| 397 | ! !==========================! |
---|
| 398 | ! |
---|
[14139] | 399 | END SUBROUTINE rst_read_ssh |
---|
| 400 | |
---|
[3] | 401 | !!===================================================================== |
---|
| 402 | END MODULE restart |
---|