- Timestamp:
- 2020-12-02T16:32:24+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2020/dev_r13648_ASINTER-04_laurent_bulk_ice/src/ICE/icerst.F90
r13472 r14017 11 11 !!---------------------------------------------------------------------- 12 12 !! ice_rst_opn : open restart file 13 !! ice_rst_write : write restart file 14 !! ice_rst_read : read restart file 13 !! ice_rst_write : write restart file 14 !! ice_rst_read : read restart file 15 15 !!---------------------------------------------------------------------- 16 16 USE ice ! sea-ice: variables … … 54 54 CHARACTER(len=20) :: clkt ! ocean time-step define as a character 55 55 CHARACTER(len=50) :: clname ! ice output restart file name 56 CHARACTER(len=256) :: clpath ! full path to ice output restart file 56 CHARACTER(len=256) :: clpath ! full path to ice output restart file 57 CHARACTER(LEN=52) :: clpname ! ocean output restart file name including prefix for AGRIF 57 58 !!---------------------------------------------------------------------- 58 59 ! … … 60 61 61 62 IF( ln_rst_list .OR. nn_stock /= -1 ) THEN 62 ! in order to get better performances with NetCDF format, we open and define the ice restart file 63 ! one ice time step before writing the data (-> at nitrst - 2*nn_fsbc + 1), except if we write ice 63 ! in order to get better performances with NetCDF format, we open and define the ice restart file 64 ! one ice time step before writing the data (-> at nitrst - 2*nn_fsbc + 1), except if we write ice 64 65 ! restart files every ice time step or if an ice restart file was writen at nitend - 2*nn_fsbc + 1 65 66 IF( kt == nitrst - 2*nn_fsbc + 1 .OR. nn_stock == nn_fsbc & … … 72 73 ! create the file 73 74 clname = TRIM(cexper)//"_"//TRIM(ADJUSTL(clkt))//"_"//TRIM(cn_icerst_out) 74 clpath = TRIM(cn_icerst_outdir) 75 clpath = TRIM(cn_icerst_outdir) 75 76 IF( clpath(LEN_TRIM(clpath):) /= '/' ) clpath = TRIM(clpath)//'/' 76 77 IF(lwp) THEN … … 84 85 ENDIF 85 86 ! 86 CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kdlev = jpl, cdcomp = 'ICE' ) 87 IF(.NOT.lwxios) THEN 88 CALL iom_open( TRIM(clpath)//TRIM(clname), numriw, ldwrt = .TRUE., kdlev = jpl, cdcomp = 'ICE' ) 89 ELSE 90 #if defined key_iomput 91 cw_icerst_cxt = "rstwi_"//TRIM(ADJUSTL(clkt)) 92 IF( TRIM(Agrif_CFixed()) == '0' ) THEN 93 clpname = clname 94 ELSE 95 clpname = TRIM(Agrif_CFixed())//"_"//clname 96 ENDIF 97 numriw = iom_xios_setid(TRIM(clpath)//TRIM(clpname)) 98 CALL iom_init( cw_icerst_cxt, kdid = numriw, ld_closedef = .FALSE. ) 99 CALL iom_swap( cxios_context ) 100 #else 101 clinfo = 'Can not use XIOS in rst_opn' 102 CALL ctl_stop(TRIM(clinfo)) 103 #endif 104 ENDIF 87 105 lrst_ice = .TRUE. 88 106 ENDIF … … 115 133 IF(lwp) WRITE(numout,*) 116 134 IF(lwp) WRITE(numout,*) 'ice_rst_write : write ice restart file kt =', kt 117 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~' 135 IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~' 118 136 ENDIF 119 137 120 138 ! Write in numriw (if iter == nitrst) 121 ! ------------------ 139 ! ------------------ 122 140 ! ! calendar control 123 CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) ) ! time-step 141 CALL iom_rstput( iter, nitrst, numriw, 'nn_fsbc', REAL( nn_fsbc, wp ) ) ! time-step 124 142 CALL iom_rstput( iter, nitrst, numriw, 'kt_ice' , REAL( iter , wp ) ) ! date 125 CALL iom_delay_rst( 'WRITE', 'ICE', numriw ) ! save only ice delayed global communication variables 143 144 IF(.NOT.lwxios) CALL iom_delay_rst( 'WRITE', 'ICE', numriw ) ! save only ice delayed global communication variables 126 145 127 146 ! Prognostic variables … … 138 157 CALL iom_rstput( iter, nitrst, numriw, 'v_il' , v_il ) 139 158 ! Snow enthalpy 140 DO jk = 1, nlay_s 159 DO jk = 1, nlay_s 141 160 WRITE(zchar1,'(I2.2)') jk 142 161 znam = 'e_s'//'_l'//zchar1 … … 145 164 END DO 146 165 ! Ice enthalpy 147 DO jk = 1, nlay_i 166 DO jk = 1, nlay_i 148 167 WRITE(zchar1,'(I2.2)') jk 149 168 znam = 'e_i'//'_l'//zchar1 … … 154 173 IF( ln_cpl ) THEN 155 174 CALL iom_rstput( iter, nitrst, numriw, 'cnd_ice', cnd_ice ) 156 CALL iom_rstput( iter, nitrst, numriw, 't1_ice' , t1_ice 175 CALL iom_rstput( iter, nitrst, numriw, 't1_ice' , t1_ice ) 157 176 ENDIF 158 177 ! … … 161 180 ! ------------------ 162 181 IF( iter == nitrst ) THEN 163 CALL iom_close( numriw ) 182 IF(.NOT.lwxios) THEN 183 CALL iom_close( numriw ) 184 ELSE 185 CALL iom_context_finalize( cw_icerst_cxt ) 186 iom_file(numriw)%nfid = 0 187 numriw = 0 188 ENDIF 164 189 lrst_ice = .FALSE. 165 190 ENDIF … … 181 206 CHARACTER(len=2) :: zchar, zchar1 182 207 REAL(wp) :: zfice, ziter 208 CHARACTER(lc) :: clpname 183 209 REAL(wp), DIMENSION(jpi,jpj,jpl) :: z3d ! 3D workspace 184 210 !!---------------------------------------------------------------------- … … 190 216 ENDIF 191 217 218 lxios_sini = .FALSE. 192 219 CALL iom_open ( TRIM(cn_icerst_indir)//'/'//cn_icerst_in, numrir ) 193 220 194 ! test if v_i exists 221 IF( lrxios) THEN 222 cr_icerst_cxt = 'si3_rst' 223 IF(lwp) WRITE(numout,*) 'Enable restart reading by XIOS for SI3' 224 ! IF( TRIM(Agrif_CFixed()) == '0' ) THEN 225 ! clpname = cn_icerst_in 226 ! ELSE 227 ! clpname = TRIM(Agrif_CFixed())//"_"//cn_icerst_in 228 ! ENDIF 229 CALL iom_init( cr_icerst_cxt, kdid = numrir, ld_closedef = .TRUE. ) 230 ENDIF 231 232 ! test if v_i exists 195 233 id0 = iom_varid( numrir, 'v_i' , ldstop = .FALSE. ) 196 234 … … 198 236 IF( id0 > 0 ) THEN ! == case of a normal restart == ! 199 237 ! ! ------------------------------ ! 200 201 238 ! Time info 202 239 CALL iom_get( numrir, 'nn_fsbc', zfice ) 203 CALL iom_get( numrir, 'kt_ice' , ziter ) 240 CALL iom_get( numrir, 'kt_ice' , ziter ) 204 241 IF(lwp) WRITE(numout,*) ' read ice restart file at time step : ', ziter 205 242 IF(lwp) WRITE(numout,*) ' in any case we force it to nit000 - 1 : ', nit000 - 1 … … 215 252 & ' control of time parameter nrstdt' ) 216 253 217 ! --- mandatory fields --- ! 254 ! --- mandatory fields --- ! 218 255 CALL iom_get( numrir, jpdom_auto, 'v_i' , v_i ) 219 256 CALL iom_get( numrir, jpdom_auto, 'v_s' , v_s ) … … 278 315 ENDIF 279 316 280 CALL iom_delay_rst( 'READ', 'ICE', numrir ) ! read only ice delayed global communication variables 281 317 IF(.NOT.lrxios) CALL iom_delay_rst( 'READ', 'ICE', numrir ) ! read only ice delayed global communication variables 282 318 ! ! ---------------------------------- ! 283 319 ELSE ! == case of a simplified restart == !
Note: See TracChangeset
for help on using the changeset viewer.