Changeset 2351 for LMDZ5/trunk/libf/phy_common
- Timestamp:
- Aug 25, 2015, 5:14:59 PM (9 years ago)
- Location:
- LMDZ5/trunk/libf/phy_common
- Files:
-
- 1 added
- 4 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/phy_common/mod_grid_phy_lmdz.F90
r2326 r2351 8 8 grid2dTo1d_glo_igen, grid2dTo1d_glo_rgen, grid2dTo1d_glo_lgen 9 9 10 INTEGER,PARAMETER :: unstructured=0 11 INTEGER,PARAMETER :: regular_lonlat=1 12 13 INTEGER,SAVE :: grid_type 14 INTEGER,SAVE :: nvertex 10 15 INTEGER,SAVE :: nbp_lon ! == iim 11 INTEGER,SAVE :: nbp_lat ! == jjmp1 16 INTEGER,SAVE :: nbp_lat ! == jjmp1 (or == 1 if running 1D model) 12 17 INTEGER,SAVE :: nbp_lev ! == llm 13 INTEGER,SAVE :: klon_glo 18 INTEGER,SAVE :: klon_glo ! total number of atmospheric columns 14 19 15 20 INTERFACE grid1dTo2d_glo … … 32 37 33 38 34 SUBROUTINE Init_grid_phy_lmdz(iim,jjp1,llm)39 SUBROUTINE init_grid_phy_lmdz(grid_type_,nvertex_,nbp_lon_,nbp_lat_,nbp_lev_) 35 40 IMPLICIT NONE 36 INTEGER, INTENT(in) :: iim 37 INTEGER, INTENT(in) :: jjp1 38 INTEGER, INTENT(in) :: llm 39 40 nbp_lon=iim 41 nbp_lat=jjp1 42 nbp_lev=llm 43 klon_glo=(iim*jjp1)-2*(iim-1) 44 45 END SUBROUTINE Init_grid_phy_lmdz 41 INTEGER,INTENT(IN) :: grid_type_ 42 INTEGER,INTENT(IN) :: nvertex_ 43 INTEGER, INTENT(IN) :: nbp_lon_ 44 INTEGER, INTENT(IN) :: nbp_lat_ 45 INTEGER, INTENT(IN) :: nbp_lev_ 46 47 grid_type = grid_type_ 48 nvertex = nvertex_ 49 nbp_lon = nbp_lon_ 50 nbp_lat = nbp_lat_ 51 nbp_lev = nbp_lev_ 52 53 IF (nbp_lon*nbp_lat==1) THEN 54 klon_glo=1 55 ELSE 56 klon_glo=(nbp_lon*nbp_lat)-2*(nbp_lon-1) 57 ENDIF 58 59 END SUBROUTINE init_grid_phy_lmdz 46 60 47 61 -
LMDZ5/trunk/libf/phy_common/mod_phys_lmdz_mpi_data.F90
r2326 r2351 3 3 ! 4 4 MODULE mod_phys_lmdz_mpi_data 5 USE mod_const_mpi5 ! USE mod_const_mpi 6 6 7 7 INTEGER,SAVE :: ii_begin … … 35 35 INTEGER,SAVE :: mpi_rank 36 36 INTEGER,SAVE :: mpi_size 37 INTEGER,SAVE :: mpi_root 37 INTEGER,SAVE :: mpi_master 38 ! INTEGER,SAVE :: mpi_root 38 39 LOGICAL,SAVE :: is_mpi_root 39 40 LOGICAL,SAVE :: is_using_mpi … … 43 44 LOGICAL,SAVE :: is_south_pole 44 45 INTEGER,SAVE :: COMM_LMDZ_PHY 46 INTEGER,SAVE :: MPI_REAL_LMDZ ! MPI_REAL8 45 47 46 48 CONTAINS 47 49 48 SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib) 49 USE mod_const_mpi, ONLY : COMM_LMDZ 50 ! SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib) 51 SUBROUTINE init_phys_lmdz_mpi_data(nbp, nbp_lon, nbp_lat, communicator) 52 ! USE mod_const_mpi, ONLY : COMM_LMDZ 50 53 IMPLICIT NONE 51 INTEGER,INTENT(in) :: iim 52 INTEGER,INTENT(in) :: jjp1 53 INTEGER,INTENT(in) :: nb_proc 54 INTEGER,INTENT(in) :: distrib(0:nb_proc-1) 55 54 #ifdef CPP_MPI 55 INCLUDE 'mpif.h' 56 #endif 57 INTEGER,INTENT(in) :: nbp 58 INTEGER,INTENT(in) :: nbp_lon 59 INTEGER,INTENT(in) :: nbp_lat 60 INTEGER,INTENT(in) :: communicator 61 62 INTEGER,ALLOCATABLE :: distrib(:) 56 63 INTEGER :: ierr 57 64 INTEGER :: klon_glo … … 64 71 #endif 65 72 66 if ( iim.eq.1) then73 if ((nbp_lon.eq.1).and.(nbp_lat.eq.1)) then ! running 1D column model 67 74 klon_glo=1 68 75 else 69 klon_glo=iim*(jjp1-2)+2 76 ! The usual global physics grid: 1 point for each pole and nbp_lon points 77 ! for all other latitudes 78 klon_glo=nbp_lon*(nbp_lat-2)+2 70 79 endif 71 80 72 COMM_LMDZ_PHY= COMM_LMDZ81 COMM_LMDZ_PHY=communicator 73 82 74 83 IF (is_using_mpi) THEN 75 84 #ifdef CPP_MPI 85 MPI_REAL_LMDZ=MPI_REAL8 76 86 CALL MPI_COMM_SIZE(COMM_LMDZ_PHY,mpi_size,ierr) 77 87 CALL MPI_COMM_RANK(COMM_LMDZ_PHY,mpi_rank,ierr) … … 82 92 ENDIF 83 93 94 ALLOCATE(distrib(0:mpi_size-1)) 95 96 IF (is_using_mpi) THEN 97 #ifdef CPP_MPI 98 CALL MPI_ALLGATHER(nbp,1,MPI_INTEGER,distrib,1,MPI_INTEGER,COMM_LMDZ_PHY,ierr) 99 #endif 100 ELSE 101 distrib(:)=nbp 102 ENDIF 103 104 84 105 IF (mpi_rank == 0) THEN 85 mpi_ root= 0106 mpi_master = 0 86 107 is_mpi_root = .true. 87 108 ENDIF … … 115 136 116 137 117 klon_mpi_para_nb(0:mpi_size-1)=distrib(0: nb_proc-1)138 klon_mpi_para_nb(0:mpi_size-1)=distrib(0:mpi_size-1) 118 139 119 140 DO i=0,mpi_size-1 … … 132 153 ij_para_begin(i) = 1 133 154 ELSE 134 ij_para_begin(i) = klon_mpi_para_begin(i)+ iim-1155 ij_para_begin(i) = klon_mpi_para_begin(i)+nbp_lon-1 135 156 ENDIF 136 157 137 jj_para_begin(i) = (ij_para_begin(i)-1)/ iim+ 1138 ii_para_begin(i) = MOD(ij_para_begin(i)-1, iim) + 1158 jj_para_begin(i) = (ij_para_begin(i)-1)/nbp_lon + 1 159 ii_para_begin(i) = MOD(ij_para_begin(i)-1,nbp_lon) + 1 139 160 140 161 141 ij_para_end(i) = klon_mpi_para_end(i)+ iim-1142 jj_para_end(i) = (ij_para_end(i)-1)/ iim+ 1143 ii_para_end(i) = MOD(ij_para_end(i)-1, iim) + 1162 ij_para_end(i) = klon_mpi_para_end(i)+nbp_lon-1 163 jj_para_end(i) = (ij_para_end(i)-1)/nbp_lon + 1 164 ii_para_end(i) = MOD(ij_para_end(i)-1,nbp_lon) + 1 144 165 145 166 … … 166 187 167 188 SUBROUTINE print_module_data 189 USE print_control_mod, ONLY: lunout 168 190 IMPLICIT NONE 169 INCLUDE "iniprint.h"191 ! INCLUDE "iniprint.h" 170 192 171 193 WRITE(lunout,*) 'ii_begin =', ii_begin … … 193 215 WRITE(lunout,*) 'mpi_rank =', mpi_rank 194 216 WRITE(lunout,*) 'mpi_size =', mpi_size 195 WRITE(lunout,*) 'mpi_ root =', mpi_root217 WRITE(lunout,*) 'mpi_master =', mpi_master 196 218 WRITE(lunout,*) 'is_mpi_root =', is_mpi_root 197 219 WRITE(lunout,*) 'is_north_pole =', is_north_pole -
LMDZ5/trunk/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90
r2326 r2351 1236 1236 1237 1237 SUBROUTINE bcast_mpi_cgen(var,nb) 1238 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1238 USE mod_phys_lmdz_mpi_data 1239 1239 IMPLICIT NONE 1240 1240 … … 1250 1250 1251 1251 #ifdef CPP_MPI 1252 CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_ root_x,COMM_LMDZ_PHY,ierr)1252 CALL MPI_BCAST(Var,nb,MPI_CHARACTER,mpi_master,COMM_LMDZ_PHY,ierr) 1253 1253 #endif 1254 1254 … … 1258 1258 1259 1259 SUBROUTINE bcast_mpi_igen(var,nb) 1260 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1260 USE mod_phys_lmdz_mpi_data 1261 1261 IMPLICIT NONE 1262 1262 … … 1272 1272 1273 1273 #ifdef CPP_MPI 1274 CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_ root_x,COMM_LMDZ_PHY,ierr)1274 CALL MPI_BCAST(Var,nb,MPI_INTEGER,mpi_master,COMM_LMDZ_PHY,ierr) 1275 1275 #endif 1276 1276 … … 1281 1281 1282 1282 SUBROUTINE bcast_mpi_rgen(var,nb) 1283 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1283 USE mod_phys_lmdz_mpi_data 1284 1284 IMPLICIT NONE 1285 1285 … … 1295 1295 1296 1296 #ifdef CPP_MPI 1297 CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_ root_x,COMM_LMDZ_PHY,ierr)1297 CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_master,COMM_LMDZ_PHY,ierr) 1298 1298 #endif 1299 1299 … … 1304 1304 1305 1305 SUBROUTINE bcast_mpi_lgen(var,nb) 1306 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1306 USE mod_phys_lmdz_mpi_data 1307 1307 IMPLICIT NONE 1308 1308 … … 1318 1318 1319 1319 #ifdef CPP_MPI 1320 CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_ root_x,COMM_LMDZ_PHY,ierr)1320 CALL MPI_BCAST(Var,nb,MPI_LOGICAL,mpi_master,COMM_LMDZ_PHY,ierr) 1321 1321 #endif 1322 1322 … … 1326 1326 1327 1327 SUBROUTINE scatter_mpi_igen(VarIn, VarOut, dimsize) 1328 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1328 USE mod_phys_lmdz_mpi_data 1329 1329 USE mod_grid_phy_lmdz 1330 1330 IMPLICIT NONE … … 1365 1365 #ifdef CPP_MPI 1366 1366 CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_INTEGER,VarOut,klon_mpi*dimsize, & 1367 MPI_INTEGER,mpi_ root_x, COMM_LMDZ_PHY,ierr)1367 MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr) 1368 1368 #endif 1369 1369 … … 1371 1371 1372 1372 SUBROUTINE scatter_mpi_rgen(VarIn, VarOut, dimsize) 1373 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1373 USE mod_phys_lmdz_mpi_data 1374 1374 USE mod_grid_phy_lmdz 1375 1375 IMPLICIT NONE … … 1409 1409 #ifdef CPP_MPI 1410 1410 CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_REAL_LMDZ,VarOut,klon_mpi*dimsize, & 1411 MPI_REAL_LMDZ,mpi_ root_x, COMM_LMDZ_PHY,ierr)1411 MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr) 1412 1412 1413 1413 #endif … … 1417 1417 1418 1418 SUBROUTINE scatter_mpi_lgen(VarIn, VarOut, dimsize) 1419 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1419 USE mod_phys_lmdz_mpi_data 1420 1420 USE mod_grid_phy_lmdz 1421 1421 IMPLICIT NONE … … 1455 1455 #ifdef CPP_MPI 1456 1456 CALL MPI_SCATTERV(VarTmp,counts,displs,MPI_LOGICAL,VarOut,klon_mpi*dimsize, & 1457 MPI_LOGICAL,mpi_ root_x, COMM_LMDZ_PHY,ierr)1457 MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr) 1458 1458 #endif 1459 1459 … … 1464 1464 1465 1465 SUBROUTINE gather_mpi_igen(VarIn, VarOut, dimsize) 1466 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1466 USE mod_phys_lmdz_mpi_data 1467 1467 USE mod_grid_phy_lmdz 1468 1468 IMPLICIT NONE … … 1500 1500 #ifdef CPP_MPI 1501 1501 CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_INTEGER,VarTmp,counts,displs, & 1502 MPI_INTEGER,mpi_ root_x, COMM_LMDZ_PHY,ierr)1502 MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr) 1503 1503 #endif 1504 1504 … … 1518 1518 1519 1519 SUBROUTINE gather_mpi_rgen(VarIn, VarOut, dimsize) 1520 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1520 USE mod_phys_lmdz_mpi_data 1521 1521 USE mod_grid_phy_lmdz 1522 1522 IMPLICIT NONE … … 1553 1553 #ifdef CPP_MPI 1554 1554 CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_REAL_LMDZ,VarTmp,counts,displs, & 1555 MPI_REAL_LMDZ,mpi_ root_x, COMM_LMDZ_PHY,ierr)1555 MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr) 1556 1556 #endif 1557 1557 … … 1570 1570 1571 1571 SUBROUTINE gather_mpi_lgen(VarIn, VarOut, dimsize) 1572 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1572 USE mod_phys_lmdz_mpi_data 1573 1573 USE mod_grid_phy_lmdz 1574 1574 IMPLICIT NONE … … 1606 1606 #ifdef CPP_MPI 1607 1607 CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_LOGICAL,VarTmp,counts,displs, & 1608 MPI_LOGICAL,mpi_ root_x, COMM_LMDZ_PHY,ierr)1608 MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr) 1609 1609 #endif 1610 1610 … … 1625 1625 1626 1626 SUBROUTINE reduce_sum_mpi_igen(VarIn,VarOut,nb) 1627 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1627 USE mod_phys_lmdz_mpi_data 1628 1628 USE mod_grid_phy_lmdz 1629 1629 IMPLICIT NONE … … 1645 1645 1646 1646 #ifdef CPP_MPI 1647 CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_ root_x,COMM_LMDZ_PHY,ierr)1647 CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_INTEGER,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr) 1648 1648 #endif 1649 1649 … … 1651 1651 1652 1652 SUBROUTINE reduce_sum_mpi_rgen(VarIn,VarOut,nb) 1653 USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root1653 USE mod_phys_lmdz_mpi_data 1654 1654 USE mod_grid_phy_lmdz 1655 1655 … … 1671 1671 1672 1672 #ifdef CPP_MPI 1673 CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_ root_x,COMM_LMDZ_PHY,ierr)1673 CALL MPI_REDUCE(VarIn,VarOut,nb,MPI_REAL_LMDZ,MPI_SUM,mpi_master,COMM_LMDZ_PHY,ierr) 1674 1674 #endif 1675 1675 … … 1901 1901 1902 1902 END MODULE mod_phys_lmdz_mpi_transfert 1903 -
LMDZ5/trunk/libf/phy_common/mod_phys_lmdz_para.F90
r2326 r2351 16 16 CONTAINS 17 17 18 SUBROUTINE Init_phys_lmdz_para( iim,jjp1,nb_proc,distrib)18 SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,communicator) 19 19 IMPLICIT NONE 20 INTEGER,INTENT(in) :: iim21 INTEGER,INTENT(in) :: jjp122 INTEGER,INTENT(in) :: nb _proc23 INTEGER,INTENT(in) :: distrib(0:nb_proc-1)20 INTEGER,INTENT(in) :: nbp 21 INTEGER,INTENT(in) :: nbp_lon 22 INTEGER,INTENT(in) :: nbp_lat 23 INTEGER,INTENT(in) :: communicator 24 24 25 CALL Init_phys_lmdz_mpi_data( iim,jjp1,nb_proc,distrib)25 CALL Init_phys_lmdz_mpi_data(nbp,nbp_lon,nbp_lat,communicator) 26 26 !$OMP PARALLEL 27 27 CALL Init_phys_lmdz_omp_data(klon_mpi) -
LMDZ5/trunk/libf/phy_common/physics_distribution_mod.F90
r2348 r2351 1 1 ! 2 !$ Header$2 !$Id$ 3 3 ! 4 SUBROUTINE Init_Phys_lmdz(iim,jjp1,llm,nb_proc,distrib) 5 USE mod_phys_lmdz_para, ONLY: Init_phys_lmdz_para, klon_omp 6 USE mod_grid_phy_lmdz, ONLY: Init_grid_phy_lmdz, nbp_lev 7 USE dimphy, ONLY : Init_dimphy 8 USE infotrac_phy, ONLY : type_trac 9 #ifdef REPROBUS 10 USE CHEM_REP, ONLY : Init_chem_rep_phys 11 #endif 12 13 IMPLICIT NONE 14 15 INTEGER,INTENT(in) :: iim 16 INTEGER,INTENT(in) :: jjp1 17 INTEGER,INTENT(in) :: llm 18 INTEGER,INTENT(in) :: nb_proc 19 INTEGER,INTENT(in) :: distrib(0:nb_proc-1) 4 MODULE physics_distribution_mod 20 5 21 6 22 CALL Init_grid_phy_lmdz(iim,jjp1,llm) 23 CALL Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib) 24 !$OMP PARALLEL 25 CALL Init_dimphy(klon_omp,nbp_lev) 7 CONTAINS 26 8 27 ! Initialization of Reprobus 28 IF (type_trac == 'repr') THEN 29 #ifdef REPROBUS 30 CALL Init_chem_rep_phys(klon_omp,nbp_lev) 31 #endif 32 END IF 9 SUBROUTINE init_physics_distribution(grid_type, nvertex, & 10 nbp, nbp_lon, nbp_lat, nbp_lev, & 11 communicator) 12 USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para 13 USE mod_grid_phy_lmdz, ONLY: init_grid_phy_lmdz 14 IMPLICIT NONE 15 INTEGER,INTENT(IN) :: grid_type 16 INTEGER,INTENT(IN) :: nvertex 17 INTEGER,INTENT(IN) :: nbp 18 INTEGER,INTENT(IN) :: nbp_lon 19 INTEGER,INTENT(IN) :: nbp_lat 20 INTEGER,INTENT(IN) :: nbp_lev 21 INTEGER,INTENT(IN) :: communicator 33 22 34 !$OMP END PARALLEL 23 24 CALL init_grid_phy_lmdz(grid_type,nvertex, nbp_lon,nbp_lat,nbp_lev) 25 CALL init_phys_lmdz_para(nbp,nbp_lon, nbp_lat, communicator) 26 27 END SUBROUTINE init_physics_distribution 28 29 !SUBROUTINE Init_Phys_lmdz(iim,jjp1,llm,nb_proc,distrib) 30 ! USE mod_phys_lmdz_para, ONLY: Init_phys_lmdz_para!, klon_omp 31 ! USE mod_grid_phy_lmdz, ONLY: Init_grid_phy_lmdz!, nbp_lev 32 ! USE dimphy, ONLY : Init_dimphy 33 ! USE infotrac_phy, ONLY : type_trac 34 !#ifdef REPROBUS 35 ! USE CHEM_REP, ONLY : Init_chem_rep_phys 36 !#endif 37 38 ! IMPLICIT NONE 39 40 ! INTEGER,INTENT(in) :: iim 41 ! INTEGER,INTENT(in) :: jjp1 42 ! INTEGER,INTENT(in) :: llm 43 ! INTEGER,INTENT(in) :: nb_proc 44 ! INTEGER,INTENT(in) :: distrib(0:nb_proc-1) 45 46 47 ! CALL Init_grid_phy_lmdz(iim,jjp1,llm) 48 ! CALL Init_phys_lmdz_para(iim,jjp1,nb_proc,distrib) 49 !!$OMP PARALLEL 50 ! CALL Init_dimphy(klon_omp,nbp_lev) 51 ! 52 !! Initialization of Reprobus 53 ! IF (type_trac == 'repr') THEN 54 !#ifdef REPROBUS 55 ! CALL Init_chem_rep_phys(klon_omp,nbp_lev) 56 !#endif 57 ! END IF 58 ! 59 !!$OMP END PARALLEL 35 60 36 END SUBROUTINE Init_Phys_lmdz 61 !END SUBROUTINE Init_Phys_lmdz 62 63 64 65 66 67 68 69 70 END MODULE physics_distribution_mod 71
Note: See TracChangeset
for help on using the changeset viewer.