Changeset 2351 for LMDZ5/trunk/libf


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

Location:
LMDZ5/trunk/libf
Files:
2 added
6 deleted
38 edited
2 moved

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/dyn3d/gcm.F90

    r2347 r2351  
    2222  USE infotrac
    2323  USE control_mod
     24  USE mod_const_mpi, ONLY: COMM_LMDZ
    2425
    2526#ifdef INCA
     
    181182  ! A nettoyer. On ne veut qu'une ou deux routines d'interface
    182183  ! dynamique -> physique pour l'initialisation
    183 #ifdef CPP_PHYS
    184   CALL Init_Phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
    185   !      call InitComgeomphy ! now done in iniphysiq
    186 #endif
     184!#ifdef CPP_PHYS
     185!  CALL Init_Phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
     186!  !      call InitComgeomphy ! now done in iniphysiq
     187!#endif
    187188!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    188189  !-----------------------------------------------------------------------
     
    415416     ! Physics:
    416417#ifdef CPP_PHYS
    417      CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys, &
     418     CALL iniphysiq(iim,jjm,llm, &
     419          (jjm-1)*iim+2,comm_lmdz, &
     420          daysec,day_ini,dtphys/nsplit_phys, &
    418421          rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp, &
    419422          iflag_phys)
  • LMDZ5/trunk/libf/dyn3dmem/bands.F90

    r1907 r2351  
    105105   SUBROUTINE  Set_Bands
    106106     USE parallel_lmdz
    107 #ifdef CPP_PHYS
    108 ! Ehouarn: what follows is only related to // physics
    109      USE mod_phys_lmdz_para, ONLY : jj_para_begin,jj_para_end
    110 #endif
    111107     IMPLICIT NONE
    112108     INCLUDE 'dimensions.h'   
    113      INTEGER :: i
     109     INTEGER :: i, ij
     110     INTEGER :: jj_para_begin(0:mpi_size-1)
     111     INTEGER :: jj_para_end(0:mpi_size-1)
    114112       
    115113      do i=0,mpi_size-1
     
    118116      enddo
    119117         
    120 #ifdef CPP_PHYS
    121       do i=0,MPI_Size-1
     118      jj_para_begin(0)=1
     119      ij=distrib_phys(0)+iim-1
     120      jj_para_end(0)=((ij-1)/iim)+1
     121     
     122      DO i=1,mpi_Size-1
     123        ij=ij+1
     124        jj_para_begin(i)=((ij-1)/iim)+1
     125        ij=ij+distrib_phys(i)-1
     126        jj_para_end(i)=((ij-1)/iim)+1
     127      ENDDO
     128 
     129       do i=0,MPI_Size-1
    122130        jj_Nb_physic(i)=jj_para_end(i)-jj_para_begin(i)+1
    123131        if (i/=0) then
     
    139147        endif
    140148      enddo
    141 #endif     
     149
    142150      CALL create_distrib(jj_Nb_Caldyn,distrib_caldyn)
    143151      CALL create_distrib(jj_Nb_vanleer,distrib_vanleer)
     
    479487 
    480488 
     489
  • LMDZ5/trunk/libf/dyn3dmem/gcm.F90

    r2347 r2351  
    1010  USE parallel_lmdz
    1111  USE infotrac
    12 #ifdef CPP_PHYS
    13   USE mod_interface_dyn_phys, ONLY: init_interface_dyn_phys
    14 #endif
     12!#ifdef CPP_PHYS
     13!  USE mod_interface_dyn_phys, ONLY: init_interface_dyn_phys
     14!#endif
    1515  USE mod_hallo
    1616  USE Bands
     
    152152  call Read_Distrib
    153153
    154 #ifdef CPP_PHYS
    155   CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
     154!#ifdef CPP_PHYS
     155!  CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
    156156  !#endif
    157157  !      CALL set_bands
    158158  !#ifdef CPP_PHYS
    159   CALL Init_interface_dyn_phys
    160 #endif
     159!  CALL Init_interface_dyn_phys
     160!#endif
    161161  CALL barrier
    162162
     
    397397     ! Physics:
    398398#ifdef CPP_PHYS
    399      CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys, &
     399     CALL iniphysiq(iim,jjm,llm, &
     400          distrib_phys(mpi_rank),comm_lmdz, &
     401          daysec,day_ini,dtphys/nsplit_phys, &
    400402          rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp, &
    401403          iflag_phys)
  • LMDZ5/trunk/libf/dyn3dpar/bands.F90

    r1907 r2351  
    9393   SUBROUTINE  Set_Bands
    9494     USE parallel_lmdz
    95 #ifdef CPP_PHYS
    96 ! Ehouarn: what follows is only related to // physics
    97      USE mod_phys_lmdz_para, ONLY : jj_para_begin,jj_para_end
    98 #endif
    9995     IMPLICIT NONE
    10096     INCLUDE 'dimensions.h'   
    101      INTEGER :: i
    102        
     97     INTEGER :: i, ij
     98     INTEGER :: jj_para_begin(0:mpi_size-1)
     99     INTEGER :: jj_para_end(0:mpi_size-1)
     100       
    103101      do i=0,mpi_size-1
    104102         jj_nb_vanleer2(i)=(jjm+1)/mpi_size
     
    106104      enddo
    107105         
    108 #ifdef CPP_PHYS
     106      jj_para_begin(0)=1
     107      ij=distrib_phys(0)+iim-1
     108      jj_para_end(0)=((ij-1)/iim)+1
     109     
     110      DO i=1,mpi_Size-1
     111        ij=ij+1
     112        jj_para_begin(i)=((ij-1)/iim)+1
     113        ij=ij+distrib_phys(i)-1
     114        jj_para_end(i)=((ij-1)/iim)+1
     115      ENDDO
     116 
    109117      do i=0,MPI_Size-1
    110118        jj_Nb_physic(i)=jj_para_end(i)-jj_para_begin(i)+1
     
    127135        endif
    128136      enddo
    129 #endif     
    130137     
    131138    end subroutine Set_Bands
  • LMDZ5/trunk/libf/dyn3dpar/gcm.F

    r2347 r2351  
    1414      USE parallel_lmdz
    1515      USE infotrac
    16 #ifdef CPP_PHYS
    17       USE mod_interface_dyn_phys, ONLY: init_interface_dyn_phys
    18 #endif
     16!#ifdef CPP_PHYS
     17!      USE mod_interface_dyn_phys, ONLY: init_interface_dyn_phys
     18!#endif
    1919      USE mod_hallo
    2020      USE Bands
     
    159159      call Read_Distrib
    160160
    161 #ifdef CPP_PHYS
    162         CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
     161!#ifdef CPP_PHYS
     162!        CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
    163163!#endif
    164164!      CALL set_bands
    165165!#ifdef CPP_PHYS
    166       CALL Init_interface_dyn_phys
    167 #endif
     166!      CALL Init_interface_dyn_phys
     167!#endif
    168168      CALL barrier
    169169
     
    403403! Physics:
    404404#ifdef CPP_PHYS
    405          CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys,
     405         CALL iniphysiq(iim,jjm,llm,
     406     &                distrib_phys(mpi_rank),comm_lmdz,
     407     &                daysec,day_ini,dtphys/nsplit_phys,
    406408     &                rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp,
    407409     &                iflag_phys)
  • LMDZ5/trunk/libf/dynlonlat_phylonlat/calfis_loc.F

    r2333 r2351  
    3232c   .........
    3333      USE dimphy
    34       USE mod_phys_lmdz_para, mpi_root_xx=>mpi_root
     34      USE mod_phys_lmdz_mpi_data, mpi_root_xx=>mpi_master
     35      USE mod_phys_lmdz_omp_data, ONLY: klon_omp, klon_omp_begin
     36      USE mod_const_mpi, ONLY: COMM_LMDZ
    3537      USE mod_interface_dyn_phys
    3638      USE IOPHY
  • LMDZ5/trunk/libf/dynlonlat_phylonlat/calfis_p.F

    r2239 r2351  
    2929! If using physics
    3030      USE dimphy
    31       USE mod_phys_lmdz_para, mpi_root_xx=>mpi_root
     31      USE mod_phys_lmdz_mpi_data, mpi_root_xx=>mpi_master
     32      USE mod_phys_lmdz_omp_data, ONLY: klon_omp, klon_omp_begin
     33      USE mod_const_mpi, ONLY: COMM_LMDZ
    3234      USE mod_interface_dyn_phys
    3335      USE IOPHY
  • LMDZ5/trunk/libf/dynlonlat_phylonlat/mod_interface_dyn_phys.F90

    r2239 r2351  
    77 
    88 
     9CONTAINS
     10 
    911#ifdef CPP_PARA
    1012! Interface with parallel physics,
    11 CONTAINS
    12  
    1313  SUBROUTINE Init_interface_dyn_phys
    1414    USE mod_phys_lmdz_mpi_data
     
    5454 
    5555  END SUBROUTINE Init_interface_dyn_phys
     56#else
     57  SUBROUTINE Init_interface_dyn_phys
     58  ! dummy routine for seq case
     59  END SUBROUTINE Init_interface_dyn_phys
    5660#endif
    5761! of #ifdef CPP_PARA
  • LMDZ5/trunk/libf/dynlonlat_phylonlat/phydev/iniphysiq_mod.F90

    r2347 r2351  
    66CONTAINS
    77
    8 SUBROUTINE iniphysiq(iim,jjm,nlayer,punjours, pdayref,ptimestep, &
     8SUBROUTINE iniphysiq(iim,jjm,nlayer, &
     9                     nbp, communicator, &
     10                     punjours, pdayref,ptimestep, &
    911                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv, &
    1012                     prad,pg,pr,pcpp,iflag_phys)
    11   USE dimphy, ONLY: klev ! number of atmospheric levels
    12   USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns
    13                                         ! (on full grid)
     13  USE dimphy, ONLY: init_dimphy
     14  USE mod_grid_phy_lmdz, ONLY: klon_glo,  & ! number of atmospheric columns (on full grid)
     15                               regular_lonlat  ! regular longitude-latitude grid type
    1416  USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid)
    1517                                klon_omp_begin, & ! start index of local omp subgrid
    1618                                klon_omp_end, & ! end index of local omp subgrid
    1719                                klon_mpi_begin ! start indes of columns (on local mpi grid)
    18   USE comgeomphy, ONLY: initcomgeomphy, &
    19                         airephy, & ! physics grid area (m2)
    20                         cuphy, & ! cu coeff. (u_covariant = cu * u)
    21                         cvphy, & ! cv coeff. (v_covariant = cv * v)
    22                         rlond, & ! longitudes
    23                         rlatd ! latitudes
     20  USE geometry_mod, ONLY : init_geometry
    2421  USE infotrac, ONLY: nqtot, type_trac
    2522  USE infotrac_phy, ONLY: init_infotrac_phy
     
    3027  USE inifis_mod, ONLY: inifis
    3128  USE phyaqua_mod, ONLY: iniaqua
     29  USE physics_distribution_mod, ONLY : init_physics_distribution
    3230  USE regular_lonlat_mod, ONLY : init_regular_lonlat, &
    3331                                 east, west, north, south, &
    3432                                 north_east, north_west, &
    3533                                 south_west, south_east
     34  USE mod_interface_dyn_phys, ONLY :  init_interface_dyn_phys
    3635  USE nrtype, ONLY: pi
    3736  IMPLICIT NONE
     
    5352  INTEGER, INTENT (IN) :: iim ! number of atmospheric coulumns along longitudes
    5453  INTEGER, INTENT (IN) :: jjm  ! number of atompsheric columns along latitudes
     54  INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process
     55  INTEGER, INTENT(IN) :: communicator ! MPI communicator
    5556  REAL, INTENT (IN) :: rlatu(jjm+1) ! latitudes of the physics grid
    5657  REAL, INTENT (IN) :: rlatv(jjm) ! latitude boundaries of the physics grid
     
    6566
    6667  INTEGER :: ibegin,iend,offset
    67   INTEGER :: i,j
     68  INTEGER :: i,j,k
    6869  CHARACTER (LEN=20) :: modname='iniphysiq'
    6970  CHARACTER (LEN=80) :: abort_message
     
    7576
    7677  ! global array, on full physics grid:
    77   REAL,ALLOCATABLE :: latfi(:)
    78   REAL,ALLOCATABLE :: lonfi(:)
    79   REAL,ALLOCATABLE :: cufi(:)
    80   REAL,ALLOCATABLE :: cvfi(:)
    81   REAL,ALLOCATABLE :: airefi(:)
    82 
    83   IF (nlayer.NE.klev) THEN
    84     WRITE(lunout,*) 'STOP in ',trim(modname)
    85     WRITE(lunout,*) 'Problem with dimensions :'
    86     WRITE(lunout,*) 'nlayer     = ',nlayer
    87     WRITE(lunout,*) 'klev   = ',klev
    88     abort_message = ''
    89     CALL abort_gcm (modname,abort_message,1)
    90   ENDIF
    91 
    92   !call init_phys_lmdz(iim,jjm+1,llm,1,(/(jjm-1)*iim+2/))
     78  REAL,ALLOCATABLE :: latfi_glo(:)
     79  REAL,ALLOCATABLE :: lonfi_glo(:)
     80  REAL,ALLOCATABLE :: cufi_glo(:)
     81  REAL,ALLOCATABLE :: cvfi_glo(:)
     82  REAL,ALLOCATABLE :: airefi_glo(:)
     83  REAL,ALLOCATABLE :: boundslonfi_glo(:,:)
     84  REAL,ALLOCATABLE :: boundslatfi_glo(:,:)
     85
     86  ! local arrays, on given MPI/OpenMP domain:
     87  REAL,ALLOCATABLE,SAVE :: latfi(:)
     88  REAL,ALLOCATABLE,SAVE :: lonfi(:)
     89  REAL,ALLOCATABLE,SAVE :: cufi(:)
     90  REAL,ALLOCATABLE,SAVE :: cvfi(:)
     91  REAL,ALLOCATABLE,SAVE :: airefi(:)
     92  REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)
     93  REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)
     94!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
     95
     96  ! Initialize Physics distibution and parameters and interface with dynamics
     97  CALL init_physics_distribution(regular_lonlat,4, &
     98                                 nbp,iim,jjm+1,nlayer,communicator)
     99  CALL init_interface_dyn_phys
    93100 
    94101  ! init regular global longitude-latitude grid points and boundaries
     
    115122
    116123  ! Generate global arrays on full physics grid
    117   ALLOCATE(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
    118   ALLOCATE(airefi(klon_glo))
     124  ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo))
     125  ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))
     126  ALLOCATE(airefi_glo(klon_glo))
     127  ALLOCATE(boundslonfi_glo(klon_glo,4))
     128  ALLOCATE(boundslatfi_glo(klon_glo,4))
    119129
    120130    ! North pole
    121     latfi(1)=rlatu(1)
    122     lonfi(1)=0.
    123     cufi(1) = cu(1)
    124     cvfi(1) = cv(1)
     131    latfi_glo(1)=rlatu(1)
     132    lonfi_glo(1)=0.
     133    cufi_glo(1) = cu(1)
     134    cvfi_glo(1) = cv(1)
     135    boundslonfi_glo(1,north_east)=0
     136    boundslatfi_glo(1,north_east)=PI/2
     137    boundslonfi_glo(1,north_west)=2*PI
     138    boundslatfi_glo(1,north_west)=PI/2
     139    boundslonfi_glo(1,south_west)=2*PI
     140    boundslatfi_glo(1,south_west)=rlatv(1)
     141    boundslonfi_glo(1,south_east)=0
     142    boundslatfi_glo(1,south_east)=rlatv(1)
    125143    DO j=2,jjm
    126144      DO i=1,iim
    127         latfi((j-2)*iim+1+i)= rlatu(j)
    128         lonfi((j-2)*iim+1+i)= rlonv(i)
    129         cufi((j-2)*iim+1+i) = cu((j-1)*iim+1+i)
    130         cvfi((j-2)*iim+1+i) = cv((j-1)*iim+1+i)
     145        k=(j-2)*iim+1+i
     146        latfi_glo(k)= rlatu(j)
     147        lonfi_glo(k)= rlonv(i)
     148        cufi_glo(k) = cu((j-1)*iim+1+i)
     149        cvfi_glo(k) = cv((j-1)*iim+1+i)
     150        boundslonfi_glo(k,north_east)=rlonu(i)
     151        boundslatfi_glo(k,north_east)=rlatv(j-1)
     152        boundslonfi_glo(k,north_west)=rlonu(i+1)
     153        boundslatfi_glo(k,north_west)=rlatv(j-1)
     154        boundslonfi_glo(k,south_west)=rlonu(i+1)
     155        boundslatfi_glo(k,south_west)=rlatv(j)
     156        boundslonfi_glo(k,south_east)=rlonu(i)
     157        boundslatfi_glo(k,south_east)=rlatv(j)
    131158      ENDDO
    132159    ENDDO
    133160    ! South pole
    134     latfi(klon_glo)= rlatu(jjm+1)
    135     lonfi(klon_glo)= 0.
    136     cufi(klon_glo) = cu((iim+1)*jjm+1)
    137     cvfi(klon_glo) = cv((iim+1)*jjm-iim)
     161    latfi_glo(klon_glo)= rlatu(jjm+1)
     162    lonfi_glo(klon_glo)= 0.
     163    cufi_glo(klon_glo) = cu((iim+1)*jjm+1)
     164    cvfi_glo(klon_glo) = cv((iim+1)*jjm-iim)
     165    boundslonfi_glo(klon_glo,north_east)= 0
     166    boundslatfi_glo(klon_glo,north_east)= rlatv(jjm)
     167    boundslonfi_glo(klon_glo,north_west)= 2*PI
     168    boundslatfi_glo(klon_glo,north_west)= rlatv(jjm)
     169    boundslonfi_glo(klon_glo,south_west)= 2*PI
     170    boundslatfi_glo(klon_glo,south_west)= -PI/2
     171    boundslonfi_glo(klon_glo,south_east)= 0
     172    boundslatfi_glo(klon_glo,south_east)= -Pi/2
    138173
    139174    ! build airefi(), mesh area on physics grid
    140     CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi)
     175    CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi_glo)
    141176    ! Poles are single points on physics grid
    142     airefi(1)=sum(aire(1:iim,1))
    143     airefi(klon_glo)=sum(aire(1:iim,jjm+1))
     177    airefi_glo(1)=sum(aire(1:iim,1))
     178    airefi_glo(klon_glo)=sum(aire(1:iim,jjm+1))
    144179
    145180    ! Sanity check: do total planet area match between physics and dynamics?
    146181    total_area_dyn=sum(aire(1:iim,1:jjm+1))
    147     total_area_phy=sum(airefi(1:klon_glo))
     182    total_area_phy=sum(airefi_glo(1:klon_glo))
    148183    IF (total_area_dyn/=total_area_phy) THEN
    149184      WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
     
    158193
    159194!$OMP PARALLEL
     195  ! Now generate local lon/lat/cu/cv/area/bounds arrays
     196  ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
     197  ALLOCATE(airefi(klon_omp))
     198  ALLOCATE(boundslonfi(klon_omp,4))
     199  ALLOCATE(boundslatfi(klon_omp,4))
     200
     201
     202  offset = klon_mpi_begin - 1
     203  airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     204  cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     205  cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     206  lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     207  latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     208  boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     209  boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     210
     211  ! copy over local grid longitudes and latitudes
     212  CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
     213                     airefi,cufi,cvfi)
     214
    160215  ! Initialize physical constants in physics:
    161216  CALL inifis(prad,pg,pr,pcpp)
     
    164219  CALL init_infotrac_phy(nqtot,type_trac)
    165220
    166   ! Now generate local lon/lat/cu/cv/area arrays
    167   CALL initcomgeomphy
    168 
    169   offset = klon_mpi_begin - 1
    170   airephy(1:klon_omp) = airefi(offset+klon_omp_begin:offset+klon_omp_end)
    171   cuphy(1:klon_omp) = cufi(offset+klon_omp_begin:offset+klon_omp_end)
    172   cvphy(1:klon_omp) = cvfi(offset+klon_omp_begin:offset+klon_omp_end)
    173   rlond(1:klon_omp) = lonfi(offset+klon_omp_begin:offset+klon_omp_end)
    174   rlatd(1:klon_omp) = latfi(offset+klon_omp_begin:offset+klon_omp_end)
    175 
    176221  ! Additional initializations for aquaplanets
    177222  IF (iflag_phys>=100) THEN
    178     CALL iniaqua(klon_omp,rlatd,rlond,iflag_phys)
     223    CALL iniaqua(klon_omp,iflag_phys)
    179224  ENDIF
    180225!$OMP END PARALLEL
  • LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/ce0l.F90

    r2349 r2351  
    2626  USE filtreg_mod,    ONLY: inifilr
    2727  USE iniphysiq_mod,  ONLY: iniphysiq
     28  USE mod_const_mpi,  ONLY: comm_lmdz
    2829#ifdef inca
    2930  USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic
     
    106107  CALL read_distrib()
    107108  CALL init_mod_hallo()
    108   CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
    109   CALL init_interface_dyn_phys()
    110 #else
    111   CALL Init_Phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
    112109#endif
    113110  WRITE(lunout,*)'---> klon=',klon
     
    126123
    127124  CALL inifilr()
    128   CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys, &
     125  CALL iniphysiq(iim,jjm,llm, &
     126                 distrib_phys(mpi_rank),comm_lmdz, &
     127                 daysec,day_ini,dtphys/nsplit_phys, &
    129128                 rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp,iflag_phys)
    130129  IF(pressure_exner) CALL test_disvert
  • LMDZ5/trunk/libf/dynlonlat_phylonlat/phylmd/iniphysiq_mod.F90

    r2347 r2351  
    66CONTAINS
    77
    8 SUBROUTINE iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep, &
     8SUBROUTINE iniphysiq(ii,jj,nlayer, &
     9                     nbp, communicator, &
     10                     punjours, pdayref,ptimestep, &
    911                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv,       &
    1012                     prad,pg,pr,pcpp,iflag_phys)
    11   USE dimphy, ONLY: klev ! number of atmospheric levels
    12   USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns
    13                                         ! (on full grid)
     13  USE dimphy, ONLY: init_dimphy
     14  USE mod_grid_phy_lmdz, ONLY: klon_glo,  & ! number of atmospheric columns (on full grid)
     15                               regular_lonlat  ! regular longitude-latitude grid type
    1416  USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid)
    1517                                klon_omp_begin, & ! start index of local omp subgrid
    1618                                klon_omp_end, & ! end index of local omp subgrid
    1719                                klon_mpi_begin ! start indes of columns (on local mpi grid)
     20  USE geometry_mod, ONLY : init_geometry
    1821  USE vertical_layers_mod, ONLY : init_vertical_layers
    1922  USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,&
     
    2629                      indnum_fn_num,index_trac,&
    2730                      niso,ntraceurs_zone,ntraciso
     31#ifdef REPROBUS
     32  USE CHEM_REP, ONLY : Init_chem_rep_phys
     33#endif
    2834  USE control_mod, ONLY: dayref,anneeref,day_step,nday,offline
    29   USE comgeomphy, ONLY: initcomgeomphy, &
    30                         airephy, & ! physics grid area (m2)
    31                         cuphy, & ! cu coeff. (u_covariant = cu * u)
    32                         cvphy, & ! cv coeff. (v_covariant = cv * v)
    33                         rlond, & ! longitudes
    34                         rlatd ! latitudes
    3535  USE inifis_mod, ONLY: inifis
    3636  USE time_phylmdz_mod, ONLY: init_time
     
    3838  USE phystokenc_mod, ONLY: init_phystokenc
    3939  USE phyaqua_mod, ONLY: iniaqua
     40  USE physics_distribution_mod, ONLY : init_physics_distribution
    4041  USE regular_lonlat_mod, ONLY : init_regular_lonlat, &
    4142                                 east, west, north, south, &
    4243                                 north_east, north_west, &
    4344                                 south_west, south_east
     45  USE mod_interface_dyn_phys, ONLY :  init_interface_dyn_phys
    4446  IMPLICIT NONE
    4547
     
    6466  INTEGER, INTENT (IN) :: ii ! number of atmospheric columns along longitudes
    6567  INTEGER, INTENT (IN) :: jj ! number of atompsheric columns along latitudes
     68  INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process
     69  INTEGER, INTENT(IN) :: communicator ! MPI communicator
    6670  REAL, INTENT (IN) :: rlatu(jj+1) ! latitudes of the physics grid
    6771  REAL, INTENT (IN) :: rlatv(jj) ! latitude boundaries of the physics grid
     
    7680
    7781  INTEGER :: ibegin, iend, offset
    78   INTEGER :: i,j
     82  INTEGER :: i,j,k
    7983  CHARACTER (LEN=20) :: modname = 'iniphysiq'
    8084  CHARACTER (LEN=80) :: abort_message
     
    8690
    8791  ! global array, on full physics grid:
    88   REAL,ALLOCATABLE :: latfi(:)
    89   REAL,ALLOCATABLE :: lonfi(:)
    90   REAL,ALLOCATABLE :: cufi(:)
    91   REAL,ALLOCATABLE :: cvfi(:)
    92   REAL,ALLOCATABLE :: airefi(:)
    93 
    94   IF (nlayer/=klev) THEN
    95     WRITE (lunout, *) 'nlayer     = ', nlayer
    96     WRITE (lunout, *) 'klev   = ', klev
    97     CALL abort_gcm(modname, 'Problem with dimensions', 1)
    98   END IF
    99 
    100   !call init_phys_lmdz(ii,jj+1,llm,1,(/(jj-1)*ii+2/))
     92  REAL,ALLOCATABLE :: latfi_glo(:)
     93  REAL,ALLOCATABLE :: lonfi_glo(:)
     94  REAL,ALLOCATABLE :: cufi_glo(:)
     95  REAL,ALLOCATABLE :: cvfi_glo(:)
     96  REAL,ALLOCATABLE :: airefi_glo(:)
     97  REAL,ALLOCATABLE :: boundslonfi_glo(:,:)
     98  REAL,ALLOCATABLE :: boundslatfi_glo(:,:)
     99
     100  ! local arrays, on given MPI/OpenMP domain:
     101  REAL,ALLOCATABLE,SAVE :: latfi(:)
     102  REAL,ALLOCATABLE,SAVE :: lonfi(:)
     103  REAL,ALLOCATABLE,SAVE :: cufi(:)
     104  REAL,ALLOCATABLE,SAVE :: cvfi(:)
     105  REAL,ALLOCATABLE,SAVE :: airefi(:)
     106  REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)
     107  REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)
     108!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
     109
     110  ! Initialize Physics distibution and parameters and interface with dynamics
     111  CALL init_physics_distribution(regular_lonlat,4, &
     112                                 nbp,ii,jj+1,nlayer,communicator)
     113  CALL init_interface_dyn_phys
    101114 
    102115  ! init regular global longitude-latitude grid points and boundaries
     
    123136
    124137  ! Generate global arrays on full physics grid
    125   ALLOCATE(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
    126   ALLOCATE(airefi(klon_glo))
     138  ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo))
     139  ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))
     140  ALLOCATE(airefi_glo(klon_glo))
     141  ALLOCATE(boundslonfi_glo(klon_glo,4))
     142  ALLOCATE(boundslatfi_glo(klon_glo,4))
     143 
    127144
    128145  IF (klon_glo>1) THEN ! general case
    129146    ! North pole
    130     latfi(1)=rlatu(1)
    131     lonfi(1)=0.
    132     cufi(1) = cu(1)
    133     cvfi(1) = cv(1)
     147    latfi_glo(1)=rlatu(1)
     148    lonfi_glo(1)=0.
     149    cufi_glo(1) = cu(1)
     150    cvfi_glo(1) = cv(1)
     151    boundslonfi_glo(1,north_east)=0
     152    boundslatfi_glo(1,north_east)=PI/2
     153    boundslonfi_glo(1,north_west)=2*PI
     154    boundslatfi_glo(1,north_west)=PI/2
     155    boundslonfi_glo(1,south_west)=2*PI
     156    boundslatfi_glo(1,south_west)=rlatv(1)
     157    boundslonfi_glo(1,south_east)=0
     158    boundslatfi_glo(1,south_east)=rlatv(1)
    134159    DO j=2,jj
    135160      DO i=1,ii
    136         latfi((j-2)*ii+1+i)= rlatu(j)
    137         lonfi((j-2)*ii+1+i)= rlonv(i)
    138         cufi((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i)
    139         cvfi((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i)
     161        k=(j-2)*ii+1+i
     162        latfi_glo(k)= rlatu(j)
     163        lonfi_glo(k)= rlonv(i)
     164        cufi_glo(k) = cu((j-1)*ii+1+i)
     165        cvfi_glo(k) = cv((j-1)*ii+1+i)
     166        boundslonfi_glo(k,north_east)=rlonu(i)
     167        boundslatfi_glo(k,north_east)=rlatv(j-1)
     168        boundslonfi_glo(k,north_west)=rlonu(i+1)
     169        boundslatfi_glo(k,north_west)=rlatv(j-1)
     170        boundslonfi_glo(k,south_west)=rlonu(i+1)
     171        boundslatfi_glo(k,south_west)=rlatv(j)
     172        boundslonfi_glo(k,south_east)=rlonu(i)
     173        boundslatfi_glo(k,south_east)=rlatv(j)
    140174      ENDDO
    141175    ENDDO
    142176    ! South pole
    143     latfi(klon_glo)= rlatu(jj+1)
    144     lonfi(klon_glo)= 0.
    145     cufi(klon_glo) = cu((ii+1)*jj+1)
    146     cvfi(klon_glo) = cv((ii+1)*jj-ii)
    147 
    148     ! build airefi(), mesh area on physics grid
    149     CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi)
     177    latfi_glo(klon_glo)= rlatu(jj+1)
     178    lonfi_glo(klon_glo)= 0.
     179    cufi_glo(klon_glo) = cu((ii+1)*jj+1)
     180    cvfi_glo(klon_glo) = cv((ii+1)*jj-ii)
     181    boundslonfi_glo(klon_glo,north_east)= 0
     182    boundslatfi_glo(klon_glo,north_east)= rlatv(jj)
     183    boundslonfi_glo(klon_glo,north_west)= 2*PI
     184    boundslatfi_glo(klon_glo,north_west)= rlatv(jj)
     185    boundslonfi_glo(klon_glo,south_west)= 2*PI
     186    boundslatfi_glo(klon_glo,south_west)= -PI/2
     187    boundslonfi_glo(klon_glo,south_east)= 0
     188    boundslatfi_glo(klon_glo,south_east)= -Pi/2
     189
     190    ! build airefi_glo(), mesh area on physics grid
     191    CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi_glo)
    150192    ! Poles are single points on physics grid
    151     airefi(1)=sum(aire(1:ii,1))
    152     airefi(klon_glo)=sum(aire(1:ii,jj+1))
     193    airefi_glo(1)=sum(aire(1:ii,1))
     194    airefi_glo(klon_glo)=sum(aire(1:ii,jj+1))
    153195
    154196    ! Sanity check: do total planet area match between physics and dynamics?
    155197    total_area_dyn=sum(aire(1:ii,1:jj+1))
    156     total_area_phy=sum(airefi(1:klon_glo))
     198    total_area_phy=sum(airefi_glo(1:klon_glo))
    157199    IF (total_area_dyn/=total_area_phy) THEN
    158200      WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
     
    167209  ELSE ! klon_glo==1, running the 1D model
    168210    ! just copy over input values
    169     latfi(1)=rlatu(1)
    170     lonfi(1)=rlonv(1)
    171     cufi(1)=cu(1)
    172     cvfi(1)=cv(1)
    173     airefi(1)=aire(1,1)
     211    latfi_glo(1)=rlatu(1)
     212    lonfi_glo(1)=rlonv(1)
     213    cufi_glo(1)=cu(1)
     214    cvfi_glo(1)=cv(1)
     215    airefi_glo(1)=aire(1,1)
     216    boundslonfi_glo(1,north_east)=rlonu(1)
     217    boundslatfi_glo(1,north_east)=PI/2
     218    boundslonfi_glo(1,north_west)=rlonu(2)
     219    boundslatfi_glo(1,north_west)=PI/2
     220    boundslonfi_glo(1,south_west)=rlonu(2)
     221    boundslatfi_glo(1,south_west)=rlatv(1)
     222    boundslonfi_glo(1,south_east)=rlonu(1)
     223    boundslatfi_glo(1,south_east)=rlatv(1)
    174224  ENDIF ! of IF (klon_glo>1)
    175225
    176226!$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/)
    177   ! Initialize physical constants in physics:
    178   CALL inifis(punjours,prad,pg,pr,pcpp)
    179   CALL init_time(annee_ref,day_ref,day_ini,start_time,nday,ptimestep)
    180 
    181   ! Copy over "offline" settings
    182   CALL init_phystokenc(offline,istphy)
     227  ! Now generate local lon/lat/cu/cv/area/bounds arrays
     228  ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
     229  ALLOCATE(airefi(klon_omp))
     230  ALLOCATE(boundslonfi(klon_omp,4))
     231  ALLOCATE(boundslatfi(klon_omp,4))
     232
     233
     234  offset = klon_mpi_begin - 1
     235  airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     236  cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     237  cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     238  lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     239  latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     240  boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     241  boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     242
     243  ! copy over local grid longitudes and latitudes
     244  CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
     245                     airefi,cufi,cvfi)
    183246
    184247  ! copy over preff , ap(), bp(), etc
    185248  CALL init_vertical_layers(nlayer,preff,scaleheight, &
    186249                            ap,bp,presnivs,pseudoalt)
     250
     251  ! Initialize physical constants in physics:
     252  CALL inifis(punjours,prad,pg,pr,pcpp)
     253
     254  CALL init_time(annee_ref,day_ref,day_ini,start_time,nday,ptimestep)
     255
     256  ! Initialize dimphy module
     257  CALL Init_dimphy(klon_omp,nlayer)
     258
     259  ! Copy over "offline" settings
     260  CALL init_phystokenc(offline,istphy)
    187261
    188262  ! Initialize tracer names, numbers, etc. for physics
     
    197271                         niso,ntraceurs_zone,ntraciso)
    198272
    199   ! Now generate local lon/lat/cu/cv/area arrays
    200   CALL initcomgeomphy
    201 
    202   offset = klon_mpi_begin - 1
    203   airephy(1:klon_omp) = airefi(offset+klon_omp_begin:offset+klon_omp_end)
    204   cuphy(1:klon_omp) = cufi(offset+klon_omp_begin:offset+klon_omp_end)
    205   cvphy(1:klon_omp) = cvfi(offset+klon_omp_begin:offset+klon_omp_end)
    206   rlond(1:klon_omp) = lonfi(offset+klon_omp_begin:offset+klon_omp_end)
    207   rlatd(1:klon_omp) = latfi(offset+klon_omp_begin:offset+klon_omp_end)
     273  ! Initializations for Reprobus
     274  IF (type_trac == 'repr') THEN
     275#ifdef REPROBUS
     276    CALL Init_chem_rep_phys(klon_omp,nlayer)
     277#endif
     278  ENDIF
    208279
    209280  ! Additional initializations for aquaplanets
    210281  IF (iflag_phys>=100) THEN
    211     CALL iniaqua(klon_omp, rlatd, rlond, iflag_phys)
     282    CALL iniaqua(klon_omp,iflag_phys)
    212283  END IF
    213284!$OMP END PARALLEL
  • LMDZ5/trunk/libf/dynlonlat_phylonlat/phymar/iniphysiq_mod.F90

    r2347 r2351  
    66CONTAINS
    77
    8 SUBROUTINE iniphysiq(iim,jjm,nlayer,punjours, pdayref,ptimestep, &
     8SUBROUTINE iniphysiq(iim,jjm,nlayer,
     9                     nbp, communicator, &
     10                     punjours, pdayref,ptimestep, &
    911                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv,         &
    1012                     prad,pg,pr,pcpp,iflag_phys)
    11   USE dimphy, ONLY: klev ! number of atmospheric levels
    12   USE mod_grid_phy_lmdz, ONLY: klon_glo ! number of atmospheric columns
    13                                         ! (on full grid)
     13  USE dimphy, ONLY: init_dimphy
     14  USE mod_grid_phy_lmdz, ONLY: klon_glo,  & ! number of atmospheric columns (on full grid)
     15                               regular_lonlat  ! regular longitude-latitude grid type
    1416  USE mod_phys_lmdz_para, ONLY: klon_omp, & ! number of columns (on local omp grid)
    1517                                klon_omp_begin, & ! start index of local omp subgrid
    1618                                klon_omp_end, & ! end index of local omp subgrid
    1719                                klon_mpi_begin ! start indes of columns (on local mpi grid)
    18   USE comgeomphy, ONLY: initcomgeomphy, &
    19                         airephy, & ! physics grid area (m2)
    20                         cuphy, & ! cu coeff. (u_covariant = cu * u)
    21                         cvphy, & ! cv coeff. (v_covariant = cv * v)
    22                         rlond, & ! longitudes
    23                         rlatd ! latitudes
     20  USE geometry_mod, ONLY : init_geometry
    2421  USE comcstphy, ONLY: rradius, & ! planet radius (m)
    2522                       rr, & ! recuced gas constant: R/molar mass of atm
     
    2724                       rcpp  ! specific heat of the atmosphere
    2825!  USE phyaqua_mod, ONLY: iniaqua
     26  USE physics_distribution_mod, ONLY : init_physics_distribution
    2927  USE regular_lonlat_mod, ONLY : init_regular_lonlat, &
    3028                                 east, west, north, south, &
    3129                                 north_east, north_west, &
    3230                                 south_west, south_east
     31  USE mod_interface_dyn_phys, ONLY :  init_interface_dyn_phys
    3332  USE nrtype, ONLY: pi
    3433  IMPLICIT NONE
     
    5049  INTEGER, INTENT (IN) :: iim ! number of atmospheric coulumns along longitudes
    5150  INTEGER, INTENT (IN) :: jjm  ! number of atompsheric columns along latitudes
     51  INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process
     52  INTEGER, INTENT(IN) :: communicator ! MPI communicator
    5253  REAL, INTENT (IN) :: rlatu(jjm+1) ! latitudes of the physics grid
    5354  REAL, INTENT (IN) :: rlatv(jjm) ! latitude boundaries of the physics grid
     
    6263
    6364  INTEGER :: ibegin,iend,offset
    64   INTEGER :: i,j
     65  INTEGER :: i,j,k
    6566  CHARACTER (LEN=20) :: modname='iniphysiq'
    6667  CHARACTER (LEN=80) :: abort_message
     
    7273
    7374  ! global array, on full physics grid:
    74   REAL,ALLOCATABLE :: latfi(:)
    75   REAL,ALLOCATABLE :: lonfi(:)
    76   REAL,ALLOCATABLE :: cufi(:)
    77   REAL,ALLOCATABLE :: cvfi(:)
    78   REAL,ALLOCATABLE :: airefi(:)
    79  
    80   IF (nlayer.NE.klev) THEN
    81     WRITE(lunout,*) 'STOP in ',trim(modname)
    82     WRITE(lunout,*) 'Problem with dimensions :'
    83     WRITE(lunout,*) 'nlayer     = ',nlayer
    84     WRITE(lunout,*) 'klev   = ',klev
    85     abort_message = ''
    86     CALL abort_gcm (modname,abort_message,1)
    87   ENDIF
    88 
     75  REAL,ALLOCATABLE :: latfi_glo(:)
     76  REAL,ALLOCATABLE :: lonfi_glo(:)
     77  REAL,ALLOCATABLE :: cufi_glo(:)
     78  REAL,ALLOCATABLE :: cvfi_glo(:)
     79  REAL,ALLOCATABLE :: airefi_glo(:)
     80  REAL,ALLOCATABLE :: boundslonfi_glo(:,:)
     81  REAL,ALLOCATABLE :: boundslatfi_glo(:,:)
     82
     83  ! local arrays, on given MPI/OpenMP domain:
     84  REAL,ALLOCATABLE,SAVE :: latfi(:)
     85  REAL,ALLOCATABLE,SAVE :: lonfi(:)
     86  REAL,ALLOCATABLE,SAVE :: cufi(:)
     87  REAL,ALLOCATABLE,SAVE :: cvfi(:)
     88  REAL,ALLOCATABLE,SAVE :: airefi(:)
     89  REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)
     90  REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)
     91!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
     92
     93  ! Initialize Physics distibution and parameters and interface with dynamics
     94  CALL init_physics_distribution(regular_lonlat,4, &
     95                                 nbp,ii,jj+1,nlayer,communicator)
     96  CALL init_interface_dyn_phys
     97 
    8998  ! init regular global longitude-latitude grid points and boundaries
    9099  ALLOCATE(boundslon_reg(iim,2))
     
    110119
    111120  ! Generate global arrays on full physics grid
    112   ALLOCATE(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
    113   ALLOCATE(airefi(klon_glo))
     121  ALLOCATE(latfi_glo(klon_glo),lonfi_glo(klon_glo))
     122  ALLOCATE(cufi_glo(klon_glo),cvfi_glo(klon_glo))
     123  ALLOCATE(airefi_glo(klon_glo))
     124  ALLOCATE(boundslonfi_glo(klon_glo,4))
     125  ALLOCATE(boundslatfi_glo(klon_glo,4))
    114126
    115127  IF (klon_glo>1) THEN ! general case
    116128    ! North pole
    117     latfi(1)=rlatu(1)
    118     lonfi(1)=0.
    119     cufi(1) = cu(1)
    120     cvfi(1) = cv(1)
     129    latfi_glo(1)=rlatu(1)
     130    lonfi_glo(1)=0.
     131    cufi_glo(1) = cu(1)
     132    cvfi_glo(1) = cv(1)
     133    boundslonfi_glo(1,north_east)=0
     134    boundslatfi_glo(1,north_east)=PI/2
     135    boundslonfi_glo(1,north_west)=2*PI
     136    boundslatfi_glo(1,north_west)=PI/2
     137    boundslonfi_glo(1,south_west)=2*PI
     138    boundslatfi_glo(1,south_west)=rlatv(1)
     139    boundslonfi_glo(1,south_east)=0
     140    boundslatfi_glo(1,south_east)=rlatv(1)
    121141    DO j=2,jjm
    122142      DO i=1,iim
    123         latfi((j-2)*iim+1+i)= rlatu(j)
    124         lonfi((j-2)*iim+1+i)= rlonv(i)
    125         cufi((j-2)*iim+1+i) = cu((j-1)*iim+1+i)
    126         cvfi((j-2)*iim+1+i) = cv((j-1)*iim+1+i)
     143        k=(j-2)*iim+1+i
     144        latfi_glo((j-2)*iim+1+i)= rlatu(j)
     145        lonfi_glo((j-2)*iim+1+i)= rlonv(i)
     146        cufi_glo((j-2)*iim+1+i) = cu((j-1)*iim+1+i)
     147        cvfi_glo((j-2)*iim+1+i) = cv((j-1)*iim+1+i)
     148        boundslonfi_glo(k,north_east)=rlonu(i)
     149        boundslatfi_glo(k,north_east)=rlatv(j-1)
     150        boundslonfi_glo(k,north_west)=rlonu(i+1)
     151        boundslatfi_glo(k,north_west)=rlatv(j-1)
     152        boundslonfi_glo(k,south_west)=rlonu(i+1)
     153        boundslatfi_glo(k,south_west)=rlatv(j)
     154        boundslonfi_glo(k,south_east)=rlonu(i)
     155        boundslatfi_glo(k,south_east)=rlatv(j)
    127156      ENDDO
    128157    ENDDO
    129158    ! South pole
    130     latfi(klon_glo)= rlatu(jjm+1)
    131     lonfi(klon_glo)= 0.
    132     cufi(klon_glo) = cu((iim+1)*jjm+1)
    133     cvfi(klon_glo) = cv((iim+1)*jjm-iim)
     159    latfi_glo(klon_glo)= rlatu(jjm+1)
     160    lonfi_glo(klon_glo)= 0.
     161    cufi_glo(klon_glo) = cu((iim+1)*jjm+1)
     162    cvfi_glo(klon_glo) = cv((iim+1)*jjm-iim)
     163    boundslonfi_glo(klon_glo,north_east)= 0
     164    boundslatfi_glo(klon_glo,north_east)= rlatv(jjm)
     165    boundslonfi_glo(klon_glo,north_west)= 2*PI
     166    boundslatfi_glo(klon_glo,north_west)= rlatv(jjm)
     167    boundslonfi_glo(klon_glo,south_west)= 2*PI
     168    boundslatfi_glo(klon_glo,south_west)= -PI/2
     169    boundslonfi_glo(klon_glo,south_east)= 0
     170    boundslatfi_glo(klon_glo,south_east)= -Pi/2
    134171
    135172    ! build airefi(), mesh area on physics grid
    136     CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi)
     173    CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi_glo)
    137174    ! Poles are single points on physics grid
    138     airefi(1)=sum(aire(1:iim,1))
    139     airefi(klon_glo)=sum(aire(1:iim,jjm+1))
     175    airefi_glo(1)=sum(aire(1:iim,1))
     176    airefi_glo(klon_glo)=sum(aire(1:iim,jjm+1))
    140177
    141178    ! Sanity check: do total planet area match between physics and dynamics?
    142179    total_area_dyn=sum(aire(1:iim,1:jjm+1))
    143     total_area_phy=sum(airefi(1:klon_glo))
     180    total_area_phy=sum(airefi_glo(1:klon_glo))
    144181    IF (total_area_dyn/=total_area_phy) THEN
    145182      WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
     
    154191  ELSE ! klon_glo==1, running the 1D model
    155192    ! just copy over input values
    156     latfi(1)=rlatu(1)
    157     lonfi(1)=rlonv(1)
    158     cufi(1)=cu(1)
    159     cvfi(1)=cv(1)
    160     airefi(1)=aire(1,1)
     193    latfi_glo(1)=rlatu(1)
     194    lonfi_glo(1)=rlonv(1)
     195    cufi_glo(1)=cu(1)
     196    cvfi_glo(1)=cv(1)
     197    airefi_glo(1)=aire(1,1)
     198    boundslonfi_glo(1,north_east)=rlonu(1)
     199    boundslatfi_glo(1,north_east)=PI/2
     200    boundslonfi_glo(1,north_west)=rlonu(2)
     201    boundslatfi_glo(1,north_west)=PI/2
     202    boundslonfi_glo(1,south_west)=rlonu(2)
     203    boundslatfi_glo(1,south_west)=rlatv(1)
     204    boundslonfi_glo(1,south_east)=rlonu(1)
     205    boundslatfi_glo(1,south_east)=rlatv(1)
    161206  ENDIF ! of IF (klon_glo>1)
    162207
    163208!$OMP PARALLEL
    164   ! Now generate local lon/lat/cu/cv/area arrays
    165   CALL initcomgeomphy
    166      
     209  ! Now generate local lon/lat/cu/cv/area/bounds arrays
     210  ALLOCATE(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
     211  ALLOCATE(airefi(klon_omp))
     212  ALLOCATE(boundslonfi(klon_omp,4))
     213  ALLOCATE(boundslatfi(klon_omp,4))
     214
     215
    167216  offset = klon_mpi_begin - 1
    168   airephy(1:klon_omp) = airefi(offset+klon_omp_begin:offset+klon_omp_end)
    169   cuphy(1:klon_omp) = cufi(offset+klon_omp_begin:offset+klon_omp_end)
    170   cvphy(1:klon_omp) = cvfi(offset+klon_omp_begin:offset+klon_omp_end)
    171   rlond(1:klon_omp) = lonfi(offset+klon_omp_begin:offset+klon_omp_end)
    172   rlatd(1:klon_omp) = latfi(offset+klon_omp_begin:offset+klon_omp_end)
     217  airefi(1:klon_omp) = airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     218  cufi(1:klon_omp) = cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     219  cvfi(1:klon_omp) = cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     220  lonfi(1:klon_omp) = lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     221  latfi(1:klon_omp) = latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     222  boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     223  boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     224
     225  ! copy over local grid longitudes and latitudes
     226  CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
     227                     airefi,cufi,cvfi)
     228
    173229
    174230! copy some fundamental parameters to physics
  • LMDZ5/trunk/libf/phy_common/mod_grid_phy_lmdz.F90

    r2326 r2351  
    88             grid2dTo1d_glo_igen, grid2dTo1d_glo_rgen, grid2dTo1d_glo_lgen
    99 
     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     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
    4660 
    4761 
  • 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
  • LMDZ5/trunk/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90

    r2326 r2351  
    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
     1260    USE mod_phys_lmdz_mpi_data
    12611261    IMPLICIT NONE
    12621262   
     
    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
     1283    USE mod_phys_lmdz_mpi_data
    12841284    IMPLICIT NONE
    12851285   
     
    12951295
    12961296#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)
    12981298#endif
    12991299   
     
    13041304
    13051305  SUBROUTINE bcast_mpi_lgen(var,nb)
    1306     USE mod_phys_lmdz_mpi_data ,  mpi_root_x=>mpi_root
     1306    USE mod_phys_lmdz_mpi_data
    13071307    IMPLICIT NONE
    13081308   
     
    13181318
    13191319#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
     
    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)
     1502                     MPI_INTEGER,mpi_master, COMM_LMDZ_PHY,ierr)
    15031503#endif
    15041504
     
    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
     
    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)
     1555                      MPI_REAL_LMDZ,mpi_master, COMM_LMDZ_PHY,ierr)
    15561556#endif
    15571557                         
     
    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
     
    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)
     1608                      MPI_LOGICAL,mpi_master, COMM_LMDZ_PHY,ierr)
    16091609#endif
    16101610                         
     
    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
     
    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
     
    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       
     
    19011901
    19021902END MODULE mod_phys_lmdz_mpi_transfert
     1903
  • LMDZ5/trunk/libf/phy_common/mod_phys_lmdz_para.F90

    r2326 r2351  
    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
    2727    CALL Init_phys_lmdz_omp_data(klon_mpi)
  • LMDZ5/trunk/libf/phy_common/physics_distribution_mod.F90

    r2348 r2351  
    11!
    2 !$Header$
     2!$Id$
    33!
    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)
     4MODULE physics_distribution_mod
    205
    216
    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)
     7CONTAINS
    268
    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
    3322
    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
    3560 
    36 END SUBROUTINE Init_Phys_lmdz 
     61!END SUBROUTINE Init_Phys_lmdz 
     62
     63
     64
     65
     66
     67
     68
     69
     70END MODULE physics_distribution_mod
     71
  • LMDZ5/trunk/libf/phydev/phyaqua_mod.F90

    r1994 r2351  
    88CONTAINS
    99
    10   SUBROUTINE iniaqua(nlon, latfi, lonfi, iflag_phys)
     10  SUBROUTINE iniaqua(nlon, iflag_phys)
    1111
    1212  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    1717  USE phys_state_var_mod, ONLY: rlat, rlon, phys_state_var_init
    1818  USE mod_phys_lmdz_para, ONLY: klon_omp
    19   USE comgeomphy, ONLY: rlond, rlatd
     19  USE geometry_mod, ONLY: longitude_deg, latitude_deg
    2020  IMPLICIT NONE
    2121     
    2222  INTEGER,INTENT(IN) :: nlon,iflag_phys
    23   REAL,INTENT(IN) :: lonfi(nlon),latfi(nlon)
    2423
    2524  ! local variables
     
    3130  CALL phys_state_var_init()
    3231
    33   rlat(1:klon_omp)=rlatd(1:klon_omp)*180./pi
    34   rlon(1:klon_omp)=rlond(1:klon_omp)*180./pi
     32  rlat(1:klon_omp)=latitude_deg(1:klon_omp)
     33  rlon(1:klon_omp)=longitude_deg(1:klon_omp)
    3534
    3635
  • LMDZ5/trunk/libf/phydev/physiq.F90

    r2326 r2351  
    55     &            debut,lafin,jD_cur, jH_cur,pdtphys, &
    66     &            paprs,pplay,pphi,pphis,presnivs, &
    7      &            u,v,t,qx, &
     7     &            u,v,rot,t,qx, &
    88     &            flxmass_w, &
    99     &            d_u, d_v, d_t, d_qx, d_ps &
     
    1212      USE dimphy, only : klon,klev
    1313      USE infotrac_phy, only : nqtot
    14       USE comgeomphy, only : rlatd
     14      USE geometry_mod, only : latitude
    1515      USE comcstphy, only : rg
    1616      USE iophy, only : histbeg_phy,histwrite_phy
     
    5353      real,intent(out) :: d_ps(klon) ! physics tendency on surface pressure
    5454      real,intent(in) :: dudyn(nbp_lon+1,nbp_lat,klev) ! Not used
     55      REAL, intent(in):: rot(klon, klev) ! Not used
     56      ! relative vorticity, in s-1, needed for frontal waves
    5557
    5658integer,save :: itau=0 ! counter to count number of calls to physics
     
    157159! newtonian relaxation towards temp_newton()
    158160do k=1,klev
    159   temp_newton(1:klon,k)=280.+cos(rlatd(1:klon))*40.-pphi(1:klon,k)/rg*6.e-3
     161  temp_newton(1:klon,k)=280.+cos(latitude(1:klon))*40.-pphi(1:klon,k)/rg*6.e-3
    160162  d_t(1:klon,k)=(temp_newton(1:klon,k)-t(1:klon,k))/1.e5
    161163enddo
  • LMDZ5/trunk/libf/phylmd/calcul_divers.h

    r2103 r2351  
    88         DO i=1, klon
    99            IF(pctsrf(i,is_ter).GT.0.) THEN
    10                paire_ter(i)=airephy(i)*pctsrf(i,is_ter)
     10               paire_ter(i)=cell_area(i)*pctsrf(i,is_ter)
    1111            ENDIF
    1212         ENDDO
  • LMDZ5/trunk/libf/phylmd/carbon_cycle_mod.F90

    r2320 r2351  
    8686
    8787    USE dimphy
    88     USE comgeomphy
     88    USE geometry_mod, ONLY : cell_area
    8989    USE mod_phys_lmdz_transfert_para
    9090    USE infotrac_phy, ONLY: nbtr, nqo, niadv, tname
     
    290290! 5) Calculate total area of the earth surface
    291291! --------------------------------------------
    292     CALL reduce_sum(SUM(airephy),airetot)
     292    CALL reduce_sum(SUM(cell_area),airetot)
    293293    CALL bcast(airetot)
    294294
     
    309309    USE phys_cal_mod, ONLY : mth_cur, mth_len
    310310    USE phys_cal_mod, ONLY : day_cur
    311     USE comgeomphy
    312311    USE indice_sol_mod
    313312    USE print_control_mod, ONLY: lunout
     313    USE geometry_mod, ONLY : cell_area
    314314
    315315    IMPLICIT NONE
     
    444444
    445445          ! Calculate a global mean value of delta CO2 flux
    446           fco2_tmp(1:klon) = fco2_tmp(1:klon) * airephy(1:klon)
     446          fco2_tmp(1:klon) = fco2_tmp(1:klon) * cell_area(1:klon)
    447447          CALL reduce_sum(SUM(fco2_tmp),sumtmp)
    448448          CALL bcast(sumtmp)
  • LMDZ5/trunk/libf/phylmd/dyn1d/lmdz1d.F90

    r2347 r2351  
    2424      USE print_control_mod, ONLY: prt_level
    2525      USE iniphysiq_mod, ONLY: iniphysiq
     26      USE mod_const_mpi, ONLY: comm_lmdz
    2627
    2728      implicit none
     
    486487! Initialization of dimensions, geometry and initial state
    487488!---------------------------------------------------------------------
    488       call init_phys_lmdz(1,1,llm,1,(/1/))
     489!      call init_phys_lmdz(1,1,llm,1,(/1/)) ! job now done via iniphysiq
    489490      call suphel
    490491      call infotrac_init
     
    626627     ! e.g. for cell boundaries, which are meaningless in 1D; so pad these
    627628     ! with '0.' when necessary
    628       call iniphysiq(iim,jjm,llm,rday,day_ini,timestep,  &
     629      call iniphysiq(iim,jjm,llm, &
     630           1,comm_lmdz, &
     631           rday,day_ini,timestep,  &
    629632           (/rlat_rad(1),0./),(/0./), &
    630633           (/0.,0./),(/rlon_rad(1),0./),  &
  • LMDZ5/trunk/libf/phylmd/init_be.F90

    r2320 r2351  
    55
    66  USE dimphy
    7   USE comgeomphy
    87  USE infotrac_phy, ONLY : nbtr
    98  USE indice_sol_mod
     9  USE geometry_mod, ONLY : longitude, latitude
    1010   
    1111  IMPLICIT NONE
     
    114114
    115115  DO i = 1,klon
    116      qcos=sin(glt)*sin(rlatd(i))
     116     qcos=sin(glt)*sin(latitude(i))
    117117!!jyg
    118 !!     qcos=qcos+cos(glt)*cos(rlatd(i))*cos(rlond(i)+glg)
    119      qcos=qcos+cos(glt)*cos(rlatd(i))*cos(rlond(i)-glg)
     118!!     qcos=qcos+cos(glt)*cos(latitude(i))*cos(longitude(i)+glg)
     119     qcos=qcos+cos(glt)*cos(latitude(i))*cos(longitude(i)-glg)
    120120!!jyg end
    121121     IF ( qcos .LT. -1.) qcos = -1.
  • LMDZ5/trunk/libf/phylmd/lsc_scav.F90

    r2346 r2351  
    1414  USE traclmdz_mod
    1515  USE infotrac_phy,ONLY : nbtr
    16   USE comgeomphy
    1716  USE iophy
    1817  IMPLICIT NONE
  • LMDZ5/trunk/libf/phylmd/mod_surf_para.F90

    r1907 r2351  
    4949
    5050  SUBROUTINE Init_surf_para(knon)
    51   USE mod_phys_lmdz_para, mpi_rank_root=>mpi_root
     51  USE mod_phys_lmdz_para
    5252#ifdef CPP_MPI
    5353  INCLUDE 'mpif.h'
     
    168168     
    169169  SUBROUTINE gather_surf_mpi_i(FieldIn,FieldOut)
    170   USE mod_phys_lmdz_para, mpi_rank_root => mpi_root
     170  USE mod_phys_lmdz_para
    171171#ifdef CPP_MPI
    172172  INCLUDE 'mpif.h'
     
    180180      CALL MPI_Gatherv(FieldIn,knon_mpi,MPI_INTEGER,                                &
    181181                       FieldOut,knon_mpi_para,knon_mpi_begin_para(:)-1,MPI_INTEGER, &
    182                        mpi_rank_root,COMM_LMDZ_PHY,ierr)
     182                       mpi_master,COMM_LMDZ_PHY,ierr)
    183183#endif
    184184    ELSE
     
    223223     
    224224  SUBROUTINE gather_surf_mpi_r(FieldIn,FieldOut)
    225   USE mod_phys_lmdz_para, mpi_rank_root => mpi_root
     225  USE mod_phys_lmdz_para
    226226#ifdef CPP_MPI
    227227  INCLUDE 'mpif.h'
     
    235235      CALL MPI_Gatherv(FieldIn,knon_mpi,MPI_REAL_LMDZ,                                 &
    236236                       FieldOut,knon_mpi_para,knon_mpi_begin_para(:)-1,MPI_REAL_LMDZ,  &
    237                        mpi_rank_root,COMM_LMDZ_PHY,ierr)           
     237                       mpi_master,COMM_LMDZ_PHY,ierr)           
    238238#endif
    239239    ELSE
     
    276276     
    277277  SUBROUTINE scatter_surf_mpi_i(FieldIn,FieldOut)
    278   USE mod_phys_lmdz_para, mpi_rank_root => mpi_root
     278  USE mod_phys_lmdz_para
    279279#ifdef CPP_MPI
    280280  INCLUDE 'mpif.h'
     
    288288      CALL MPI_Scatterv(FieldIn,knon_mpi_para,knon_mpi_begin_para(:)-1,MPI_INTEGER,   &
    289289                        FieldOut,knon_mpi,MPI_INTEGER,                                &
    290                         mpi_rank_root,COMM_LMDZ_PHY,ierr)
     290                        mpi_master,COMM_LMDZ_PHY,ierr)
    291291#endif
    292292    ELSE
     
    328328     
    329329  SUBROUTINE scatter_surf_mpi_r(FieldIn,FieldOut)
    330   USE mod_phys_lmdz_para, mpi_rank_root => mpi_root
     330  USE mod_phys_lmdz_para
    331331#ifdef CPP_MPI
    332332  INCLUDE 'mpif.h'
     
    340340      CALL MPI_Scatterv(FieldIn,knon_mpi_para,knon_mpi_begin_para(:)-1,MPI_INTEGER,   &
    341341                        FieldOut,knon_mpi,MPI_INTEGER,                                &
    342                         mpi_rank_root,COMM_LMDZ_PHY,ierr)
     342                        mpi_master,COMM_LMDZ_PHY,ierr)
    343343#endif
    344344    ELSE
     
    349349
    350350END MODULE mod_surf_para
     351
  • LMDZ5/trunk/libf/phylmd/phyaqua_mod.F90

    r2346 r2351  
    55CONTAINS
    66
    7   SUBROUTINE iniaqua(nlon, latfi, lonfi, iflag_phys)
     7  SUBROUTINE iniaqua(nlon, iflag_phys)
    88
    99    ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    1919    ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    2020
    21     USE comgeomphy, ONLY: rlatd, rlond
    2221    USE dimphy, ONLY: klon
     22    USE geometry_mod, ONLY : latitude
    2323    USE surface_data, ONLY: type_ocean, ok_veget
    2424    USE pbl_surface_mod, ONLY: pbl_surface_init
     
    3838    INTEGER, INTENT (IN) :: nlon, iflag_phys
    3939    ! IM ajout latfi, lonfi
    40     REAL, INTENT (IN) :: lonfi(nlon), latfi(nlon)
     40!    REAL, INTENT (IN) :: lonfi(nlon), latfi(nlon)
    4141
    4242    INTEGER type_profil, type_aqua
     
    117117    INTEGER l, ierr, aslun
    118118
    119     REAL longitude, latitude
     119!    REAL longitude, latitude
    120120    REAL paire
    121121
    122     DATA latitude, longitude/48., 0./
     122!    DATA latitude, longitude/48., 0./
    123123
    124124    ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    149149
    150150    ! IM ajout latfi, lonfi
    151     rlatd = latfi
    152     rlond = lonfi
    153     rlat = rlatd*180./pi
    154     rlon = rlond*180./pi
     151!    rlatd = latfi
     152!    rlond = lonfi
     153!    rlat = rlatd*180./pi
     154!    rlon = rlond*180./pi
    155155
    156156    ! -----------------------------------------------------------------------
     
    160160    day_ini = day_ref
    161161    day_end = day_ini + ndays
    162     airefi = 1.
    163     zcufi = 1.
    164     zcvfi = 1.
     162!    airefi = 1.
     163!    zcufi = 1.
     164!    zcvfi = 1.
    165165    !$OMP MASTER
    166166    nbapp_rad_omp = 24
     
    260260    END DO
    261261    ! IM calcul profil sst
    262     CALL profil_sst(nlon, rlatd, type_profil, phy_sst)
     262    CALL profil_sst(nlon, latitude, type_profil, phy_sst)
    263263
    264264    CALL writelim(klon, phy_nat, phy_alb, phy_sst, phy_bil, phy_rug, phy_ice, &
  • LMDZ5/trunk/libf/phylmd/phys_output_mod.F90

    r2344 r2351  
    531531    real                :: ttt,xxx,timestep,dayseconde,dtime
    532532    parameter (dayseconde=86400.)
    533     include "comconst.h"
    534533
    535534    ipos=scan(str,'0123456789.',.TRUE.)
  • LMDZ5/trunk/libf/phylmd/phys_output_write_mod.F90

    r2344 r2351  
    248248    USE indice_sol_mod, only: nbsrf
    249249    USE infotrac_phy, only: nqtot, nqo, type_trac
    250     USE comgeomphy, only: airephy
     250    USE geometry_mod, only: cell_area
    251251    USE surface_data, only: type_ocean, version_ocean, ok_veget, ok_snow
    252252!    USE aero_mod, only: naero_spc
     
    337337!!! Champs 1D !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    338338       CALL histwrite_phy(o_phis, pphis)
    339        CALL histwrite_phy(o_aire, airephy)
     339       CALL histwrite_phy(o_aire, cell_area)
    340340
    341341       IF (vars_defined) THEN
  • LMDZ5/trunk/libf/phylmd/physiq.F90

    r2345 r2351  
    1212  USE ioipsl, only: histbeg, histvert, histdef, histend, histsync, &
    1313       histwrite, ju2ymds, ymds2ju, getin
    14   USE comgeomphy
     14  USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg
    1515  USE phys_cal_mod, only: year_len, mth_len, days_elapsed, jh_1jan, year_cur, &
    1616       mth_cur,jD_cur, jH_cur, jD_ref, phys_cal_update
     
    923923     igout=klon/2+1/klon
    924924     write(lunout,*) 'DEBUT DE PHYSIQ !!!!!!!!!!!!!!!!!!!!'
    925      write(lunout,*) 'igout, rlat, rlon ',igout, rlatd(igout)*180./3.141593, rlond(igout)*180./3.141593
     925     write(lunout,*) 'igout, rlat, rlon ',igout, latitude_deg(igout), longitude_deg(igout)
    926926     write(lunout,*) &
    927927          'nlon,klev,nqtot,debut,lafin, jD_cur, jH_cur,pdtphys'
     
    13561356             rg, &
    13571357             ra, &
    1358              airephy, &
     1358             cell_area, &
    13591359             rlat, &
    13601360             rlon, &
     
    15631563  IF (ip_ebil_phy.ge.1) THEN
    15641564     ztit='after dynamic'
    1565      CALL diagetpq(airephy,ztit,ip_ebil_phy,1,1,dtime &
     1565     CALL diagetpq(cell_area,ztit,ip_ebil_phy,1,1,dtime &
    15661566          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    15671567          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
     
    15701570     !     est egale a la variation de la physique au pas de temps precedent.
    15711571     !     Donc la somme de ces 2 variations devrait etre nulle.
    1572      call diagphy(airephy,ztit,ip_ebil_phy &
     1572     call diagphy(cell_area,ztit,ip_ebil_phy &
    15731573          , zero_v, zero_v, zero_v, zero_v, zero_v &
    15741574          , zero_v, zero_v, zero_v, ztsol &
     
    17741774  IF (ip_ebil_phy.ge.2) THEN
    17751775     ztit='after reevap'
    1776      CALL diagetpq(airephy,ztit,ip_ebil_phy,2,1,dtime &
     1776     CALL diagetpq(cell_area,ztit,ip_ebil_phy,2,1,dtime &
    17771777          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    17781778          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
    1779      call diagphy(airephy,ztit,ip_ebil_phy &
     1779     call diagphy(cell_area,ztit,ip_ebil_phy &
    17801780          , zero_v, zero_v, zero_v, zero_v, zero_v &
    17811781          , zero_v, zero_v, zero_v, ztsol &
     
    20322032     IF (ip_ebil_phy.ge.2) THEN
    20332033        ztit='after surface_main'
    2034         CALL diagetpq(airephy,ztit,ip_ebil_phy,2,2,dtime &
     2034        CALL diagetpq(cell_area,ztit,ip_ebil_phy,2,2,dtime &
    20352035             , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    20362036             , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
    2037         call diagphy(airephy,ztit,ip_ebil_phy &
     2037        call diagphy(cell_area,ztit,ip_ebil_phy &
    20382038             , zero_v, zero_v, zero_v, zero_v, sens &
    20392039             , evap  , zero_v, zero_v, ztsol &
     
    20822082  ENDDO
    20832083  IF (check) THEN
    2084      za = qcheck(klon,klev,paprs,q_seri,ql_seri,airephy)
     2084     za = qcheck(klon,klev,paprs,q_seri,ql_seri,cell_area)
    20852085     WRITE(lunout,*) "avantcon=", za
    20862086  ENDIF
     
    21022102  DO k = 1, klev
    21032103     DO i = 1, klon
    2104         omega(i,k) = RG*flxmass_w(i,k) / airephy(i)
     2104        omega(i,k) = RG*flxmass_w(i,k) / cell_area(i)
    21052105     END DO
    21062106  END DO
     
    24882488  IF (ip_ebil_phy.ge.2) THEN
    24892489     ztit='after convect'
    2490      CALL diagetpq(airephy,ztit,ip_ebil_phy,2,2,dtime &
     2490     CALL diagetpq(cell_area,ztit,ip_ebil_phy,2,2,dtime &
    24912491          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    24922492          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
    2493      call diagphy(airephy,ztit,ip_ebil_phy &
     2493     call diagphy(cell_area,ztit,ip_ebil_phy &
    24942494          , zero_v, zero_v, zero_v, zero_v, zero_v &
    24952495          , zero_v, rain_con, snow_con, ztsol &
     
    24992499  !
    25002500  IF (check) THEN
    2501      za = qcheck(klon,klev,paprs,q_seri,ql_seri,airephy)
     2501     za = qcheck(klon,klev,paprs,q_seri,ql_seri,cell_area)
    25022502     WRITE(lunout,*)"aprescon=", za
    25032503     zx_t = 0.0
    25042504     za = 0.0
    25052505     DO i = 1, klon
    2506         za = za + airephy(i)/REAL(klon)
     2506        za = za + cell_area(i)/REAL(klon)
    25072507        zx_t = zx_t + (rain_con(i)+ &
    2508              snow_con(i))*airephy(i)/REAL(klon)
     2508             snow_con(i))*cell_area(i)/REAL(klon)
    25092509     ENDDO
    25102510     zx_t = zx_t/za*dtime
     
    26532653  IF (ip_ebil_phy.ge.2) THEN
    26542654     ztit='after wake'
    2655      CALL diagetpq(airephy,ztit,ip_ebil_phy,2,2,dtime &
     2655     CALL diagetpq(cell_area,ztit,ip_ebil_phy,2,2,dtime &
    26562656          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    26572657          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
    2658      call diagphy(airephy,ztit,ip_ebil_phy &
     2658     call diagphy(cell_area,ztit,ip_ebil_phy &
    26592659          , zero_v, zero_v, zero_v, zero_v, zero_v &
    26602660          , zero_v, zero_v, zero_v, ztsol &
     
    27462746             ,ztv,zpspsk,ztla,zthl &
    27472747             !cc nrlmd le 10/04/2012
    2748              ,pbl_tke_input,pctsrf,omega,airephy &
     2748             ,pbl_tke_input,pctsrf,omega,cell_area &
    27492749             ,zlcl_th,fraca0,w0,w_conv,therm_tke_max0,env_tke_max0 &
    27502750             ,n2,s2,ale_bl_stat &
     
    29702970  IF (ip_ebil_phy.ge.2) THEN
    29712971     ztit='after dry_adjust'
    2972      CALL diagetpq(airephy,ztit,ip_ebil_phy,2,2,dtime &
     2972     CALL diagetpq(cell_area,ztit,ip_ebil_phy,2,2,dtime &
    29732973          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    29742974          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
    2975      call diagphy(airephy,ztit,ip_ebil_phy &
     2975     call diagphy(cell_area,ztit,ip_ebil_phy &
    29762976          , zero_v, zero_v, zero_v, zero_v, zero_v &
    29772977          , zero_v, zero_v, zero_v, ztsol &
     
    30233023  ENDDO
    30243024  IF (check) THEN
    3025      za = qcheck(klon,klev,paprs,q_seri,ql_seri,airephy)
     3025     za = qcheck(klon,klev,paprs,q_seri,ql_seri,cell_area)
    30263026     WRITE(lunout,*)"apresilp=", za
    30273027     zx_t = 0.0
    30283028     za = 0.0
    30293029     DO i = 1, klon
    3030         za = za + airephy(i)/REAL(klon)
     3030        za = za + cell_area(i)/REAL(klon)
    30313031        zx_t = zx_t + (rain_lsc(i) &
    3032              + snow_lsc(i))*airephy(i)/REAL(klon)
     3032             + snow_lsc(i))*cell_area(i)/REAL(klon)
    30333033     ENDDO
    30343034     zx_t = zx_t/za*dtime
     
    30383038  IF (ip_ebil_phy.ge.2) THEN
    30393039     ztit='after fisrt'
    3040      CALL diagetpq(airephy,ztit,ip_ebil_phy,2,2,dtime &
     3040     CALL diagetpq(cell_area,ztit,ip_ebil_phy,2,2,dtime &
    30413041          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    30423042          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
    3043      call diagphy(airephy,ztit,ip_ebil_phy &
     3043     call diagphy(cell_area,ztit,ip_ebil_phy &
    30443044          , zero_v, zero_v, zero_v, zero_v, zero_v &
    30453045          , zero_v, rain_lsc, snow_lsc, ztsol &
     
    33083308  IF (ip_ebil_phy.ge.2) THEN
    33093309     ztit="after diagcld"
    3310      CALL diagetpq(airephy,ztit,ip_ebil_phy,2,2,dtime &
     3310     CALL diagetpq(cell_area,ztit,ip_ebil_phy,2,2,dtime &
    33113311          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    33123312          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
    3313      call diagphy(airephy,ztit,ip_ebil_phy &
     3313     call diagphy(cell_area,ztit,ip_ebil_phy &
    33143314          , zero_v, zero_v, zero_v, zero_v, zero_v &
    33153315          , zero_v, zero_v, zero_v, ztsol &
     
    33773377        CALL AEROSOL_METEO_CALC( &
    33783378             calday,pdtphys,pplay,paprs,t,pmflxr,pmflxs, &
    3379              prfl,psfl,pctsrf,airephy,rlat,rlon,u10m,v10m)
     3379             prfl,psfl,pctsrf,cell_area,rlat,rlon,u10m,v10m)
    33803380     END IF
    33813381
     
    33883388          rlat, &
    33893389          rlon, &
    3390           airephy, &
     3390          cell_area, &
    33913391          paprs, &
    33923392          pplay, &
     
    37353735  IF (ip_ebil_phy.ge.2) THEN
    37363736     ztit='after rad'
    3737      CALL diagetpq(airephy,ztit,ip_ebil_phy,2,2,dtime &
     3737     CALL diagetpq(cell_area,ztit,ip_ebil_phy,2,2,dtime &
    37383738          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    37393739          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
    3740      call diagphy(airephy,ztit,ip_ebil_phy &
     3740     call diagphy(cell_area,ztit,ip_ebil_phy &
    37413741          , topsw, toplw, solsw, sollw, zero_v &
    37423742          , zero_v, zero_v, zero_v, ztsol &
     
    39533953  IF (ip_ebil_phy.ge.2) THEN
    39543954     ztit='after orography'
    3955      CALL diagetpq(airephy,ztit,ip_ebil_phy,2,2,dtime &
     3955     CALL diagetpq(cell_area,ztit,ip_ebil_phy,2,2,dtime &
    39563956          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    39573957          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
    3958      call diagphy(airephy,ztit,ip_ebil_phy &
     3958     call diagphy(cell_area,ztit,ip_ebil_phy &
    39593959          , zero_v, zero_v, zero_v, zero_v, zero_v &
    39603960          , zero_v, zero_v, zero_v, ztsol &
     
    40614061          cdragh,coefh(1:klon,1:klev,is_ave),u1,v1,ftsol,pctsrf, &
    40624062          frac_impa, frac_nucl, &
    4063           pphis,airephy,dtime,itap, &
     4063          pphis,cell_area,dtime,itap, &
    40644064          qx(:,:,ivap),da,phi,mp,upwd,dnwd)
    40654065
     
    41014101  IF (ip_ebil_phy.ge.1) THEN
    41024102     ztit='after physic'
    4103      CALL diagetpq(airephy,ztit,ip_ebil_phy,1,1,dtime &
     4103     CALL diagetpq(cell_area,ztit,ip_ebil_phy,1,1,dtime &
    41044104          , t_seri,q_seri,ql_seri,qs_seri,u_seri,v_seri,paprs,pplay &
    41054105          , d_h_vcol, d_qt, d_qw, d_ql, d_qs, d_ec)
     
    41094109     !     Donc la somme de ces 2 variations devrait etre nulle.
    41104110
    4111      call diagphy(airephy,ztit,ip_ebil_phy &
     4111     call diagphy(cell_area,ztit,ip_ebil_phy &
    41124112          , topsw, toplw, solsw, sollw, sens &
    41134113          , evap, rain_fall, snow_fall, ztsol &
     
    41694169          paprs, &
    41704170          q_seri, &
    4171           airephy, &
     4171          cell_area, &
    41724172          pphi, &
    41734173          pphis, &
  • LMDZ5/trunk/libf/phylmd/phytrac_mod.F90

    r2345 r2351  
    9292    USE mod_grid_phy_lmdz
    9393    USE mod_phys_lmdz_para
    94     USE comgeomphy
    9594    USE iophy
    9695    USE traclmdz_mod
  • LMDZ5/trunk/libf/phylmd/surf_land_bucket_mod.F90

    r2254 r2351  
    2424    USE cpl_mod
    2525    USE dimphy
    26     USE comgeomphy
     26    USE geometry_mod, ONLY: latitude
    2727    USE mod_grid_phy_lmdz
    2828    USE mod_phys_lmdz_para
     
    9999    CALL calbeta(dtime, is_ter, knon, snow, qsol, beta, capsol, dif_grnd)
    100100    if (type_veget=='betaclim') then
    101        CALL calbeta_clim(knon,jour,rlatd(knindex(1:knon)),beta)
     101       CALL calbeta_clim(knon,jour,latitude(knindex(1:knon)),beta)
    102102    endif
    103103       
  • LMDZ5/trunk/libf/phylmd/surf_land_orchidee_mod.F90

    r2348 r2351  
    1616  USE cpl_mod,      ONLY : cpl_send_land_fields
    1717  USE surface_data, ONLY : type_ocean
    18   USE comgeomphy,   ONLY : cuphy, cvphy
     18  USE geometry_mod, ONLY : dx, dy
    1919  USE mod_grid_phy_lmdz
    20   USE mod_phys_lmdz_para, mpi_root_rank=>mpi_root
     20  USE mod_phys_lmdz_para, mpi_root_rank=>mpi_master
    2121
    2222  IMPLICIT NONE
     
    330330       DO igrid = 1, knon
    331331          ij = knindex(igrid)
    332           resolution(igrid,1) = cuphy(ij)
    333           resolution(igrid,2) = cvphy(ij)
     332          resolution(igrid,1) = dx(ij)
     333          resolution(igrid,2) = dy(ij)
    334334       ENDDO
    335335     
  • LMDZ5/trunk/libf/phylmd/surf_land_orchidee_noopenmp_mod.F90

    r2348 r2351  
    2121  USE cpl_mod,      ONLY : cpl_send_land_fields
    2222  USE surface_data, ONLY : type_ocean
    23   USE comgeomphy,   ONLY : cuphy, cvphy
     23  USE geometry_mod, ONLY : dx, dy
    2424  USE mod_grid_phy_lmdz
    2525  USE mod_phys_lmdz_para
     
    334334       DO igrid = 1, knon
    335335          ij = knindex(igrid)
    336           resolution(igrid,1) = cuphy(ij)
    337           resolution(igrid,2) = cvphy(ij)
     336          resolution(igrid,1) = dx(ij)
     337          resolution(igrid,2) = dy(ij)
    338338       ENDDO
    339339     
  • LMDZ5/trunk/libf/phylmd/thermcellV0_main.F90

    r2346 r2351  
    1313
    1414      USE dimphy
    15       USE comgeomphy , ONLY:rlond,rlatd
    1615      USE print_control_mod, ONLY: prt_level,lunout
    1716      IMPLICIT NONE
  • LMDZ5/trunk/libf/phylmd/thermcell_main.F90

    r2346 r2351  
    2323      USE dimphy
    2424      USE ioipsl
    25       USE comgeomphy , ONLY:rlond,rlatd
    2625      USE indice_sol_mod
    2726      USE print_control_mod, ONLY: lunout,prt_level
  • LMDZ5/trunk/libf/phylmd/tracinca_mod.F90

    r2345 r2351  
    5454    USE infotrac_phy, ONLY: nbtr
    5555    USE vampir
    56     USE comgeomphy
    5756    USE indice_sol_mod
    5857
  • LMDZ5/trunk/libf/phylmd/write_histday_seri.h

    r2344 r2351  
    2020      ok_msk=.FALSE.
    2121      msk(1:klon)=pctsrf(1:klon,is_ter)
    22       CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy,  &
     22      CALL moyglo_pondaire(klon, zx_tmp_fi2d, cell_area,  &
    2323           ok_msk, msk, moyglo)
    2424      zx_tmp_fi2d(1:klon)=moyglo
     
    2929!
    3030      ok_msk=.FALSE.
    31       CALL moyglo_pondaire(klon, bils, airephy,  &
     31      CALL moyglo_pondaire(klon, bils, cell_area,  &
    3232           ok_msk, msk, moyglo)
    3333      zx_tmp_fi2d(1:klon)=moyglo
     
    4545!
    4646      CALL moyglo_pondaima(klon, klev, zx_tmp_fi3d,  &
    47            airephy, paprs, moyglo)
     47           cell_area, paprs, moyglo)
    4848      zx_tmp_fi2d(1:klon)=moyglo
    4949!
     
    6262!
    6363      CALL moyglo_pondaima(klon, klev, zx_tmp_fi3d,  &
    64            airephy, paprs, moyglo)
     64           cell_area, paprs, moyglo)
    6565      zx_tmp_fi2d(1:klon)=moyglo
    6666!
     
    7676!
    7777      ok_msk=.FALSE.
    78       CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy,  &
     78      CALL moyglo_pondaire(klon, zx_tmp_fi2d, cell_area,  &
    7979           ok_msk, msk, moyglo)
    8080      zx_tmp_fi2d(1:klon)=moyglo
     
    8787!
    8888!IM 190504 BEG
    89       CALL gr_fi_dyn(1,klon,nbp_lon+1,nbp_lat,airephy,airedyn)
     89      CALL gr_fi_dyn(1,klon,nbp_lon+1,nbp_lat,cell_area,airedyn)
    9090      CALL gr_fi_dyn(klev+1,klon,nbp_lon+1,nbp_lat,paprs,padyn)
    9191      CALL gr_fi_dyn(1,klon,nbp_lon+1,nbp_lat,rlat,rlatdyn)
     
    120120!
    121121!
    122       CALL gr_fi_dyn(1,klon,nbp_lon+1,nbp_lat,airephy,airedyn)
    123       CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,airephy,zx_tmp_2d)
     122      CALL gr_fi_dyn(1,klon,nbp_lon+1,nbp_lat,cell_area,airedyn)
     123      CALL gr_fi_ecrit(1,klon,nbp_lon,nbp_lat,cell_area,zx_tmp_2d)
    124124      airetot=0.
    125125!     DO j = 1, nbp_lat
     
    134134!
    135135      DO i=1, klon
    136        airetot=airetot+airephy(i)
     136       airetot=airetot+cell_area(i)
    137137      ENDDO
    138138!     IF(itap.EQ.1) PRINT*,'airetotphy=',airetot
     
    161161!
    162162      CALL moyglo_pondmass(klon, klev, t_seri, &
    163            airephy, paprs, moyglo)
     163           cell_area, paprs, moyglo)
    164164      zx_tmp_fi2d(1:klon)=moyglo
    165165!
     
    169169!
    170170      ok_msk=.FALSE.
    171       CALL moyglo_pondaire(klon, paprs(:,1), airephy,  &
     171      CALL moyglo_pondaire(klon, paprs(:,1), cell_area,  &
    172172           ok_msk, msk, moyglo)
    173173      zx_tmp_fi2d(1:klon)=moyglo
     
    178178!
    179179      ok_msk=.FALSE.
    180       CALL moyglo_pondaire(klon, evap, airephy,  &
     180      CALL moyglo_pondaire(klon, evap, cell_area,  &
    181181           ok_msk, msk, moyglo)
    182182      zx_tmp_fi2d(1:klon)=moyglo
     
    192192!     ok_msk=.TRUE.
    193193!     msk(1:klon)=pctsrf(1:klon,is_ter)
    194 !     CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy,
     194!     CALL moyglo_pondaire(klon, zx_tmp_fi2d, cell_area,
    195195!    .                     ok_msk, msk, moyglo)
    196196!     zx_tmp_fi2d(1:klon)=moyglo
     
    208208!     ok_msk=.TRUE.
    209209!     msk(1:klon)=pctsrf(1:klon,is_ter)
    210 !     CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy,
     210!     CALL moyglo_pondaire(klon, zx_tmp_fi2d, cell_area,
    211211!    .     ok_msk, msk, moyglo)
    212212!     zx_tmp_fi2d(1:klon)=moyglo
     
    222222      ok_msk=.TRUE.
    223223      msk(1:klon)=pctsrf(1:klon,is_oce)
    224       CALL moyglo_pondaire(klon, zx_tmp_fi2d, airephy,  &
     224      CALL moyglo_pondaire(klon, zx_tmp_fi2d, cell_area,  &
    225225           ok_msk, msk, moyglo)
    226226      zx_tmp_fi2d(1:klon)=moyglo
  • LMDZ5/trunk/libf/phylmd/write_paramLMDZ_phy.h

    r2343 r2351  
    22! calcul moyennes globales
    33!
    4        zx_tmp_fi2d=bils*airephy
    5        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,gbils)
    6        zx_tmp_fi2d=evap*airephy
    7        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,gevap)
    8        zx_tmp_fi2d(:)=fevap(:, is_ter)*airephy(:)
    9        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,gevapt)
    10        zx_tmp_fi2d=zxfluxlat*airephy
    11        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,glat)
    12        zx_tmp_fi2d=(topsw0-toplw0)*airephy
    13        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,gnet0)
    14        zx_tmp_fi2d=(topsw-toplw)*airephy
    15        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,gnet)
    16        zx_tmp_fi2d=(rain_fall+snow_fall)*airephy
    17        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,grain)
    18        zx_tmp_fi2d=zxtsol*airephy
    19        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,gtsol)
    20        zx_tmp_fi2d=zt2m*airephy
    21        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,gt2m)
    22        zx_tmp_fi2d=prw*airephy
    23        CALL global_mean(zx_tmp_fi2d,airephy,.TRUE.,gprw)
     4       zx_tmp_fi2d=bils*cell_area
     5       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,gbils)
     6       zx_tmp_fi2d=evap*cell_area
     7       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,gevap)
     8       zx_tmp_fi2d(:)=fevap(:, is_ter)*cell_area(:)
     9       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,gevapt)
     10       zx_tmp_fi2d=zxfluxlat*cell_area
     11       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,glat)
     12       zx_tmp_fi2d=(topsw0-toplw0)*cell_area
     13       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,gnet0)
     14       zx_tmp_fi2d=(topsw-toplw)*cell_area
     15       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,gnet)
     16       zx_tmp_fi2d=(rain_fall+snow_fall)*cell_area
     17       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,grain)
     18       zx_tmp_fi2d=zxtsol*cell_area
     19       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,gtsol)
     20       zx_tmp_fi2d=zt2m*cell_area
     21       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,gt2m)
     22       zx_tmp_fi2d=prw*cell_area
     23       CALL global_mean(zx_tmp_fi2d,cell_area,.TRUE.,gprw)
    2424!
    2525!$OMP MASTER
  • LMDZ5/trunk/libf/phymar/phyaqua_mod.F90

    r2348 r2351  
    22! $Id: $
    33!
     4MODULE phyaqua_mod
    45
    5       subroutine iniaqua(nlon,latfi,lonfi,iflag_phys)
     6  IMPLICIT NONE
    67
    7 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    8 !  Create an initial state (startphy.nc) for the physics
    9 !  Usefull for idealised cases (e.g. aquaplanets or testcases)
    10 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     8CONTAINS
    119
    12       use phys_state_var_mod, only : rlat,rlon,
    13      &                               phys_state_var_init
    14       use mod_phys_lmdz_para, only : klon_omp
    15       use comgeomphy, only : rlond,rlatd
    16       implicit none
     10  SUBROUTINE iniaqua(nlon, iflag_phys)
     11
     12  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     13  !  Create an initial state (startphy.nc) for the physics
     14  !  Usefull for idealised cases (e.g. aquaplanets or testcases)
     15  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     16
     17  USE phys_state_var_mod, ONLY: rlat, rlon, phys_state_var_init
     18  USE mod_phys_lmdz_para, ONLY: klon_omp
     19  USE geometry_mod, ONLY: longitude_deg, latitude_deg
     20  IMPLICIT NONE
    1721     
    18       integer,intent(in) :: nlon,iflag_phys
    19       real,intent(in) :: lonfi(nlon),latfi(nlon)
     22  INTEGER,INTENT(IN) :: nlon,iflag_phys
    2023
    21 ! local variables
    22       real :: pi
     24  ! local variables
     25  REAL :: pi
    2326
    24 ! initializations:
    25       pi=2.*asin(1.)
     27  ! initializations:
     28  pi=2.*ASIN(1.)
    2629
    27       call phys_state_var_init()
     30  CALL phys_state_var_init()
    2831
    29       rlat(1:klon_omp)=rlatd(1:klon_omp)*180./pi
    30       rlon(1:klon_omp)=rlond(1:klon_omp)*180./pi
     32  rlat(1:klon_omp)=latitude_deg(1:klon_omp)
     33  rlon(1:klon_omp)=longitude_deg(1:klon_omp)
    3134
    3235
    33 ! Here you could create an initial condition for the physics
    34 ! ...
    35 ! ... fill in the fields...
    36 ! ...
    37 ! ... and create a "startphy.nc" file
     36  ! Here you could create an initial condition for the physics
     37  ! ...
     38  ! ... fill in the fields...
     39  ! ...
     40  ! ... and create a "startphy.nc" file
    3841      CALL phyredem ("startphy.nc")
    3942
    40       end
     43  END SUBROUTINE iniaqua
    4144
     45END MODULE phyaqua_mod
  • LMDZ5/trunk/libf/phymar/physiq.F90

    r2320 r2351  
    1111     &            debut,lafin,jD_cur, jH_cur,pdtphys, &
    1212     &            paprs,pplay,pphi,pphis,ppresnivs, &
    13      &            u,v,t,qx, &
     13     &            u,v,rot,t,qx, &
    1414     &            flxmass_w, &
    1515     &            d_u, d_v, d_t, d_qx, d_ps &
     
    1818      USE dimphy, only : klon,klev,klevp1
    1919      USE infotrac_phy, only : nqtot
    20       USE comgeomphy, only : rlatd,rlond,airephy
     20      USE geometry_mod, only : latitude,longitude,cell_area
    2121      !USE comcstphy, only : rg
    2222      USE iophy, only : histbeg_phy,histwrite_phy
     
    498498
    499499DO i=1,klon
    500   IF (rlond(i) .LT. 0) THEN
    501     lonh_HOST(i)=rlond(i)*12./rpi+24. ! from radians to hours
     500  IF (longitude(i) .LT. 0) THEN
     501    lonh_HOST(i)=longitude(i)*12./rpi+24. ! from radians to hours
    502502   ELSE
    503     lonh_HOST(i)=rlond(i)*12./rpi ! from radians to hours
     503    lonh_HOST(i)=longitude(i)*12./rpi ! from radians to hours
    504504  ENDIF
    505505ENDDO
    506 latr_HOST(:)=rlatd(:) ! from radians to radians
     506latr_HOST(:)=latitude(:) ! from radians to radians
    507507
    508508!PRINT*, 'lonh_HOST(:)=',lonh_HOST(:)
     
    689689PRINT*, 'Initialisation de la temperature de surface avec les SST aquaplanète'
    690690          DO i = 1,klon
    691             Ts___HOST(i)=273.+27.*(1-sin(1.5*rlatd(i))**2)
    692             IF ((rlatd(i).GT.1.0471975).OR.(rlatd(i).LT.-1.0471975)) THEN
     691            Ts___HOST(i)=273.+27.*(1-sin(1.5*latitude(i))**2)
     692            IF ((latitude(i).GT.1.0471975).OR.(latitude(i).LT.-1.0471975)) THEN
    693693              Ts___HOST(i)=273.
    694694            ENDIF
     
    791791DO k = 1, klev
    792792  i=klev+1-k
    793   !omega(i,k) = RG*flxmass_w(i,k) / airephy(i) ! omega en Pa/s
    794   Wa___HOST(:,i)=flxmass_w(:,k) / airephy(:) * (gZam_HOST(:,i+1) - gZam_HOST(:,i))/(paprs(:,k+1)-paprs(:,k)) ! Equilibre hydrostatique
     793  !omega(i,k) = RG*flxmass_w(i,k) / cell_area(i) ! omega en Pa/s
     794  Wa___HOST(:,i)=flxmass_w(:,k) / cell_area(:) * (gZam_HOST(:,i+1) - gZam_HOST(:,i))/(paprs(:,k+1)-paprs(:,k)) ! Equilibre hydrostatique
    795795END DO
    796796Wa___HOST(:,klev)=0 ! Vitesse nulle à la surface.
     
    853853!IF (debut) THEN
    854854  DO i=1,klon
    855     sst__HOST(i)=273.+27.*(1-sin(1.5*rlatd(i))**2)
    856     IF ((rlatd(i).GT.1.0471975).OR.(rlatd(i).LT.-1.0471975)) THEN
     855    sst__HOST(i)=273.+27.*(1-sin(1.5*latitude(i))**2)
     856    IF ((latitude(i).GT.1.0471975).OR.(latitude(i).LT.-1.0471975)) THEN
    857857      sst__HOST(i)=273.
    858858    ENDIF
     
    908908      ikl0 = i
    909909      PRINT*,'Attention : NaN at'
    910       PRINT*,'longitude=',rlond(i)*180/rpi
    911       PRINT*,'latitude=',rlatd(i)*180/rpi
     910      PRINT*,'longitude=',longitude(i)*180/rpi
     911      PRINT*,'latitude=',latitude(i)*180/rpi
    912912    ENDIF
    913913  ENDDO
Note: See TracChangeset for help on using the changeset viewer.