Changeset 8770 for branches/2017/dev_r8600_xios_read_write
- Timestamp:
- 2017-11-21T17:21:22+01:00 (7 years ago)
- Location:
- branches/2017/dev_r8600_xios_read_write/NEMOGCM
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2017/dev_r8600_xios_read_write/NEMOGCM/CONFIG/SHARED/namelist_ref
r8613 r8770 54 54 nn_chunksz = 0 ! chunksize (bytes) for NetCDF file (works only with iom_nf90 routines) 55 55 ln_xios_read = .FALSE. ! use XIOS to read restart file (only for a single file restart) 56 nn_wxios = 0 ! use XIOS to write restart file 0 - no, 1 - single file output, 2 - multiple file output 56 57 / 57 58 ! -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90
r8668 r8770 32 32 USE timing ! preformance summary 33 33 USE wrk_nemo ! work arrays 34 USE iom_def, ONLY : lwxios 34 35 USE iom_def, ONLY : lxios_read 35 36 … … 309 310 IF(lwp) WRITE(numout,*) ' dia_hsb_rst at it= ', kt,' date= ', ndastp 310 311 IF(lwp) WRITE(numout,*) '~~~~~~~' 311 312 CALL iom_rstput( kt, nitrst, numrow, 'frc_v' , frc_v 313 CALL iom_rstput( kt, nitrst, numrow, 'frc_t' , frc_t 314 CALL iom_rstput( kt, nitrst, numrow, 'frc_s' , frc_s 312 IF( lwxios ) CALL iom_swap( cwxios_context ) 313 CALL iom_rstput( kt, nitrst, numrow, 'frc_v' , frc_v, ldxios = lwxios) 314 CALL iom_rstput( kt, nitrst, numrow, 'frc_t' , frc_t, ldxios = lwxios) 315 CALL iom_rstput( kt, nitrst, numrow, 'frc_s' , frc_s, ldxios = lwxios) 315 316 IF( ln_linssh ) THEN 316 CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t 317 CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s )317 CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_t', frc_wn_t, ldxios = lwxios) 318 CALL iom_rstput( kt, nitrst, numrow, 'frc_wn_s', frc_wn_s, ldxios = lwxios ) 318 319 ENDIF 319 CALL iom_rstput( kt, nitrst, numrow, 'surf_ini', surf_ini ) ! ice sheet coupling320 CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini', ssh_ini(:,:) )321 CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini', e3t_ini(:,:,:) )322 CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini(:,:,:) )323 CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini(:,:,:) )320 CALL iom_rstput( kt, nitrst, numrow, 'surf_ini', surf_ini, ldxios = lwxios ) ! ice sheet coupling 321 CALL iom_rstput( kt, nitrst, numrow, 'ssh_ini', ssh_ini(:,:), ldxios = lwxios ) 322 CALL iom_rstput( kt, nitrst, numrow, 'e3t_ini', e3t_ini(:,:,:), ldxios = lwxios ) 323 CALL iom_rstput( kt, nitrst, numrow, 'hc_loc_ini', hc_loc_ini(:,:,:), ldxios = lwxios ) 324 CALL iom_rstput( kt, nitrst, numrow, 'sc_loc_ini', sc_loc_ini(:,:,:), ldxios = lwxios ) 324 325 IF( ln_linssh ) THEN 325 CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini(:,:) )326 CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini(:,:) )326 CALL iom_rstput( kt, nitrst, numrow, 'ssh_hc_loc_ini', ssh_hc_loc_ini(:,:), ldxios = lwxios ) 327 CALL iom_rstput( kt, nitrst, numrow, 'ssh_sc_loc_ini', ssh_sc_loc_ini(:,:), ldxios = lwxios ) 327 328 ENDIF 328 329 ! 330 IF( lwxios ) CALL iom_swap( cxios_context ) 329 331 ENDIF 330 332 ! … … 368 370 IF( .NOT. ln_diahsb ) RETURN 369 371 372 IF(lwxios) THEN 373 ! define variables in restart file when writing with XIOS 374 CALL iom_set_rstw_var_active('frc_v') 375 CALL iom_set_rstw_var_active('frc_t') 376 CALL iom_set_rstw_var_active('frc_s') 377 IF( ln_linssh ) THEN 378 CALL iom_set_rstw_var_active('frc_wn_t') 379 CALL iom_set_rstw_var_active('frc_wn_s') 380 ENDIF 381 CALL iom_set_rstw_var_active('surf_ini') 382 CALL iom_set_rstw_var_active('ssh_ini') 383 CALL iom_set_rstw_var_active('e3t_ini') 384 CALL iom_set_rstw_var_active('hc_loc_ini') 385 CALL iom_set_rstw_var_active('sc_loc_ini') 386 IF( ln_linssh ) THEN 387 CALL iom_set_rstw_var_active('ssh_hc_loc_ini') 388 CALL iom_set_rstw_var_active('ssh_sc_loc_ini') 389 ENDIF 390 ENDIF 370 391 ! ------------------- ! 371 392 ! 1 - Allocate memory ! -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90
r8668 r8770 33 33 USE timing ! Timing 34 34 USE restart ! restart 35 USE iom_def, ONLY : lwxios 35 36 USE iom_def, ONLY : lxios_read 36 37 … … 144 145 CALL day( nit000 ) 145 146 ! 147 IF( lwxios ) THEN 148 ! define variables in restart file when writing with XIOS 149 CALL iom_set_rstw_var_active('kt') 150 CALL iom_set_rstw_var_active('ndastp') 151 CALL iom_set_rstw_var_active('adatrj') 152 CALL iom_set_rstw_var_active('ntime') 153 ENDIF 154 146 155 END SUBROUTINE day_init 147 156 … … 400 409 ENDIF 401 410 ! calendar control 402 CALL iom_rstput( kt, nitrst, numrow, 'kt' , REAL( kt , wp) ) ! time-step 403 CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp) ) ! date 404 CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj ) ! number of elapsed days since 411 IF( lwxios ) CALL iom_swap( cwxios_context ) 412 CALL iom_rstput( kt, nitrst, numrow, 'kt' , REAL( kt , wp), ldxios = lwxios ) ! time-step 413 CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp), ldxios = lwxios ) ! date 414 CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj, ldxios = lwxios ) ! number of elapsed days since 405 415 ! ! the begining of the run [s] 406 CALL iom_rstput( kt, nitrst, numrow, 'ntime' , REAL( nn_time0, wp) ) ! time 416 CALL iom_rstput( kt, nitrst, numrow, 'ntime' , REAL( nn_time0, wp), ldxios = lwxios ) ! time 417 IF( lwxios ) CALL iom_swap( cxios_context ) 407 418 ENDIF 408 419 ! -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
r8614 r8770 47 47 USE wrk_nemo ! Memory Allocation 48 48 USE timing ! Timing 49 USE iom_def, ONLY:lwxios, nxioso, rst_wfields ! write restart flag and output type 50 USE iom, ONLY : iom_set_rst_vars, iom_set_rstw_core 49 51 USE iom_def, ONLY : lxios_read 50 52 … … 129 131 CALL dom_glo ! global domain versus local domain 130 132 CALL dom_nam ! read namelist ( namrun, namdom ) 133 ! 134 IF( lwxios ) THEN 135 !define names for restart write and set core output (restart.F90) 136 CALL iom_set_rst_vars(rst_wfields) 137 CALL iom_set_rstw_core() 138 ENDIF 139 ! 131 140 CALL dom_clo( cn_cfg, nn_cfg ) ! Closed seas and lake 132 141 CALL dom_hgr ! Horizontal mesh … … 286 295 & nn_it000, nn_itend , nn_date0 , nn_time0 , nn_leapy , nn_istate , & 287 296 & nn_stock, nn_write , ln_mskland , ln_clobber , nn_chunksz, nn_euler , & 288 & ln_cfmeta, ln_iscpl, ln_xios_read 297 & ln_cfmeta, ln_iscpl, ln_xios_read, nn_wxios 289 298 NAMELIST/namdom/ ln_linssh, nn_closea, nn_msh, rn_isfhmin, rn_rdt, rn_atfp, ln_crs 290 299 #if defined key_netcdf4 … … 295 304 ! 296 305 ln_xios_read = .false. ! set in case ln_xios_read is not in namelist 306 nn_wxios = 0 297 307 REWIND( numnam_ref ) ! Namelist namrun in reference namelist : Parameters of the run 298 308 READ ( numnam_ref, namrun, IOSTAT = ios, ERR = 901) … … 336 346 WRITE(numout,*) ' IS coupling at the restart step ln_iscpl = ', ln_iscpl 337 347 WRITE(numout,*) ' READ restart for a single file using XIOS ln_xios_read =', ln_xios_read 338 IF( TRIM(Agrif_CFixed()) /= '0') THEN 339 WRITE(numout,*) ' READ restart for a single file using XIOS WILL not use AGRIF setting.' 340 ENDIF 348 IF( TRIM(Agrif_CFixed()) /= '0') & 349 & WRITE(numout,*) ' READ restart for a single file using XIOS WILL not use AGRIF setting.' 350 IF( TRIM(Agrif_CFixed()) == '0' ) & 351 & WRITE(numout,*) ' Write restart using XIOS nn_wxios = ', nn_wxios 341 352 ENDIF 342 353 … … 422 433 rdt = rn_rdt 423 434 435 IF( TRIM(Agrif_CFixed()) == '0' ) THEN 436 !set output file type for XIOS based on NEMO namelist 437 if (nn_wxios > 0) lwxios = .TRUE. 438 nxioso = nn_wxios 439 ELSE 440 IF(lwp) THEN 441 write(numout,*) 442 write(numout,*) "AGRIF: nn_wxios will be ingored. See setting for NEMO" 443 write(numout,*) 444 ENDIF 445 ENDIF 446 424 447 #if defined key_netcdf4 425 448 ! ! NetCDF 4 case ("key_netcdf4" defined) -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/DOM/domvvl.F90
r8668 r8770 33 33 USE wrk_nemo ! Memory allocation 34 34 USE timing ! Timing 35 USE iom_def, ONLY : lxios_read 35 USE iom_def, ONLY : lxios_read, lwxios 36 36 37 37 IMPLICIT NONE … … 243 243 ENDIF 244 244 ! 245 IF(lwxios) THEN 246 ! define variables in restart file when writing with XIOS 247 CALL iom_set_rstw_var_active('e3t_b') 248 CALL iom_set_rstw_var_active('e3t_n') 249 ! ! ----------------------- ! 250 IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN ! z_tilde and layer cases ! 251 ! ! ----------------------- ! 252 CALL iom_set_rstw_var_active('tilde_e3t_b') 253 CALL iom_set_rstw_var_active('tilde_e3t_n') 254 END IF 255 ! ! -------------! 256 IF( ln_vvl_ztilde ) THEN ! z_tilde case ! 257 ! ! ------------ ! 258 CALL iom_set_rstw_var_active('hdiv_lf') 259 ENDIF 260 ! 261 ENDIF 262 245 263 IF( nn_timing == 1 ) CALL timing_stop('dom_vvl_init') 246 264 ! … … 929 947 ! ! =================== 930 948 IF(lwp) WRITE(numout,*) '---- dom_vvl_rst ----' 949 IF( lwxios ) CALL iom_swap( cwxios_context ) 931 950 ! ! --------- ! 932 951 ! ! all cases ! 933 952 ! ! --------- ! 934 CALL iom_rstput( kt, nitrst, numrow, 'e3t_b', e3t_b(:,:,:) )935 CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t_n(:,:,:) )953 CALL iom_rstput( kt, nitrst, numrow, 'e3t_b', e3t_b(:,:,:), ldxios = lwxios ) 954 CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t_n(:,:,:), ldxios = lwxios ) 936 955 ! ! ----------------------- ! 937 956 IF( ln_vvl_ztilde .OR. ln_vvl_layer ) THEN ! z_tilde and layer cases ! 938 957 ! ! ----------------------- ! 939 CALL iom_rstput( kt, nitrst, numrow, 'tilde_e3t_b', tilde_e3t_b(:,:,:) 940 CALL iom_rstput( kt, nitrst, numrow, 'tilde_e3t_n', tilde_e3t_n(:,:,:) 958 CALL iom_rstput( kt, nitrst, numrow, 'tilde_e3t_b', tilde_e3t_b(:,:,:), ldxios = lwxios) 959 CALL iom_rstput( kt, nitrst, numrow, 'tilde_e3t_n', tilde_e3t_n(:,:,:), ldxios = lwxios) 941 960 END IF 942 961 ! ! -------------! 943 962 IF( ln_vvl_ztilde ) THEN ! z_tilde case ! 944 963 ! ! ------------ ! 945 CALL iom_rstput( kt, nitrst, numrow, 'hdiv_lf', hdiv_lf(:,:,:) ) 946 ENDIF 947 ! 964 CALL iom_rstput( kt, nitrst, numrow, 'hdiv_lf', hdiv_lf(:,:,:), ldxios = lwxios) 965 ENDIF 966 ! 967 IF( lwxios ) CALL iom_swap( cxios_context ) 948 968 ENDIF 949 969 ! -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90
r8668 r8770 56 56 USE asminc ! Assimilation increment 57 57 #endif 58 USE iom_def, ONLY : lxios_read 58 USE iom_def, ONLY : lxios_read, lwxios 59 59 60 60 … … 1218 1218 ! 1219 1219 ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN 1220 CALL iom_rstput( kt, nitrst, numrow, 'ub2_b' , ub2_b (:,:) ) 1221 CALL iom_rstput( kt, nitrst, numrow, 'vb2_b' , vb2_b (:,:) ) 1220 IF( lwxios ) CALL iom_swap( cwxios_context ) 1221 CALL iom_rstput( kt, nitrst, numrow, 'ub2_b' , ub2_b (:,:), ldxios = lwxios ) 1222 CALL iom_rstput( kt, nitrst, numrow, 'vb2_b' , vb2_b (:,:), ldxios = lwxios ) 1222 1223 ! 1223 1224 IF (.NOT.ln_bt_av) THEN 1224 CALL iom_rstput( kt, nitrst, numrow, 'sshbb_e' , sshbb_e(:,:) )1225 CALL iom_rstput( kt, nitrst, numrow, 'ubb_e' , ubb_e(:,:) )1226 CALL iom_rstput( kt, nitrst, numrow, 'vbb_e' , vbb_e(:,:) )1227 CALL iom_rstput( kt, nitrst, numrow, 'sshb_e' , sshb_e(:,:) )1228 CALL iom_rstput( kt, nitrst, numrow, 'ub_e' , ub_e(:,:) )1229 CALL iom_rstput( kt, nitrst, numrow, 'vb_e' , vb_e(:,:) )1225 CALL iom_rstput( kt, nitrst, numrow, 'sshbb_e' , sshbb_e(:,:), ldxios = lwxios ) 1226 CALL iom_rstput( kt, nitrst, numrow, 'ubb_e' , ubb_e(:,:), ldxios = lwxios ) 1227 CALL iom_rstput( kt, nitrst, numrow, 'vbb_e' , vbb_e(:,:), ldxios = lwxios ) 1228 CALL iom_rstput( kt, nitrst, numrow, 'sshb_e' , sshb_e(:,:), ldxios = lwxios ) 1229 CALL iom_rstput( kt, nitrst, numrow, 'ub_e' , ub_e(:,:), ldxios = lwxios ) 1230 CALL iom_rstput( kt, nitrst, numrow, 'vb_e' , vb_e(:,:), ldxios = lwxios ) 1230 1231 ENDIF 1231 1232 #if defined key_agrif 1232 1233 ! Save time integrated fluxes 1233 1234 IF ( .NOT.Agrif_Root() ) THEN 1234 CALL iom_rstput( kt, nitrst, numrow, 'ub2_i_b' , ub2_i_b(:,:) )1235 CALL iom_rstput( kt, nitrst, numrow, 'vb2_i_b' , vb2_i_b(:,:) )1235 CALL iom_rstput( kt, nitrst, numrow, 'ub2_i_b' , ub2_i_b(:,:), ldxios = lwxios ) 1236 CALL iom_rstput( kt, nitrst, numrow, 'vb2_i_b' , vb2_i_b(:,:), ldxios = lwxios ) 1236 1237 ENDIF 1237 1238 #endif 1239 IF( lwxios ) CALL iom_swap( cxios_context ) 1238 1240 ENDIF 1239 1241 ! … … 1323 1325 CALL wrk_dealloc( jpi,jpj, zcu ) 1324 1326 ! 1327 IF( lwxios ) THEN 1328 ! define variables in restart file when writing with XIOS 1329 CALL iom_set_rstw_var_active('ub2_b') 1330 CALL iom_set_rstw_var_active('vb2_b') 1331 ! 1332 IF (.NOT.ln_bt_av) THEN 1333 CALL iom_set_rstw_var_active('sshbb_e') 1334 CALL iom_set_rstw_var_active('ubb_e') 1335 CALL iom_set_rstw_var_active('vbb_e') 1336 CALL iom_set_rstw_var_active('sshb_e') 1337 CALL iom_set_rstw_var_active('ub_e') 1338 CALL iom_set_rstw_var_active('vb_e') 1339 ENDIF 1340 #if defined key_agrif 1341 ! Save time integrated fluxes 1342 IF ( .NOT.Agrif_Root() ) THEN 1343 CALL iom_set_rstw_var_active('ub2_i_b') 1344 CALL iom_set_rstw_var_active('vb2_i_b') 1345 ENDIF 1346 #endif 1347 ENDIF 1348 1325 1349 END SUBROUTINE dyn_spg_ts_init 1326 1350 -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90
r8668 r8770 45 45 INTEGER :: nn_chunksz !: chunksize (bytes) for NetCDF file (works only with iom_nf90 routines) 46 46 LOGICAL :: ln_xios_read !: use xios to read single file restart 47 INTEGER :: nn_wxios !: write resart using xios 0 - no, 1 - single, 2 - multiple file output 47 48 48 49 #if defined key_netcdf4 … … 152 153 CHARACTER(lc) :: cxios_context !: context name used in xios 153 154 CHARACTER(lc) :: crxios_context !: context name used in xios to read restart 155 CHARACTER(lc) :: cwxios_context !: context name used in xios to write restart file 154 156 155 157 !!---------------------------------------------------------------------- -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
r8668 r8770 41 41 USE dianam ! build name of file 42 42 USE xios 43 USE iom_def, ONLY : max_rst_fields, rst_fields 43 USE iom_def, ONLY : max_rst_fields, rst_fields, rst_wfields, RST_FIELD 44 44 # endif 45 45 USE ioipsl, ONLY : ju2ymds ! for calendar 46 46 USE crs ! Grid coarsening 47 47 USE lib_fortran 48 USE diurnal_bulk, ONLY : ln_diurnal_only, ln_diurnal 48 49 49 50 IMPLICIT NONE … … 65 66 PRIVATE iom_set_domain_attr, iom_set_axis_attr, iom_set_field_attr, iom_set_file_attr, iom_get_file_attr, iom_set_grid_attr 66 67 PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_update_file_name, iom_sdate 67 PRIVATE set_rst_vars, set_rstr_active, set_rst_context 68 PRIVATE iom_set_rst_context, iom_set_rstw_active 69 PUBLIC iom_set_rstw_var_active, iom_set_rst_vars 68 70 # endif 69 71 … … 92 94 CONTAINS 93 95 94 SUBROUTINE iom_init( cdname )96 SUBROUTINE iom_init( cdname, fname ) 95 97 !!---------------------------------------------------------------------- 96 98 !! *** ROUTINE *** … … 100 102 !!---------------------------------------------------------------------- 101 103 CHARACTER(len=*), INTENT(in) :: cdname 104 CHARACTER(len=*), OPTIONAL, INTENT(in) :: fname 102 105 #if defined key_iomput 103 106 104 107 TYPE(xios_duration) :: dtime = xios_duration(0, 0, 0, 0, 0, 0) 105 108 TYPE(xios_date) :: start_date 106 CHARACTER(len= 10) :: clname109 CHARACTER(len=lc) :: clname 107 110 INTEGER :: ji, jkmin 108 111 LOGICAL :: llrst_context ! is context related to restart … … 117 120 CALL xios_context_initialize(TRIM(clname), mpi_comm_opa) 118 121 CALL iom_swap( cdname ) 119 llrst_context = (TRIM(cdname) == TRIM(crxios_context) )122 llrst_context = (TRIM(cdname) == TRIM(crxios_context) .OR. TRIM(cdname) == TRIM(cwxios_context)) 120 123 121 124 ! Calendar type is now defined in xml file … … 162 165 CALL dom_grid_glo ! Return to parent grid domain 163 166 ! 164 IF( ln_cfmeta .AND. TRIM(cdname) .NE. TRIM(crxios_context)) THEN ! Add additional grid metadata167 IF( ln_cfmeta .AND. .NOT. llrst_context) THEN ! Add additional grid metadata 165 168 CALL iom_set_domain_attr("grid_T", area = e1e2t_crs(nldi:nlei, nldj:nlej)) 166 169 CALL iom_set_domain_attr("grid_U", area = e1u_crs(nldi:nlei, nldj:nlej) * e2u_crs(nldi:nlei, nldj:nlej)) … … 206 209 ENDIF 207 210 ! automatic definitions of some of the xml attributs 208 IF( llrst_context) THEN209 !set names of the fields in restart file IF using XIOS to read /writedata211 IF( TRIM(cdname) == TRIM(crxios_context) ) THEN 212 !set names of the fields in restart file IF using XIOS to read data 210 213 CALL set_rst_context() 211 CALL set_rst_vars()214 CALL iom_set_rst_vars(rst_fields) 212 215 !set which fields are to be read from restart file 213 216 CALL set_rstr_active() 217 ELSE IF( TRIM(cdname) == TRIM(cwxios_context) ) THEN 218 !set names of the fields in restart file IF using XIOS to write data 219 CALL set_rst_context() 220 CALL iom_set_rst_vars(rst_wfields) 221 !set which fields are to be read from restart file 222 CALL iom_set_rstw_active(fname) 214 223 ELSE 215 224 CALL set_xmlatt … … 229 238 END SUBROUTINE iom_init 230 239 231 232 SUBROUTINE set_rst_vars() 233 !set names for variables in restart file 240 SUBROUTINE iom_set_rstw_var_active(field) 241 CHARACTER(len = *), INTENT(IN) :: field 234 242 INTEGER :: i 235 rst_fields(:)%vname="NO_NAME"; rst_fields(:)%grid="NO_GRID" 236 i = 0 237 i = i + 1; rst_fields(i)%vname="rdt"; rst_fields(i)% grid="grid_scalar" 238 i = i + 1; rst_fields(i)%vname="un"; rst_fields(i)% grid="grid_N_3D" 239 i = i + 1; rst_fields(i)%vname="ub"; rst_fields(i)% grid="grid_N_3D" 240 i = i + 1; rst_fields(i)%vname="vn"; rst_fields(i)% grid="grid_N_3D" 241 i = i + 1; rst_fields(i)%vname="vb"; rst_fields(i)% grid="grid_N_3D" 242 i = i + 1; rst_fields(i)%vname="tn"; rst_fields(i)% grid="grid_N_3D" 243 i = i + 1; rst_fields(i)%vname="tb"; rst_fields(i)% grid="grid_N_3D" 244 i = i + 1; rst_fields(i)%vname="sn"; rst_fields(i)% grid="grid_N_3D" 245 i = i + 1; rst_fields(i)%vname="sb"; rst_fields(i)%grid="grid_N_3D" 246 i = i + 1; rst_fields(i)%vname="sshn"; rst_fields(i)%grid="grid_N" 247 i = i + 1; rst_fields(i)%vname="sshb"; rst_fields(i)%grid="grid_N" 248 i = i + 1; rst_fields(i)%vname="rhop"; rst_fields(i)%grid="grid_N_3D" 249 i = i + 1; rst_fields(i)%vname="kt"; rst_fields(i)%grid="grid_scalar" 250 i = i + 1; rst_fields(i)%vname="ndastp"; rst_fields(i)%grid="grid_scalar" 251 i = i + 1; rst_fields(i)%vname="adatrj"; rst_fields(i)%grid="grid_scalar" 252 i = i + 1; rst_fields(i)%vname="utau_b"; rst_fields(i)%grid="grid_N" 253 i = i + 1; rst_fields(i)%vname="vtau_b"; rst_fields(i)%grid="grid_N" 254 i = i + 1; rst_fields(i)%vname="qns_b"; rst_fields(i)%grid="grid_N" 255 i = i + 1; rst_fields(i)%vname="emp_b"; rst_fields(i)%grid="grid_N" 256 i = i + 1; rst_fields(i)%vname="sfx_b"; rst_fields(i)%grid="grid_N" 257 i = i + 1; rst_fields(i)%vname="en" ; rst_fields(i)%grid="grid_N_3D" 258 i = i + 1; rst_fields(i)%vname="avt"; rst_fields(i)%grid="grid_N_3D" 259 i = i + 1; rst_fields(i)%vname="avm"; rst_fields(i)%grid="grid_N_3D" 260 i = i + 1; rst_fields(i)%vname="avmu"; rst_fields(i)%grid="grid_N_3D" 261 i = i + 1; rst_fields(i)%vname="avmv"; rst_fields(i)%grid="grid_N_3D" 262 i = i + 1; rst_fields(i)%vname="dissl"; rst_fields(i)%grid="grid_N_3D" 263 i = i + 1; rst_fields(i)%vname="sbc_hc_b"; rst_fields(i)%grid="grid_N" 264 i = i + 1; rst_fields(i)%vname="sbc_sc_b"; rst_fields(i)%grid="grid_N" 265 i = i + 1; rst_fields(i)%vname="qsr_hc_b"; rst_fields(i)%grid="grid_N_3D" 266 i = i + 1; rst_fields(i)%vname="fraqsr_1lev"; rst_fields(i)%grid="grid_N" 267 i = i + 1; rst_fields(i)%vname="greenland_icesheet_mass" 268 rst_fields(i)%grid="grid_scalar" 269 i = i + 1; rst_fields(i)%vname="greenland_icesheet_timelapsed" 270 rst_fields(i)%grid="grid_scalar" 271 i = i + 1; rst_fields(i)%vname="greenland_icesheet_mass_roc" 272 rst_fields(i)%grid="grid_scalar" 273 i = i + 1; rst_fields(i)%vname="antarctica_icesheet_mass" 274 rst_fields(i)%grid="grid_scalar" 275 i = i + 1; rst_fields(i)%vname="antarctica_icesheet_timelapsed" 276 rst_fields(i)%grid="grid_scalar" 277 i = i + 1; rst_fields(i)%vname="antarctica_icesheet_mass_roc" 278 rst_fields(i)%grid="grid_scalar" 279 i = i + 1; rst_fields(i)%vname="frc_v"; rst_fields(i)%grid="grid_scalar" 280 i = i + 1; rst_fields(i)%vname="frc_t"; rst_fields(i)%grid="grid_scalar" 281 i = i + 1; rst_fields(i)%vname="frc_s"; rst_fields(i)%grid="grid_scalar" 282 i = i + 1; rst_fields(i)%vname="frc_wn_t"; rst_fields(i)%grid="grid_scalar" 283 i = i + 1; rst_fields(i)%vname="frc_wn_s"; rst_fields(i)%grid="grid_scalar" 284 i = i + 1; rst_fields(i)%vname="ssh_ini"; rst_fields(i)%grid="grid_N" 285 i = i + 1; rst_fields(i)%vname="e3t_ini"; rst_fields(i)%grid="grid_N_3D" 286 i = i + 1; rst_fields(i)%vname="hc_loc_ini"; rst_fields(i)%grid="grid_N_3D" 287 i = i + 1; rst_fields(i)%vname="sc_loc_ini"; rst_fields(i)%grid="grid_N_3D" 288 i = i + 1; rst_fields(i)%vname="ssh_hc_loc_ini"; rst_fields(i)%grid="grid_N" 289 i = i + 1; rst_fields(i)%vname="ssh_sc_loc_ini"; rst_fields(i)%grid="grid_N" 290 i = i + 1; rst_fields(i)%vname="tilde_e3t_b"; rst_fields(i)%grid="grid_N" 291 i = i + 1; rst_fields(i)%vname="tilde_e3t_n"; rst_fields(i)%grid="grid_N" 292 i = i + 1; rst_fields(i)%vname="hdiv_lf"; rst_fields(i)%grid="grid_N" 293 i = i + 1; rst_fields(i)%vname="ub2_b"; rst_fields(i)%grid="grid_N" 294 i = i + 1; rst_fields(i)%vname="vb2_b"; rst_fields(i)%grid="grid_N" 295 i = i + 1; rst_fields(i)%vname="sshbb_e"; rst_fields(i)%grid="grid_N" 296 i = i + 1; rst_fields(i)%vname="ubb_e"; rst_fields(i)%grid="grid_N" 297 i = i + 1; rst_fields(i)%vname="vbb_e"; rst_fields(i)%grid="grid_N" 298 i = i + 1; rst_fields(i)%vname="sshb_e"; rst_fields(i)%grid="grid_N" 299 i = i + 1; rst_fields(i)%vname="ub_e"; rst_fields(i)%grid="grid_N" 300 i = i + 1; rst_fields(i)%vname="vb_e"; rst_fields(i)%grid="grid_N" 301 i = i + 1; rst_fields(i)%vname="fwf_isf_b"; rst_fields(i)%grid="grid_N" 302 i = i + 1; rst_fields(i)%vname="isf_sc_b"; rst_fields(i)%grid="grid_N" 303 i = i + 1; rst_fields(i)%vname="isf_hc_b"; rst_fields(i)%grid="grid_N" 304 i = i + 1; rst_fields(i)%vname="ssh_ibb"; rst_fields(i)%grid="grid_N" 305 i = i + 1; rst_fields(i)%vname="rnf_b"; rst_fields(i)%grid="grid_N" 306 i = i + 1; rst_fields(i)%vname="rnf_hc_b"; rst_fields(i)%grid="grid_N" 307 i = i + 1; rst_fields(i)%vname="rnf_sc_b"; rst_fields(i)%grid="grid_N" 308 i = i + 1; rst_fields(i)%vname="nn_fsbc"; rst_fields(i)%grid="grid_scalar" 309 i = i + 1; rst_fields(i)%vname="ssu_m"; rst_fields(i)%grid="grid_N" 310 i = i + 1; rst_fields(i)%vname="ssv_m"; rst_fields(i)%grid="grid_N" 311 i = i + 1; rst_fields(i)%vname="sst_m"; rst_fields(i)%grid="grid_N" 312 i = i + 1; rst_fields(i)%vname="sss_m"; rst_fields(i)%grid="grid_N" 313 i = i + 1; rst_fields(i)%vname="ssh_m"; rst_fields(i)%grid="grid_N" 314 i = i + 1; rst_fields(i)%vname="e3t_m"; rst_fields(i)%grid="grid_N" 315 i = i + 1; rst_fields(i)%vname="frq_m"; rst_fields(i)%grid="grid_N" 316 i = i + 1; rst_fields(i)%vname="avmb"; rst_fields(i)%grid="grid_vector" 317 i = i + 1; rst_fields(i)%vname="avtb"; rst_fields(i)%grid="grid_vector" 318 i = i + 1; rst_fields(i)%vname="ub2_i_b"; rst_fields(i)%grid="grid_N" 319 i = i + 1; rst_fields(i)%vname="vb2_i_b"; rst_fields(i)%grid="grid_N" 320 i = i + 1; rst_fields(i)%vname="ntime"; rst_fields(i)%grid="grid_scalar" 321 i = i + 1; rst_fields(i)%vname="Dsst"; rst_fields(i)%grid="grid_scalar" 322 i = i + 1; rst_fields(i)%vname="tmask"; rst_fields(i)%grid="grid_N_3D" 323 i = i + 1; rst_fields(i)%vname="umask"; rst_fields(i)%grid="grid_N_3D" 324 i = i + 1; rst_fields(i)%vname="vmask"; rst_fields(i)%grid="grid_N_3D" 325 i = i + 1; rst_fields(i)%vname="smask"; rst_fields(i)%grid="grid_N_3D" 326 i = i + 1; rst_fields(i)%vname="gdepw_n"; rst_fields(i)%grid="grid_N_3D" 327 i = i + 1; rst_fields(i)%vname="e3t_n"; rst_fields(i)%grid="grid_N_3D" 328 i = i + 1; rst_fields(i)%vname="e3u_n"; rst_fields(i)%grid="grid_N_3D" 329 i = i + 1; rst_fields(i)%vname="e3v_n"; rst_fields(i)%grid="grid_N_3D" 330 i = i + 1; rst_fields(i)%vname="surf_ini"; rst_fields(i)%grid="grid_N" 331 i = i + 1; rst_fields(i)%vname="e3t_b"; rst_fields(i)%grid="grid_N_3D" 332 i = i + 1; rst_fields(i)%vname="e3t_n"; rst_fields(i)%grid="grid_N_3D" 333 i = i + 1; rst_fields(i)%vname="mxln"; rst_fields(i)%grid="grid_N_3D" 334 i = i + 1; rst_fields(i)%vname="e3t_m"; rst_fields(i)%grid="grid_N_3D" 335 END SUBROUTINE set_rst_vars 336 243 LOGICAL :: llis_set 244 245 llis_set = .FALSE. 246 247 DO i = 1, max_rst_fields 248 IF(TRIM(rst_wfields(i)%vname) == field) THEN 249 rst_wfields(i)%active = .TRUE. 250 llis_set = .TRUE. 251 EXIT 252 ENDIF 253 ENDDO 254 !Warn if variable is not in defined in rst_wfields 255 IF(.NOT.llis_set) THEN 256 IF(lwp) THEN 257 write(numout,cform_err) 258 write(numout,*) 'iom_set_rstw_var_active: variable ', field ,' is available for writing but not defined' 259 ENDIF 260 nstop = nstop + 1 261 ENDIF 262 263 END SUBROUTINE iom_set_rstw_var_active 337 264 338 265 SUBROUTINE set_rstr_active() … … 408 335 #endif 409 336 END SUBROUTINE set_rst_context 337 338 SUBROUTINE iom_set_rstw_core() 339 !from restart.F90 340 CALL iom_set_rstw_var_active("rdt") 341 IF ( .NOT. ln_diurnal_only ) THEN 342 CALL iom_set_rstw_var_active('ub' ) 343 CALL iom_set_rstw_var_active('vb' ) 344 CALL iom_set_rstw_var_active('tb' ) 345 CALL iom_set_rstw_var_active('sb' ) 346 CALL iom_set_rstw_var_active('sshb') 347 ! 348 CALL iom_set_rstw_var_active('un' ) 349 CALL iom_set_rstw_var_active('vn' ) 350 CALL iom_set_rstw_var_active('tn' ) 351 CALL iom_set_rstw_var_active('sn' ) 352 CALL iom_set_rstw_var_active('sshn') 353 CALL iom_set_rstw_var_active('rhop') 354 ! extra variable needed for the ice sheet coupling 355 IF ( ln_iscpl ) THEN 356 CALL iom_set_rstw_var_active('tmask') 357 CALL iom_set_rstw_var_active('umask') 358 CALL iom_set_rstw_var_active('vmask') 359 CALL iom_set_rstw_var_active('smask') 360 CALL iom_set_rstw_var_active('e3t_n') 361 CALL iom_set_rstw_var_active('e3u_n') 362 CALL iom_set_rstw_var_active('e3v_n') 363 CALL iom_set_rstw_var_active('gdepw_n') 364 END IF 365 ENDIF 366 IF(ln_diurnal) CALL iom_set_rstw_var_active('Dsst') 367 !from trasbc.F90 368 CALL iom_set_rstw_var_active('sbc_hc_b') 369 CALL iom_set_rstw_var_active('sbc_sc_b') 370 END SUBROUTINE iom_set_rstw_core 371 372 SUBROUTINE iom_set_rst_vars(fields) 373 !set names for variables in restart file 374 TYPE(RST_FIELD), INTENT(INOUT) :: fields(max_rst_fields) 375 INTEGER :: i 376 i = 0 377 i = i + 1; fields(i)%vname="rdt"; fields(i)%grid="grid_scalar" 378 i = i + 1; fields(i)%vname="un"; fields(i)%grid="grid_N_3D" 379 i = i + 1; fields(i)%vname="ub"; fields(i)%grid="grid_N_3D" 380 i = i + 1; fields(i)%vname="vn"; fields(i)%grid="grid_N_3D" 381 i = i + 1; fields(i)%vname="vb"; fields(i)%grid="grid_N_3D" 382 i = i + 1; fields(i)%vname="tn"; fields(i)%grid="grid_N_3D" 383 i = i + 1; fields(i)%vname="tb"; fields(i)%grid="grid_N_3D" 384 i = i + 1; fields(i)%vname="sn"; fields(i)%grid="grid_N_3D" 385 i = i + 1; fields(i)%vname="sb"; fields(i)%grid="grid_N_3D" 386 i = i + 1; fields(i)%vname="sshn"; fields(i)%grid="grid_N" 387 i = i + 1; fields(i)%vname="sshb"; fields(i)%grid="grid_N" 388 i = i + 1; fields(i)%vname="rhop"; fields(i)%grid="grid_N_3D" 389 i = i + 1; fields(i)%vname="kt"; fields(i)%grid="grid_scalar" 390 i = i + 1; fields(i)%vname="ndastp"; fields(i)%grid="grid_scalar" 391 i = i + 1; fields(i)%vname="adatrj"; fields(i)%grid="grid_scalar" 392 i = i + 1; fields(i)%vname="utau_b"; fields(i)%grid="grid_N" 393 i = i + 1; fields(i)%vname="vtau_b"; fields(i)%grid="grid_N" 394 i = i + 1; fields(i)%vname="qns_b"; fields(i)%grid="grid_N" 395 i = i + 1; fields(i)%vname="emp_b"; fields(i)%grid="grid_N" 396 i = i + 1; fields(i)%vname="sfx_b"; fields(i)%grid="grid_N" 397 i = i + 1; fields(i)%vname="en" ; fields(i)%grid="grid_N_3D" 398 i = i + 1; fields(i)%vname="avt"; fields(i)%grid="grid_N_3D" 399 i = i + 1; fields(i)%vname="avm"; fields(i)%grid="grid_N_3D" 400 i = i + 1; fields(i)%vname="avmu"; fields(i)%grid="grid_N_3D" 401 i = i + 1; fields(i)%vname="avmv"; fields(i)%grid="grid_N_3D" 402 i = i + 1; fields(i)%vname="dissl"; fields(i)%grid="grid_N_3D" 403 i = i + 1; fields(i)%vname="sbc_hc_b"; fields(i)%grid="grid_N" 404 i = i + 1; fields(i)%vname="sbc_sc_b"; fields(i)%grid="grid_N" 405 i = i + 1; fields(i)%vname="qsr_hc_b"; fields(i)%grid="grid_N_3D" 406 i = i + 1; fields(i)%vname="fraqsr_1lev"; fields(i)%grid="grid_N" 407 i = i + 1; fields(i)%vname="greenland_icesheet_mass" 408 fields(i)%grid="grid_scalar" 409 i = i + 1; fields(i)%vname="greenland_icesheet_timelapsed" 410 fields(i)%grid="grid_scalar" 411 i = i + 1; fields(i)%vname="greenland_icesheet_mass_roc" 412 fields(i)%grid="grid_scalar" 413 i = i + 1; fields(i)%vname="antarctica_icesheet_mass" 414 fields(i)%grid="grid_scalar" 415 i = i + 1; fields(i)%vname="antarctica_icesheet_timelapsed" 416 fields(i)%grid="grid_scalar" 417 i = i + 1; fields(i)%vname="antarctica_icesheet_mass_roc" 418 fields(i)%grid="grid_scalar" 419 i = i + 1; fields(i)%vname="frc_v"; fields(i)%grid="grid_scalar" 420 i = i + 1; fields(i)%vname="frc_t"; fields(i)%grid="grid_scalar" 421 i = i + 1; fields(i)%vname="frc_s"; fields(i)%grid="grid_scalar" 422 i = i + 1; fields(i)%vname="frc_wn_t"; fields(i)%grid="grid_scalar" 423 i = i + 1; fields(i)%vname="frc_wn_s"; fields(i)%grid="grid_scalar" 424 i = i + 1; fields(i)%vname="ssh_ini"; fields(i)%grid="grid_N" 425 i = i + 1; fields(i)%vname="e3t_ini"; fields(i)%grid="grid_N_3D" 426 i = i + 1; fields(i)%vname="hc_loc_ini"; fields(i)%grid="grid_N_3D" 427 i = i + 1; fields(i)%vname="sc_loc_ini"; fields(i)%grid="grid_N_3D" 428 i = i + 1; fields(i)%vname="ssh_hc_loc_ini"; fields(i)%grid="grid_N" 429 i = i + 1; fields(i)%vname="ssh_sc_loc_ini"; fields(i)%grid="grid_N" 430 i = i + 1; fields(i)%vname="tilde_e3t_b"; fields(i)%grid="grid_N" 431 i = i + 1; fields(i)%vname="tilde_e3t_n"; fields(i)%grid="grid_N" 432 i = i + 1; fields(i)%vname="hdiv_lf"; fields(i)%grid="grid_N" 433 i = i + 1; fields(i)%vname="ub2_b"; fields(i)%grid="grid_N" 434 i = i + 1; fields(i)%vname="vb2_b"; fields(i)%grid="grid_N" 435 i = i + 1; fields(i)%vname="sshbb_e"; fields(i)%grid="grid_N" 436 i = i + 1; fields(i)%vname="ubb_e"; fields(i)%grid="grid_N" 437 i = i + 1; fields(i)%vname="vbb_e"; fields(i)%grid="grid_N" 438 i = i + 1; fields(i)%vname="sshb_e"; fields(i)%grid="grid_N" 439 i = i + 1; fields(i)%vname="ub_e"; fields(i)%grid="grid_N" 440 i = i + 1; fields(i)%vname="vb_e"; fields(i)%grid="grid_N" 441 i = i + 1; fields(i)%vname="fwf_isf_b"; fields(i)%grid="grid_N" 442 i = i + 1; fields(i)%vname="isf_sc_b"; fields(i)%grid="grid_N" 443 i = i + 1; fields(i)%vname="isf_hc_b"; fields(i)%grid="grid_N" 444 i = i + 1; fields(i)%vname="ssh_ibb"; fields(i)%grid="grid_N" 445 i = i + 1; fields(i)%vname="rnf_b"; fields(i)%grid="grid_N" 446 i = i + 1; fields(i)%vname="rnf_hc_b"; fields(i)%grid="grid_N" 447 i = i + 1; fields(i)%vname="rnf_sc_b"; fields(i)%grid="grid_N" 448 i = i + 1; fields(i)%vname="nn_fsbc"; fields(i)%grid="grid_scalar" 449 i = i + 1; fields(i)%vname="ssu_m"; fields(i)%grid="grid_N" 450 i = i + 1; fields(i)%vname="ssv_m"; fields(i)%grid="grid_N" 451 i = i + 1; fields(i)%vname="sst_m"; fields(i)%grid="grid_N" 452 i = i + 1; fields(i)%vname="sss_m"; fields(i)%grid="grid_N" 453 i = i + 1; fields(i)%vname="ssh_m"; fields(i)%grid="grid_N" 454 i = i + 1; fields(i)%vname="e3t_m"; fields(i)%grid="grid_N" 455 i = i + 1; fields(i)%vname="frq_m"; fields(i)%grid="grid_N" 456 i = i + 1; fields(i)%vname="avmb"; fields(i)%grid="grid_vector" 457 i = i + 1; fields(i)%vname="avtb"; fields(i)%grid="grid_vector" 458 i = i + 1; fields(i)%vname="ub2_i_b"; fields(i)%grid="grid_N" 459 i = i + 1; fields(i)%vname="vb2_i_b"; fields(i)%grid="grid_N" 460 i = i + 1; fields(i)%vname="ntime"; fields(i)%grid="grid_scalar" 461 i = i + 1; fields(i)%vname="Dsst"; fields(i)%grid="grid_scalar" 462 i = i + 1; fields(i)%vname="tmask"; fields(i)%grid="grid_N_3D" 463 i = i + 1; fields(i)%vname="umask"; fields(i)%grid="grid_N_3D" 464 i = i + 1; fields(i)%vname="vmask"; fields(i)%grid="grid_N_3D" 465 i = i + 1; fields(i)%vname="smask"; fields(i)%grid="grid_N_3D" 466 i = i + 1; fields(i)%vname="gdepw_n"; fields(i)%grid="grid_N_3D" 467 i = i + 1; fields(i)%vname="e3t_n"; fields(i)%grid="grid_N_3D" 468 i = i + 1; fields(i)%vname="e3u_n"; fields(i)%grid="grid_N_3D" 469 i = i + 1; fields(i)%vname="e3v_n"; fields(i)%grid="grid_N_3D" 470 i = i + 1; fields(i)%vname="surf_ini"; fields(i)%grid="grid_N" 471 i = i + 1; fields(i)%vname="e3t_b"; fields(i)%grid="grid_N_3D" 472 i = i + 1; fields(i)%vname="mxln"; fields(i)%grid="grid_N_3D" 473 474 IF( i-1 > max_rst_fields) THEN 475 IF(lwp) write(numout,*) 'E R R O R : iom_set_rst_vars SIZE of RST_FIELD array is too small' 476 nstop = nstop + 1 477 ENDIF 478 479 END SUBROUTINE iom_set_rst_vars 480 481 482 SUBROUTINE iom_set_rstw_active(cdrst_file) 483 !sets enabled = .TRUE. for each field in restart file 484 CHARACTER(len=*) :: cdrst_file 485 #if defined key_iomput 486 TYPE(xios_field) :: field_hdl 487 TYPE(xios_file) :: file_hdl 488 TYPE(xios_filegroup) :: filegroup_hdl 489 INTEGER :: i 490 CHARACTER(lc) :: clpath 491 492 !set name of the restart file and enable available fields 493 IF(lwp) WRITE(numout,*) 'Setting restart filename (for XIOS write) to: ',cdrst_file 494 CALL xios_get_handle("file_definition", filegroup_hdl ) 495 CALL xios_add_child(filegroup_hdl, file_hdl, 'wrestart') 496 IF(nxioso.eq.1) THEN 497 CALL xios_set_file_attr( "wrestart", type="one_file", enabled=.TRUE.,& 498 mode="write", output_freq=xios_timestep) 499 if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in one_file mode' 500 ELSE 501 CALL xios_set_file_attr( "wrestart", type="multiple_file", enabled=.TRUE.,& 502 mode="write", output_freq=xios_timestep) 503 if(lwp) write(numout,*) 'OPEN ', trim(cdrst_file), ' in multiple_file mode' 504 ENDIF 505 CALL xios_set_file_attr( "wrestart", name=trim(cdrst_file)) 506 !defin files for restart context 507 DO i = 1, max_rst_fields 508 IF( rst_wfields(i)%active ) THEN 509 CALL xios_add_child(file_hdl, field_hdl, TRIM(rst_wfields(i)%vname)) 510 SELECT CASE (TRIM(rst_wfields(i)%grid)) 511 CASE ("grid_N_3D") 512 CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & 513 domain_ref="grid_N", axis_ref="deptht", prec = 8, operation = "instant") 514 CASE ("grid_N") 515 CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & 516 domain_ref="grid_N", prec = 8, operation = "instant") 517 CASE ("grid_vector") 518 CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & 519 axis_ref="deptht", prec = 8, operation = "instant") 520 CASE ("grid_scalar") 521 CALL xios_set_attr (field_hdl, enabled = .TRUE., name = TRIM(rst_wfields(i)%vname), & 522 scalar_ref = "grid_scalar", prec = 8, operation = "instant") 523 END SELECT 524 ENDIF 525 END DO 526 #endif 527 END SUBROUTINE iom_set_rstw_active 528 529 SUBROUTINE iom_set_rst_context( ) 530 #if defined key_iomput 531 TYPE(xios_domaingroup) :: domaingroup_hdl 532 TYPE(xios_domain) :: domain_hdl 533 TYPE(xios_axisgroup) :: axisgroup_hdl 534 TYPE(xios_axis) :: axis_hdl 535 TYPE(xios_scalar) :: scalar_hdl 536 TYPE(xios_scalargroup) :: scalargroup_hdl 537 538 CALL xios_get_handle("domain_definition",domaingroup_hdl) 539 CALL xios_add_child(domaingroup_hdl, domain_hdl, "grid_N") 540 CALL set_grid("N", glamt, gphit, .TRUE.) 541 542 CALL xios_get_handle("axis_definition",axisgroup_hdl) 543 CALL xios_add_child(axisgroup_hdl, axis_hdl, "deptht") 544 !AGRIF fails to compile when unit= is in call to xios_set_axis_attr 545 ! CALL xios_set_axis_attr( "deptht", long_name="Vertical levels", unit="m", positive="down") 546 CALL xios_set_axis_attr( "deptht", long_name="Vertical levels in meters", positive="down") 547 CALL iom_set_axis_attr( "deptht", paxis = gdept_1d ) 548 549 CALL xios_get_handle("scalar_definition", scalargroup_hdl) 550 CALL xios_add_child(scalargroup_hdl, scalar_hdl, "grid_scalar") 551 #endif 552 END SUBROUTINE iom_set_rst_context 410 553 411 554 SUBROUTINE iom_swap( cdname ) … … 1363 1506 !! INTERFACE iom_rstput 1364 1507 !!---------------------------------------------------------------------- 1365 SUBROUTINE iom_rp0d( kt, kwrite, kiomid, cdvar, pvar, ktype )1508 SUBROUTINE iom_rp0d( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 1366 1509 INTEGER , INTENT(in) :: kt ! ocean time-step 1367 1510 INTEGER , INTENT(in) :: kwrite ! writing time-step … … 1370 1513 REAL(wp) , INTENT(in) :: pvar ! written field 1371 1514 INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type 1515 LOGICAL, OPTIONAL :: ldxios ! xios write flag 1516 LOGICAL :: llx ! local xios write flag 1372 1517 INTEGER :: ivid ! variable id 1373 IF( kiomid > 0 ) THEN 1374 IF( iom_file(kiomid)%nfid > 0 ) THEN 1375 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1376 SELECT CASE (iom_file(kiomid)%iolib) 1377 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r0d = pvar ) 1378 CASE DEFAULT 1379 CALL ctl_stop( 'iom_rp0d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1380 END SELECT 1518 1519 llx = .FALSE. 1520 IF(PRESENT(ldxios)) llx = ldxios 1521 IF( llx ) THEN 1522 #ifdef key_iomput 1523 IF( kt == kwrite ) THEN 1524 IF(lwp) write(numout,*) 'RESTART: write (XIOS 0D) ',trim(cdvar) 1525 CALL xios_send_field(trim(cdvar), pvar) 1526 ENDIF 1527 #endif 1528 ELSE 1529 IF( kiomid > 0 ) THEN 1530 IF( iom_file(kiomid)%nfid > 0 ) THEN 1531 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1532 SELECT CASE (iom_file(kiomid)%iolib) 1533 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r0d = pvar ) 1534 CASE DEFAULT 1535 CALL ctl_stop( 'iom_rp0d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1536 END SELECT 1537 ENDIF 1381 1538 ENDIF 1382 1539 ENDIF 1383 1540 END SUBROUTINE iom_rp0d 1384 1541 1385 SUBROUTINE iom_rp1d( kt, kwrite, kiomid, cdvar, pvar, ktype )1542 SUBROUTINE iom_rp1d( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 1386 1543 INTEGER , INTENT(in) :: kt ! ocean time-step 1387 1544 INTEGER , INTENT(in) :: kwrite ! writing time-step … … 1390 1547 REAL(wp) , INTENT(in), DIMENSION( :) :: pvar ! written field 1391 1548 INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type 1549 LOGICAL, OPTIONAL :: ldxios ! xios write flag 1550 LOGICAL :: llx ! local xios write flag 1392 1551 INTEGER :: ivid ! variable id 1393 IF( kiomid > 0 ) THEN 1394 IF( iom_file(kiomid)%nfid > 0 ) THEN 1395 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1396 SELECT CASE (iom_file(kiomid)%iolib) 1397 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r1d = pvar ) 1398 CASE DEFAULT 1399 CALL ctl_stop( 'iom_rp1d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1400 END SELECT 1552 1553 llx = .FALSE. 1554 IF(PRESENT(ldxios)) llx = ldxios 1555 IF( llx ) THEN 1556 #ifdef key_iomput 1557 IF( kt == kwrite ) THEN 1558 IF(lwp) write(numout,*) 'RESTART: write (XIOS 1D) ',trim(cdvar) 1559 CALL xios_send_field(trim(cdvar), pvar) 1560 ENDIF 1561 #endif 1562 ELSE 1563 IF( kiomid > 0 ) THEN 1564 IF( iom_file(kiomid)%nfid > 0 ) THEN 1565 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1566 SELECT CASE (iom_file(kiomid)%iolib) 1567 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r1d = pvar ) 1568 CASE DEFAULT 1569 CALL ctl_stop( 'iom_rp1d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1570 END SELECT 1571 ENDIF 1401 1572 ENDIF 1402 1573 ENDIF 1403 1574 END SUBROUTINE iom_rp1d 1404 1575 1405 SUBROUTINE iom_rp2d( kt, kwrite, kiomid, cdvar, pvar, ktype )1576 SUBROUTINE iom_rp2d( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 1406 1577 INTEGER , INTENT(in) :: kt ! ocean time-step 1407 1578 INTEGER , INTENT(in) :: kwrite ! writing time-step … … 1410 1581 REAL(wp) , INTENT(in), DIMENSION(:, : ) :: pvar ! written field 1411 1582 INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type 1583 LOGICAL, OPTIONAL :: ldxios ! xios write flag 1584 LOGICAL :: llx 1412 1585 INTEGER :: ivid ! variable id 1413 IF( kiomid > 0 ) THEN 1414 IF( iom_file(kiomid)%nfid > 0 ) THEN 1415 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1416 SELECT CASE (iom_file(kiomid)%iolib) 1417 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r2d = pvar ) 1418 CASE DEFAULT 1419 CALL ctl_stop( 'iom_rp2d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1420 END SELECT 1586 1587 llx = .FALSE. 1588 IF(PRESENT(ldxios)) llx = ldxios 1589 IF( llx ) THEN 1590 #ifdef key_iomput 1591 IF( kt == kwrite ) THEN 1592 IF(lwp) write(numout,*) 'RESTART: write (XIOS 2D) ',trim(cdvar) 1593 CALL xios_send_field(trim(cdvar), pvar) 1594 ENDIF 1595 #endif 1596 ELSE 1597 IF( kiomid > 0 ) THEN 1598 IF( iom_file(kiomid)%nfid > 0 ) THEN 1599 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1600 SELECT CASE (iom_file(kiomid)%iolib) 1601 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r2d = pvar ) 1602 CASE DEFAULT 1603 CALL ctl_stop( 'iom_rp2d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1604 END SELECT 1605 ENDIF 1421 1606 ENDIF 1422 1607 ENDIF 1423 1608 END SUBROUTINE iom_rp2d 1424 1609 1425 SUBROUTINE iom_rp3d( kt, kwrite, kiomid, cdvar, pvar, ktype )1610 SUBROUTINE iom_rp3d( kt, kwrite, kiomid, cdvar, pvar, ktype, ldxios ) 1426 1611 INTEGER , INTENT(in) :: kt ! ocean time-step 1427 1612 INTEGER , INTENT(in) :: kwrite ! writing time-step … … 1430 1615 REAL(wp) , INTENT(in), DIMENSION(:,:,:) :: pvar ! written field 1431 1616 INTEGER , INTENT(in), OPTIONAL :: ktype ! variable external type 1617 LOGICAL, OPTIONAL :: ldxios ! xios write flag 1618 LOGICAL :: llx ! local xios write flag 1432 1619 INTEGER :: ivid ! variable id 1433 IF( kiomid > 0 ) THEN 1434 IF( iom_file(kiomid)%nfid > 0 ) THEN 1435 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1436 SELECT CASE (iom_file(kiomid)%iolib) 1437 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r3d = pvar ) 1438 CASE DEFAULT 1439 CALL ctl_stop( 'iom_rp3d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1440 END SELECT 1620 1621 llx = .FALSE. 1622 IF(PRESENT(ldxios)) llx = ldxios 1623 IF( llx ) THEN 1624 #ifdef key_iomput 1625 IF( kt == kwrite ) THEN 1626 IF(lwp) write(numout,*) 'RESTART: write (XIOS 3D) ',trim(cdvar) 1627 CALL xios_send_field(trim(cdvar), pvar) 1628 ENDIF 1629 #endif 1630 ELSE 1631 IF( kiomid > 0 ) THEN 1632 IF( iom_file(kiomid)%nfid > 0 ) THEN 1633 ivid = iom_varid( kiomid, cdvar, ldstop = .FALSE. ) 1634 SELECT CASE (iom_file(kiomid)%iolib) 1635 CASE (jpnf90 ) ; CALL iom_nf90_rstput( kt, kwrite, kiomid, cdvar, ivid, ktype, pv_r3d = pvar ) 1636 CASE DEFAULT 1637 CALL ctl_stop( 'iom_rp3d: accepted IO library is only jpnf90 (jpioipsl option has been removed)' ) 1638 END SELECT 1639 ENDIF 1441 1640 ENDIF 1442 1641 ENDIF … … 1616 1815 SUBROUTINE iom_context_finalize( cdname ) 1617 1816 CHARACTER(LEN=*), INTENT(in) :: cdname 1618 ! 1619 IF( xios_is_valid_context(cdname) ) THEN 1817 CHARACTER(LEN=120) :: clname 1818 ! 1819 clname = cdname 1820 IF( TRIM(Agrif_CFixed()) .NE. '0' ) clname = TRIM(Agrif_CFixed())//"_"//clname 1821 1822 IF( xios_is_valid_context(clname) ) THEN 1620 1823 CALL iom_swap( cdname ) ! swap to cdname context 1621 1824 CALL xios_context_finalize() ! finalize the context … … 1645 1848 CALL iom_set_domain_attr("grid_"//cdgrd, ni_glo=jpiglo, nj_glo=jpjglo, ibegin=nimpp+nldi-2, jbegin=njmpp+nldj-2, ni=ni, nj=nj) 1646 1849 CALL iom_set_domain_attr("grid_"//cdgrd, data_dim=2, data_ibegin = 1-nldi, data_ni = jpi, data_jbegin = 1-nldj, data_nj = jpj) 1647 CALL iom_set_domain_attr("grid_"//cdgrd, lonvalue = RESHAPE(plon(nldi:nlei, nldj:nlej),(/ ni*nj /)), &1850 if(.NOT.ldxios) CALL iom_set_domain_attr("grid_"//cdgrd, lonvalue = RESHAPE(plon(nldi:nlei, nldj:nlej),(/ ni*nj /)), & 1648 1851 & latvalue = RESHAPE(plat(nldi:nlei, nldj:nlej),(/ ni*nj /))) 1649 1852 -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/IOM/iom_def.F90
r8631 r8770 46 46 !$AGRIF_DO_NOT_TREAT 47 47 INTEGER, PUBLIC :: iom_open_init = 0 !: used to initialize iom_file(:)%nfid to 0 48 !XIOS write restart 49 LOGICAL, PUBLIC :: lwxios !: read single file restart using XIOS 50 INTEGER, PUBLIC :: nxioso !: type of restart file when writing using XIOS 1 - single, 2 - multiple 48 51 !XIOS read restart 49 52 LOGICAL, PUBLIC :: lxios_read !: read single file restart using XIOS 50 53 LOGICAL, PUBLIC :: lxios_sini = .FALSE. ! is restart in a single file 51 54 LOGICAL, PUBLIC :: lxios_set = .FALSE. 55 56 52 57 53 58 TYPE, PUBLIC :: file_descriptor … … 70 75 END TYPE file_descriptor 71 76 TYPE(file_descriptor), DIMENSION(jpmax_files), PUBLIC :: iom_file !: array containing the info for all opened files 72 73 77 INTEGER, PARAMETER, PUBLIC :: max_rst_fields = 95 74 78 TYPE, PUBLIC :: RST_FIELD 79 CHARACTER(len=30) :: vname = "NO_NAME" ! names of variables in restart file 80 CHARACTER(len=30) :: grid = "NO_GRID" 81 LOGICAL :: active =.FALSE. ! for restart write only: true - write field, false do not write field 82 END TYPE RST_FIELD 75 83 !$AGRIF_END_DO_NOT_TREAT 76 84 77 TYPE, PUBLIC :: RST_FIELD 78 CHARACTER(len=30) :: vname ! names of variables in restart file 79 CHARACTER(len=30) :: grid 80 END TYPE RST_FIELD 81 TYPE(RST_FIELD), PUBLIC :: rst_fields(max_rst_fields) 85 TYPE(RST_FIELD), PUBLIC :: rst_wfields(max_rst_fields), rst_fields(max_rst_fields) 82 86 83 87 !!===================================================================== -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
r8668 r8770 28 28 USE iom ! I/O module 29 29 USE diurnal_bulk 30 30 USE iom_def, ONLY : lwxios 31 31 32 IMPLICIT NONE 32 33 PRIVATE … … 61 62 CHARACTER(LEN=50) :: clname ! ocean output restart file name 62 63 CHARACTER(lc) :: clpath ! full path to ocean output restart file 64 CHARACTER(LEN=52) :: clpname ! ocean output restart file name including prefix for AGRIF 63 65 !!---------------------------------------------------------------------- 64 66 ! … … 94 96 IF(lwp) THEN 95 97 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 98 IF(.NOT.lwxios) THEN 99 SELECT CASE ( jprstlib ) 100 CASE DEFAULT ; WRITE(numout,*) & 101 ' open ocean restart NetCDF file: ',TRIM(clpath)//TRIM(clname) 102 END SELECT 103 IF ( snc4set%luse ) WRITE(numout,*) ' opened for NetCDF4 chunking and compression' 104 IF( kt == nitrst - 1 ) THEN ; WRITE(numout,*) ' kt = nitrst - 1 = ', kt 105 ELSE ; WRITE(numout,*) ' kt = ' , kt 106 ENDIF 103 107 ENDIF 104 108 ENDIF 105 109 ! 106 CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 110 IF(.NOT.lwxios) THEN 111 CALL iom_open( TRIM(clpath)//TRIM(clname), numrow, ldwrt = .TRUE., kiolib = jprstlib ) 112 ELSE 113 cwxios_context = "rstw_"//TRIM(ADJUSTL(clkt)) 114 IF( TRIM(Agrif_CFixed()) == '0' ) THEN 115 clpname = clname 116 ELSE 117 clpname = TRIM(Agrif_CFixed())//"_"//clname 118 ENDIF 119 CALL iom_init( cwxios_context, TRIM(clpath)//TRIM(clpname)) 120 CALL xios_update_calendar(nitrst) 121 CALL iom_swap( cxios_context ) 122 ENDIF 107 123 lrst_oce = .TRUE. 108 124 ENDIF … … 123 139 INTEGER, INTENT(in) :: kt ! ocean time-step 124 140 !!---------------------------------------------------------------------- 125 126 CALL iom_rstput( kt, nitrst, numrow, 'rdt' , rdt ) ! dynamics and tracertime step141 IF(lwxios) CALL iom_swap( cwxios_context ) 142 CALL iom_rstput( kt, nitrst, numrow, 'rdt' , rdt , ldxios = lwxios) ! dynamics time step 127 143 128 144 IF ( .NOT. ln_diurnal_only ) THEN 129 CALL iom_rstput( kt, nitrst, numrow, 'ub' , ub ) ! before fields130 CALL iom_rstput( kt, nitrst, numrow, 'vb' , vb )131 CALL iom_rstput( kt, nitrst, numrow, 'tb' , tsb(:,:,:,jp_tem) )132 CALL iom_rstput( kt, nitrst, numrow, 'sb' , tsb(:,:,:,jp_sal) )133 CALL iom_rstput( kt, nitrst, numrow, 'sshb' , sshb )145 CALL iom_rstput( kt, nitrst, numrow, 'ub' , ub, ldxios = lwxios ) ! before fields 146 CALL iom_rstput( kt, nitrst, numrow, 'vb' , vb, ldxios = lwxios ) 147 CALL iom_rstput( kt, nitrst, numrow, 'tb' , tsb(:,:,:,jp_tem), ldxios = lwxios ) 148 CALL iom_rstput( kt, nitrst, numrow, 'sb' , tsb(:,:,:,jp_sal), ldxios = lwxios ) 149 CALL iom_rstput( kt, nitrst, numrow, 'sshb' , sshb, ldxios = lwxios ) 134 150 ! 135 CALL iom_rstput( kt, nitrst, numrow, 'un' , un ) ! now fields 136 CALL iom_rstput( kt, nitrst, numrow, 'vn' , vn ) 137 CALL iom_rstput( kt, nitrst, numrow, 'tn' , tsn(:,:,:,jp_tem) ) 138 CALL iom_rstput( kt, nitrst, numrow, 'sn' , tsn(:,:,:,jp_sal) ) 139 CALL iom_rstput( kt, nitrst, numrow, 'sshn' , sshn ) 140 CALL iom_rstput( kt, nitrst, numrow, 'rhop' , rhop ) 141 151 CALL iom_rstput( kt, nitrst, numrow, 'un' , un, ldxios = lwxios ) ! now fields 152 CALL iom_rstput( kt, nitrst, numrow, 'vn' , vn, ldxios = lwxios ) 153 CALL iom_rstput( kt, nitrst, numrow, 'tn' , tsn(:,:,:,jp_tem), ldxios = lwxios ) 154 CALL iom_rstput( kt, nitrst, numrow, 'sn' , tsn(:,:,:,jp_sal), ldxios = lwxios ) 155 CALL iom_rstput( kt, nitrst, numrow, 'sshn' , sshn, ldxios = lwxios ) 156 CALL iom_rstput( kt, nitrst, numrow, 'rhop' , rhop, ldxios = lwxios ) 142 157 ! extra variable needed for the ice sheet coupling 143 158 IF ( ln_iscpl ) THEN 144 CALL iom_rstput( kt, nitrst, numrow, 'tmask' , tmask 145 CALL iom_rstput( kt, nitrst, numrow, 'umask' , umask 146 CALL iom_rstput( kt, nitrst, numrow, 'vmask' , vmask 147 CALL iom_rstput( kt, nitrst, numrow, 'smask' , ssmask 148 CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t_n(:,:,:) ) ! need to compute temperature correction149 CALL iom_rstput( kt, nitrst, numrow, 'e3u_n', e3u_n(:,:,:) ) ! need to compute bt conservation150 CALL iom_rstput( kt, nitrst, numrow, 'e3v_n', e3v_n(:,:,:) ) ! need to compute bt conservation151 CALL iom_rstput( kt, nitrst, numrow, 'gdepw_n', gdepw_n(:,:,:) ) ! need to compute extrapolation if vvl159 CALL iom_rstput( kt, nitrst, numrow, 'tmask' , tmask, ldxios = lwxios ) ! need to extrapolate T/S 160 CALL iom_rstput( kt, nitrst, numrow, 'umask' , umask, ldxios = lwxios ) ! need to correct barotropic velocity 161 CALL iom_rstput( kt, nitrst, numrow, 'vmask' , vmask, ldxios = lwxios ) ! need to correct barotropic velocity 162 CALL iom_rstput( kt, nitrst, numrow, 'smask' , ssmask, ldxios = lwxios) ! need to correct barotropic velocity 163 CALL iom_rstput( kt, nitrst, numrow, 'e3t_n', e3t_n(:,:,:), ldxios = lwxios ) ! need to compute temperature correction 164 CALL iom_rstput( kt, nitrst, numrow, 'e3u_n', e3u_n(:,:,:), ldxios = lwxios ) ! need to compute bt conservation 165 CALL iom_rstput( kt, nitrst, numrow, 'e3v_n', e3v_n(:,:,:), ldxios = lwxios ) ! need to compute bt conservation 166 CALL iom_rstput( kt, nitrst, numrow, 'gdepw_n', gdepw_n(:,:,:), ldxios = lwxios ) ! need to compute extrapolation if vvl 152 167 END IF 153 168 ENDIF 154 169 155 IF (ln_diurnal) CALL iom_rstput( kt, nitrst, numrow, 'Dsst', x_dsst 156 170 IF (ln_diurnal) CALL iom_rstput( kt, nitrst, numrow, 'Dsst', x_dsst, ldxios = lwxios ) 171 IF(lwxios) CALL iom_swap( cxios_context ) 157 172 IF( kt == nitrst ) THEN 158 CALL iom_close( numrow ) ! close the restart file (only at last time step) 173 IF(.NOT.lwxios) THEN 174 CALL iom_close( numrow ) ! close the restart file (only at last time step) 175 ELSE 176 CALL iom_context_finalize( cwxios_context ) 177 ENDIF 159 178 !!gm IF( .NOT. lk_trdmld ) lrst_oce = .FALSE. 160 179 !!gm not sure what to do here ===>>> ask to Sebastian … … 164 183 nitrst = nstocklist( nrst_lst ) 165 184 ENDIF 166 lrst_oce = .FALSE.167 185 ENDIF 168 186 ! -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/SBC/sbcapr.F90
r8668 r8770 19 19 USE iom ! IOM library 20 20 USE lib_mpp ! MPP library 21 USE iom_def, ONLY : lwxios 21 22 22 23 IMPLICIT NONE … … 110 111 CALL ctl_warn( 'sbc_apr: use inverse barometer ssh at open boundary ONLY requires ln_apr_dyn=T' ) 111 112 ! 113 IF( lwxios ) THEN 114 CALL iom_set_rstw_var_active('ssh_ibb') 115 ENDIF 112 116 END SUBROUTINE sbc_apr_init 113 117 … … 166 170 IF(lwp) WRITE(numout,*) 'sbc_apr : ssh_ib written in ocean restart file at it= ', kt,' date= ', ndastp 167 171 IF(lwp) WRITE(numout,*) '~~~~' 168 CALL iom_rstput( kt, nitrst, numrow, 'ssh_ibb' , ssh_ib ) 172 IF( lwxios ) CALL iom_swap( cwxios_context ) 173 CALL iom_rstput( kt, nitrst, numrow, 'ssh_ibb' , ssh_ib, ldxios = lwxios ) 174 IF( lwxios ) CALL iom_swap( cxios_context ) 169 175 ENDIF 170 176 ! -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/SBC/sbcisf.F90
r8668 r8770 27 27 USE timing ! Timing 28 28 USE lib_fortran ! glob_sum 29 USE iom_def, ONLY : lxios_read 29 USE iom_def, ONLY : lxios_read, lwxios 30 30 31 31 IMPLICIT NONE … … 233 233 & 'at it= ', kt,' date= ', ndastp 234 234 IF(lwp) WRITE(numout,*) '~~~~' 235 CALL iom_rstput( kt, nitrst, numrow, 'fwf_isf_b', fwfisf(:,:) ) 236 CALL iom_rstput( kt, nitrst, numrow, 'isf_hc_b' , risf_tsc(:,:,jp_tem) ) 237 CALL iom_rstput( kt, nitrst, numrow, 'isf_sc_b' , risf_tsc(:,:,jp_sal) ) 235 IF( lwxios ) CALL iom_swap( cwxios_context ) 236 CALL iom_rstput( kt, nitrst, numrow, 'fwf_isf_b', fwfisf(:,:), ldxios = lwxios ) 237 CALL iom_rstput( kt, nitrst, numrow, 'isf_hc_b' , risf_tsc(:,:,jp_tem), ldxios = lwxios ) 238 CALL iom_rstput( kt, nitrst, numrow, 'isf_sc_b' , risf_tsc(:,:,jp_sal), ldxios = lwxios ) 239 IF( lwxios ) CALL iom_swap( cxios_context ) 238 240 ENDIF 239 241 ! … … 394 396 END DO 395 397 398 IF( lwxios ) THEN 399 CALL iom_set_rstw_var_active('fwf_isf_b') 400 CALL iom_set_rstw_var_active('isf_hc_b') 401 CALL iom_set_rstw_var_active('isf_sc_b') 402 ENDIF 403 404 396 405 END SUBROUTINE sbc_isf_init 397 406 -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
r8668 r8770 58 58 59 59 USE diurnal_bulk, ONLY: ln_diurnal_only ! diurnal SST diagnostic 60 USE iom_def, ONLY : lxios_read 60 USE iom_def, ONLY : lxios_read, lwxios 61 61 62 62 IMPLICIT NONE … … 342 342 IF( ln_wave ) CALL sbc_wave_init ! surface wave initialisation 343 343 ! 344 IF( lwxios ) THEN 345 CALL iom_set_rstw_var_active('utau_b') 346 CALL iom_set_rstw_var_active('vtau_b') 347 CALL iom_set_rstw_var_active('qns_b') 348 ! The 3D heat content due to qsr forcing is treated in traqsr 349 ! CALL iom_set_rstw_var_active('qsr_b') 350 CALL iom_set_rstw_var_active('emp_b') 351 CALL iom_set_rstw_var_active('sfx_b') 352 ENDIF 353 344 354 END SUBROUTINE sbc_init 345 355 … … 486 496 & 'at it= ', kt,' date= ', ndastp 487 497 IF(lwp) WRITE(numout,*) '~~~~' 488 CALL iom_rstput( kt, nitrst, numrow, 'utau_b' , utau ) 489 CALL iom_rstput( kt, nitrst, numrow, 'vtau_b' , vtau ) 490 CALL iom_rstput( kt, nitrst, numrow, 'qns_b' , qns ) 498 IF( lwxios ) CALL iom_swap( cwxios_context ) 499 CALL iom_rstput( kt, nitrst, numrow, 'utau_b' , utau, ldxios = lwxios ) 500 CALL iom_rstput( kt, nitrst, numrow, 'vtau_b' , vtau, ldxios = lwxios ) 501 CALL iom_rstput( kt, nitrst, numrow, 'qns_b' , qns, ldxios = lwxios ) 491 502 ! The 3D heat content due to qsr forcing is treated in traqsr 492 503 ! CALL iom_rstput( kt, nitrst, numrow, 'qsr_b' , qsr ) 493 CALL iom_rstput( kt, nitrst, numrow, 'emp_b' , emp ) 494 CALL iom_rstput( kt, nitrst, numrow, 'sfx_b' , sfx ) 504 CALL iom_rstput( kt, nitrst, numrow, 'emp_b' , emp, ldxios = lwxios ) 505 CALL iom_rstput( kt, nitrst, numrow, 'sfx_b' , sfx, ldxios = lwxios ) 506 IF( lwxios ) CALL iom_swap( cxios_context ) 495 507 ENDIF 496 508 ! ! ---------------------------------------- ! -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90
r8668 r8770 28 28 USE lib_mpp ! MPP library 29 29 USE wrk_nemo ! Memory allocation 30 USE iom_def, ONLY : lxios_read 30 USE iom_def, ONLY : lxios_read, lwxios 31 31 32 32 IMPLICIT NONE … … 165 165 & 'at it= ', kt,' date= ', ndastp 166 166 IF(lwp) WRITE(numout,*) '~~~~' 167 CALL iom_rstput( kt, nitrst, numrow, 'rnf_b' , rnf ) 168 CALL iom_rstput( kt, nitrst, numrow, 'rnf_hc_b', rnf_tsc(:,:,jp_tem) ) 169 CALL iom_rstput( kt, nitrst, numrow, 'rnf_sc_b', rnf_tsc(:,:,jp_sal) ) 167 IF( lwxios ) CALL iom_swap( cwxios_context ) 168 CALL iom_rstput( kt, nitrst, numrow, 'rnf_b' , rnf, ldxios = lwxios ) 169 CALL iom_rstput( kt, nitrst, numrow, 'rnf_hc_b', rnf_tsc(:,:,jp_tem), ldxios = lwxios ) 170 CALL iom_rstput( kt, nitrst, numrow, 'rnf_sc_b', rnf_tsc(:,:,jp_sal), ldxios = lwxios ) 171 IF( lwxios ) CALL iom_swap( cxios_context ) 170 172 ENDIF 171 173 ! … … 473 475 ENDIF 474 476 ! 477 IF( lwxios ) THEN 478 CALL iom_set_rstw_var_active('rnf_b') 479 CALL iom_set_rstw_var_active('rnf_hc_b') 480 CALL iom_set_rstw_var_active('rnf_sc_b') 481 ENDIF 482 475 483 END SUBROUTINE sbc_rnf_init 476 484 -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssm.F90
r8668 r8770 22 22 USE prtctl ! Print control 23 23 USE iom ! IOM library 24 USE iom_def, ONLY : lxios_read 24 USE iom_def, ONLY : lxios_read, lwxios 25 25 26 26 IMPLICIT NONE … … 156 156 IF(lwp) WRITE(numout,*) '~~~~~~~' 157 157 zf_sbc = REAL( nn_fsbc, wp ) 158 CALL iom_rstput( kt, nitrst, numrow, 'nn_fsbc', zf_sbc ) ! sbc frequency 159 CALL iom_rstput( kt, nitrst, numrow, 'ssu_m' , ssu_m ) ! sea surface mean fields 160 CALL iom_rstput( kt, nitrst, numrow, 'ssv_m' , ssv_m ) 161 CALL iom_rstput( kt, nitrst, numrow, 'sst_m' , sst_m ) 162 CALL iom_rstput( kt, nitrst, numrow, 'sss_m' , sss_m ) 163 CALL iom_rstput( kt, nitrst, numrow, 'ssh_m' , ssh_m ) 164 CALL iom_rstput( kt, nitrst, numrow, 'e3t_m' , e3t_m ) 165 CALL iom_rstput( kt, nitrst, numrow, 'frq_m' , frq_m ) 166 ! 158 IF( lwxios ) CALL iom_swap( cwxios_context ) 159 CALL iom_rstput( kt, nitrst, numrow, 'nn_fsbc', zf_sbc, ldxios = lwxios ) ! sbc frequency 160 CALL iom_rstput( kt, nitrst, numrow, 'ssu_m' , ssu_m, ldxios = lwxios ) ! sea surface mean fields 161 CALL iom_rstput( kt, nitrst, numrow, 'ssv_m' , ssv_m, ldxios = lwxios ) 162 CALL iom_rstput( kt, nitrst, numrow, 'sst_m' , sst_m, ldxios = lwxios ) 163 CALL iom_rstput( kt, nitrst, numrow, 'sss_m' , sss_m, ldxios = lwxios ) 164 CALL iom_rstput( kt, nitrst, numrow, 'ssh_m' , ssh_m, ldxios = lwxios ) 165 CALL iom_rstput( kt, nitrst, numrow, 'e3t_m' , e3t_m, ldxios = lwxios ) 166 CALL iom_rstput( kt, nitrst, numrow, 'frq_m' , frq_m, ldxios = lwxios ) 167 ! 168 IF( lwxios ) CALL iom_swap( cxios_context ) 167 169 ENDIF 168 170 ! … … 253 255 ENDIF 254 256 ! 257 IF( lwxios.AND.nn_fsbc > 1 ) THEN 258 CALL iom_set_rstw_var_active('nn_fsbc') 259 CALL iom_set_rstw_var_active('ssu_m') 260 CALL iom_set_rstw_var_active('ssv_m') 261 CALL iom_set_rstw_var_active('sst_m') 262 CALL iom_set_rstw_var_active('sss_m') 263 CALL iom_set_rstw_var_active('ssh_m') 264 CALL iom_set_rstw_var_active('e3t_m') 265 CALL iom_set_rstw_var_active('frq_m') 266 ENDIF 267 255 268 END SUBROUTINE sbc_ssm_init 256 269 -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90
r8668 r8770 36 36 USE wrk_nemo ! Memory Allocation 37 37 USE timing ! Timing 38 USE iom_def, ONLY : lxios_read 38 USE iom_def, ONLY : lxios_read, lwxios 39 39 IMPLICIT NONE 40 40 PRIVATE … … 294 294 ! 295 295 IF( lrst_oce ) THEN ! write in the ocean restart file 296 CALL iom_rstput( kt, nitrst, numrow, 'qsr_hc_b' , qsr_hc ) 297 CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev', fraqsr_1lev ) 296 IF( lwxios ) CALL iom_swap( cwxios_context ) 297 CALL iom_rstput( kt, nitrst, numrow, 'qsr_hc_b' , qsr_hc, ldxios = lwxios ) 298 CALL iom_rstput( kt, nitrst, numrow, 'fraqsr_1lev', fraqsr_1lev, ldxios = lwxios ) 299 IF( lwxios ) CALL iom_swap( cxios_context ) 298 300 ENDIF 299 301 ! … … 435 437 ENDIF 436 438 ! 439 IF( lwxios ) THEN 440 CALL iom_set_rstw_var_active('qsr_hc_b') 441 CALL iom_set_rstw_var_active('fraqsr_1lev') 442 ENDIF 437 443 IF( nn_timing == 1 ) CALL timing_stop('tra_qsr_init') 438 444 ! -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90
r8668 r8770 34 34 USE wrk_nemo ! Memory Allocation 35 35 USE timing ! Timing 36 USE iom_def, ONLY : lxios_read 36 USE iom_def, ONLY : lxios_read, lwxios 37 37 38 38 IMPLICIT NONE … … 147 147 ! 148 148 IF( lrst_oce ) THEN !== write sbc_tsc in the ocean restart file ==! 149 CALL iom_rstput( kt, nitrst, numrow, 'sbc_hc_b', sbc_tsc(:,:,jp_tem) ) 150 CALL iom_rstput( kt, nitrst, numrow, 'sbc_sc_b', sbc_tsc(:,:,jp_sal) ) 149 IF( lwxios ) CALL iom_swap( cwxios_context ) 150 CALL iom_rstput( kt, nitrst, numrow, 'sbc_hc_b', sbc_tsc(:,:,jp_tem), ldxios = lwxios ) 151 CALL iom_rstput( kt, nitrst, numrow, 'sbc_sc_b', sbc_tsc(:,:,jp_sal), ldxios = lwxios ) 152 IF( lwxios ) CALL iom_swap( cxios_context ) 151 153 ENDIF 152 154 ! -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90
r8668 r8770 34 34 USE timing ! Timing 35 35 USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 36 USE iom_def, ONLY : lxios_read 36 USE iom_def, ONLY : lxios_read, lwxios 37 37 38 38 IMPLICIT NONE … … 1141 1141 CALL gls_rst( nit000, 'READ' ) !* read or initialize all required files 1142 1142 ! 1143 IF( lwxios ) THEN 1144 CALL iom_set_rstw_var_active('en') 1145 CALL iom_set_rstw_var_active('avt') 1146 CALL iom_set_rstw_var_active('avm') 1147 CALL iom_set_rstw_var_active('avmu') 1148 CALL iom_set_rstw_var_active('avmv') 1149 CALL iom_set_rstw_var_active('mxln') 1150 ENDIF 1151 1143 1152 IF( nn_timing == 1 ) CALL timing_stop('zdf_gls_init') 1144 1153 ! … … 1201 1210 ! ! ------------------- 1202 1211 IF(lwp) WRITE(numout,*) '---- gls-rst ----' 1203 CALL iom_rstput( kt, nitrst, numrow, 'en' , en ) 1204 CALL iom_rstput( kt, nitrst, numrow, 'avt' , avt_k ) 1205 CALL iom_rstput( kt, nitrst, numrow, 'avm' , avm_k ) 1206 CALL iom_rstput( kt, nitrst, numrow, 'avmu' , avmu_k ) 1207 CALL iom_rstput( kt, nitrst, numrow, 'avmv' , avmv_k ) 1208 CALL iom_rstput( kt, nitrst, numrow, 'mxln' , mxln ) 1212 IF( lwxios ) CALL iom_swap( cwxios_context ) 1213 CALL iom_rstput( kt, nitrst, numrow, 'en' , en, ldxios = lwxios ) 1214 CALL iom_rstput( kt, nitrst, numrow, 'avt' , avt_k, ldxios = lwxios ) 1215 CALL iom_rstput( kt, nitrst, numrow, 'avm' , avm_k, ldxios = lwxios ) 1216 CALL iom_rstput( kt, nitrst, numrow, 'avmu' , avmu_k, ldxios = lwxios ) 1217 CALL iom_rstput( kt, nitrst, numrow, 'avmv' , avmv_k, ldxios = lwxios ) 1218 CALL iom_rstput( kt, nitrst, numrow, 'mxln' , mxln, ldxios = lwxios ) 1219 IF( lwxios ) CALL iom_swap( cxios_context ) 1209 1220 ! 1210 1221 ENDIF -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90
r8668 r8770 53 53 USE timing ! Timing 54 54 USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) 55 USE iom_def, ONLY : lwxios 55 56 #if defined key_agrif 56 57 USE agrif_opa_interp … … 815 816 CALL tke_rst( nit000, 'READ' ) !* read or initialize all required files 816 817 ! 818 IF( lwxios ) THEN 819 CALL iom_set_rstw_var_active('en') 820 CALL iom_set_rstw_var_active('avt') 821 CALL iom_set_rstw_var_active('avm') 822 CALL iom_set_rstw_var_active('avmu') 823 CALL iom_set_rstw_var_active('avmv') 824 CALL iom_set_rstw_var_active('dissl') 825 ENDIF 826 817 827 END SUBROUTINE zdf_tke_init 818 828 … … 881 891 ! ! ------------------- 882 892 IF(lwp) WRITE(numout,*) '---- tke-rst ----' 883 CALL iom_rstput( kt, nitrst, numrow, 'en' , en ) 884 CALL iom_rstput( kt, nitrst, numrow, 'avt' , avt_k ) 885 CALL iom_rstput( kt, nitrst, numrow, 'avm' , avm_k ) 886 CALL iom_rstput( kt, nitrst, numrow, 'avmu' , avmu_k ) 887 CALL iom_rstput( kt, nitrst, numrow, 'avmv' , avmv_k ) 888 CALL iom_rstput( kt, nitrst, numrow, 'dissl', dissl ) 893 IF( lwxios ) CALL iom_swap( cwxios_context ) 894 CALL iom_rstput( kt, nitrst, numrow, 'en' , en , ldxios = lwxios ) 895 CALL iom_rstput( kt, nitrst, numrow, 'avt' , avt_k , ldxios = lwxios ) 896 CALL iom_rstput( kt, nitrst, numrow, 'avm' , avm_k , ldxios = lwxios ) 897 CALL iom_rstput( kt, nitrst, numrow, 'avmu' , avmu_k, ldxios = lwxios ) 898 CALL iom_rstput( kt, nitrst, numrow, 'avmv' , avmv_k, ldxios = lwxios ) 899 CALL iom_rstput( kt, nitrst, numrow, 'dissl', dissl , ldxios = lwxios ) 900 IF( lwxios ) CALL iom_swap( cxios_context ) 889 901 ! 890 902 ENDIF -
branches/2017/dev_r8600_xios_read_write/NEMOGCM/NEMO/SAS_SRC/daymod.F90
r8668 r8770 318 318 IF( iom_varid( numror, 'kt', ldstop = .FALSE. ) > 0 ) THEN 319 319 ! Get Calendar informations 320 CALL iom_get( numror, 'kt', zk , ldxios = lxios_read ) ! last time-step of previous run320 CALL iom_get( numror, 'kt', zkt, ldxios = lxios_read ) ! last time-step of previous run 321 321 IF(lwp) THEN 322 322 WRITE(numout,*) ' *** Info read in restart : '
Note: See TracChangeset
for help on using the changeset viewer.