Ignore:
Timestamp:
Dec 14, 2015, 11:43:09 AM (9 years ago)
Author:
Laurent Fairhead
Message:

Merged trunk changes r2298:2396 into testing branch

Location:
LMDZ5/branches/testing
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/branches/testing

  • LMDZ5/branches/testing/libf/phylmd/surf_land_orchidee_noopenmp_mod.F90

    r1999 r2408  
    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
     
    9898    USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, fco2_land_inst, fco2_lu_inst
    9999    USE indice_sol_mod
     100    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat
     101    USE print_control_mod, ONLY: lunout
     102#ifdef CPP_VEGET
     103    USE time_phylmdz_mod, ONLY: itau_phy
     104#endif
    100105    IMPLICIT NONE
    101106
    102     INCLUDE "temps.h"
    103107    INCLUDE "YOMCST.h"
    104     INCLUDE "iniprint.h"
    105     INCLUDE "dimensions.h"
    106108 
    107109!
     
    215217       IF (carbon_cycle_cpl) THEN
    216218          abort_message='You must define preprossing key ORCH_NEW when running carbon_cycle_cpl=y'
    217           CALL abort_gcm(modname,abort_message,1)
     219          CALL abort_physic(modname,abort_message,1)
    218220       END IF
    219221#endif
     
    232234       DO igrid = 2, klon - 1
    233235          indi = indi + 1
    234           IF ( indi > iim) THEN
     236          IF ( indi > nbp_lon) THEN
    235237             indi = 1
    236238             indj = indj + 1
     
    240242       ENDDO
    241243       ig(klon) = 1
    242        jg(klon) = jjm + 1
     244       jg(klon) = nbp_lat
    243245
    244246       IF ((.NOT. ALLOCATED(lalo))) THEN
     
    246248          IF (error /= 0) THEN
    247249             abort_message='Pb allocation lalo'
    248              CALL abort_gcm(modname,abort_message,1)
     250             CALL abort_physic(modname,abort_message,1)
    249251          ENDIF
    250252       ENDIF
    251253       IF ((.NOT. ALLOCATED(lon_scat))) THEN
    252           ALLOCATE(lon_scat(iim,jjm+1), stat = error)
     254          ALLOCATE(lon_scat(nbp_lon,nbp_lat), stat = error)
    253255          IF (error /= 0) THEN
    254256             abort_message='Pb allocation lon_scat'
    255              CALL abort_gcm(modname,abort_message,1)
     257             CALL abort_physic(modname,abort_message,1)
    256258          ENDIF
    257259       ENDIF
    258260       IF ((.NOT. ALLOCATED(lat_scat))) THEN
    259           ALLOCATE(lat_scat(iim,jjm+1), stat = error)
     261          ALLOCATE(lat_scat(nbp_lon,nbp_lat), stat = error)
    260262          IF (error /= 0) THEN
    261263             abort_message='Pb allocation lat_scat'
    262              CALL abort_gcm(modname,abort_message,1)
     264             CALL abort_physic(modname,abort_message,1)
    263265          ENDIF
    264266       ENDIF
     
    278280       IF (is_mpi_root) THEN
    279281          index = 1
    280           DO jj = 2, jjm
    281              DO ij = 1, iim
     282          DO jj = 2, nbp_lat-1
     283             DO ij = 1, nbp_lon
    282284                index = index + 1
    283285                lon_scat(ij,jj) = rlon_g(index)
     
    287289          lon_scat(:,1) = lon_scat(:,2)
    288290          lat_scat(:,1) = rlat_g(1)
    289           lon_scat(:,jjm+1) = lon_scat(:,2)
    290           lat_scat(:,jjm+1) = rlat_g(klon_glo)
     291          lon_scat(:,nbp_lat) = lon_scat(:,2)
     292          lat_scat(:,nbp_lat) = rlat_g(klon_glo)
    291293       ENDIF
    292294
     
    301303          IF (error /= 0) THEN
    302304             abort_message='Pb allocation neighbours'
    303              CALL abort_gcm(modname,abort_message,1)
     305             CALL abort_physic(modname,abort_message,1)
    304306          ENDIF
    305307       ENDIF
     
    309311          IF (error /= 0) THEN
    310312             abort_message='Pb allocation contfrac'
    311              CALL abort_gcm(modname,abort_message,1)
     313             CALL abort_physic(modname,abort_message,1)
    312314          ENDIF
    313315       ENDIF
     
    327329          IF (error /= 0) THEN
    328330             abort_message='Pb allocation resolution'
    329              CALL abort_gcm(modname,abort_message,1)
     331             CALL abort_physic(modname,abort_message,1)
    330332          ENDIF
    331333       ENDIF
    332334       DO igrid = 1, knon
    333335          ij = knindex(igrid)
    334           resolution(igrid,1) = cuphy(ij)
    335           resolution(igrid,2) = cvphy(ij)
     336          resolution(igrid,1) = dx(ij)
     337          resolution(igrid,2) = dy(ij)
    336338       ENDDO
    337339     
     
    339341       IF (error /= 0) THEN
    340342          abort_message='Pb allocation coastalflow'
    341           CALL abort_gcm(modname,abort_message,1)
     343          CALL abort_physic(modname,abort_message,1)
    342344       ENDIF
    343345       
     
    345347       IF (error /= 0) THEN
    346348          abort_message='Pb allocation riverflow'
    347           CALL abort_gcm(modname,abort_message,1)
     349          CALL abort_physic(modname,abort_message,1)
    348350       ENDIF
    349351
     
    359361       IF (carbon_cycle_cpl) THEN
    360362          ALLOCATE(fco2_land_inst(klon),stat=error)
    361           IF (error /= 0)  CALL abort_gcm(modname,'Pb in allocation fco2_land_inst',1)
     363          IF (error /= 0)  CALL abort_physic(modname,'Pb in allocation fco2_land_inst',1)
    362364         
    363365          ALLOCATE(fco2_lu_inst(klon),stat=error)
    364           IF(error /=0) CALL abort_gcm(modname,'Pb in allocation fco2_lu_inst',1)
     366          IF(error /=0) CALL abort_physic(modname,'Pb in allocation fco2_lu_inst',1)
    365367       END IF
    366368
    367369       ALLOCATE(fields_cpl(klon,nb_fields_cpl), stat = error)
    368        IF (error /= 0) CALL abort_gcm(modname,'Pb in allocation fields_cpl',1)
     370       IF (error /= 0) CALL abort_physic(modname,'Pb in allocation fields_cpl',1)
    369371
    370372    ENDIF                          ! (fin debut)
     
    399401!  if (pole_nord) then
    400402!    offset=0
    401 !    ktindex(:)=ktindex(:)+iim-1
     403!    ktindex(:)=ktindex(:)+nbp_lon-1
    402404!  else
    403 !    offset = klon_mpi_begin-1+iim-1
    404 !    ktindex(:)=ktindex(:)+MOD(offset,iim)
    405 !    offset=offset-MOD(offset,iim)
     405!    offset = klon_mpi_begin-1+nbp_lon-1
     406!    ktindex(:)=ktindex(:)+MOD(offset,nbp_lon)
     407!    offset=offset-MOD(offset,nbp_lon)
    406408!  endif
    407409 
     
    413415#ifndef CPP_MPI
    414416          ! Interface for ORCHIDEE compiled in sequential mode(without preprocessing flag CPP_MPI)
    415           CALL intersurf_main (itime+itau_phy-1, iim, jjm+1, knon, ktindex, dtime, &
     417          CALL intersurf_main (itime+itau_phy-1, nbp_lon, nbp_lat, knon, ktindex, dtime, &
    416418               lrestart_read, lrestart_write, lalo, &
    417419               contfrac, neighbours, resolution, date0, &
     
    430432#else         
    431433          ! Interface for ORCHIDEE version 1.9 or later(1.9.2, 1.9.3, 1.9.4, 1.9.5) compiled in parallel mode(with preprocessing flag CPP_MPI)
    432           CALL intersurf_main (itime+itau_phy-1, iim, jjm+1, offset, knon, ktindex, &
     434          CALL intersurf_main (itime+itau_phy-1, nbp_lon, nbp_lat, offset, knon, ktindex, &
    433435               orch_comm, dtime, lrestart_read, lrestart_write, lalo, &
    434436               contfrac, neighbours, resolution, date0, &
     
    458460#ifndef CPP_MPI
    459461       ! Interface for ORCHIDEE compiled in sequential mode(without preprocessing flag CPP_MPI)
    460        CALL intersurf_main (itime+itau_phy, iim, jjm+1, knon, ktindex, dtime, &
     462       CALL intersurf_main (itime+itau_phy, nbp_lon, nbp_lat, knon, ktindex, dtime, &
    461463            lrestart_read, lrestart_write, lalo, &
    462464            contfrac, neighbours, resolution, date0, &
     
    474476#else
    475477       ! Interface for ORCHIDEE version 1.9 or later compiled in parallel mode(with preprocessing flag CPP_MPI)
    476        CALL intersurf_main (itime+itau_phy, iim, jjm+1,offset, knon, ktindex, &
     478       CALL intersurf_main (itime+itau_phy, nbp_lon, nbp_lat,offset, knon, ktindex, &
    477479            orch_comm,dtime, lrestart_read, lrestart_write, lalo, &
    478480            contfrac, neighbours, resolution, date0, &
     
    530532  SUBROUTINE Init_orchidee_index(knon,orch_comm,knindex,offset,ktindex)
    531533   
    532     INCLUDE "dimensions.h"
     534    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat
    533535
    534536#ifdef CPP_MPI
     
    563565!****************************************************************************************
    564566
    565     MyLastPoint=klon_mpi_begin-1+knindex(knon)+iim-1
     567    MyLastPoint=klon_mpi_begin-1+knindex(knon)+nbp_lon-1
    566568   
    567569    IF (is_parallel) THEN
     
    592594       offset=0
    593595    ELSE
    594        offset=LastPoint-MOD(LastPoint,iim)
    595     ENDIF
    596    
    597     ktindex(1:knon)=knindex(1:knon)+(klon_mpi_begin+iim-1)-offset-1     
     596       offset=LastPoint-MOD(LastPoint,nbp_lon)
     597    ENDIF
     598   
     599    ktindex(1:knon)=knindex(1:knon)+(klon_mpi_begin+nbp_lon-1)-offset-1
    598600   
    599601
     
    635637   
    636638    USE indice_sol_mod
    637 
    638     INCLUDE "dimensions.h"
     639    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat
     640
    639641#ifdef CPP_MPI
    640642    INCLUDE 'mpif.h'
     
    662664    INTEGER, DIMENSION(8)                :: offset 
    663665    INTEGER, DIMENSION(knon)             :: ktindex_p
    664     INTEGER, DIMENSION(iim,jjm+1)        :: correspond
     666    INTEGER, DIMENSION(nbp_lon,nbp_lat)        :: correspond
    665667    INTEGER, ALLOCATABLE, DIMENSION(:)   :: ktindex_g
    666668    INTEGER, ALLOCATABLE, DIMENSION(:,:) :: neighbours_g
     
    695697   ENDIF
    696698   
    697     ktindex_p(1:knon)=ktindex(1:knon)+klon_mpi_begin-1+iim-1
     699    ktindex_p(1:knon)=ktindex(1:knon)+klon_mpi_begin-1+nbp_lon-1
    698700   
    699701    IF (is_sequential) THEN
     
    714716!
    715717! offset bord ouest
    716        off_ini(1,1) = - iim  ; off_ini(2,1) = - iim + 1; off_ini(3,1) = 1
    717        off_ini(4,1) = iim + 1; off_ini(5,1) = iim      ; off_ini(6,1) = 2 * iim - 1
    718        off_ini(7,1) = iim -1 ; off_ini(8,1) = - 1
     718       off_ini(1,1) = - nbp_lon  ; off_ini(2,1) = - nbp_lon + 1; off_ini(3,1) = 1
     719       off_ini(4,1) = nbp_lon + 1; off_ini(5,1) = nbp_lon      ; off_ini(6,1) = 2 * nbp_lon - 1
     720       off_ini(7,1) = nbp_lon -1 ; off_ini(8,1) = - 1
    719721! offset point normal
    720        off_ini(1,2) = - iim  ; off_ini(2,2) = - iim + 1; off_ini(3,2) = 1
    721        off_ini(4,2) = iim + 1; off_ini(5,2) = iim      ; off_ini(6,2) = iim - 1
    722        off_ini(7,2) = -1     ; off_ini(8,2) = - iim - 1
     722       off_ini(1,2) = - nbp_lon  ; off_ini(2,2) = - nbp_lon + 1; off_ini(3,2) = 1
     723       off_ini(4,2) = nbp_lon + 1; off_ini(5,2) = nbp_lon      ; off_ini(6,2) = nbp_lon - 1
     724       off_ini(7,2) = -1     ; off_ini(8,2) = - nbp_lon - 1
    723725! offset bord   est
    724        off_ini(1,3) = - iim; off_ini(2,3) = - 2 * iim + 1; off_ini(3,3) = - iim + 1
    725        off_ini(4,3) =  1   ; off_ini(5,3) = iim          ; off_ini(6,3) = iim - 1
    726        off_ini(7,3) = -1   ; off_ini(8,3) = - iim - 1
     726       off_ini(1,3) = - nbp_lon; off_ini(2,3) = - 2 * nbp_lon + 1; off_ini(3,3) = - nbp_lon + 1
     727       off_ini(4,3) =  1   ; off_ini(5,3) = nbp_lon          ; off_ini(6,3) = nbp_lon - 1
     728       off_ini(7,3) = -1   ; off_ini(8,3) = - nbp_lon - 1
    727729!
    728730!
     
    731733       DO igrid = 1, knon_g
    732734          index = ktindex_g(igrid)
    733           jj = INT((index - 1)/iim) + 1
    734           ij = index - (jj - 1) * iim
     735          jj = INT((index - 1)/nbp_lon) + 1
     736          ij = index - (jj - 1) * nbp_lon
    735737          correspond(ij,jj) = igrid
    736738       ENDDO
     
    738740       DO igrid = 1, knon_g
    739741          iglob = ktindex_g(igrid)
    740           IF (MOD(iglob, iim) == 1) THEN
     742          IF (MOD(iglob, nbp_lon) == 1) THEN
    741743             offset = off_ini(:,1)
    742           ELSE IF(MOD(iglob, iim) == 0) THEN
     744          ELSE IF(MOD(iglob, nbp_lon) == 0) THEN
    743745             offset = off_ini(:,3)
    744746          ELSE
     
    747749          DO i = 1, 8
    748750             index = iglob + offset(i)
    749              ireal = (MIN(MAX(1, index - iim + 1), klon_glo))
     751             ireal = (MIN(MAX(1, index - nbp_lon + 1), klon_glo))
    750752             IF (pctsrf_g(ireal) > EPSFRA) THEN
    751                 jj = INT((index - 1)/iim) + 1
    752                 ij = index - (jj - 1) * iim
     753                jj = INT((index - 1)/nbp_lon) + 1
     754                ij = index - (jj - 1) * nbp_lon
    753755                neighbours_g(igrid, i) = correspond(ij, jj)
    754756             ENDIF
Note: See TracChangeset for help on using the changeset viewer.