Changeset 1682 for trunk/LMDZ.COMMON/libf/misc
- Timestamp:
- Mar 31, 2017, 11:31:38 AM (8 years ago)
- Location:
- trunk/LMDZ.COMMON/libf/misc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/misc/handle_err_m.F90
r1391 r1682 39 39 end if 40 40 end if 41 call abort_ gcm("NetCDF95 handle_err", "", 1)41 call abort_physic("NetCDF95 handle_err", "", 1) 42 42 end if 43 43 -
trunk/LMDZ.COMMON/libf/misc/wxios.F90
r1650 r1682 15 15 16 16 INTEGER, SAVE :: g_comm 17 CHARACTER(len=100), SAVE :: g_ctx_name 17 CHARACTER(len=100), SAVE :: g_ctx_name ="LMDZ" 18 18 TYPE(xios_context), SAVE :: g_ctx 19 19 !$OMP THREADPRIVATE(g_comm,g_cts_name,g_ctx) … … 136 136 g_ctx_name = xios_ctx_name 137 137 138 ! Si couple alors init fait dans cpl_init139 IF (.not. PRESENT(type_ocean)) THEN140 CALL wxios_context_init()141 ENDIF138 ! ! Si couple alors init fait dans cpl_init 139 ! IF (.not. PRESENT(type_ocean)) THEN 140 ! CALL wxios_context_init() 141 ! ENDIF 142 142 143 143 END SUBROUTINE wxios_init … … 145 145 SUBROUTINE wxios_context_init() 146 146 USE print_control_mod, ONLY : prt_level, lunout 147 !USE mod_phys_lmdz_mpi_data, ONLY : COMM_LMDZ_PHY147 USE mod_phys_lmdz_mpi_data, ONLY : COMM_LMDZ_PHY 148 148 IMPLICIT NONE 149 149 … … 152 152 !$OMP MASTER 153 153 !Initialisation du contexte: 154 CALL xios_context_initialize(g_ctx_name, g_comm)154 CALL xios_context_initialize(g_ctx_name, COMM_LMDZ_PHY) 155 155 CALL xios_get_handle(g_ctx_name, xios_ctx) !Récupération 156 156 CALL xios_set_current_context(xios_ctx) !Activation … … 165 165 !$OMP END MASTER 166 166 END SUBROUTINE wxios_context_init 167 168 169 SUBROUTINE wxios_set_context() 170 IMPLICIT NONE 171 TYPE(xios_context) :: xios_ctx 172 173 !$OMP MASTER 174 CALL xios_get_handle(g_ctx_name, xios_ctx) !Récupération 175 CALL xios_set_current_context(xios_ctx) !Activation 176 !$OMP END MASTER 177 178 END SUBROUTINE wxios_set_context 167 179 168 180 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 203 215 CASE DEFAULT 204 216 abort_message = 'wxios_set_cal: Mauvais choix de calendrier' 205 CALL abort_ gcm('Gcm:Xios',abort_message,1)217 CALL abort_physic('Gcm:Xios',abort_message,1) 206 218 END SELECT 207 219 … … 210 222 211 223 IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Time origin: ", date 224 212 225 CALL xios_set_time_origin(xios_date(annee,mois,jour,int(heure),0,0)) 213 226 … … 237 250 ! Pour initialiser un domaine !!!!!!!!!!!!!!!!!!!! 238 251 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 239 SUBROUTINE wxios_domain_param(dom_id, is_sequential, ni, nj, ni_glo, nj_glo, & 240 ibegin, iend, ii_begin, ii_end, jbegin, jend, & 241 data_ni, data_ibegin, data_iend, & 242 io_lat, io_lon,is_south_pole,mpi_rank) 243 244 245 USE print_control_mod, ONLY : prt_level, lunout 246 IMPLICIT NONE 247 252 SUBROUTINE wxios_domain_param(dom_id,flip_coordinates) 253 USE dimphy, only: klon 254 USE mod_phys_lmdz_transfert_para, ONLY: gather, bcast 255 USE mod_phys_lmdz_para, only: jj_nb, jj_begin, jj_end, ii_begin, ii_end, & 256 mpi_size, mpi_rank, klon_mpi, & 257 is_sequential, is_south_pole_dyn 258 USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, klon_glo 259 USE print_control_mod, ONLY : prt_level, lunout 260 USE geometry_mod 261 262 IMPLICIT NONE 248 263 CHARACTER(len=*),INTENT(IN) :: dom_id ! domain identifier 249 LOGICAL,INTENT(IN) :: is_sequential ! flag 250 INTEGER,INTENT(IN) :: ni ! local MPI domain number of longitudes 251 INTEGER,INTENT(IN) :: nj ! local MPI domain number of latitudes 252 INTEGER,INTENT(IN) :: ni_glo ! global grid number of longitudes 253 INTEGER,INTENT(IN) :: nj_glo ! global grid number of latitudes 254 INTEGER,INTENT(IN) :: ibegin ! start index, on global grid, of local MPI domain 255 INTEGER,INTENT(IN) :: iend ! end index, on global grid, of local MPI domain 256 INTEGER,INTENT(IN) :: ii_begin ! i index at which local data starts (first row) 257 INTEGER,INTENT(IN) :: ii_end ! i index at which local data ends (last row) 258 INTEGER,INTENT(IN) :: jbegin ! start index, on global grid, of local MPI domain 259 INTEGER,INTENT(IN) :: jend ! end index, on global grid, of local MPI domain 260 INTEGER,INTENT(IN) :: data_ni 261 INTEGER,INTENT(IN) :: data_ibegin 262 INTEGER,INTENT(IN) :: data_iend 263 REAL,INTENT(IN) :: io_lat(:) ! latitudes (of global grid) 264 REAL,INTENT(IN) :: io_lon(:) ! longitudes (of global grid) 265 logical,intent(in) :: is_south_pole ! does this process include the south pole? 266 integer,intent(in) :: mpi_rank ! rank of process 267 264 LOGICAL,OPTIONAL,INTENT(IN) :: flip_coordinates ! .true. to change signs 265 ! of coordinates 266 LOGICAL :: flip_axes=.false. ! default; do not swap axes 267 REAL :: rlat_glo(klon_glo) 268 REAL :: rlon_glo(klon_glo) 269 REAL :: io_lat(nbp_lat) 270 REAL :: io_lon(nbp_lon) 271 LOGICAL :: mask(nbp_lon,jj_nb) !Masque pour les problèmes de recouvrement MPI 268 272 TYPE(xios_domain) :: dom 273 INTEGER :: i 269 274 LOGICAL :: boool 270 275 271 !Masque pour les problèmes de recouvrement MPI: 272 LOGICAL :: mask(ni,nj) 276 277 IF (flip_axes) THEN 278 ! change signs of axes 279 CALL gather(-latitude_deg,rlat_glo) 280 CALL bcast(rlat_glo) 281 CALL gather(-longitude_deg,rlon_glo) 282 CALL bcast(rlon_glo) 283 ELSE 284 CALL gather(latitude_deg,rlat_glo) 285 CALL bcast(rlat_glo) 286 CALL gather(longitude_deg,rlon_glo) 287 CALL bcast(rlon_glo) 288 ENDIF 289 290 !$OMP MASTER 291 io_lat(1)=rlat_glo(1) 292 io_lat(nbp_lat)=rlat_glo(klon_glo) 293 IF ((nbp_lon*nbp_lat) > 1) then 294 DO i=2,nbp_lat-1 295 io_lat(i)=rlat_glo(2+(i-2)*nbp_lon) 296 ENDDO 297 ENDIF 298 299 IF (klon_glo == 1) THEN 300 io_lon(1)=rlon_glo(1) 301 ELSE 302 io_lon(1:nbp_lon)=rlon_glo(2:nbp_lon+1) 303 ENDIF 304 273 305 274 306 !On récupère le handle: 275 307 CALL xios_get_domain_handle(dom_id, dom) 276 308 277 IF (prt_level >= 10) THEN278 WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," ni:",ni," ni_glo:", ni_glo, " nj:", nj, " nj_glo:", nj_glo279 WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," ibegin:",ibegin," iend:", iend, " jbegin:", jbegin, " jend:", jend280 WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," ii_begin:",ii_begin," ii_end:", ii_end281 WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," Size io_lon:", SIZE(io_lon(ibegin:iend)), " io_lat:", SIZE(io_lat(jbegin:jend))282 ENDIF283 284 309 !On parametrise le domaine: 285 CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin-1, ni=ni, type="rectilinear") 286 CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin-1, nj=nj, data_dim=2) 287 CALL xios_set_domain_attr_hdl(dom, lonvalue_1d=io_lon(ibegin:iend), latvalue_1d=io_lat(jbegin:jend)) 310 CALL xios_set_domain_attr_hdl(dom, ni_glo=nbp_lon, ibegin=0, ni=nbp_lon, type="rectilinear") 311 CALL xios_set_domain_attr_hdl(dom, nj_glo=nbp_lat, jbegin=jj_begin-1, nj=jj_nb, data_dim=2) 312 CALL xios_set_domain_attr_hdl(dom, lonvalue_1d=io_lon(1:nbp_lon), latvalue_1d=io_lat(jj_begin:jj_end)) 313 288 314 IF (.NOT.is_sequential) THEN 289 315 mask(:,:)=.TRUE. 290 316 if (ii_begin>1) mask(1:ii_begin-1,1) = .FALSE. 291 if (ii_end<n i) mask(ii_end+1:ni,nj) = .FALSE.317 if (ii_end<nbp_lon) mask(ii_end+1:nbp_lon,jj_nb) = .FALSE. 292 318 ! special case for south pole 293 if ((ii_end .eq.1).and.(is_south_pole)) mask(1:ni,nj)=.true.319 if ((ii_end==1).and.(is_south_pole_dyn)) mask(1:nbp_lon,jj_nb)=.true. 294 320 IF (prt_level >= 10) THEN 295 321 WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,1)=",mask(:,1) 296 WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:, nj)=",mask(:,nj)322 WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,jj_nb)=",mask(:,jj_nb) 297 323 ENDIF 298 324 CALL xios_set_domain_attr_hdl(dom, mask_2d=mask) … … 306 332 IF (prt_level >= 10) WRITE(lunout,*) "wxios_domain_param: Invalid domain: ", trim(dom_id) 307 333 END IF 334 !$OMP END MASTER 335 308 336 END SUBROUTINE wxios_domain_param 309 337 338 339 SUBROUTINE wxios_domain_param_unstructured(dom_id,flip_coordinates) 340 USE geometry_mod, ONLY : longitude, latitude, boundslon, boundslat,ind_cell_glo 341 USE mod_grid_phy_lmdz, ONLY : nvertex, klon_glo 342 USE mod_phys_lmdz_para 343 USE nrtype, ONLY : PI 344 IMPLICIT NONE 345 CHARACTER(len=*),INTENT(IN) :: dom_id ! domain identifier 346 LOGICAL,OPTIONAL,INTENT(IN) :: flip_coordinates ! .true. to change signs 347 ! of coordinates 348 LOGICAL :: flip_axes=.false. ! default; do not swap axes 349 REAL :: lon_mpi(klon_mpi) 350 REAL :: lat_mpi(klon_mpi) 351 REAL :: boundslon_mpi(klon_mpi,nvertex) 352 REAL :: boundslat_mpi(klon_mpi,nvertex) 353 INTEGER :: ind_cell_glo_mpi(klon_mpi) 354 TYPE(xios_domaingroup) :: dom 355 356 IF (PRESENT(flip_coordinates)) flip_axes=flip_coordinates 357 358 IF (flip_axes) THEN 359 ! change signs of axes and boundaries 360 CALL gather_omp(-longitude*180/PI,lon_mpi) 361 CALL gather_omp(-latitude*180/PI,lat_mpi) 362 CALL gather_omp(-boundslon*180/PI,boundslon_mpi) 363 CALL gather_omp(-boundslat*180/PI,boundslat_mpi) 364 ELSE 365 CALL gather_omp(longitude*180/PI,lon_mpi) 366 CALL gather_omp(latitude*180/PI,lat_mpi) 367 CALL gather_omp(boundslon*180/PI,boundslon_mpi) 368 CALL gather_omp(boundslat*180/PI,boundslat_mpi) 369 ENDIF 370 CALL gather_omp(ind_cell_glo,ind_cell_glo_mpi) 371 372 373 !$OMP MASTER 374 CALL xios_get_domaingroup_handle(dom_id, dom) 375 376 !On parametrise le domaine: 377 CALL xios_set_attr(dom, ni_glo=klon_glo, ibegin=ij_begin-1, ni=ij_nb, type="unstructured") 378 CALL xios_set_attr(dom, nvertex=nvertex, lonvalue_1d=lon_mpi, latvalue_1d=lat_mpi, & 379 bounds_lon_1d=TRANSPOSE(boundslon_mpi), bounds_lat_1d=TRANSPOSE(boundslat_mpi) ) 380 CALL xios_set_attr(dom, i_index=ind_cell_glo_mpi(:)-1) 381 !$OMP END MASTER 382 383 END SUBROUTINE wxios_domain_param_unstructured 384 385 386 387 310 388 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 311 389 ! Pour déclarer un axe vertical !!!!!!!!!!!!!!!
Note: See TracChangeset
for help on using the changeset viewer.