- Timestamp:
- 2017-05-26T12:09:41+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r7573_xios_write/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
r6755 r8079 26 26 USE divcur ! hor. divergence and curl (div & cur routines) 27 27 USE sbc_oce ! for icesheet freshwater input variables 28 USE iom_def, ONLY : lwxios 28 29 29 30 IMPLICIT NONE … … 65 66 !!---------------------------------------------------------------------- 66 67 ! 68 67 69 IF( kt == nit000 ) THEN ! default definitions 68 70 lrst_oce = .FALSE. … … 84 86 ! we open and define the ocean restart file one time step before writing the data (-> at nitrst - 1) 85 87 ! except if we write ocean restart files every time step or if an ocean restart file was writen at nitend - 1 86 IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN 88 ! NO, because the data is written 2 times on nitrst - 1 and nitrst 89 ! IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN 90 IF( kt == nitrst .OR. nstock == 1 ) THEN 87 91 IF( nitrst <= nitend .AND. nitrst > 0 ) THEN 88 92 IF ( ln_rstdate ) THEN … … 103 107 IF(lwp) THEN 104 108 WRITE(numout,*) 105 SELECT CASE ( jprstlib ) 106 CASE ( jprstdimg ) ; WRITE(numout,*) & 107 ' open ocean restart binary file: ',TRIM(clpath)//clname 108 CASE DEFAULT ; WRITE(numout,*) & 109 ' open ocean restart NetCDF file: ',TRIM(clpath)//clname 110 END SELECT 111 IF ( snc4set%luse ) WRITE(numout,*) ' opened for NetCDF4 chunking and compression' 112 IF( kt == nitrst - 1 ) THEN ; WRITE(numout,*) ' kt = nitrst - 1 = ', kt 113 ELSE ; WRITE(numout,*) ' kt = ' , kt 109 IF(lwxios) THEN 110 WRITE(numout,*) & 111 ' XIOS open ocean restart NetCDF file: ',TRIM(clpath)//TRIM(clname) 112 ELSE 113 SELECT CASE ( jprstlib ) 114 CASE ( jprstdimg ) ; WRITE(numout,*) & 115 ' open ocean restart binary file: ',TRIM(clpath)//TRIM(clname) 116 CASE DEFAULT ; WRITE(numout,*) & 117 ' open ocean restart NetCDF file: ',TRIM(clpath)//TRIM(clname) 118 END SELECT 119 IF ( snc4set%luse ) WRITE(numout,*) ' opened for NetCDF4 chunking and compression' 120 IF( kt == nitrst - 1 ) THEN ; WRITE(numout,*) ' kt = nitrst - 1 = ', kt 121 ELSE ; WRITE(numout,*) ' kt = ' , kt 122 ENDIF 114 123 ENDIF 115 124 ENDIF 116 125 ! 117 CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 126 IF(.NOT.lwxios) THEN 127 CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 128 ELSE 129 CALL iom_init( wxios_context, TRIM(clpath)//TRIM(clname) ) 130 CALL xios_update_calendar(nitrst) 131 CALL iom_swap( cxios_context ) 132 ENDIF 133 !HAVE TO set lrst_oce to FALSE after XIOS restart is written !!!!!! 134 ! THIS CALL SHOULDN't be here we open restart file on iter-1, move it 135 ! to SUBROUTINE day to set the flag on the step when we save data 118 136 lrst_oce = .TRUE. 119 137 ENDIF 120 138 ENDIF 139 121 140 ! 122 141 END SUBROUTINE rst_opn … … 134 153 INTEGER, INTENT(in) :: kt ! ocean time-step 135 154 !!---------------------------------------------------------------------- 136 137 CALL iom_rstput( kt, nitrst, numrow, 'rdt' , rdt ) ! dynamics time step138 CALL iom_rstput( kt, nitrst, numrow, 'rdttra1', rdttra(1) ) ! surface tracer time step139 140 CALL iom_rstput( kt, nitrst, numrow, 'ub' , ub ) ! before fields141 CALL iom_rstput( kt, nitrst, numrow, 'vb' , vb )142 CALL iom_rstput( kt, nitrst, numrow, 'tb' , tsb(:,:,:,jp_tem) )143 CALL iom_rstput( kt, nitrst, numrow, 'sb' , tsb(:,:,:,jp_sal) )144 CALL iom_rstput( kt, nitrst, numrow, 'rotb' , rotb )145 CALL iom_rstput( kt, nitrst, numrow, 'hdivb' , hdivb )146 CALL iom_rstput( kt, nitrst, numrow, 'sshb' , sshb )155 IF(lwxios) CALL iom_swap( wxios_context ) 156 CALL iom_rstput( kt, nitrst, numrow, 'rdt' , rdt , lxios = lwxios) ! dynamics time step 157 CALL iom_rstput( kt, nitrst, numrow, 'rdttra1', rdttra(1) , lxios = lwxios) ! surface tracer time step 158 159 CALL iom_rstput( kt, nitrst, numrow, 'ub' , ub , lxios = lwxios) ! before fields 160 CALL iom_rstput( kt, nitrst, numrow, 'vb' , vb , lxios = lwxios) 161 CALL iom_rstput( kt, nitrst, numrow, 'tb' , tsb(:,:,:,jp_tem) , lxios = lwxios) 162 CALL iom_rstput( kt, nitrst, numrow, 'sb' , tsb(:,:,:,jp_sal) , lxios = lwxios) 163 CALL iom_rstput( kt, nitrst, numrow, 'rotb' , rotb , lxios = lwxios) 164 CALL iom_rstput( kt, nitrst, numrow, 'hdivb' , hdivb , lxios = lwxios) 165 CALL iom_rstput( kt, nitrst, numrow, 'sshb' , sshb , lxios = lwxios) 147 166 ! 148 CALL iom_rstput( kt, nitrst, numrow, 'un' , un ) ! now fields149 CALL iom_rstput( kt, nitrst, numrow, 'vn' , vn )150 CALL iom_rstput( kt, nitrst, numrow, 'tn' , tsn(:,:,:,jp_tem) )151 CALL iom_rstput( kt, nitrst, numrow, 'sn' , tsn(:,:,:,jp_sal) )152 CALL iom_rstput( kt, nitrst, numrow, 'rotn' , rotn )153 CALL iom_rstput( kt, nitrst, numrow, 'hdivn' , hdivn )154 CALL iom_rstput( kt, nitrst, numrow, 'sshn' , sshn )155 CALL iom_rstput( kt, nitrst, numrow, 'rhop' , rhop )167 CALL iom_rstput( kt, nitrst, numrow, 'un' , un , lxios = lwxios) ! now fields 168 CALL iom_rstput( kt, nitrst, numrow, 'vn' , vn , lxios = lwxios) 169 CALL iom_rstput( kt, nitrst, numrow, 'tn' , tsn(:,:,:,jp_tem) , lxios = lwxios) 170 CALL iom_rstput( kt, nitrst, numrow, 'sn' , tsn(:,:,:,jp_sal) , lxios = lwxios) 171 CALL iom_rstput( kt, nitrst, numrow, 'rotn' , rotn , lxios = lwxios) 172 CALL iom_rstput( kt, nitrst, numrow, 'hdivn' , hdivn , lxios = lwxios) 173 CALL iom_rstput( kt, nitrst, numrow, 'sshn' , sshn , lxios = lwxios) 174 CALL iom_rstput( kt, nitrst, numrow, 'rhop' , rhop , lxios = lwxios) 156 175 #if defined key_zdfkpp 157 CALL iom_rstput( kt, nitrst, numrow, 'rhd' , rhd )176 CALL iom_rstput( kt, nitrst, numrow, 'rhd' , rhd , lxios = lwxios) 158 177 #endif 159 178 IF( lk_oasis) THEN 160 179 ! ln_coupled_iceshelf_fluxes uninitialised unless lk_oasis=true 161 180 IF( ln_coupled_iceshelf_fluxes ) THEN 162 CALL iom_rstput( kt, nitrst, numrow, 'greenland_icesheet_mass', greenland_icesheet_mass ) 163 CALL iom_rstput( kt, nitrst, numrow, 'greenland_icesheet_timelapsed', greenland_icesheet_timelapsed ) 164 CALL iom_rstput( kt, nitrst, numrow, 'greenland_icesheet_mass_roc', greenland_icesheet_mass_rate_of_change ) 165 CALL iom_rstput( kt, nitrst, numrow, 'antarctica_icesheet_mass', antarctica_icesheet_mass ) 166 CALL iom_rstput( kt, nitrst, numrow, 'antarctica_icesheet_timelapsed', antarctica_icesheet_timelapsed ) 167 CALL iom_rstput( kt, nitrst, numrow, 'antarctica_icesheet_mass_roc', antarctica_icesheet_mass_rate_of_change ) 181 CALL iom_rstput( kt, nitrst, numrow, 'greenland_icesheet_mass', greenland_icesheet_mass ,& 182 & lxios = lwxios) 183 CALL iom_rstput( kt, nitrst, numrow, 'greenland_icesheet_timelapsed', greenland_icesheet_timelapsed ,& 184 & lxios = lwxios) 185 CALL iom_rstput( kt, nitrst, numrow, 'greenland_icesheet_mass_roc', greenland_icesheet_mass_rate_of_change ,& 186 & lxios = lwxios) 187 CALL iom_rstput( kt, nitrst, numrow, 'antarctica_icesheet_mass', antarctica_icesheet_mass , & 188 & lxios = lwxios) 189 CALL iom_rstput( kt, nitrst, numrow, 'antarctica_icesheet_timelapsed', antarctica_icesheet_timelapsed ,& 190 & lxios = lwxios) 191 CALL iom_rstput( kt, nitrst, numrow, 'antarctica_icesheet_mass_roc', & 192 & antarctica_icesheet_mass_rate_of_change , lxios = lwxios) 168 193 ENDIF 169 194 ENDIF 170 195 171 196 IF( kt == nitrst ) THEN 172 CALL iom_close( numrow ) ! close the restart file (only at last time step) 197 IF(.NOT.lwxios) THEN 198 CALL iom_close( numrow ) ! close the restart file (only at last time step) 199 ELSE 200 CALL iom_context_finalize( wxios_context ) 201 CALL iom_swap( cxios_context ) 202 ENDIF 173 203 !!gm IF( .NOT. lk_trdmld ) lrst_oce = .FALSE. 174 204 !!gm not sure what to do here ===>>> ask to Sebastian … … 178 208 nitrst = nstocklist( nrst_lst ) 179 209 ENDIF 180 lrst_oce = .FALSE.181 210 ENDIF 182 211 ! … … 318 347 ! 319 348 END SUBROUTINE rst_read 320 321 349 !!===================================================================== 322 350 END MODULE restart
Note: See TracChangeset
for help on using the changeset viewer.