Changeset 12377 for NEMO/trunk/src/OCE/IOM/iom.F90
- Timestamp:
- 2020-02-12T15:39:06+01:00 (4 years ago)
- Location:
- NEMO/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/trunk
- Property svn:externals
-
old new 3 3 ^/utils/build/mk@HEAD mk 4 4 ^/utils/tools@HEAD tools 5 ^/vendors/AGRIF/dev @HEAD ext/AGRIF5 ^/vendors/AGRIF/dev_r11615_ENHANCE-04_namelists_as_internalfiles_agrif@HEAD ext/AGRIF 6 6 ^/vendors/FCM@HEAD ext/FCM 7 7 ^/vendors/IOIPSL@HEAD ext/IOIPSL
-
- Property svn:externals
-
NEMO/trunk/src/OCE/IOM/iom.F90
r12283 r12377 29 29 USE lib_mpp ! MPP library 30 30 #if defined key_iomput 31 USE sbc_oce , ONLY : nn_fsbc ! ocean space and time domain 32 USE trc_oce , ONLY : nn_dttrc ! !: frequency of step on passive tracers 31 USE sbc_oce , ONLY : nn_fsbc, ght_abl, ghw_abl, e3t_abl, e3w_abl, jpka, jpkam1 33 32 USE icb_oce , ONLY : nclasses, class_num ! !: iceberg classes 34 33 #if defined key_si3 … … 46 45 #endif 47 46 USE lib_fortran 48 USE diu rnal_bulk, ONLY : ln_diurnal_only, ln_diurnal47 USE diu_bulk, ONLY : ln_diurnal_only, ln_diurnal 49 48 50 49 IMPLICIT NONE … … 56 55 LOGICAL, PUBLIC, PARAMETER :: lk_iomput = .FALSE. !: iom_put flag 57 56 #endif 58 PUBLIC iom_init, iom_ swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_get_var57 PUBLIC iom_init, iom_init_closedef, iom_swap, iom_open, iom_close, iom_setkt, iom_varid, iom_get, iom_get_var 59 58 PUBLIC iom_chkatt, iom_getatt, iom_putatt, iom_getszuld, iom_rstput, iom_delay_rst, iom_put 60 PUBLIC iom_use, iom_context_finalize, iom_ miss_val59 PUBLIC iom_use, iom_context_finalize, iom_update_file_name, iom_miss_val 61 60 62 61 PRIVATE iom_rp0d, iom_rp1d, iom_rp2d, iom_rp3d … … 65 64 #if defined key_iomput 66 65 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 67 PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_ update_file_name, iom_sdate66 PRIVATE set_grid, set_grid_bounds, set_scalar, set_xmlatt, set_mooring, iom_sdate 68 67 PRIVATE iom_set_rst_context, iom_set_rstw_active, iom_set_rstr_active 69 68 # endif … … 86 85 END INTERFACE iom_put 87 86 87 !! * Substitutions 88 # include "do_loop_substitute.h90" 88 89 !!---------------------------------------------------------------------- 89 90 !! NEMO/OCE 4.0 , NEMO Consortium (2018) … … 93 94 CONTAINS 94 95 95 SUBROUTINE iom_init( cdname, fname, ld_tmppatch )96 SUBROUTINE iom_init( cdname, fname, ld_tmppatch, ld_closedef ) 96 97 !!---------------------------------------------------------------------- 97 98 !! *** ROUTINE *** … … 103 104 CHARACTER(len=*), OPTIONAL, INTENT(in) :: fname 104 105 LOGICAL , OPTIONAL, INTENT(in) :: ld_tmppatch 106 LOGICAL , OPTIONAL, INTENT(in) :: ld_closedef 105 107 #if defined key_iomput 106 108 ! … … 113 115 ! 114 116 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zt_bnds, zw_bnds 117 REAL(wp), DIMENSION(2,jpkam1) :: za_bnds ! ABL vertical boundaries 115 118 LOGICAL :: ll_tmppatch = .TRUE. !: seb: patch before we remove periodicity 116 119 INTEGER :: nldi_save, nlei_save !: and close boundaries in output files 117 120 INTEGER :: nldj_save, nlej_save !: 121 LOGICAL :: ll_closedef = .TRUE. 118 122 !!---------------------------------------------------------------------- 119 123 ! … … 130 134 IF( njmpp + jpj - 1 == jpjglo ) nlej = jpj 131 135 ENDIF 136 IF ( PRESENT(ld_closedef) ) ll_closedef = ld_closedef 132 137 ! 133 138 ALLOCATE( zt_bnds(2,jpk), zw_bnds(2,jpk) ) … … 200 205 ! vertical grid definition 201 206 IF(.NOT.llrst_context) THEN 202 CALL iom_set_axis_attr( "deptht", paxis = gdept_1d ) 203 CALL iom_set_axis_attr( "depthu", paxis = gdept_1d ) 204 CALL iom_set_axis_attr( "depthv", paxis = gdept_1d ) 205 CALL iom_set_axis_attr( "depthw", paxis = gdepw_1d ) 206 207 CALL iom_set_axis_attr( "deptht", paxis = gdept_1d ) 208 CALL iom_set_axis_attr( "depthu", paxis = gdept_1d ) 209 CALL iom_set_axis_attr( "depthv", paxis = gdept_1d ) 210 CALL iom_set_axis_attr( "depthw", paxis = gdepw_1d ) 211 212 ! ABL 213 IF( .NOT. ALLOCATED(ght_abl) ) THEN ! force definition for xml files (xios) 214 ALLOCATE( ght_abl(jpka), ghw_abl(jpka), e3t_abl(jpka), e3w_abl(jpka) ) ! default allocation needed by iom 215 ght_abl(:) = -1._wp ; ghw_abl(:) = -1._wp 216 e3t_abl(:) = -1._wp ; e3w_abl(:) = -1._wp 217 ENDIF 218 CALL iom_set_axis_attr( "ght_abl", ght_abl(2:jpka) ) 219 CALL iom_set_axis_attr( "ghw_abl", ghw_abl(2:jpka) ) 220 207 221 ! Add vertical grid bounds 208 222 jkmin = MIN(2,jpk) ! in case jpk=1 (i.e. sas2D) … … 213 227 zw_bnds(2,1:jpkm1 ) = gdepw_1d(jkmin:jpk) 214 228 zw_bnds(2,jpk: ) = gdepw_1d(jpk) + e3t_1d(jpk) 215 CALL iom_set_axis_attr( "deptht", bounds=zw_bnds ) 216 CALL iom_set_axis_attr( "depthu", bounds=zw_bnds ) 217 CALL iom_set_axis_attr( "depthv", bounds=zw_bnds ) 218 CALL iom_set_axis_attr( "depthw", bounds=zt_bnds ) 229 CALL iom_set_axis_attr( "deptht", bounds=zw_bnds ) 230 CALL iom_set_axis_attr( "depthu", bounds=zw_bnds ) 231 CALL iom_set_axis_attr( "depthv", bounds=zw_bnds ) 232 CALL iom_set_axis_attr( "depthw", bounds=zt_bnds ) 233 234 ! ABL 235 za_bnds(1,:) = ghw_abl(1:jpkam1) 236 za_bnds(2,:) = ghw_abl(2:jpka ) 237 CALL iom_set_axis_attr( "ght_abl", bounds=za_bnds ) 238 za_bnds(1,:) = ght_abl(2:jpka ) 239 za_bnds(2,:) = ght_abl(2:jpka ) + e3w_abl(2:jpka) 240 CALL iom_set_axis_attr( "ghw_abl", bounds=za_bnds ) 241 219 242 CALL iom_set_axis_attr( "nfloat", (/ (REAL(ji,wp), ji=1,jpnfl) /) ) 220 243 # if defined key_si3 … … 250 273 ENDIF 251 274 ! 252 ! end file definition275 ! set time step length 253 276 dtime%second = rdt 254 277 CALL xios_set_timestep( dtime ) 255 CALL xios_close_context_definition() 256 CALL xios_update_calendar( 0 ) 278 ! 279 ! conditional closure of context definition 280 IF ( ll_closedef ) CALL iom_init_closedef 257 281 ! 258 282 DEALLOCATE( zt_bnds, zw_bnds ) … … 265 289 ! 266 290 END SUBROUTINE iom_init 291 292 SUBROUTINE iom_init_closedef 293 !!---------------------------------------------------------------------- 294 !! *** SUBROUTINE iom_init_closedef *** 295 !!---------------------------------------------------------------------- 296 !! 297 !! ** Purpose : Closure of context definition 298 !! 299 !!---------------------------------------------------------------------- 300 301 #if defined key_iomput 302 CALL xios_close_context_definition() 303 CALL xios_update_calendar( 0 ) 304 #else 305 IF( .FALSE. ) WRITE(numout,*) 'iom_init_closedef: should not see this' ! useless statement to avoid compilation warnings 306 #endif 307 308 END SUBROUTINE iom_init_closedef 267 309 268 310 SUBROUTINE iom_set_rstw_var_active(field) … … 382 424 CALL iom_set_rstw_var_active('sshn') 383 425 CALL iom_set_rstw_var_active('rhop') 384 ! extra variable needed for the ice sheet coupling385 IF ( ln_iscpl ) THEN386 CALL iom_set_rstw_var_active('tmask')387 CALL iom_set_rstw_var_active('umask')388 CALL iom_set_rstw_var_active('vmask')389 CALL iom_set_rstw_var_active('smask')390 CALL iom_set_rstw_var_active('e3t_n')391 CALL iom_set_rstw_var_active('e3u_n')392 CALL iom_set_rstw_var_active('e3v_n')393 CALL iom_set_rstw_var_active('gdepw_n')394 END IF395 426 ENDIF 396 427 IF(ln_diurnal) CALL iom_set_rstw_var_active('Dsst') … … 701 732 clname = trim(cdname) 702 733 IF ( .NOT. Agrif_Root() .AND. .NOT. lliof ) THEN 703 !FUS iln = INDEX(clname,'/') 704 iln = INDEX(clname,'/',BACK=.true.) ! FUS: to insert the nest index at the right location within the string, the last / has to be found (search from the right to left) 734 iln = INDEX(clname,'/') 705 735 cltmpn = clname(1:iln) 706 736 clname = clname(iln+1:LEN_TRIM(clname)) … … 1149 1179 WRITE(cldmspc , fmt='(i1)') idmspc 1150 1180 ! 1151 IF( idmspc < irankpv ) THEN 1152 CALL ctl_stop( TRIM(clinfo), 'The file has only '//cldmspc//' spatial dimension', & 1153 & 'it is impossible to read a '//clrankpv//'D array from this file...' ) 1154 ELSEIF( idmspc == irankpv ) THEN 1181 !!GS: we consider 2D data as 3D data with vertical dim size = 1 1182 !IF( idmspc < irankpv ) THEN 1183 ! CALL ctl_stop( TRIM(clinfo), 'The file has only '//cldmspc//' spatial dimension', & 1184 ! & 'it is impossible to read a '//clrankpv//'D array from this file...' ) 1185 !ELSEIF( idmspc == irankpv ) THEN 1186 IF( idmspc == irankpv ) THEN 1155 1187 IF( PRESENT(pv_r1d) .AND. idom /= jpdom_unknown ) & 1156 1188 & CALL ctl_stop( TRIM(clinfo), 'case not coded...You must use jpdom_unknown' ) … … 1732 1764 1733 1765 SUBROUTINE iom_p4d( cdname, pfield4d ) 1734 CHARACTER(LEN=*) 1766 CHARACTER(LEN=*) , INTENT(in) :: cdname 1735 1767 REAL(wp), DIMENSION(:,:,:,:), INTENT(in) :: pfield4d 1736 1768 #if defined key_iomput … … 1974 2006 ! 1975 2007 INTEGER :: ji, jj, jn, ni, nj 1976 INTEGER :: icnr, jcnr 1977 ! 2008 INTEGER :: icnr, jcnr ! Offset such that the vertex coordinate (i+icnr,j+jcnr) 2009 ! ! represents the bottom-left corner of cell (i,j) 1978 2010 REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: z_bnds ! Lat/lon coordinates of the vertices of cell (i,j) 1979 2011 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: z_fld ! Working array to determine where to rotate cells … … 2145 2177 f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('SBC' , freq_op=f_op, freq_offset=f_of) 2146 2178 f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('SBC_scalar' , freq_op=f_op, freq_offset=f_of) 2147 f_op%timestep = nn_dttrc ; f_of%timestep = 0 ; CALL iom_set_field_attr('ptrc_T' , freq_op=f_op, freq_offset=f_of) 2148 f_op%timestep = nn_dttrc ; f_of%timestep = 0 ; CALL iom_set_field_attr('diad_T' , freq_op=f_op, freq_offset=f_of) 2179 f_op%timestep = nn_fsbc ; f_of%timestep = 0 ; CALL iom_set_field_attr('ABL' , freq_op=f_op, freq_offset=f_of) 2149 2180 2150 2181 ! output file names (attribut: name) … … 2271 2302 CHARACTER(LEN=20) :: clfreq 2272 2303 CHARACTER(LEN=20) :: cldate 2273 CHARACTER(LEN=256) :: cltmpn !FUS needed for correct path with AGRIF2274 INTEGER :: iln !FUS needed for correct path with AGRIF2275 2304 INTEGER :: idx 2276 2305 INTEGER :: jn … … 2355 2384 END DO 2356 2385 ! 2357 !FUS IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' ) clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 2358 !FUS see comment line 700 2359 IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' ) THEN 2360 iln = INDEX(clname,'/',BACK=.true.) 2361 cltmpn = clname(1:iln) 2362 clname = clname(iln+1:LEN_TRIM(clname)) 2363 clname = TRIM(cltmpn)//TRIM(Agrif_CFixed())//'_'//TRIM(clname) 2364 ENDIF 2365 !FUS 2386 IF( jn == 1 .AND. TRIM(Agrif_CFixed()) /= '0' ) clname = TRIM(Agrif_CFixed())//"_"//TRIM(clname) 2366 2387 IF( jn == 1 ) CALL iom_set_file_attr( cdid, name = clname ) 2367 2388 IF( jn == 2 ) CALL iom_set_file_attr( cdid, name_suffix = clname ) … … 2442 2463 END SUBROUTINE iom_context_finalize 2443 2464 2465 SUBROUTINE iom_update_file_name( cdid ) 2466 CHARACTER(LEN=*), INTENT(in) :: cdid 2467 IF( .FALSE. ) WRITE(numout,*) cdid ! useless test to avoid compilation warnings 2468 END SUBROUTINE iom_update_file_name 2469 2444 2470 #endif 2445 2471 … … 2461 2487 #else 2462 2488 IF( .FALSE. ) WRITE(numout,*) cdname, pmiss_val ! useless test to avoid compilation warnings 2489 IF( .FALSE. ) pmiss_val = 0._wp ! useless assignment to avoid compilation warnings 2463 2490 #endif 2464 2491 END SUBROUTINE iom_miss_val
Note: See TracChangeset
for help on using the changeset viewer.