Ignore:
Timestamp:
Apr 22, 2016, 9:02:11 AM (9 years ago)
Author:
emillour
Message:

All models: Further adaptations to keep up with changes in LMDZ5 concerning
physics/dynamics separation:

  • dyn3d:
  • adapted gcm.F so that all physics initializations are now done in iniphysiq.
  • dyn3dpar:
  • adapted gcm.F so that all physics initializations are now done in iniphysiq.
  • updated calfis_p.F to follow up with changes.
  • copied over updated "bands.F90" from LMDZ5.
  • dynphy_lonlat:
  • calfis_p.F90, mod_interface_dyn_phys.F90, follow up of changes in phy_common/mod_* routines
  • phy_common:
  • added "geometry_mod.F90" to store information about the grid (replaces phy*/comgeomphy.F90) and give variables friendlier names: rlond => longitude , rlatd => latitude, airephy => cell_area, cuphy => dx , cvphy => dy
  • added "physics_distribution_mod.F90"
  • updated "mod_grid_phy_lmdz.F90", "mod_phys_lmdz_mpi_data.F90", "mod_phys_lmdz_para.F90", "mod_phys_lmdz_mpi_transfert.F90", "mod_grid_phy_lmdz.F90", "mod_phys_lmdz_omp_data.F90", "mod_phys_lmdz_omp_transfert.F90", "write_field_phy.F90" and "ioipsl_getin_p_mod.F90" to LMDZ5 versions.
  • phy[venus/titan/mars/std]:
  • removed "init_phys_lmdz.F90", "comgeomphy.F90"; adapted routines to use geometry_mod (longitude, latitude, cell_area, etc.)

EM

Location:
trunk/LMDZ.COMMON/libf/phy_common
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/phy_common/ioipsl_getin_p_mod.F90

    r1521 r1543  
    1212USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
    1313USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
    14 use mod_phys_lmdz_para, only : bcast
     14USE mod_phys_lmdz_transfert_para, ONLY : bcast
    1515!-
    1616IMPLICIT NONE
  • trunk/LMDZ.COMMON/libf/phy_common/mod_grid_phy_lmdz.F90

    r1534 r1543  
    11!
    2 !$Header$
     2!$Id $
    33!
    44MODULE mod_grid_phy_lmdz
     
    77  PRIVATE :: grid1dTo2d_glo_igen, grid1dTo2d_glo_rgen, grid1dTo2d_glo_lgen, &
    88             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
    1015  INTEGER,SAVE :: nbp_lon  ! == iim
    11   INTEGER,SAVE :: nbp_lat  ! == jjmp1
     16  INTEGER,SAVE :: nbp_lat  ! == jjmp1 (or == 1 if running 1D model)
    1217  INTEGER,SAVE :: nbp_lev  ! == llm
    13   INTEGER,SAVE :: klon_glo
     18  INTEGER,SAVE :: klon_glo ! total number of atmospheric columns
    1419
    1520  INTERFACE grid1dTo2d_glo
     
    3237
    3338
    34   SUBROUTINE init_grid_phy_lmdz(iim,jjp1,llm)
     39  SUBROUTINE init_grid_phy_lmdz(grid_type_,nvertex_,nbp_lon_,nbp_lat_,nbp_lev_)
    3540  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    
    44     ! Ehouarn: handle 1D case:
     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   
    4553    IF (nbp_lon*nbp_lat==1) THEN
    4654      klon_glo=1
     
    283291
    284292!----------------------------------------------------------------
    285 fonctions generiques (privees)
     293Generic (private) fonctions
    286294!----------------------------------------------------------------
     295 
    287296  SUBROUTINE grid1dTo2d_glo_igen(VarIn,VarOut,dimsize)
     297
    288298    IMPLICIT NONE
    289299
     
    320330
    321331  SUBROUTINE grid1dTo2d_glo_rgen(VarIn,VarOut,dimsize)
     332
    322333    IMPLICIT NONE
    323334
     
    353364
    354365  SUBROUTINE grid1dTo2d_glo_lgen(VarIn,VarOut,dimsize)
     366
    355367    IMPLICIT NONE
    356368   
     
    386398 
    387399  SUBROUTINE grid2dTo1d_glo_igen(VarIn,VarOut,dimsize)
     400
    388401    IMPLICIT NONE
    389402
     
    408421 
    409422  SUBROUTINE grid2dTo1d_glo_rgen(VarIn,VarOut,dimsize)
     423
    410424    IMPLICIT NONE
    411425
     
    430444   
    431445  SUBROUTINE grid2dTo1d_glo_lgen(VarIn,VarOut,dimsize)
     446
    432447    IMPLICIT NONE
    433448
  • trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_mpi_data.F90

    r1521 r1543  
    33!
    44MODULE mod_phys_lmdz_mpi_data
    5   USE mod_const_mpi
     5!  USE mod_const_mpi
    66 
    77  INTEGER,SAVE :: ii_begin
     
    3535  INTEGER,SAVE :: mpi_rank
    3636  INTEGER,SAVE :: mpi_size
    37   INTEGER,SAVE :: mpi_root
     37  INTEGER,SAVE :: mpi_master
     38!  INTEGER,SAVE :: mpi_root
    3839  LOGICAL,SAVE :: is_mpi_root
    3940  LOGICAL,SAVE :: is_using_mpi
     
    4344  LOGICAL,SAVE :: is_south_pole
    4445  INTEGER,SAVE :: COMM_LMDZ_PHY
     46  INTEGER,SAVE :: MPI_REAL_LMDZ   ! MPI_REAL8
    4547
    4648CONTAINS
    4749 
    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
    5053  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(:)
    5663    INTEGER :: ierr
    5764    INTEGER :: klon_glo
     
    6471#endif
    6572   
    66     if (iim.eq.1) then
     73    if ((nbp_lon.eq.1).and.(nbp_lat.eq.1)) then ! running 1D column model
    6774       klon_glo=1
    6875    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
    7079    endif
    7180   
    72     COMM_LMDZ_PHY=COMM_LMDZ
     81    COMM_LMDZ_PHY=communicator
    7382
    7483    IF (is_using_mpi) THEN   
    7584#ifdef CPP_MPI
     85      MPI_REAL_LMDZ=MPI_REAL8
    7686      CALL MPI_COMM_SIZE(COMM_LMDZ_PHY,mpi_size,ierr)   
    7787      CALL MPI_COMM_RANK(COMM_LMDZ_PHY,mpi_rank,ierr)
     
    8292    ENDIF
    8393   
     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
    84105    IF (mpi_rank == 0) THEN
    85       mpi_root = 0
     106      mpi_master = 0
    86107      is_mpi_root = .true.
    87108    ENDIF
     
    115136 
    116137     
    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)
    118139
    119140    DO i=0,mpi_size-1
     
    132153        ij_para_begin(i) = 1
    133154      ELSE
    134         ij_para_begin(i) = klon_mpi_para_begin(i)+iim-1
     155        ij_para_begin(i) = klon_mpi_para_begin(i)+nbp_lon-1
    135156      ENDIF
    136157
    137       jj_para_begin(i) = (ij_para_begin(i)-1)/iim + 1
    138       ii_para_begin(i) = MOD(ij_para_begin(i)-1,iim) + 1
     158      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
    139160
    140161     
    141       ij_para_end(i) = klon_mpi_para_end(i)+iim-1
    142       jj_para_end(i) = (ij_para_end(i)-1)/iim + 1
    143       ii_para_end(i) = MOD(ij_para_end(i)-1,iim) + 1
     162      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
    144165
    145166
     
    161182    klon_mpi       = klon_mpi_para_nb(mpi_rank)
    162183   
    163     CALL print_module_data
    164    
    165   END SUBROUTINE init_phys_lmdz_mpi_data
     184    CALL Print_module_data
     185   
     186  END SUBROUTINE Init_phys_lmdz_mpi_data
    166187
    167188  SUBROUTINE print_module_data
     189!  USE print_control_mod, ONLY: lunout
    168190  IMPLICIT NONE
    169191  INCLUDE "iniprint.h"
     
    193215    WRITE(lunout,*) 'mpi_rank =', mpi_rank
    194216    WRITE(lunout,*) 'mpi_size =', mpi_size
    195     WRITE(lunout,*) 'mpi_root =', mpi_root
     217    WRITE(lunout,*) 'mpi_master =', mpi_master
    196218    WRITE(lunout,*) 'is_mpi_root =', is_mpi_root
    197219    WRITE(lunout,*) 'is_north_pole =', is_north_pole
  • trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90

    r1521 r1543  
    99                     bcast_mpi_i,bcast_mpi_i1,bcast_mpi_i2,bcast_mpi_i3,bcast_mpi_i4, &
    1010                     bcast_mpi_r,bcast_mpi_r1,bcast_mpi_r2,bcast_mpi_r3,bcast_mpi_r4, &
    11                      bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
     11                     bcast_mpi_l,bcast_mpi_l1,bcast_mpi_l2,bcast_mpi_l3,bcast_mpi_l4
    1212  END INTERFACE
    1313
     
    1515    MODULE PROCEDURE scatter_mpi_i,scatter_mpi_i1,scatter_mpi_i2,scatter_mpi_i3, &
    1616                     scatter_mpi_r,scatter_mpi_r1,scatter_mpi_r2,scatter_mpi_r3, &
    17                      scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
     17                     scatter_mpi_l,scatter_mpi_l1,scatter_mpi_l2,scatter_mpi_l3
    1818  END INTERFACE
    1919
     
    2222    MODULE PROCEDURE gather_mpi_i,gather_mpi_i1,gather_mpi_i2,gather_mpi_i3, &
    2323                     gather_mpi_r,gather_mpi_r1,gather_mpi_r2,gather_mpi_r3, &
    24                      gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3 
     24                     gather_mpi_l,gather_mpi_l1,gather_mpi_l2,gather_mpi_l3 
    2525  END INTERFACE
    2626 
     
    2828    MODULE PROCEDURE scatter2D_mpi_i,scatter2D_mpi_i1,scatter2D_mpi_i2,scatter2D_mpi_i3, &
    2929                     scatter2D_mpi_r,scatter2D_mpi_r1,scatter2D_mpi_r2,scatter2D_mpi_r3, &
    30                      scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
     30                     scatter2D_mpi_l,scatter2D_mpi_l1,scatter2D_mpi_l2,scatter2D_mpi_l3
    3131  END INTERFACE
    3232
     
    3434    MODULE PROCEDURE gather2D_mpi_i,gather2D_mpi_i1,gather2D_mpi_i2,gather2D_mpi_i3, &
    3535                     gather2D_mpi_r,gather2D_mpi_r1,gather2D_mpi_r2,gather2D_mpi_r3, &
    36                      gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
     36                     gather2D_mpi_l,gather2D_mpi_l1,gather2D_mpi_l2,gather2D_mpi_l3
    3737  END INTERFACE
    3838 
     
    4545    MODULE PROCEDURE grid1dTo2d_mpi_i,grid1dTo2d_mpi_i1,grid1dTo2d_mpi_i2,grid1dTo2d_mpi_i3, &
    4646                     grid1dTo2d_mpi_r,grid1dTo2d_mpi_r1,grid1dTo2d_mpi_r2,grid1dTo2d_mpi_r3, &
    47                      grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
     47                     grid1dTo2d_mpi_l,grid1dTo2d_mpi_l1,grid1dTo2d_mpi_l2,grid1dTo2d_mpi_l3
    4848 END INTERFACE
    4949
     
    5151    MODULE PROCEDURE grid2dTo1d_mpi_i,grid2dTo1d_mpi_i1,grid2dTo1d_mpi_i2,grid2dTo1d_mpi_i3, &
    5252                     grid2dTo1d_mpi_r,grid2dTo1d_mpi_r1,grid2dTo1d_mpi_r2,grid2dTo1d_mpi_r3, &
    53                      grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
     53                     grid2dTo1d_mpi_l,grid2dTo1d_mpi_l1,grid2dTo1d_mpi_l2,grid2dTo1d_mpi_l3
    5454 END INTERFACE
    5555   
     
    12361236
    12371237  SUBROUTINE bcast_mpi_cgen(var,nb)
    1238     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
     1238    USE mod_phys_lmdz_mpi_data
    12391239    IMPLICIT NONE
    12401240   
     
    12501250   
    12511251#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)
    12531253#endif
    12541254       
     
    12581258     
    12591259  SUBROUTINE bcast_mpi_igen(var,nb)
    1260     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
    1261     IMPLICIT NONE
    1262    
     1260    USE mod_phys_lmdz_mpi_data
     1261    IMPLICIT NONE
     1262   
     1263    INTEGER,INTENT(IN) :: nb
    12631264    INTEGER,DIMENSION(nb),INTENT(INOUT) :: Var
    1264     INTEGER,INTENT(IN) :: nb
    12651265   
    12661266#ifdef CPP_MPI
     
    12721272
    12731273#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)
    12751275#endif
    12761276       
     
    12811281 
    12821282  SUBROUTINE bcast_mpi_rgen(var,nb)
    1283     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
    1284     IMPLICIT NONE
    1285    
     1283    USE mod_phys_lmdz_mpi_data
     1284    IMPLICIT NONE
     1285   
     1286    INTEGER,INTENT(IN) :: nb
    12861287    REAL,DIMENSION(nb),INTENT(INOUT) :: Var
     1288   
     1289#ifdef CPP_MPI
     1290    INCLUDE 'mpif.h'
     1291#endif
     1292    INTEGER :: ierr
     1293
     1294    IF (.not.is_using_mpi) RETURN
     1295
     1296#ifdef CPP_MPI
     1297    CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_master,COMM_LMDZ_PHY,ierr)
     1298#endif
     1299   
     1300  END SUBROUTINE bcast_mpi_rgen
     1301 
     1302
     1303
     1304
     1305  SUBROUTINE bcast_mpi_lgen(var,nb)
     1306    USE mod_phys_lmdz_mpi_data
     1307    IMPLICIT NONE
     1308   
    12871309    INTEGER,INTENT(IN) :: nb
     1310    LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
    12881311   
    12891312#ifdef CPP_MPI
     
    12951318
    12961319#ifdef CPP_MPI
    1297     CALL MPI_BCAST(Var,nb,MPI_REAL_LMDZ,mpi_root_x,COMM_LMDZ_PHY,ierr)
    1298 #endif
    1299    
    1300   END SUBROUTINE bcast_mpi_rgen
    1301  
    1302 
    1303 
    1304 
    1305   SUBROUTINE bcast_mpi_lgen(var,nb)
    1306     USE mod_phys_lmdz_mpi_data ,  mpi_root_x=>mpi_root
    1307     IMPLICIT NONE
    1308    
    1309     LOGICAL,DIMENSION(nb),INTENT(INOUT) :: Var
    1310     INTEGER,INTENT(IN) :: nb
    1311    
    1312 #ifdef CPP_MPI
    1313     INCLUDE 'mpif.h'
    1314 #endif
    1315     INTEGER :: ierr
    1316 
    1317     IF (.not.is_using_mpi) RETURN
    1318 
    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)
    13211321#endif
    13221322
     
    13261326
    13271327  SUBROUTINE scatter_mpi_igen(VarIn, VarOut, dimsize)
    1328     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
     1328    USE mod_phys_lmdz_mpi_data
    13291329    USE mod_grid_phy_lmdz
    13301330    IMPLICIT NONE
     
    13651365#ifdef CPP_MPI
    13661366    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)
    13681368#endif
    13691369
     
    13711371
    13721372  SUBROUTINE scatter_mpi_rgen(VarIn, VarOut, dimsize)
    1373     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
     1373    USE mod_phys_lmdz_mpi_data
    13741374    USE mod_grid_phy_lmdz
    13751375    IMPLICIT NONE
     
    14091409#ifdef CPP_MPI
    14101410    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)
    14121412
    14131413#endif
     
    14171417 
    14181418  SUBROUTINE scatter_mpi_lgen(VarIn, VarOut, dimsize)
    1419     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
     1419    USE mod_phys_lmdz_mpi_data
    14201420    USE mod_grid_phy_lmdz
    14211421    IMPLICIT NONE
     
    14551455#ifdef CPP_MPI
    14561456    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)
    14581458#endif
    14591459
     
    14641464
    14651465  SUBROUTINE gather_mpi_igen(VarIn, VarOut, dimsize)
    1466     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
     1466    USE mod_phys_lmdz_mpi_data
    14671467    USE mod_grid_phy_lmdz
    14681468    IMPLICIT NONE
     
    14931493        displs(rank)=Index-1
    14941494        counts(rank)=nb*dimsize
    1495         Index=Index+nb*dimsize
     1495        Index=Index+nb*dimsize
    14961496      ENDDO
    14971497     
     
    15001500#ifdef CPP_MPI
    15011501    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_INTEGER,VarTmp,counts,displs,   &
    1502                      MPI_INTEGER,mpi_root_x, COMM_LMDZ_PHY,ierr)
    1503 #endif
    1504 
    1505                          
     1502                     MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
     1503#endif
     1504
     1505                         
    15061506    IF (is_mpi_root) THEN
    15071507      Index=1
     
    15101510        DO i=1,dimsize
    15111511          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
    1512           Index=Index+nb
     1512          Index=Index+nb
    15131513        ENDDO
    15141514      ENDDO
     
    15181518
    15191519  SUBROUTINE gather_mpi_rgen(VarIn, VarOut, dimsize)
    1520     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
     1520    USE mod_phys_lmdz_mpi_data
    15211521    USE mod_grid_phy_lmdz
    15221522    IMPLICIT NONE
     
    15421542        displs(rank)=Index-1
    15431543        counts(rank)=nb*dimsize
    1544         Index=Index+nb*dimsize
     1544        Index=Index+nb*dimsize
    15451545      ENDDO
    15461546    ENDIF
     
    15531553#ifdef CPP_MPI
    15541554    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_REAL_LMDZ,VarTmp,counts,displs,   &
    1555                       MPI_REAL_LMDZ,mpi_root_x, COMM_LMDZ_PHY,ierr)
    1556 #endif
    1557                          
     1555                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
     1556#endif
     1557                         
    15581558    IF (is_mpi_root) THEN
    15591559      Index=1
     
    15621562        DO i=1,dimsize
    15631563          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
    1564           Index=Index+nb
     1564          Index=Index+nb
    15651565        ENDDO
    15661566      ENDDO
     
    15701570
    15711571  SUBROUTINE gather_mpi_lgen(VarIn, VarOut, dimsize)
    1572     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
     1572    USE mod_phys_lmdz_mpi_data
    15731573    USE mod_grid_phy_lmdz
    15741574    IMPLICIT NONE
     
    15991599        displs(rank)=Index-1
    16001600        counts(rank)=nb*dimsize
    1601         Index=Index+nb*dimsize
     1601        Index=Index+nb*dimsize
    16021602      ENDDO
    16031603    ENDIF
     
    16061606#ifdef CPP_MPI
    16071607    CALL MPI_GATHERV(VarIn,klon_mpi*dimsize,MPI_LOGICAL,VarTmp,counts,displs,   &
    1608                       MPI_LOGICAL,mpi_root_x, COMM_LMDZ_PHY,ierr)
    1609 #endif
    1610                          
     1608                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
     1609#endif
     1610                         
    16111611    IF (is_mpi_root) THEN
    16121612      Index=1
     
    16151615        DO i=1,dimsize
    16161616          VarOut(klon_mpi_para_begin(rank):klon_mpi_para_end(rank),i)=VarTmp(Index:Index+nb-1)
    1617           Index=Index+nb
     1617          Index=Index+nb
    16181618        ENDDO
    16191619      ENDDO
     
    16251625
    16261626  SUBROUTINE reduce_sum_mpi_igen(VarIn,VarOut,nb)
    1627     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
     1627    USE mod_phys_lmdz_mpi_data
    16281628    USE mod_grid_phy_lmdz
    16291629    IMPLICIT NONE
     
    16331633#endif
    16341634   
     1635    INTEGER,INTENT(IN) :: nb
    16351636    INTEGER,DIMENSION(nb),INTENT(IN) :: VarIn
    16361637    INTEGER,DIMENSION(nb),INTENT(OUT) :: VarOut   
    1637     INTEGER,INTENT(IN) :: nb
    16381638    INTEGER :: ierr
    16391639   
     
    16451645
    16461646#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)
    16481648#endif
    16491649           
     
    16511651 
    16521652  SUBROUTINE reduce_sum_mpi_rgen(VarIn,VarOut,nb)
    1653     USE mod_phys_lmdz_mpi_data , mpi_root_x=>mpi_root
     1653    USE mod_phys_lmdz_mpi_data
    16541654    USE mod_grid_phy_lmdz
    16551655
     
    16601660#endif
    16611661   
     1662    INTEGER,INTENT(IN) :: nb
    16621663    REAL,DIMENSION(nb),INTENT(IN) :: VarIn
    16631664    REAL,DIMENSION(nb),INTENT(OUT) :: VarOut   
    1664     INTEGER,INTENT(IN) :: nb
    16651665    INTEGER :: ierr
    16661666 
     
    16711671   
    16721672#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)
    16741674#endif
    16751675       
     
    17071707        DO ij=1,nbp_lon
    17081708         VarOut(ij,i)=VarIn(1,i)
    1709         ENDDO
     1709        ENDDO
    17101710      ENDDO
    17111711    ENDIF
     
    17151715        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
    17161716         VarOut(ij,i)=VarIn(klon_mpi,i)
    1717         ENDDO
     1717        ENDDO
    17181718      ENDDO
    17191719    ENDIF
     
    17511751        DO ij=1,nbp_lon
    17521752         VarOut(ij,i)=VarIn(1,i)
    1753         ENDDO
     1753        ENDDO
    17541754      ENDDO
    17551755    ENDIF
     
    17591759        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
    17601760         VarOut(ij,i)=VarIn(klon_mpi,i)
    1761         ENDDO
     1761        ENDDO
    17621762      ENDDO
    17631763    ENDIF
     
    17961796        DO ij=1,nbp_lon
    17971797         VarOut(ij,i)=VarIn(1,i)
    1798         ENDDO
     1798        ENDDO
    17991799      ENDDO
    18001800    ENDIF
     
    18041804        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
    18051805         VarOut(ij,i)=VarIn(klon_mpi,i)
    1806         ENDDO
     1806        ENDDO
    18071807      ENDDO
    18081808    ENDIF
     
    19011901
    19021902END MODULE mod_phys_lmdz_mpi_transfert
     1903
  • trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_omp_data.F90

    r1521 r1543  
    11!
    2 !$Id: mod_phys_lmdz_omp_data.F90 1575 2011-09-21 13:57:48Z jghattas $
     2!$Id: mod_phys_lmdz_omp_data.F90 2326 2015-07-10 12:24:29Z emillour $
    33!
    44MODULE mod_phys_lmdz_omp_data
     
    2020CONTAINS
    2121 
    22   SUBROUTINE init_phys_lmdz_omp_data(klon_mpi)
     22  SUBROUTINE Init_phys_lmdz_omp_data(klon_mpi)
    2323    USE dimphy
    2424    IMPLICIT NONE
     
    8585    klon_omp_end=klon_omp_para_end(omp_rank)
    8686   
    87     CALL print_module_data
     87    CALL Print_module_data
    8888   
    89   END SUBROUTINE init_phys_lmdz_omp_data
     89  END SUBROUTINE Init_phys_lmdz_omp_data
    9090
    91   SUBROUTINE print_module_data
     91  SUBROUTINE Print_module_data
    9292  IMPLICIT NONE
    9393  INCLUDE "iniprint.h"
     
    106106!$OMP END CRITICAL
    107107
    108   END SUBROUTINE print_module_data
     108  END SUBROUTINE Print_module_data
    109109END MODULE mod_phys_lmdz_omp_data
  • trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_omp_transfert.F90

    r1521 r1543  
    2525                     bcast_omp_i,bcast_omp_i1,bcast_omp_i2,bcast_omp_i3,bcast_omp_i4, &
    2626                     bcast_omp_r,bcast_omp_r1,bcast_omp_r2,bcast_omp_r3,bcast_omp_r4, &
    27                      bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
     27                     bcast_omp_l,bcast_omp_l1,bcast_omp_l2,bcast_omp_l3,bcast_omp_l4
    2828  END INTERFACE
    2929
     
    3131    MODULE PROCEDURE scatter_omp_i,scatter_omp_i1,scatter_omp_i2,scatter_omp_i3, &
    3232                     scatter_omp_r,scatter_omp_r1,scatter_omp_r2,scatter_omp_r3, &
    33                      scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
     33                     scatter_omp_l,scatter_omp_l1,scatter_omp_l2,scatter_omp_l3
    3434  END INTERFACE
    3535
     
    3838    MODULE PROCEDURE gather_omp_i,gather_omp_i1,gather_omp_i2,gather_omp_i3, &
    3939                     gather_omp_r,gather_omp_r1,gather_omp_r2,gather_omp_r3, &
    40                      gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3 
     40                     gather_omp_l,gather_omp_l1,gather_omp_l2,gather_omp_l3 
    4141  END INTERFACE
    4242 
     
    4848
    4949
    50   PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp
     50  PUBLIC bcast_omp,scatter_omp,gather_omp,reduce_sum_omp, omp_barrier
    5151
    5252CONTAINS
    5353
     54  SUBROUTINE omp_barrier
     55  IMPLICIT NONE
     56
     57!$OMP BARRIER
     58
     59  END SUBROUTINE omp_barrier
     60 
    5461  SUBROUTINE check_buffer_i(buff_size)
    5562  IMPLICIT NONE
     
    733740  IMPLICIT NONE
    734741   
     742    INTEGER,INTENT(IN) :: Nb
    735743    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Var
    736744    INTEGER,DIMENSION(Nb),INTENT(INOUT) :: Buff
    737     INTEGER,INTENT(IN) :: Nb
    738745
    739746    INTEGER :: i
     
    757764  IMPLICIT NONE
    758765   
     766    INTEGER,INTENT(IN) :: Nb
    759767    REAL,DIMENSION(Nb),INTENT(INOUT) :: Var
    760768    REAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
    761     INTEGER,INTENT(IN) :: Nb
    762769
    763770    INTEGER :: i
     
    780787  IMPLICIT NONE
    781788   
     789    INTEGER,INTENT(IN) :: Nb
    782790    LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Var
    783791    LOGICAL,DIMENSION(Nb),INTENT(INOUT) :: Buff
    784     INTEGER,INTENT(IN) :: Nb
    785792 
    786793    INTEGER :: i
  • trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_para.F90

    r1521 r1543  
    1616CONTAINS
    1717
    18   SUBROUTINE init_phys_lmdz_para(iim,jjp1,nb_proc,distrib)
     18  SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,communicator)
    1919  IMPLICIT NONE
    20     INTEGER,INTENT(in) :: iim
    21     INTEGER,INTENT(in) :: jjp1
    22     INTEGER,INTENT(in) :: nb_proc
    23     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
    2424
    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)
    2626!$OMP PARALLEL
    27     CALL init_phys_lmdz_omp_data(klon_mpi)
     27    CALL Init_phys_lmdz_omp_data(klon_mpi)
    2828    klon_loc=klon_omp
    2929    IF (is_mpi_root .AND. is_omp_root) THEN
     
    3232       is_master=.FALSE.
    3333     ENDIF
    34     CALL test_transfert
     34     CALL Test_transfert
    3535!$OMP END PARALLEL   
    3636     IF (is_using_mpi .OR. is_using_omp) THEN
     
    4242     ENDIF
    4343     
    44   END SUBROUTINE init_phys_lmdz_para
     44  END SUBROUTINE Init_phys_lmdz_para
    4545
    46   SUBROUTINE test_transfert
     46  SUBROUTINE Test_transfert
    4747  USE mod_grid_phy_lmdz
    4848  IMPLICIT NONE
     
    108108   
    109109     
    110    END SUBROUTINE test_transfert
     110   END SUBROUTINE Test_transfert
    111111 
    112112END MODULE mod_phys_lmdz_para
  • trunk/LMDZ.COMMON/libf/phy_common/write_field_phy.F90

    r1523 r1543  
    11!
    2 ! $Header$
     2! $Id: write_field_phy.F90 2342 2015-08-19 13:21:38Z emillour $
    33!
    44MODULE write_field_phy
    55
     6  ! Dump a field on the global (nbp_lon by nbp_lat) physics grid
     7 
    68  CONTAINS
    79 
    810    SUBROUTINE WriteField_phy(name,Field,ll)
    9     USE dimphy
    10     USE mod_phys_lmdz_para
    11     USE mod_grid_phy_lmdz
    12     USE Write_Field
     11    USE mod_phys_lmdz_para, ONLY: klon_omp, is_mpi_root, &
     12                                  Gather
     13    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, &
     14                                 Grid1Dto2D_glo
     15    USE Write_Field, ONLY: WriteField
    1316   
    1417    IMPLICIT NONE
    15     include 'dimensions.h'
    16     include 'paramet.h'
    1718
    18     character(len=*)  :: name
    19     INTEGER :: ll
    20     real, dimension(klon_omp,ll) :: Field
    21     real,save,allocatable :: Field_tmp(:,:)
     19    CHARACTER(len=*),INTENT(IN) :: name
     20    INTEGER,INTENT(IN) :: ll
     21    REAL,INTENT(IN) :: Field(klon_omp,ll)
     22
    2223    real, dimension(klon_glo,ll):: New_Field
    23     real, dimension(iim,jjp1,ll):: Field_2d
     24    real, dimension(nbp_lon,nbp_lat,ll):: Field_2d
    2425
    2526    CALL Gather(Field,New_Field)
Note: See TracChangeset for help on using the changeset viewer.