Ignore:
Timestamp:
Aug 25, 2015, 5:14:59 PM (9 years ago)
Author:
Ehouarn Millour
Message:

More on physics/dynamics separation and cleanup:

  • Set things up so that all physics-related initializations are done via iniphysiq.
  • Created a "geometry_mod.F90" module in phy_common to store information on the loacl grid (i.e. replaces comgeomphy) and moreover give these variables more obvious names (e.g.: rlond => longitude, rlatd => latitude, airephy => cell_area).
  • removed obsolete comgeomphy.h and comgeomphy.F90

EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/phy_common/mod_phys_lmdz_mpi_data.F90

    r2326 r2351  
    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
     
    166187
    167188  SUBROUTINE print_module_data
     189  USE print_control_mod, ONLY: lunout
    168190  IMPLICIT NONE
    169   INCLUDE "iniprint.h"
     191!  INCLUDE "iniprint.h"
    170192 
    171193    WRITE(lunout,*) 'ii_begin =', ii_begin
     
    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
Note: See TracChangeset for help on using the changeset viewer.