Changeset 3435 for LMDZ6/trunk/libf/phylmd/iophy.F90
- Timestamp:
- Jan 22, 2019, 4:21:59 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/phylmd/iophy.F90
r3266 r3435 18 18 #ifdef CPP_XIOS 19 19 INTERFACE histwrite_phy 20 !#ifdef CPP_XIOSnew21 20 MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy,histwrite2d_phy_old,histwrite3d_phy_old,histwrite2d_xios,histwrite3d_xios,histwrite0d_xios 22 !#else23 ! MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy,histwrite2d_phy_old,histwrite3d_phy_old,histwrite2d_xios,histwrite3d_xios24 !#endif25 26 21 END INTERFACE 27 22 #else … … 52 47 mpi_size, mpi_rank, klon_mpi, & 53 48 is_sequential, is_south_pole_dyn 54 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo55 49 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid_type, unstructured 50 USE print_control_mod, ONLY: prt_level,lunout 56 51 #ifdef CPP_IOIPSL 57 52 USE ioipsl, ONLY: flio_dom_set 58 53 #endif 59 54 #ifdef CPP_XIOS 60 USE wxios, ONLY: wxios_domain_param55 use wxios, ONLY: wxios_domain_param, wxios_domain_param_unstructured, wxios_context_init 61 56 #endif 62 57 IMPLICIT NONE … … 77 72 INTEGER :: data_ibegin, data_iend 78 73 79 CALL gather(rlat,rlat_glo) 80 CALL bcast(rlat_glo) 81 CALL gather(rlon,rlon_glo) 82 CALL bcast(rlon_glo) 74 #ifdef CPP_XIOS 75 CALL wxios_context_init 76 #endif 77 78 79 IF (grid_type==unstructured) THEN 80 81 #ifdef CPP_XIOS 82 CALL wxios_domain_param_unstructured("dom_glo") 83 #endif 84 85 ELSE 86 87 CALL gather(rlat,rlat_glo) 88 CALL bcast(rlat_glo) 89 CALL gather(rlon,rlon_glo) 90 CALL bcast(rlon_glo) 83 91 84 92 !$OMP MASTER … … 133 141 #endif 134 142 #ifdef CPP_XIOS 135 ! Set values for the mask: 136 IF (mpi_rank == 0) THEN 137 data_ibegin = 0 138 ELSE 139 data_ibegin = ii_begin - 1 140 ENDIF 141 142 IF (mpi_rank == mpi_size-1) THEN 143 data_iend = nbp_lon 144 ELSE 145 data_iend = ii_end + 1 146 ENDIF 147 148 IF (prt_level>=10) THEN 149 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end 150 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat 151 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend 152 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend 153 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn 154 ENDIF 155 156 ! Initialize the XIOS domain coreesponding to this process: 157 CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, & 158 1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end, & 159 klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend, & 160 io_lat, io_lon,is_south_pole_dyn,mpi_rank) 143 ! Set values for the mask: 144 IF (mpi_rank == 0) THEN 145 data_ibegin = 0 146 ELSE 147 data_ibegin = ii_begin - 1 148 END IF 149 150 IF (mpi_rank == mpi_size-1) THEN 151 data_iend = nbp_lon 152 ELSE 153 data_iend = ii_end + 1 154 END IF 155 156 IF (prt_level>=10) THEN 157 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end 158 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat 159 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend 160 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend 161 write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole_dyn=",is_south_pole_dyn 162 ENDIF 163 164 ! Initialize the XIOS domain coreesponding to this process: 161 165 #endif 162 166 !$OMP END MASTER 167 168 #ifdef CPP_XIOS 169 CALL wxios_domain_param("dom_glo") 170 #endif 171 172 ENDIF 163 173 164 174 END SUBROUTINE init_iophy_new … … 291 301 is_sequential, klon_mpi_begin, klon_mpi_end, & 292 302 mpi_rank 293 USE mod_grid_phy_lmdz, ONLY: klon_glo, nbp_lon, nbp_lat 303 USE mod_grid_phy_lmdz, ONLY: klon_glo, nbp_lon, nbp_lat, grid1dTo2d_glo 294 304 USE ioipsl, ONLY: histbeg 295 305 … … 366 376 ENDDO 367 377 368 CALL gr _fi_ecrit(1,klon,nbp_lon,nbp_lat,rlon_glo,zx_lon)378 CALL grid1dTo2d_glo(rlon_glo,zx_lon) 369 379 IF ((nbp_lon*nbp_lat).GT.1) THEN 370 380 DO i = 1, nbp_lon … … 373 383 ENDDO 374 384 ENDIF 375 CALL gr _fi_ecrit(1,klon,nbp_lon,nbp_lat,rlat_glo,zx_lat)385 CALL grid1dTo2d_glo(rlat_glo,zx_lat) 376 386 377 387 DO i=1,pim … … 963 973 nid_files, swaerofree_diag, swaero_diag, dryaod_diag, ok_4xCO2atm 964 974 USE print_control_mod, ONLY: prt_level,lunout 965 USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat 975 USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat, grid_type, unstructured, regular_lonlat 966 976 #ifdef CPP_XIOS 967 977 USE xios, ONLY: xios_send_field 968 978 #endif 979 USE print_control_mod, ONLY: lunout, prt_level 969 980 970 981 IMPLICIT NONE … … 1007 1018 IF (.not. ok_all_xml) THEN 1008 1019 IF (prt_level >= 10) THEN 1009 WRITE (lunout,*)"histwrite2d_phy: .not.vars_defined ; time to define ", trim(var%name) 1020 write(lunout,*)"histwrite2d_phy: .not.vars_defined ; time to define ", & 1021 trim(var%name) 1010 1022 ENDIF 1011 1023 DO iff=iff_beg, iff_end … … 1037 1049 ENDIF 1038 1050 !$OMP MASTER 1039 CALL grid1Dto2D_mpi(buffer_omp,Field2d)1051 IF (grid_type==regular_lonlat) CALL grid1Dto2D_mpi(buffer_omp,Field2d) 1040 1052 1041 1053 ! La boucle sur les fichiers: … … 1047 1059 write(lunout,*)'Dans iophy histwrite2D,var%name ', trim(var%name) 1048 1060 ENDIF 1049 IF (SIZE(field) == klon) then 1061 1062 IF (grid_type==regular_lonlat) THEN 1063 IF (SIZE(field) == klon) then 1050 1064 CALL xios_send_field(var%name, Field2d) 1051 ELSE 1052 CALL xios_send_field(var%name, field) 1053 ENDIF 1065 ELSE 1066 CALL xios_send_field(var%name, field) 1067 ENDIF 1068 ELSE IF (grid_type==unstructured) THEN 1069 CALL xios_send_field(var%name, buffer_omp) 1070 ENDIF 1054 1071 IF (prt_level >= 10) THEN 1055 WRITE (lunout,*)'Dans iophy histwrite2D,var%name apres xios_send ', trim(var%name) 1072 write(lunout,*)'Dans iophy histwrite2D,var%name apres xios_send ',& 1073 trim(var%name) 1056 1074 ENDIF 1057 1075 #else … … 1065 1083 IF (firstx) THEN 1066 1084 IF (prt_level >= 10) THEN 1067 WRITE (lunout,*)'Dans iophy histwrite2D,iff,var%name ', iff,trim(var%name) 1068 WRITE (lunout,*)"histwrite2d_phy:.NOT.clef_stations(iff)and iff==iff_beg, call xios_send_field" 1085 write(lunout,*)'Dans iophy histwrite2D,iff,var%name ',& 1086 iff,trim(var%name) 1087 write(lunout,*)"histwrite2d_phy:.NOT.clef_stations(iff)and iff==iff_beg, call xios_send_field" 1069 1088 ENDIF 1070 IF (SIZE(field) == klon) then 1071 CALL xios_send_field(var%name, Field2d) 1072 ELSE 1073 CALL xios_send_field(var%name, field) 1089 IF (grid_type==regular_lonlat) THEN 1090 IF (SIZE(field) == klon) then 1091 CALL xios_send_field(var%name, Field2d) 1092 ELSE 1093 CALL xios_send_field(var%name, field) 1094 ENDIF 1095 ELSE IF (grid_type==unstructured) THEN 1096 CALL xios_send_field(var%name, buffer_omp) 1074 1097 ENDIF 1098 1075 1099 firstx=.false. 1076 1100 ENDIF … … 1085 1109 !#ifdef CPP_XIOS 1086 1110 ! IF (iff == iff_beg) THEN 1087 ! if (prt_level >= 10) then1111 ! IF (prt_level >= 10) THEN 1088 1112 ! write(lunout,*)"histwrite2d_phy: .NOT.clef_stations(iff) and iff==iff_beg, call xios_send_field" 1089 ! endif1113 ! ENDIF 1090 1114 ! CALL xios_send_field(var%name, Field2d) 1091 1115 ! ENDIF … … 1109 1133 ENDIF ! of IF (is_sequential) 1110 1134 #ifndef CPP_IOIPSL_NO_OUTPUT 1111 IF (prt_level >= 10) THE n1135 IF (prt_level >= 10) THEN 1112 1136 write(lunout,*)"histwrite2d_phy: clef_stations(iff) and iff==iff_beg, call wxios_write_2D" 1113 1137 ENDIF … … 1141 1165 nfiles, vars_defined, clef_stations, & 1142 1166 nid_files, swaerofree_diag 1143 USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat 1167 USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat, grid_type, regular_lonlat, unstructured 1144 1168 #ifdef CPP_XIOS 1145 1169 USE xios, ONLY: xios_send_field … … 1206 1230 ENDIF 1207 1231 !$OMP MASTER 1208 CALL grid1Dto2D_mpi(buffer_omp,field3d)1232 IF (grid_type==regular_lonlat) CALL grid1Dto2D_mpi(buffer_omp,field3d) 1209 1233 1210 1234 ! BOUCLE SUR LES FICHIERS … … 1213 1237 IF (ok_all_xml) THEN 1214 1238 #ifdef CPP_XIOS 1215 IF (prt_level >= 10) THEN 1216 write(lunout,*)'Dans iophy histwrite3D,var%name ',trim(var%name) 1239 IF (prt_level >= 10) THEN 1240 write(lunout,*)'Dans iophy histwrite3D,var%name ',& 1241 trim(var%name) 1242 ENDIF 1243 IF (grid_type==regular_lonlat) THEN 1244 IF (SIZE(field,1) == klon) then 1245 CALL xios_send_field(var%name, Field3d(:,:,1:nlevx)) 1246 ELSE 1247 CALL xios_send_field(var%name, field) 1248 ENDIF 1249 ELSE IF (grid_type==unstructured) THEN 1250 CALL xios_send_field(var%name, buffer_omp(:,1:nlevx)) 1217 1251 ENDIF 1218 IF (SIZE(field,1) == klon) then 1219 CALL xios_send_field(var%name, Field3d(:,:,1:nlevx)) 1220 ELSE 1221 CALL xios_send_field(var%name, field) 1222 ENDIF 1252 1223 1253 #else 1224 1254 CALL abort_physic ('iophy','cannot have ok_all_xml = .T. without CPP_XIOS defined' ,1) … … 1230 1260 #ifdef CPP_XIOS 1231 1261 IF (firstx) THEN 1232 IF (prt_level >= 10) THE n1233 WRITE(lunout,*)'Dans iophy, histwrite3D iff nlev klev firstx', &1262 IF (prt_level >= 10) THEN 1263 write(lunout,*)'Dans iophy, histwrite3D iff nlev klev firstx', & 1234 1264 iff,nlev,klev, firstx 1235 WRITE(lunout,*)'histwrite3d_phy: call xios_send_field for ', &1265 write(lunout,*)'histwrite3d_phy: call xios_send_field for ', & 1236 1266 trim(var%name), ' with iim jjm nlevx = ', & 1237 1267 nbp_lon,jj_nb,nlevx 1238 1268 ENDIF 1239 IF (SIZE(field,1) == klon) then 1240 CALL xios_send_field(var%name, Field3d(:,:,1:nlevx)) 1241 ELSE 1242 CALL xios_send_field(var%name, field) 1269 IF (grid_type==regular_lonlat) THEN 1270 IF (SIZE(field,1) == klon) then 1271 CALL xios_send_field(var%name, Field3d(:,:,1:nlevx)) 1272 ELSE 1273 CALL xios_send_field(var%name, field) 1274 ENDIF 1275 ELSE IF (grid_type==unstructured) THEN 1276 CALL xios_send_field(var%name, buffer_omp(:,1:nlevx)) 1243 1277 ENDIF 1278 1244 1279 firstx=.false. 1245 1280 ENDIF … … 1305 1340 is_sequential, klon_mpi_begin, klon_mpi_end, & 1306 1341 jj_nb, klon_mpi, is_master 1307 USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat 1342 USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat, grid_type, unstructured 1308 1343 USE xios, ONLY: xios_send_field 1309 1344 USE print_control_mod, ONLY: prt_level,lunout … … 1335 1370 CALL Gather_omp(field,buffer_omp) 1336 1371 !$OMP MASTER 1372 1373 IF (grid_type==unstructured) THEN 1374 1375 CALL xios_send_field(field_name, buffer_omp) 1376 1377 ELSE 1378 1337 1379 CALL grid1Dto2D_mpi(buffer_omp,Field2d) 1338 1380 … … 1342 1384 !IF(.NOT.clef_stations(iff)) THEN 1343 1385 IF (.TRUE.) THEN 1344 ALLOCATE(index2d(nbp_lon*jj_nb))1345 ALLOCATE(fieldok(nbp_lon*jj_nb))1346 1347 1386 1348 1387 CALL xios_send_field(field_name, Field2d) … … 1365 1404 ENDDO 1366 1405 ENDIF 1367 1368 ENDIF1369 1370 DEALLOCATE(index2d)1371 DEALLOCATE(fieldok)1406 DEALLOCATE(index2d) 1407 DEALLOCATE(fieldok) 1408 1409 ENDIF 1410 ENDIF 1372 1411 !$OMP END MASTER 1373 1412 ENDIF … … 1385 1424 jj_nb, klon_mpi, is_master 1386 1425 USE xios, ONLY: xios_send_field 1387 USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat 1426 USE mod_grid_phy_lmdz, ONLY : nbp_lon, nbp_lat, grid_type, unstructured 1388 1427 USE print_control_mod, ONLY: prt_level,lunout 1389 1428 … … 1416 1455 CALL Gather_omp(field,buffer_omp) 1417 1456 !$OMP MASTER 1457 1458 IF (grid_type==unstructured) THEN 1459 1460 CALL xios_send_field(field_name, buffer_omp(:,1:nlev)) 1461 1462 ELSE 1418 1463 CALL grid1Dto2D_mpi(buffer_omp,field3d) 1419 1464 … … 1423 1468 !IF (.NOT.clef_stations(iff)) THEN 1424 1469 IF(.TRUE.)THEN 1425 ALLOCATE(index3d(nbp_lon*jj_nb*nlev)) 1426 ALLOCATE(fieldok(nbp_lon*jj_nb,nlev)) 1427 CALL xios_send_field(field_name, Field3d(:,:,1:nlev)) 1470 1471 CALL xios_send_field(field_name, Field3d(:,:,1:nlev)) 1428 1472 1429 1473 ELSE … … 1448 1492 ENDDO 1449 1493 ENDIF 1494 DEALLOCATE(index3d) 1495 DEALLOCATE(fieldok) 1450 1496 ENDIF 1451 DEALLOCATE(index3d) 1452 DEALLOCATE(fieldok) 1497 ENDIF 1453 1498 !$OMP END MASTER 1454 1499 ENDIF
Note: See TracChangeset
for help on using the changeset viewer.