Changeset 1682


Ignore:
Timestamp:
Mar 31, 2017, 11:31:38 AM (8 years ago)
Author:
emillour
Message:

All GCMs: set things up to enable pluging physics with dynamico

  • dyn3d
  • gcm.F90 : move I/O initialization (dates) to be done before physics

initialization

  • dyn3dpar
  • gcm.F : move I/O initialization (dates) to be done before physics

initialization

  • dynphy_lonlat:
  • inigeomphy_mod.F90 : add ind_cell_glo computation and transfer

to init_geometry

  • phy_common:
  • geometry_mod.F90 : add ind_cell_glo module variable to store global

column index

  • print_control_mod.F90 : make initialization occur via init_print_control_mod

to avoid circular module dependencies

  • init_print_control_mod.F90 : added to initialize print_control_mod module

variables

  • mod_phys_lmdz_mpi_data.F90 : use print_control_mod (rather than iniprint.h)
  • mod_phys_lmdz_para.F90 : use print_control_mod (rather than iniprint.h)
  • mod_phys_lmdz_omp_data.F90 : add is_omp_master (alias of is_omp_root) module

variable and use print_control_mod (rather than
iniprint.h)

  • physics_distribution_mod.F90 : add call to init_dimphy in

init_physics_distribution

  • xios_writefield.F90 : generic routine to output field with XIOS (for debug)
  • misc:
  • handle_err_m.F90 : call abort_physic, rather than abort_gcm
  • wxios.F90 : updates to enable unstructured grids

set module variable g_ctx_name to "LMDZ"
wxios_init(): remove call to wxios_context_init
wxios_context_init(): call xios_context_initialize with COMM_LMDZ_PHY
add routine wxios_set_context() to get handle and set context to XIOS
wxios_domain_param(): change arguments and generate the domain in-place
add wxios_domain_param_unstructured(): generate domain for unstructured case

NB: access is via "domain group" (whereas it is via "domain" in

wxios_domain_param)

  • dynphy_lonlat/phy[std|mars|venus|titan]:
  • iniphysiq_mod.F90 : Remove call to init_dimphy (which is now done in

phy_common/physics_distribution_mod.F90)

EM

Location:
trunk
Files:
6 added
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/DOC/chantiers/commit_importants.log

    r1650 r1682  
    19601960* misc
    19611961- wxios.F90 : follow up on changes in LMDZ5
     1962
     1963**********************
     1964**** commit_v1682 ****
     1965**********************
     1966Ehouarn: set things up to enable pluging physics with dynamico
     1967
     1968* dyn3d
     1969- gcm.F90 : move I/O initialization (dates) to be done before physics
     1970            initialization
     1971
     1972* dyn3dpar
     1973- gcm.F : move I/O initialization (dates) to be done before physics
     1974          initialization
     1975
     1976* dynphy_lonlat:
     1977- inigeomphy_mod.F90 : add ind_cell_glo computation and  transfer
     1978                       to init_geometry
     1979
     1980* phy_common:
     1981- geometry_mod.F90 : add ind_cell_glo module variable to store global
     1982                     column index
     1983- print_control_mod.F90 : make initialization occur via init_print_control_mod
     1984                          to avoid circular module dependencies
     1985- init_print_control_mod.F90 : added to initialize print_control_mod module
     1986                               variables
     1987- mod_phys_lmdz_mpi_data.F90 : use print_control_mod (rather than iniprint.h)
     1988- mod_phys_lmdz_para.F90 : use print_control_mod (rather than iniprint.h)
     1989- mod_phys_lmdz_omp_data.F90 : add is_omp_master (alias of is_omp_root) module
     1990                               variable and use print_control_mod (rather than
     1991                               iniprint.h)
     1992- physics_distribution_mod.F90 : add call to init_dimphy in
     1993                                 init_physics_distribution
     1994- xios_writefield.F90 : generic routine to output field with XIOS (for debug)
     1995
     1996* misc:
     1997- handle_err_m.F90 : call abort_physic, rather than abort_gcm
     1998- wxios.F90 : updates to enable unstructured grids
     1999   set module variable g_ctx_name to "LMDZ"
     2000   wxios_init(): remove call to wxios_context_init
     2001   wxios_context_init(): call xios_context_initialize with COMM_LMDZ_PHY
     2002   add routine wxios_set_context() to get handle and set context to XIOS
     2003   wxios_domain_param(): change arguments and generate the domain in-place
     2004   add wxios_domain_param_unstructured(): generate domain for unstructured case
     2005       NB: access is via "domain group" (whereas it is via "domain" in
     2006                                         wxios_domain_param)
     2007* dynphy_lonlat/phy[std|mars|venus|titan]:
     2008- iniphysiq_mod.F90 : Remove call to init_dimphy (which is now done in
     2009                      phy_common/physics_distribution_mod.F90)
     2010
     2011* phystd:
     2012- ocean_slab_mod.F90 : call abort_physic, rather than abort_gcm
     2013- inifis_mod.F90 : initialize print_control variables
     2014- physiq_mod.F90 : add XIOS context initialization and finalization
     2015- xios_output_mod.F90 : update initialize_xios_output initialization
     2016                        of the horizontal domain
     2017
  • trunk/LMDZ.COMMON/libf/dyn3d/gcm.F90

    r1672 r1682  
    417417
    418418  !-----------------------------------------------------------------------
    419   !   Initialisation de la physique :
    420   !   -------------------------------
    421 
    422   IF ((iflag_phys==1).or.(iflag_phys>=100)) THEN
    423      ! Physics:
    424 #ifdef CPP_PHYS
    425      CALL iniphysiq(iim,jjm,llm, &
    426           (jjm-1)*iim+2,comm_lmdz, &
    427           daysec,day_ini,dtphys/nsplit_phys, &
    428           rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp, &
    429           iflag_phys)
    430 #endif
    431   ENDIF ! of IF ((iflag_phys==1).or.(iflag_phys>=100))
    432 
    433   !-----------------------------------------------------------------------
    434419  !   Initialisation des I/O :
    435420  !   ------------------------
     
    465450#endif
    466451
     452
     453  !-----------------------------------------------------------------------
     454  !   Initialisation de la physique :
     455  !   -------------------------------
     456
     457  IF ((iflag_phys==1).or.(iflag_phys>=100)) THEN
     458     ! Physics:
     459#ifdef CPP_PHYS
     460     CALL iniphysiq(iim,jjm,llm, &
     461          (jjm-1)*iim+2,comm_lmdz, &
     462          daysec,day_ini,dtphys/nsplit_phys, &
     463          rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp, &
     464          iflag_phys)
     465#endif
     466  ENDIF ! of IF ((iflag_phys==1).or.(iflag_phys>=100))
     467
     468
    467469  if (planet_type=="mars") then
    468470    ! For Mars we transmit day_ini
  • trunk/LMDZ.COMMON/libf/dyn3dpar/gcm.F

    r1672 r1682  
    441441
    442442c-----------------------------------------------------------------------
    443 c   Initialisation de la physique :
    444 c   -------------------------------
    445 
    446       IF ((iflag_phys==1).or.(iflag_phys>=100)) THEN
    447 !         latfi(1)=rlatu(1)
    448 !         lonfi(1)=0.
    449 !         zcufi(1) = cu(1)
    450 !         zcvfi(1) = cv(1)
    451 !         DO j=2,jjm
    452 !            DO i=1,iim
    453 !               latfi((j-2)*iim+1+i)= rlatu(j)
    454 !               lonfi((j-2)*iim+1+i)= rlonv(i)
    455 !               zcufi((j-2)*iim+1+i) = cu((j-1)*iip1+i)
    456 !               zcvfi((j-2)*iim+1+i) = cv((j-1)*iip1+i)
    457 !            ENDDO
    458 !         ENDDO
    459 !         latfi(ngridmx)= rlatu(jjp1)
    460 !         lonfi(ngridmx)= 0.
    461 !         zcufi(ngridmx) = cu(ip1jm+1)
    462 !         zcvfi(ngridmx) = cv(ip1jm-iim)
    463 
    464          ! build airefi(), mesh area on physics grid
    465 !         CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi)
    466          ! Poles are single points on physics grid
    467 !         airefi(1)=airefi(1)*iim
    468 !         airefi(ngridmx)=airefi(ngridmx)*iim
    469 
    470 ! Physics
    471 #ifdef CPP_PHYS
    472 !         CALL iniphysiq(ngridmx,llm,daysec,day_ini,dtphys/nsplit_phys,
    473 !     &                latfi,lonfi,airefi,zcufi,zcvfi,rad,g,r,cpp,
    474 !     &                iflag_phys)
    475          CALL iniphysiq(iim,jjm,llm,
    476      &                distrib_phys(mpi_rank),comm_lmdz,
    477      &                daysec,day_ini,dtphys/nsplit_phys,
    478      &                rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp,
    479      &                iflag_phys)
    480 #endif
    481 !         call_iniphys=.false.
    482       ENDIF ! of IF (call_iniphys.and.(iflag_phys==1.or.iflag_phys>=100))
    483 
    484 
    485 c-----------------------------------------------------------------------
    486443c   Initialisation des I/O :
    487444c   ------------------------
     
    519476#endif
    520477
     478
     479c-----------------------------------------------------------------------
     480c   Initialisation de la physique :
     481c   -------------------------------
     482
     483      IF ((iflag_phys==1).or.(iflag_phys>=100)) THEN
     484! Physics
     485#ifdef CPP_PHYS
     486         CALL iniphysiq(iim,jjm,llm,
     487     &                distrib_phys(mpi_rank),comm_lmdz,
     488     &                daysec,day_ini,dtphys/nsplit_phys,
     489     &                rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp,
     490     &                iflag_phys)
     491#endif
     492!         call_iniphys=.false.
     493      ENDIF ! of IF (call_iniphys.and.(iflag_phys==1.or.iflag_phys>=100))
     494
     495
    521496      if (planet_type=="mars") then
    522497         ! For Mars we transmit day_ini
  • trunk/LMDZ.COMMON/libf/dynphy_lonlat/inigeomphy_mod.F90

    r1621 r1682  
    7373  REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)
    7474  REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)
    75 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
     75  INTEGER,ALLOCATABLE,SAVE :: ind_cell_glo_fi(:)
     76!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi,ind_cell_glo_fi)
    7677
    7778  ! Initialize Physics distibution and parameters and interface with dynamics
     
    201202  ALLOCATE(boundslonfi(klon_omp,4))
    202203  ALLOCATE(boundslatfi(klon_omp,4))
    203 !  CALL initcomgeomphy
     204  ALLOCATE(ind_cell_glo_fi(klon_omp))
     205
    204206
    205207  offset = klon_mpi_begin - 1
     
    211213  boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
    212214  boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     215  ind_cell_glo_fi(1:klon_omp)=(/ (i,i=offset+klon_omp_begin,offset+klon_omp_end) /)
    213216
    214217  ! copy over local grid longitudes and latitudes
    215218  CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
    216                      airefi,cufi,cvfi)
     219                     airefi,ind_cell_glo_fi,cufi,cvfi)
    217220
    218221  ! copy over preff , ap(), bp(), etc
  • trunk/LMDZ.COMMON/libf/dynphy_lonlat/phyvenus/iniphysiq_mod.F90

    r1621 r1682  
    7272!$OMP PARALLEL
    7373
    74   ! Initialize dimphy module
    75   call init_dimphy(klon_omp,nlayer)
     74  ! Initialize dimphy module => Now done in physics_distribution_mod
     75  !call init_dimphy(klon_omp,nlayer)
    7676
    7777  ! Initialize some physical constants
  • trunk/LMDZ.COMMON/libf/misc/handle_err_m.F90

    r1391 r1682  
    3939          end if
    4040       end if
    41        call abort_gcm("NetCDF95 handle_err", "", 1)
     41       call abort_physic("NetCDF95 handle_err", "", 1)
    4242    end if
    4343
  • trunk/LMDZ.COMMON/libf/misc/wxios.F90

    r1650 r1682  
    1515   
    1616    INTEGER, SAVE :: g_comm
    17     CHARACTER(len=100), SAVE :: g_ctx_name
     17    CHARACTER(len=100), SAVE :: g_ctx_name ="LMDZ"
    1818    TYPE(xios_context), SAVE :: g_ctx
    1919!$OMP THREADPRIVATE(g_comm,g_cts_name,g_ctx)
     
    136136        g_ctx_name = xios_ctx_name
    137137       
    138         ! Si couple alors init fait dans cpl_init
    139         IF (.not. PRESENT(type_ocean)) THEN
    140             CALL wxios_context_init()
    141         ENDIF
     138!        ! Si couple alors init fait dans cpl_init
     139!        IF (.not. PRESENT(type_ocean)) THEN
     140!            CALL wxios_context_init()
     141!        ENDIF
    142142
    143143    END SUBROUTINE wxios_init
     
    145145    SUBROUTINE wxios_context_init()
    146146        USE print_control_mod, ONLY : prt_level, lunout
    147 !        USE mod_phys_lmdz_mpi_data, ONLY : COMM_LMDZ_PHY
     147        USE mod_phys_lmdz_mpi_data, ONLY : COMM_LMDZ_PHY
    148148        IMPLICIT NONE
    149149
     
    152152!$OMP MASTER
    153153        !Initialisation du contexte:
    154         CALL xios_context_initialize(g_ctx_name, g_comm)
     154        CALL xios_context_initialize(g_ctx_name, COMM_LMDZ_PHY)
    155155        CALL xios_get_handle(g_ctx_name, xios_ctx)    !Récupération
    156156        CALL xios_set_current_context(xios_ctx)            !Activation
     
    165165!$OMP END MASTER
    166166    END SUBROUTINE wxios_context_init
     167
     168
     169    SUBROUTINE wxios_set_context()
     170        IMPLICIT NONE
     171        TYPE(xios_context) :: xios_ctx
     172
     173       !$OMP MASTER
     174        CALL xios_get_handle(g_ctx_name, xios_ctx)    !Récupération
     175        CALL xios_set_current_context(xios_ctx)            !Activation
     176       !$OMP END MASTER
     177
     178    END SUBROUTINE wxios_set_context
    167179
    168180    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    203215            CASE DEFAULT
    204216                abort_message = 'wxios_set_cal: Mauvais choix de calendrier'
    205                 CALL abort_gcm('Gcm:Xios',abort_message,1)
     217                CALL abort_physic('Gcm:Xios',abort_message,1)
    206218        END SELECT
    207219       
     
    210222       
    211223        IF (prt_level >= 10) WRITE(lunout,*) "wxios_set_cal: Time origin: ", date
     224
    212225        CALL xios_set_time_origin(xios_date(annee,mois,jour,int(heure),0,0))
    213226
     
    237250    ! Pour initialiser un domaine !!!!!!!!!!!!!!!!!!!!
    238251    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    239     SUBROUTINE wxios_domain_param(dom_id, is_sequential, ni, nj, ni_glo, nj_glo,        &
    240                                     ibegin, iend, ii_begin, ii_end, jbegin, jend,       &
    241                                     data_ni, data_ibegin, data_iend,                    &
    242                                     io_lat, io_lon,is_south_pole,mpi_rank)
    243          
    244 
    245         USE print_control_mod, ONLY : prt_level, lunout
    246         IMPLICIT NONE
    247 
     252    SUBROUTINE wxios_domain_param(dom_id,flip_coordinates)
     253       USE dimphy, only: klon
     254       USE mod_phys_lmdz_transfert_para, ONLY: gather, bcast
     255       USE mod_phys_lmdz_para, only: jj_nb, jj_begin, jj_end, ii_begin, ii_end, &
     256                                     mpi_size, mpi_rank, klon_mpi, &
     257                                     is_sequential, is_south_pole_dyn
     258       USE mod_grid_phy_lmdz, only: nbp_lon, nbp_lat, klon_glo         
     259       USE print_control_mod, ONLY : prt_level, lunout
     260       USE geometry_mod
     261
     262       IMPLICIT NONE
    248263        CHARACTER(len=*),INTENT(IN) :: dom_id ! domain identifier
    249         LOGICAL,INTENT(IN) :: is_sequential ! flag
    250         INTEGER,INTENT(IN) :: ni ! local MPI domain number of longitudes
    251         INTEGER,INTENT(IN) :: nj ! local MPI domain number of latitudes
    252         INTEGER,INTENT(IN) :: ni_glo ! global grid number of longitudes
    253         INTEGER,INTENT(IN) :: nj_glo ! global grid number of latitudes
    254         INTEGER,INTENT(IN) :: ibegin ! start index, on global grid, of local MPI domain
    255         INTEGER,INTENT(IN) :: iend ! end index, on global grid, of local MPI domain
    256         INTEGER,INTENT(IN) :: ii_begin ! i index at which local data starts (first row)
    257         INTEGER,INTENT(IN) :: ii_end ! i index at which local data ends (last row)
    258         INTEGER,INTENT(IN) :: jbegin ! start index, on global grid, of local MPI domain
    259         INTEGER,INTENT(IN) :: jend ! end index, on global grid, of local MPI domain
    260         INTEGER,INTENT(IN) :: data_ni
    261         INTEGER,INTENT(IN) :: data_ibegin
    262         INTEGER,INTENT(IN) :: data_iend
    263         REAL,INTENT(IN) :: io_lat(:) ! latitudes (of global grid)
    264         REAL,INTENT(IN) :: io_lon(:) ! longitudes (of global grid)
    265         logical,intent(in) :: is_south_pole ! does this process include the south pole?
    266         integer,intent(in) :: mpi_rank ! rank of process
    267        
     264        LOGICAL,OPTIONAL,INTENT(IN) :: flip_coordinates ! .true. to change signs
     265                                                        ! of coordinates
     266        LOGICAL :: flip_axes=.false. ! default; do not swap axes
     267        REAL   :: rlat_glo(klon_glo)
     268        REAL   :: rlon_glo(klon_glo)
     269        REAL   :: io_lat(nbp_lat)
     270        REAL   :: io_lon(nbp_lon)
     271        LOGICAL :: mask(nbp_lon,jj_nb) !Masque pour les problèmes de recouvrement MPI
    268272        TYPE(xios_domain) :: dom
     273        INTEGER :: i
    269274        LOGICAL :: boool
    270275       
    271         !Masque pour les problèmes de recouvrement MPI:
    272         LOGICAL :: mask(ni,nj)
     276
     277        IF (flip_axes) THEN
     278          ! change signs of axes
     279          CALL gather(-latitude_deg,rlat_glo)
     280          CALL bcast(rlat_glo)
     281          CALL gather(-longitude_deg,rlon_glo)
     282          CALL bcast(rlon_glo)
     283        ELSE
     284          CALL gather(latitude_deg,rlat_glo)
     285          CALL bcast(rlat_glo)
     286          CALL gather(longitude_deg,rlon_glo)
     287          CALL bcast(rlon_glo)
     288        ENDIF
     289   
     290  !$OMP MASTER 
     291        io_lat(1)=rlat_glo(1)
     292        io_lat(nbp_lat)=rlat_glo(klon_glo)
     293        IF ((nbp_lon*nbp_lat) > 1) then
     294          DO i=2,nbp_lat-1
     295            io_lat(i)=rlat_glo(2+(i-2)*nbp_lon)
     296          ENDDO
     297        ENDIF
     298
     299        IF (klon_glo == 1) THEN
     300          io_lon(1)=rlon_glo(1)
     301        ELSE
     302          io_lon(1:nbp_lon)=rlon_glo(2:nbp_lon+1)
     303        ENDIF
     304
    273305       
    274306        !On récupère le handle:
    275307        CALL xios_get_domain_handle(dom_id, dom)
    276308       
    277         IF (prt_level >= 10) THEN
    278           WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," ni:",ni," ni_glo:", ni_glo, " nj:", nj, " nj_glo:", nj_glo
    279           WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," ibegin:",ibegin," iend:", iend, " jbegin:", jbegin, " jend:", jend
    280           WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," ii_begin:",ii_begin," ii_end:", ii_end
    281           WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," Size io_lon:", SIZE(io_lon(ibegin:iend)), " io_lat:", SIZE(io_lat(jbegin:jend))
    282         ENDIF
    283        
    284309        !On parametrise le domaine:
    285         CALL xios_set_domain_attr_hdl(dom, ni_glo=ni_glo, ibegin=ibegin-1, ni=ni, type="rectilinear")
    286         CALL xios_set_domain_attr_hdl(dom, nj_glo=nj_glo, jbegin=jbegin-1, nj=nj, data_dim=2)
    287         CALL xios_set_domain_attr_hdl(dom, lonvalue_1d=io_lon(ibegin:iend), latvalue_1d=io_lat(jbegin:jend))
     310        CALL xios_set_domain_attr_hdl(dom, ni_glo=nbp_lon, ibegin=0, ni=nbp_lon, type="rectilinear")
     311        CALL xios_set_domain_attr_hdl(dom, nj_glo=nbp_lat, jbegin=jj_begin-1, nj=jj_nb, data_dim=2)
     312        CALL xios_set_domain_attr_hdl(dom, lonvalue_1d=io_lon(1:nbp_lon), latvalue_1d=io_lat(jj_begin:jj_end))
     313
    288314        IF (.NOT.is_sequential) THEN
    289315            mask(:,:)=.TRUE.
    290316            if (ii_begin>1) mask(1:ii_begin-1,1) = .FALSE.
    291             if (ii_end<ni) mask(ii_end+1:ni,nj) = .FALSE.
     317            if (ii_end<nbp_lon) mask(ii_end+1:nbp_lon,jj_nb) = .FALSE.
    292318            ! special case for south pole
    293             if ((ii_end.eq.1).and.(is_south_pole)) mask(1:ni,nj)=.true.
     319            if ((ii_end==1).and.(is_south_pole_dyn)) mask(1:nbp_lon,jj_nb)=.true.
    294320            IF (prt_level >= 10) THEN
    295321              WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,1)=",mask(:,1)
    296               WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,nj)=",mask(:,nj)
     322              WRITE(lunout,*) "wxios_domain_param: mpirank=",mpi_rank," mask(:,jj_nb)=",mask(:,jj_nb)
    297323            ENDIF
    298324            CALL xios_set_domain_attr_hdl(dom, mask_2d=mask)
     
    306332            IF (prt_level >= 10) WRITE(lunout,*) "wxios_domain_param: Invalid domain: ", trim(dom_id)
    307333        END IF
     334!$OMP END MASTER
     335       
    308336    END SUBROUTINE wxios_domain_param
    309337   
     338
     339    SUBROUTINE wxios_domain_param_unstructured(dom_id,flip_coordinates)
     340        USE geometry_mod, ONLY : longitude, latitude, boundslon, boundslat,ind_cell_glo
     341        USE mod_grid_phy_lmdz, ONLY : nvertex, klon_glo
     342        USE mod_phys_lmdz_para
     343        USE nrtype, ONLY : PI
     344        IMPLICIT NONE
     345        CHARACTER(len=*),INTENT(IN) :: dom_id ! domain identifier
     346        LOGICAL,OPTIONAL,INTENT(IN) :: flip_coordinates ! .true. to change signs
     347                                                        ! of coordinates
     348        LOGICAL :: flip_axes=.false. ! default; do not swap axes
     349        REAL :: lon_mpi(klon_mpi)
     350        REAL :: lat_mpi(klon_mpi)
     351        REAL :: boundslon_mpi(klon_mpi,nvertex)
     352        REAL :: boundslat_mpi(klon_mpi,nvertex)
     353        INTEGER :: ind_cell_glo_mpi(klon_mpi)
     354        TYPE(xios_domaingroup) :: dom
     355
     356        IF (PRESENT(flip_coordinates)) flip_axes=flip_coordinates
     357       
     358        IF (flip_axes) THEN
     359          ! change signs of axes and boundaries
     360          CALL gather_omp(-longitude*180/PI,lon_mpi)
     361          CALL gather_omp(-latitude*180/PI,lat_mpi)
     362          CALL gather_omp(-boundslon*180/PI,boundslon_mpi)
     363          CALL gather_omp(-boundslat*180/PI,boundslat_mpi)
     364        ELSE
     365          CALL gather_omp(longitude*180/PI,lon_mpi)
     366          CALL gather_omp(latitude*180/PI,lat_mpi)
     367          CALL gather_omp(boundslon*180/PI,boundslon_mpi)
     368          CALL gather_omp(boundslat*180/PI,boundslat_mpi)
     369        ENDIF
     370        CALL gather_omp(ind_cell_glo,ind_cell_glo_mpi)
     371       
     372
     373!$OMP MASTER
     374        CALL xios_get_domaingroup_handle(dom_id, dom)
     375       
     376        !On parametrise le domaine:
     377        CALL xios_set_attr(dom, ni_glo=klon_glo, ibegin=ij_begin-1, ni=ij_nb, type="unstructured")
     378        CALL xios_set_attr(dom, nvertex=nvertex, lonvalue_1d=lon_mpi, latvalue_1d=lat_mpi, &
     379                           bounds_lon_1d=TRANSPOSE(boundslon_mpi), bounds_lat_1d=TRANSPOSE(boundslat_mpi) )
     380        CALL xios_set_attr(dom, i_index=ind_cell_glo_mpi(:)-1)
     381!$OMP END MASTER
     382
     383    END SUBROUTINE wxios_domain_param_unstructured
     384
     385
     386
     387
    310388    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    311389    ! Pour déclarer un axe vertical !!!!!!!!!!!!!!!
  • trunk/LMDZ.COMMON/libf/phy_common/geometry_mod.F90

    r1543 r1682  
    3030!$OMP THREADPRIVATE(cell_area)
    3131
     32  INTEGER,SAVE,ALLOCATABLE :: ind_cell_glo(:)      ! global index of a local cell
     33!$OMP THREADPRIVATE(ind_cell_glo)
    3234
    3335CONTAINS
     
    3537  SUBROUTINE init_geometry(klon,longitude_,latitude_, &
    3638                           boundslon_,boundslat_, &
    37                            cell_area_,dx_,dy_)
     39                           cell_area_,ind_cell_glo_,dx_,dy_)
    3840  USE mod_grid_phy_lmdz, ONLY: nvertex
    3941  USE nrtype, ONLY : PI
     
    4547    REAL,INTENT(IN) :: boundslat_(klon,nvertex)
    4648    REAL,INTENT(IN) :: cell_area_(klon)
     49    INTEGER,OPTIONAL,INTENT(IN) :: ind_cell_glo_(klon)
    4750    REAL,OPTIONAL,INTENT(IN) :: dx_(klon)
    4851    REAL,OPTIONAL,INTENT(IN) :: dy_(klon)
     
    5558    ALLOCATE(boundslat(klon,nvertex))
    5659    ALLOCATE(cell_area(klon))
     60    IF (PRESENT(ind_cell_glo_)) ALLOCATE(ind_cell_glo(klon))
    5761    IF (PRESENT(dx_)) ALLOCATE(dx(klon))
    5862    IF (PRESENT(dy_))ALLOCATE(dy(klon))
     
    6569    boundslat(:,:) = boundslat_(:,:)
    6670    cell_area(:) = cell_area_(:)
     71    IF (PRESENT(ind_cell_glo_)) ind_cell_glo(:) = ind_cell_glo_(:)
    6772    IF (PRESENT(dx_)) dx(:) = dx_(:)
    6873    IF (PRESENT(dy_)) dy(:) = dy_(:)
  • trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_mpi_data.F90

    r1572 r1682  
    33!
    44MODULE mod_phys_lmdz_mpi_data
    5 !  USE mod_const_mpi
    65 
    76  INTEGER,SAVE :: ii_begin
     
    3635  INTEGER,SAVE :: mpi_size
    3736  INTEGER,SAVE :: mpi_master
    38 !  INTEGER,SAVE :: mpi_root
    3937  LOGICAL,SAVE :: is_mpi_root
    4038  LOGICAL,SAVE :: is_using_mpi
     
    4846CONTAINS
    4947 
    50 !  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
    5148  SUBROUTINE init_phys_lmdz_mpi_data(nbp, nbp_lon, nbp_lat, communicator)
    52 !  USE mod_const_mpi, ONLY : COMM_LMDZ
    5349  IMPLICIT NONE
    5450#ifdef CPP_MPI
    5551    INCLUDE 'mpif.h'
    5652#endif
    57     INTEGER,INTENT(in) :: nbp
    58     INTEGER,INTENT(in) :: nbp_lon
    59     INTEGER,INTENT(in) :: nbp_lat
    60     INTEGER,INTENT(in) :: communicator
     53    INTEGER,INTENT(IN) :: nbp
     54    INTEGER,INTENT(IN) :: nbp_lon
     55    INTEGER,INTENT(IN) :: nbp_lat
     56    INTEGER,INTENT(IN) :: communicator
    6157   
    6258    INTEGER,ALLOCATABLE :: distrib(:)
     
    187183
    188184  SUBROUTINE print_module_data
    189 !  USE print_control_mod, ONLY: lunout
     185  USE print_control_mod, ONLY: lunout
    190186  IMPLICIT NONE
    191   INCLUDE "iniprint.h"
    192187 
    193188    WRITE(lunout,*) 'ii_begin =', ii_begin
  • trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_omp_data.F90

    r1572 r1682  
    77  INTEGER,SAVE :: omp_rank
    88  LOGICAL,SAVE :: is_omp_root
     9  LOGICAL,SAVE :: is_omp_master  ! alias of is_omp_root
    910  LOGICAL,SAVE :: is_using_omp
    1011  LOGICAL,SAVE :: is_north_pole_phy, is_south_pole_phy
     
    1718  INTEGER,SAVE :: klon_omp_begin
    1819  INTEGER,SAVE :: klon_omp_end
    19 !$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,klon_omp_begin,klon_omp_end)
     20!$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,is_omp_master,klon_omp_begin,klon_omp_end)
    2021!$OMP  THREADPRIVATE(is_north_pole_phy, is_south_pole_phy)
    2122
     
    6061   ELSE
    6162     abort_message = 'ANORMAL : OMP_MASTER /= 0'
    62      CALL abort_gcm (modname,abort_message,1)
     63     CALL abort_physic (modname,abort_message,1)
    6364   ENDIF
    6465!$OMP END MASTER
    65 
     66   is_omp_master=is_omp_root
    6667
    6768!$OMP MASTER
     
    106107
    107108  SUBROUTINE Print_module_data
     109  USE print_control_mod, ONLY: lunout
    108110  IMPLICIT NONE
    109   INCLUDE "iniprint.h"
    110111
    111112!$OMP CRITICAL 
  • trunk/LMDZ.COMMON/libf/phy_common/mod_phys_lmdz_para.F90

    r1572 r1682  
    1919  SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,communicator)
    2020  IMPLICIT NONE
    21     INTEGER,INTENT(in) :: nbp
    22     INTEGER,INTENT(in) :: nbp_lon
    23     INTEGER,INTENT(in) :: nbp_lat
    24     INTEGER,INTENT(in) :: communicator
     21    INTEGER,INTENT(IN) :: nbp
     22    INTEGER,INTENT(IN) :: nbp_lon
     23    INTEGER,INTENT(IN) :: nbp_lat
     24    INTEGER,INTENT(IN) :: communicator
    2525
    2626    CALL Init_phys_lmdz_mpi_data(nbp,nbp_lon,nbp_lat,communicator)
     
    4949  SUBROUTINE Test_transfert
    5050  USE mod_grid_phy_lmdz
     51  USE print_control_mod, ONLY: lunout
    5152  IMPLICIT NONE
    52     INCLUDE "iniprint.h"
    5353 
    5454    REAL :: Test_Field1d_glo(klon_glo,nbp_lev)
  • trunk/LMDZ.COMMON/libf/phy_common/physics_distribution_mod.F90

    r1543 r1682  
    1010                                       nbp, nbp_lon, nbp_lat, nbp_lev, &
    1111                                       communicator)
    12   USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para
     12  USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para, klon_omp
    1313  USE mod_grid_phy_lmdz, ONLY: init_grid_phy_lmdz
     14  USE dimphy, ONLY : Init_dimphy
     15
    1416  IMPLICIT NONE
    1517    INTEGER,INTENT(IN) :: grid_type
     
    2426    CALL init_grid_phy_lmdz(grid_type,nvertex, nbp_lon,nbp_lat,nbp_lev)
    2527    CALL init_phys_lmdz_para(nbp,nbp_lon, nbp_lat, communicator)
     28!$OMP PARALLEL
     29    CALL init_dimphy(klon_omp,nbp_lev)
     30!$OMP END PARALLEL
    2631
    2732  END SUBROUTINE init_physics_distribution 
  • trunk/LMDZ.COMMON/libf/phy_common/print_control_mod.F90

    r1521 r1682  
    77!$OMP THREADPRIVATE(lunout,prt_level,debug)
    88
     9  ! NB: Module variable Initializations done by set_print_control
     10  !     routine from init_print_control_mod to avoid circular
     11  !     module dependencies
     12
    913CONTAINS
    1014
    11   SUBROUTINE init_print_control
    12   USE ioipsl_getin_p_mod, ONLY : getin_p
    13   USE mod_phys_lmdz_para, ONLY: is_omp_root, is_master
     15  SUBROUTINE set_print_control(lunout_,prt_level_,debug_)
    1416  IMPLICIT NONE
    15 
    16     LOGICAL :: opened
    17     INTEGER :: number
     17    INTEGER :: lunout_
     18    INTEGER :: prt_level_
     19    LOGICAL :: debug_
     20     
     21    lunout = lunout_
     22    prt_level = prt_level_
     23    debug = debug_
    1824   
    19     !Config  Key  = prt_level
    20     !Config  Desc = niveau d'impressions de débogage
    21     !Config  Def  = 0
    22     !Config  Help = Niveau d'impression pour le débogage
    23     !Config         (0 = minimum d'impression)
    24     prt_level = 0
    25     CALL getin_p('prt_level',prt_level)
    26 
    27     !Config  Key  = lunout
    28     !Config  Desc = unite de fichier pour les impressions
    29     !Config  Def  = 6
    30     !Config  Help = unite de fichier pour les impressions
    31     !Config         (defaut sortie standard = 6)
    32     lunout=6
    33     CALL getin_p('lunout', lunout)
    34 
    35     IF (is_omp_root) THEN
    36       IF (lunout /= 5 .and. lunout /= 6) THEN
    37          INQUIRE(FILE='lmdz.out_0000',OPENED=opened,NUMBER=number)
    38          IF (opened) THEN
    39            lunout=number
    40          ELSE
    41            OPEN(UNIT=lunout,FILE='lmdz.out_0000',ACTION='write',  &
    42                 STATUS='unknown',FORM='formatted')
    43          ENDIF
    44       ENDIF
    45     ENDIF
    46 
    47     !Config  Key  = debug
    48     !Config  Desc = mode debogage
    49     !Config  Def  = false
    50     !Config  Help = positionne le mode debogage
    51 
    52     debug = .FALSE.
    53     CALL getin_p('debug',debug)
    54    
    55     IF (is_master) THEN
    56       WRITE(lunout,*)"init_print_control: prt_level=",prt_level
    57       WRITE(lunout,*)"init_print_control: lunout=",lunout
    58       WRITE(lunout,*)"init_print_control: debug=",debug     
    59     ENDIF
    60    
    61   END SUBROUTINE init_print_control 
     25  END SUBROUTINE set_print_control
    6226
    6327END MODULE print_control_mod
  • trunk/LMDZ.GENERIC/README

    r1673 r1682  
    12951295>> Followup on updates in LMDZ.COMMON, add print_control_mod.F90
    12961296   and abort_physic.F90 inphy_common
     1297
     1298== 30/03/2017 == EM
     1299>> Keep up with updates in LMDZ.COMMON:
     1300In phystd:
     1301- ocean_slab_mod.F90 : call abort_physic, rather than abort_gcm
     1302- inifis_mod.F90 : initialize print_control variables
     1303- physiq_mod.F90 : add XIOS context initialization and finalization
     1304- xios_output_mod.F90 : update initialize_xios_output initialization
     1305                        of the horizontal domain
     1306In dynphy_lonlat :
     1307- inigeomphy_mod.F90 : add ind_cell_glo computation and  transfer
     1308                       to init_geometry
     1309- mod_interface_dyn_phys.F90 : use is_north_pole_dyn and is_south_pole_dyn
     1310                               (instead of is_north_pole, is_south_pole)
     1311
     1312In phy_common:
     1313- geometry_mod.F90 : add ind_cell_glo module variable to store global
     1314                     column index
     1315- init_print_control_mod.F90 : added to initialize print_control_mod module
     1316                               variables
     1317- print_control_mod.F90 : make initialization occur via init_print_control_mod
     1318                          to avoid circular module dependencies
     1319- mod_phys_lmdz_mpi_data.F90 : use print_control_mod (rather than iniprint.h)
     1320                               and define is_north_pole_dyn, is_south_pole_dyn
     1321                               (instead of is_north_pole, is_south_pole)
     1322- mod_phys_lmdz_mpi_transfert.F90 : use is_north_pole_dyn, is_south_pole_dyn
     1323                                    (instead of is_north_pole, is_south_pole)
     1324- mod_phys_lmdz_omp_data.F90 : add is_omp_master (alias of is_omp_root) module
     1325                               variable and use print_control_mod (rather than
     1326                               iniprint.h), and introduce is_north_pole_phy
     1327                               and is_south_pole_phy
     1328- mod_phys_lmdz_para.F90 : use print_control_mod (rather than iniprint.h)
     1329- physics_distribution_mod.F90 : add call to init_dimphy in
     1330                                 init_physics_distribution
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/inigeomphy_mod.F90

    r1621 r1682  
    7373  REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)
    7474  REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)
    75 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
     75  INTEGER,ALLOCATABLE,SAVE :: ind_cell_glo_fi(:)
     76!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi,ind_cell_glo_fi)
    7677
    7778  ! Initialize Physics distibution and parameters and interface with dynamics
     
    201202  ALLOCATE(boundslonfi(klon_omp,4))
    202203  ALLOCATE(boundslatfi(klon_omp,4))
    203 !  CALL initcomgeomphy
     204  ALLOCATE(ind_cell_glo_fi(klon_omp))
     205
    204206
    205207  offset = klon_mpi_begin - 1
     
    211213  boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
    212214  boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     215  ind_cell_glo_fi(1:klon_omp)=(/ (i,i=offset+klon_omp_begin,offset+klon_omp_end) /)
    213216
    214217  ! copy over local grid longitudes and latitudes
    215218  CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
    216                      airefi,cufi,cvfi)
     219                     airefi,ind_cell_glo_fi,cufi,cvfi)
    217220
    218221  ! copy over preff , ap(), bp(), etc
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/mod_interface_dyn_phys.F90

    r1543 r1682  
    2222   
    2323    k=1
    24     IF (is_north_pole) THEN
     24    IF (is_north_pole_dyn) THEN
    2525      index_i(k)=1
    2626      index_j(k)=1
     
    4242    ENDDO
    4343   
    44     IF (is_south_pole) THEN
     44    IF (is_south_pole_dyn) THEN
    4545      index_i(k)=1
    4646      index_j(k)=jj_end
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/iniphysiq_mod.F90

    r1573 r1682  
    7373! and do some initializations
    7474
    75 ! Initialize dimphy module
    76 call init_dimphy(klon_omp,nlayer)
     75! Initialize dimphy module => Now done in physics_distribution_mod
     76! call init_dimphy(klon_omp,nlayer)
    7777
    7878! copy over preff , ap() and bp()
  • trunk/LMDZ.GENERIC/libf/phy_common/geometry_mod.F90

    r1543 r1682  
    3030!$OMP THREADPRIVATE(cell_area)
    3131
     32  INTEGER,SAVE,ALLOCATABLE :: ind_cell_glo(:)      ! global index of a local cell
     33!$OMP THREADPRIVATE(ind_cell_glo)
    3234
    3335CONTAINS
     
    3537  SUBROUTINE init_geometry(klon,longitude_,latitude_, &
    3638                           boundslon_,boundslat_, &
    37                            cell_area_,dx_,dy_)
     39                           cell_area_,ind_cell_glo_,dx_,dy_)
    3840  USE mod_grid_phy_lmdz, ONLY: nvertex
    3941  USE nrtype, ONLY : PI
     
    4547    REAL,INTENT(IN) :: boundslat_(klon,nvertex)
    4648    REAL,INTENT(IN) :: cell_area_(klon)
     49    INTEGER,OPTIONAL,INTENT(IN) :: ind_cell_glo_(klon)
    4750    REAL,OPTIONAL,INTENT(IN) :: dx_(klon)
    4851    REAL,OPTIONAL,INTENT(IN) :: dy_(klon)
     
    5558    ALLOCATE(boundslat(klon,nvertex))
    5659    ALLOCATE(cell_area(klon))
     60    IF (PRESENT(ind_cell_glo_)) ALLOCATE(ind_cell_glo(klon))
    5761    IF (PRESENT(dx_)) ALLOCATE(dx(klon))
    5862    IF (PRESENT(dy_))ALLOCATE(dy(klon))
     
    6569    boundslat(:,:) = boundslat_(:,:)
    6670    cell_area(:) = cell_area_(:)
     71    IF (PRESENT(ind_cell_glo_)) ind_cell_glo(:) = ind_cell_glo_(:)
    6772    IF (PRESENT(dx_)) dx(:) = dx_(:)
    6873    IF (PRESENT(dy_)) dy(:) = dy_(:)
  • trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_mpi_data.F90

    r1543 r1682  
    11!
    2 !$Header$
     2!$Id$
    33!
    44MODULE mod_phys_lmdz_mpi_data
    5 !  USE mod_const_mpi
    65 
    76  INTEGER,SAVE :: ii_begin
     
    3635  INTEGER,SAVE :: mpi_size
    3736  INTEGER,SAVE :: mpi_master
    38 !  INTEGER,SAVE :: mpi_root
    3937  LOGICAL,SAVE :: is_mpi_root
    4038  LOGICAL,SAVE :: is_using_mpi
    4139 
    4240 
    43   LOGICAL,SAVE :: is_north_pole
    44   LOGICAL,SAVE :: is_south_pole
     41  LOGICAL,SAVE :: is_north_pole_dyn
     42  LOGICAL,SAVE :: is_south_pole_dyn
    4543  INTEGER,SAVE :: COMM_LMDZ_PHY
    4644  INTEGER,SAVE :: MPI_REAL_LMDZ   ! MPI_REAL8
     
    4846CONTAINS
    4947 
    50 !  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
    5148  SUBROUTINE init_phys_lmdz_mpi_data(nbp, nbp_lon, nbp_lat, communicator)
    52 !  USE mod_const_mpi, ONLY : COMM_LMDZ
    5349  IMPLICIT NONE
    5450#ifdef CPP_MPI
    5551    INCLUDE 'mpif.h'
    5652#endif
    57     INTEGER,INTENT(in) :: nbp
    58     INTEGER,INTENT(in) :: nbp_lon
    59     INTEGER,INTENT(in) :: nbp_lat
    60     INTEGER,INTENT(in) :: communicator
     53    INTEGER,INTENT(IN) :: nbp
     54    INTEGER,INTENT(IN) :: nbp_lon
     55    INTEGER,INTENT(IN) :: nbp_lat
     56    INTEGER,INTENT(IN) :: communicator
    6157   
    6258    INTEGER,ALLOCATABLE :: distrib(:)
     
    109105   
    110106    IF (mpi_rank == 0) THEN
    111       is_north_pole = .TRUE.
    112     ELSE
    113       is_north_pole = .FALSE.
     107      is_north_pole_dyn = .TRUE.
     108    ELSE
     109      is_north_pole_dyn = .FALSE.
    114110    ENDIF
    115111   
    116112    IF (mpi_rank == mpi_size-1) THEN
    117       is_south_pole = .TRUE.
    118     ELSE
    119       is_south_pole = .FALSE.
     113      is_south_pole_dyn = .TRUE.
     114    ELSE
     115      is_south_pole_dyn = .FALSE.
    120116    ENDIF
    121117   
     
    187183
    188184  SUBROUTINE print_module_data
    189 !  USE print_control_mod, ONLY: lunout
     185  USE print_control_mod, ONLY: lunout
    190186  IMPLICIT NONE
    191   INCLUDE "iniprint.h"
    192187 
    193188    WRITE(lunout,*) 'ii_begin =', ii_begin
     
    217212    WRITE(lunout,*) 'mpi_master =', mpi_master
    218213    WRITE(lunout,*) 'is_mpi_root =', is_mpi_root
    219     WRITE(lunout,*) 'is_north_pole =', is_north_pole
    220     WRITE(lunout,*) 'is_south_pole =', is_south_pole
     214    WRITE(lunout,*) 'is_north_pole_dyn =', is_north_pole_dyn
     215    WRITE(lunout,*) 'is_south_pole_dyn =', is_south_pole_dyn
    221216    WRITE(lunout,*) 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
    222217 
  • trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90

    r1543 r1682  
    11!
    2 !$Header$
     2!$Id$
    33!
    44MODULE mod_phys_lmdz_mpi_transfert
     
    16931693   
    16941694    offset=ii_begin
    1695     IF (is_north_pole) Offset=nbp_lon
     1695    IF (is_north_pole_dyn) Offset=nbp_lon
    16961696   
    16971697   
     
    17031703   
    17041704   
    1705     IF (is_north_pole) THEN
     1705    IF (is_north_pole_dyn) THEN
    17061706      DO i=1,dimsize
    17071707        DO ij=1,nbp_lon
     
    17111711    ENDIF
    17121712   
    1713     IF (is_south_pole) THEN
     1713    IF (is_south_pole_dyn) THEN
    17141714      DO i=1,dimsize
    17151715        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
     
    17371737   
    17381738    offset=ii_begin
    1739     IF (is_north_pole) Offset=nbp_lon
     1739    IF (is_north_pole_dyn) Offset=nbp_lon
    17401740   
    17411741   
     
    17471747   
    17481748   
    1749     IF (is_north_pole) THEN
     1749    IF (is_north_pole_dyn) THEN
    17501750      DO i=1,dimsize
    17511751        DO ij=1,nbp_lon
     
    17551755    ENDIF
    17561756   
    1757     IF (is_south_pole) THEN
     1757    IF (is_south_pole_dyn) THEN
    17581758      DO i=1,dimsize
    17591759        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
     
    17821782   
    17831783    offset=ii_begin
    1784     IF (is_north_pole) Offset=nbp_lon
     1784    IF (is_north_pole_dyn) Offset=nbp_lon
    17851785   
    17861786   
     
    17921792   
    17931793   
    1794     IF (is_north_pole) THEN
     1794    IF (is_north_pole_dyn) THEN
    17951795      DO i=1,dimsize
    17961796        DO ij=1,nbp_lon
     
    18001800    ENDIF
    18011801   
    1802     IF (is_south_pole) THEN
     1802    IF (is_south_pole_dyn) THEN
    18031803      DO i=1,dimsize
    18041804        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
     
    18241824
    18251825    offset=ii_begin
    1826     IF (is_north_pole) offset=nbp_lon
     1826    IF (is_north_pole_dyn) offset=nbp_lon
    18271827
    18281828    DO i=1,dimsize
     
    18321832    ENDDO
    18331833
    1834     IF (is_north_pole) THEN
     1834    IF (is_north_pole_dyn) THEN
    18351835      DO i=1,dimsize
    18361836        VarOut(1,i)=VarIn(1,i)
     
    18541854
    18551855    offset=ii_begin
    1856     IF (is_north_pole) offset=nbp_lon
     1856    IF (is_north_pole_dyn) offset=nbp_lon
    18571857
    18581858    DO i=1,dimsize
     
    18621862    ENDDO
    18631863
    1864     IF (is_north_pole) THEN
     1864    IF (is_north_pole_dyn) THEN
    18651865      DO i=1,dimsize
    18661866         VarOut(1,i)=VarIn(1,i)
     
    18831883
    18841884    offset=ii_begin
    1885     IF (is_north_pole) offset=nbp_lon
     1885    IF (is_north_pole_dyn) offset=nbp_lon
    18861886
    18871887    DO i=1,dimsize
     
    18911891    ENDDO
    18921892
    1893     IF (is_north_pole) THEN
     1893    IF (is_north_pole_dyn) THEN
    18941894      DO i=1,dimsize
    18951895        VarOut(1,i)=VarIn(1,i)
  • trunk/LMDZ.GENERIC/libf/phy_common/mod_phys_lmdz_omp_data.F90

    r1543 r1682  
    11!
    2 !$Id: mod_phys_lmdz_omp_data.F90 2326 2015-07-10 12:24:29Z emillour $
     2!$Id: mod_phys_lmdz_omp_data.F90 2429 2016-01-27 12:43:09Z fairhead $
    33!
    44MODULE mod_phys_lmdz_omp_data
     
    77  INTEGER,SAVE :: omp_rank
    88  LOGICAL,SAVE :: is_omp_root
     9  LOGICAL,SAVE :: is_omp_master  ! alias of is_omp_root
    910  LOGICAL,SAVE :: is_using_omp
     11  LOGICAL,SAVE :: is_north_pole_phy, is_south_pole_phy
    1012 
    1113  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_nb
     
    1618  INTEGER,SAVE :: klon_omp_begin
    1719  INTEGER,SAVE :: klon_omp_end
    18 !$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,klon_omp_begin,klon_omp_end)
     20!$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,is_omp_master,klon_omp_begin,klon_omp_end)
     21!$OMP  THREADPRIVATE(is_north_pole_phy, is_south_pole_phy)
    1922
    2023CONTAINS
    2124 
    2225  SUBROUTINE Init_phys_lmdz_omp_data(klon_mpi)
    23     USE dimphy
     26    USE dimphy
     27    USE mod_phys_lmdz_mpi_data, ONLY : is_north_pole_dyn, is_south_pole_dyn
    2428    IMPLICIT NONE
    2529    INTEGER, INTENT(in) :: klon_mpi
     
    4347        omp_size=OMP_GET_NUM_THREADS()
    4448!$OMP END MASTER
     49!$OMP BARRIER
    4550        omp_rank=OMP_GET_THREAD_NUM()   
    4651#else   
     
    5661   ELSE
    5762     abort_message = 'ANORMAL : OMP_MASTER /= 0'
    58      CALL abort_gcm (modname,abort_message,1)
     63     CALL abort_physic (modname,abort_message,1)
    5964   ENDIF
    6065!$OMP END MASTER
    61 
     66   is_omp_master=is_omp_root
    6267
    6368!$OMP MASTER
     69
    6470    ALLOCATE(klon_omp_para_nb(0:omp_size-1))
    6571    ALLOCATE(klon_omp_para_begin(0:omp_size-1))
     
    8086!$OMP END MASTER
    8187!$OMP BARRIER
     88
     89   if ((is_north_pole_dyn) .AND. (omp_rank == 0 )) then
     90      is_north_pole_phy = .TRUE.
     91    else
     92      is_north_pole_phy = .FALSE.
     93    endif
     94    if ((is_south_pole_dyn) .AND. (omp_rank == omp_size-1)) then
     95      is_south_pole_phy = .TRUE.
     96    else
     97      is_south_pole_phy = .FALSE.
     98    endif
    8299   
    83100    klon_omp=klon_omp_para_nb(omp_rank)
     
    90107
    91108  SUBROUTINE Print_module_data
     109  USE print_control_mod, ONLY: lunout
    92110  IMPLICIT NONE
    93   INCLUDE "iniprint.h"
    94111
    95112!$OMP CRITICAL 
  • trunk/LMDZ.GENERIC/libf/phy_common/physics_distribution_mod.F90

    r1543 r1682  
    1010                                       nbp, nbp_lon, nbp_lat, nbp_lev, &
    1111                                       communicator)
    12   USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para
     12  USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para, klon_omp
    1313  USE mod_grid_phy_lmdz, ONLY: init_grid_phy_lmdz
     14  USE dimphy, ONLY : Init_dimphy
     15
    1416  IMPLICIT NONE
    1517    INTEGER,INTENT(IN) :: grid_type
     
    2426    CALL init_grid_phy_lmdz(grid_type,nvertex, nbp_lon,nbp_lat,nbp_lev)
    2527    CALL init_phys_lmdz_para(nbp,nbp_lon, nbp_lat, communicator)
     28!$OMP PARALLEL
     29    CALL init_dimphy(klon_omp,nbp_lev)
     30!$OMP END PARALLEL
    2631
    2732  END SUBROUTINE init_physics_distribution 
  • trunk/LMDZ.GENERIC/libf/phy_common/print_control_mod.F90

    r1673 r1682  
    77!$OMP THREADPRIVATE(lunout,prt_level,debug)
    88
     9  ! NB: Module variable Initializations done by set_print_control
     10  !     routine from init_print_control_mod to avoid circular
     11  !     module dependencies
     12
    913CONTAINS
    1014
    11   SUBROUTINE init_print_control
    12   USE ioipsl_getin_p_mod, ONLY : getin_p
    13   USE mod_phys_lmdz_para, ONLY: is_omp_root, is_master
     15  SUBROUTINE set_print_control(lunout_,prt_level_,debug_)
    1416  IMPLICIT NONE
    15 
    16     LOGICAL :: opened
    17     INTEGER :: number
     17    INTEGER :: lunout_
     18    INTEGER :: prt_level_
     19    LOGICAL :: debug_
     20     
     21    lunout = lunout_
     22    prt_level = prt_level_
     23    debug = debug_
    1824   
    19     !Config  Key  = prt_level
    20     !Config  Desc = niveau d'impressions de débogage
    21     !Config  Def  = 0
    22     !Config  Help = Niveau d'impression pour le débogage
    23     !Config         (0 = minimum d'impression)
    24     prt_level = 0
    25     CALL getin_p('prt_level',prt_level)
    26 
    27     !Config  Key  = lunout
    28     !Config  Desc = unite de fichier pour les impressions
    29     !Config  Def  = 6
    30     !Config  Help = unite de fichier pour les impressions
    31     !Config         (defaut sortie standard = 6)
    32     lunout=6
    33     CALL getin_p('lunout', lunout)
    34 
    35     IF (is_omp_root) THEN
    36       IF (lunout /= 5 .and. lunout /= 6) THEN
    37          INQUIRE(FILE='lmdz.out_0000',OPENED=opened,NUMBER=number)
    38          IF (opened) THEN
    39            lunout=number
    40          ELSE
    41            OPEN(UNIT=lunout,FILE='lmdz.out_0000',ACTION='write',  &
    42                 STATUS='unknown',FORM='formatted')
    43          ENDIF
    44       ENDIF
    45     ENDIF
    46 
    47     !Config  Key  = debug
    48     !Config  Desc = mode debogage
    49     !Config  Def  = false
    50     !Config  Help = positionne le mode debogage
    51 
    52     debug = .FALSE.
    53     CALL getin_p('debug',debug)
    54    
    55     IF (is_master) THEN
    56       WRITE(lunout,*)"init_print_control: prt_level=",prt_level
    57       WRITE(lunout,*)"init_print_control: lunout=",lunout
    58       WRITE(lunout,*)"init_print_control: debug=",debug     
    59     ENDIF
    60    
    61   END SUBROUTINE init_print_control 
     25  END SUBROUTINE set_print_control
    6226
    6327END MODULE print_control_mod
  • trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90

    r1677 r1682  
    99             prad,pg,pr,pcpp)
    1010
     11  use init_print_control_mod, only: init_print_control
    1112  use radinc_h, only: ini_radinc_h, naerkind
    1213  use radcommon_h, only: ini_radcommon_h
     
    7677  REAL SSUM
    7778 
     79  ! Initialize flags lunout, prt_level, debug (in print_control_mod)
     80  CALL init_print_control
     81
    7882  ! initialize constants in comcstfi_mod
    7983  rad=prad
  • trunk/LMDZ.GENERIC/libf/phystd/ocean_slab_mod.F90

    r1397 r1682  
    9494      IF (error /= 0) THEN
    9595         abort_message='Pb allocation tmp_tslab'
    96          CALL abort_gcm(modname,abort_message,1)
     96         CALL abort_physic(modname,abort_message,1)
    9797      ENDIF
    9898      tmp_tslab(:,:) = tslab_rst(:,:)
     
    100100      IF (error /= 0) THEN
    101101         abort_message='Pb allocation tmp_tslab_loc'
    102          CALL abort_gcm(modname,abort_message,1)
     102         CALL abort_physic(modname,abort_message,1)
    103103      ENDIF
    104104      tmp_tslab_loc(:,:) = tslab_rst(:,:)
     
    107107    IF (error /= 0) THEN
    108108       abort_message='Pb allocation tmp_seaice'
    109        CALL abort_gcm(modname,abort_message,1)
     109       CALL abort_physic(modname,abort_message,1)
    110110    ENDIF
    111111    tmp_seaice(:) = seaice_rst(:)
     
    114114    IF (error /= 0) THEN
    115115       abort_message='Pb allocation tmp_pctsrf_slab'
    116        CALL abort_gcm(modname,abort_message,1)
     116       CALL abort_physic(modname,abort_message,1)
    117117    ENDIF
    118118    tmp_pctsrf_slab(:) = pctsrf_rst(:)
     
    122122    IF (error /= 0) THEN
    123123       abort_message='Pb allocation tmp_radsol'
    124        CALL abort_gcm(modname,abort_message,1)
     124       CALL abort_physic(modname,abort_message,1)
    125125    ENDIF
    126126
     
    128128    IF (error /= 0) THEN
    129129       abort_message='Pb allocation tmp_flux_o'
    130        CALL abort_gcm(modname,abort_message,1)
     130       CALL abort_physic(modname,abort_message,1)
    131131    ENDIF
    132132   
     
    134134    IF (error /= 0) THEN
    135135       abort_message='Pb allocation tmp_flux_g'
    136        CALL abort_gcm(modname,abort_message,1)
     136       CALL abort_physic(modname,abort_message,1)
    137137    ENDIF
    138138
     
    141141    IF (error /= 0) THEN
    142142       abort_message='Pb allocation slab_bils'
    143        CALL abort_gcm(modname,abort_message,1)
     143       CALL abort_physic(modname,abort_message,1)
    144144    ENDIF
    145145    slab_bils(:) = 0.0   
     
    148148    IF (error /= 0) THEN
    149149       abort_message='Pb allocation dt_hdiff'
    150        CALL abort_gcm(modname,abort_message,1)
     150       CALL abort_physic(modname,abort_message,1)
    151151    ENDIF
    152152    dt_hdiff = 0.0   
     
    155155    IF (error /= 0) THEN
    156156       abort_message='Pb allocation dt_hdiff'
    157        CALL abort_gcm(modname,abort_message,1)
     157       CALL abort_physic(modname,abort_message,1)
    158158    ENDIF
    159159    dt_ekman = 0.0   
     
    163163    IF (error /= 0) THEN
    164164       abort_message='Pb allocation lmt_bils'
    165        CALL abort_gcm(modname,abort_message,1)
     165       CALL abort_physic(modname,abort_message,1)
    166166    ENDIF
    167167    lmt_bils(:) = 0.0
     
    170170    IF (error /= 0) THEN
    171171       abort_message='Pb allocation slabh'
    172        CALL abort_gcm(modname,abort_message,1)
     172       CALL abort_physic(modname,abort_message,1)
    173173    ENDIF
    174174    slabh(1)=50.
  • trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90

    r1669 r1682  
    4848      use callkeys_mod
    4949      use vertical_layers_mod, only: presnivs, pseudoalt
     50      use mod_phys_lmdz_omp_data, ONLY: is_omp_master
    5051#ifdef CPP_XIOS     
    5152      use xios_output_mod, only: initialize_xios_output, &
    5253                                 update_xios_timestep, &
    5354                                 send_xios_field
     55      use wxios, only: wxios_context_init, xios_context_finalize
    5456#endif
    5557      implicit none
     
    529531         endif
    530532
     533#ifdef CPP_XIOS
     534        ! Initialize XIOS context
     535        write(*,*) "physiq: call wxios_context_init"
     536        CALL wxios_context_init
     537#endif
    531538
    532539!        Read 'startfi.nc' file.
     
    735742                                     presnivs,pseudoalt)
    736743#endif
     744         write(*,*) "physiq: end of firstcall"
    737745      endif ! end of 'firstcall'
    738746
     
    18931901         end if
    18941902
    1895          
    1896       endif ! end of 'lastcall'
     1903    endif ! end of 'lastcall'
    18971904
    18981905
     
    21812188      CALL send_xios_field("u",zu)
    21822189      CALL send_xios_field("v",zv)
    2183      
     2190
     2191      if (lastcall.and.is_omp_master) then
     2192        write(*,*) "physiq: call xios_context_finalize"
     2193        call xios_context_finalize
     2194      endif
    21842195#endif
    21852196
  • trunk/LMDZ.GENERIC/libf/phystd/xios_output_mod.F90

    r1626 r1682  
    2626                                mpi_size, mpi_rank, klon_mpi, &
    2727                                is_sequential, is_south_pole_dyn
    28   USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo
     28  USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid_type, unstructured
    2929  USE print_control_mod, ONLY: lunout, prt_level
    3030  USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat
    3131  USE regular_lonlat_mod, ONLY: lon_reg, lat_reg
    3232  USE nrtype, ONLY: pi
    33   USE wxios
     33#ifdef CPP_XIOS
     34  USE xios
     35#endif
     36  USE wxios, ONLY: wxios_domain_param, wxios_domain_param_unstructured, wxios_closedef
    3437  IMPLICIT NONE
    3538 
     
    6063    ! 2. Declare horizontal domain
    6164    ! Set values for the mask:
    62     IF (mpi_rank == 0) THEN
    63         data_ibegin = 0
    64     ELSE
    65         data_ibegin = ii_begin - 1
    66     END IF
    67 
    68     IF (mpi_rank == mpi_size-1) THEN
    69         data_iend = nbp_lon
    70     ELSE
    71         data_iend = ii_end + 1
    72     END IF
    73 
    74     if (prt_level>=10) then
    75       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
    76       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
    77       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
    78       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
    79       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
    80     endif
    81 
     65!    IF (mpi_rank == 0) THEN
     66!        data_ibegin = 0
     67!    ELSE
     68!        data_ibegin = ii_begin - 1
     69!    END IF
     70
     71!    IF (mpi_rank == mpi_size-1) THEN
     72!        data_iend = nbp_lon
     73!    ELSE
     74!        data_iend = ii_end + 1
     75!    END IF
     76
     77!    if (prt_level>=10) then
     78!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
     79!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
     80!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
     81!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
     82!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
     83!    endif
     84
     85!$OMP END MASTER
     86!$OMP BARRIER
    8287    ! Initialize the XIOS domain coreesponding to this process:
    8388    if (prt_level>=10) write(lunout,*) "initialize_xios_output: call wxios_domain_param"
    84     CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
    85                             1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
    86                             klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
    87                             lat_reg*(180./pi), lon_reg*(180./pi),                       &
    88                             is_south_pole_dyn,mpi_rank)
    89 
     89!    CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
     90!                            1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
     91!                            klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
     92!                            lat_reg*(180./pi), lon_reg*(180./pi),                       &
     93!                            is_south_pole_dyn,mpi_rank)
     94
     95    IF (grid_type==unstructured) THEN
     96      CALL wxios_domain_param_unstructured("dom_glo")
     97    ELSE
     98      CALL wxios_domain_param("dom_glo")
     99    ENDIF
     100
     101!$OMP MASTER
    90102    ! 3. Declare calendar and time step
    91103    if (prt_level>=10) write(lunout,*) "initialize_xios_output: build calendar"
  • trunk/LMDZ.MARS/README

    r1660 r1682  
    23922392  Cp and thermal conductivity in aeronomars/concentrations.F
    23932393
    2394          
     2394== 30/03/2017 == EM
     2395Keep up with updates in LMDZ.COMMON:
     2396In dynphy_lonlat :
     2397- inigeomphy_mod.F90 : add ind_cell_glo computation and  transfer
     2398                       to init_geometry
     2399- mod_interface_dyn_phys.F90 : use is_north_pole_dyn and is_south_pole_dyn
     2400                               (instead of is_north_pole, is_south_pole)
     2401In phy_common:
     2402- abort_physic.F90 : to properly abort from physics (to be used instead
     2403                     of abort_gcm which is for within the dynamics)
     2404- geometry_mod.F90 : add ind_cell_glo module variable to store global
     2405                     column index
     2406- mod_phys_lmdz_mpi_data.F90 : use print_control_mod (rather than iniprint.h)
     2407                               and define is_north_pole_dyn, is_south_pole_dyn
     2408                               (instead of is_north_pole, is_south_pole)
     2409- mod_phys_lmdz_mpi_transfert.F90 : use is_north_pole_dyn, is_south_pole_dyn
     2410                                    (instead of is_north_pole, is_south_pole)
     2411- mod_phys_lmdz_omp_data.F90 : add is_omp_master (alias of is_omp_root) module
     2412                               variable and use print_control_mod (rather than
     2413                               iniprint.h), and introduce is_north_pole_phy
     2414                               and is_south_pole_phy
     2415- mod_phys_lmdz_para.F90 : use print_control_mod (rather than iniprint.h)
     2416- physics_distribution_mod.F90 : add call to init_dimphy in
     2417                                 init_physics_distribution
     2418- init_print_control_mod.F90 : added to initialize print_control_mod module
     2419                               variables
     2420- print_control_mod.F90 : make initialization occur via init_print_control_mod
     2421                          to avoid circular module dependencies
  • trunk/LMDZ.MARS/libf/dynphy_lonlat/inigeomphy_mod.F90

    r1621 r1682  
    7373  REAL,ALLOCATABLE,SAVE :: boundslonfi(:,:)
    7474  REAL,ALLOCATABLE,SAVE :: boundslatfi(:,:)
    75 !$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
     75  INTEGER,ALLOCATABLE,SAVE :: ind_cell_glo_fi(:)
     76!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi,ind_cell_glo_fi)
    7677
    7778  ! Initialize Physics distibution and parameters and interface with dynamics
     
    201202  ALLOCATE(boundslonfi(klon_omp,4))
    202203  ALLOCATE(boundslatfi(klon_omp,4))
    203 !  CALL initcomgeomphy
     204  ALLOCATE(ind_cell_glo_fi(klon_omp))
     205
    204206
    205207  offset = klon_mpi_begin - 1
     
    211213  boundslonfi(1:klon_omp,:) = boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
    212214  boundslatfi(1:klon_omp,:) = boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     215  ind_cell_glo_fi(1:klon_omp)=(/ (i,i=offset+klon_omp_begin,offset+klon_omp_end) /)
    213216
    214217  ! copy over local grid longitudes and latitudes
    215218  CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
    216                      airefi,cufi,cvfi)
     219                     airefi,ind_cell_glo_fi,cufi,cvfi)
    217220
    218221  ! copy over preff , ap(), bp(), etc
  • trunk/LMDZ.MARS/libf/dynphy_lonlat/mod_interface_dyn_phys.F90

    r1543 r1682  
    2222   
    2323    k=1
    24     IF (is_north_pole) THEN
     24    IF (is_north_pole_dyn) THEN
    2525      index_i(k)=1
    2626      index_j(k)=1
     
    4242    ENDDO
    4343   
    44     IF (is_south_pole) THEN
     44    IF (is_south_pole_dyn) THEN
    4545      index_i(k)=1
    4646      index_j(k)=jj_end
  • trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/iniphysiq_mod.F90

    r1621 r1682  
    6666! and do some initializations
    6767
    68 ! Initialize dimphy module
    69 call init_dimphy(klon_omp,nlayer)
     68! Initialize dimphy module => Now done in physics_distribution_mod
     69!call init_dimphy(klon_omp,nlayer)
    7070
    7171call phys_state_var_init(klon_omp,nlayer,nqtot,tname, &
  • trunk/LMDZ.MARS/libf/phy_common/geometry_mod.F90

    r1543 r1682  
    3030!$OMP THREADPRIVATE(cell_area)
    3131
     32  INTEGER,SAVE,ALLOCATABLE :: ind_cell_glo(:)      ! global index of a local cell
     33!$OMP THREADPRIVATE(ind_cell_glo)
    3234
    3335CONTAINS
     
    3537  SUBROUTINE init_geometry(klon,longitude_,latitude_, &
    3638                           boundslon_,boundslat_, &
    37                            cell_area_,dx_,dy_)
     39                           cell_area_,ind_cell_glo_,dx_,dy_)
    3840  USE mod_grid_phy_lmdz, ONLY: nvertex
    3941  USE nrtype, ONLY : PI
     
    4547    REAL,INTENT(IN) :: boundslat_(klon,nvertex)
    4648    REAL,INTENT(IN) :: cell_area_(klon)
     49    INTEGER,OPTIONAL,INTENT(IN) :: ind_cell_glo_(klon)
    4750    REAL,OPTIONAL,INTENT(IN) :: dx_(klon)
    4851    REAL,OPTIONAL,INTENT(IN) :: dy_(klon)
     
    5558    ALLOCATE(boundslat(klon,nvertex))
    5659    ALLOCATE(cell_area(klon))
     60    IF (PRESENT(ind_cell_glo_)) ALLOCATE(ind_cell_glo(klon))
    5761    IF (PRESENT(dx_)) ALLOCATE(dx(klon))
    5862    IF (PRESENT(dy_))ALLOCATE(dy(klon))
     
    6569    boundslat(:,:) = boundslat_(:,:)
    6670    cell_area(:) = cell_area_(:)
     71    IF (PRESENT(ind_cell_glo_)) ind_cell_glo(:) = ind_cell_glo_(:)
    6772    IF (PRESENT(dx_)) dx(:) = dx_(:)
    6873    IF (PRESENT(dy_)) dy(:) = dy_(:)
  • trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_mpi_data.F90

    r1543 r1682  
    11!
    2 !$Header$
     2!$Id$
    33!
    44MODULE mod_phys_lmdz_mpi_data
    5 !  USE mod_const_mpi
    65 
    76  INTEGER,SAVE :: ii_begin
     
    3635  INTEGER,SAVE :: mpi_size
    3736  INTEGER,SAVE :: mpi_master
    38 !  INTEGER,SAVE :: mpi_root
    3937  LOGICAL,SAVE :: is_mpi_root
    4038  LOGICAL,SAVE :: is_using_mpi
    4139 
    4240 
    43   LOGICAL,SAVE :: is_north_pole
    44   LOGICAL,SAVE :: is_south_pole
     41  LOGICAL,SAVE :: is_north_pole_dyn
     42  LOGICAL,SAVE :: is_south_pole_dyn
    4543  INTEGER,SAVE :: COMM_LMDZ_PHY
    4644  INTEGER,SAVE :: MPI_REAL_LMDZ   ! MPI_REAL8
     
    4846CONTAINS
    4947 
    50 !  SUBROUTINE Init_phys_lmdz_mpi_data(iim,jjp1,nb_proc,distrib)
    5148  SUBROUTINE init_phys_lmdz_mpi_data(nbp, nbp_lon, nbp_lat, communicator)
    52 !  USE mod_const_mpi, ONLY : COMM_LMDZ
    5349  IMPLICIT NONE
    5450#ifdef CPP_MPI
    5551    INCLUDE 'mpif.h'
    5652#endif
    57     INTEGER,INTENT(in) :: nbp
    58     INTEGER,INTENT(in) :: nbp_lon
    59     INTEGER,INTENT(in) :: nbp_lat
    60     INTEGER,INTENT(in) :: communicator
     53    INTEGER,INTENT(IN) :: nbp
     54    INTEGER,INTENT(IN) :: nbp_lon
     55    INTEGER,INTENT(IN) :: nbp_lat
     56    INTEGER,INTENT(IN) :: communicator
    6157   
    6258    INTEGER,ALLOCATABLE :: distrib(:)
     
    109105   
    110106    IF (mpi_rank == 0) THEN
    111       is_north_pole = .TRUE.
    112     ELSE
    113       is_north_pole = .FALSE.
     107      is_north_pole_dyn = .TRUE.
     108    ELSE
     109      is_north_pole_dyn = .FALSE.
    114110    ENDIF
    115111   
    116112    IF (mpi_rank == mpi_size-1) THEN
    117       is_south_pole = .TRUE.
    118     ELSE
    119       is_south_pole = .FALSE.
     113      is_south_pole_dyn = .TRUE.
     114    ELSE
     115      is_south_pole_dyn = .FALSE.
    120116    ENDIF
    121117   
     
    187183
    188184  SUBROUTINE print_module_data
    189 !  USE print_control_mod, ONLY: lunout
     185  USE print_control_mod, ONLY: lunout
    190186  IMPLICIT NONE
    191   INCLUDE "iniprint.h"
    192187 
    193188    WRITE(lunout,*) 'ii_begin =', ii_begin
     
    217212    WRITE(lunout,*) 'mpi_master =', mpi_master
    218213    WRITE(lunout,*) 'is_mpi_root =', is_mpi_root
    219     WRITE(lunout,*) 'is_north_pole =', is_north_pole
    220     WRITE(lunout,*) 'is_south_pole =', is_south_pole
     214    WRITE(lunout,*) 'is_north_pole_dyn =', is_north_pole_dyn
     215    WRITE(lunout,*) 'is_south_pole_dyn =', is_south_pole_dyn
    221216    WRITE(lunout,*) 'COMM_LMDZ_PHY =', COMM_LMDZ_PHY
    222217 
  • trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_mpi_transfert.F90

    r1543 r1682  
    11!
    2 !$Header$
     2!$Id$
    33!
    44MODULE mod_phys_lmdz_mpi_transfert
     
    16931693   
    16941694    offset=ii_begin
    1695     IF (is_north_pole) Offset=nbp_lon
     1695    IF (is_north_pole_dyn) Offset=nbp_lon
    16961696   
    16971697   
     
    17031703   
    17041704   
    1705     IF (is_north_pole) THEN
     1705    IF (is_north_pole_dyn) THEN
    17061706      DO i=1,dimsize
    17071707        DO ij=1,nbp_lon
     
    17111711    ENDIF
    17121712   
    1713     IF (is_south_pole) THEN
     1713    IF (is_south_pole_dyn) THEN
    17141714      DO i=1,dimsize
    17151715        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
     
    17371737   
    17381738    offset=ii_begin
    1739     IF (is_north_pole) Offset=nbp_lon
     1739    IF (is_north_pole_dyn) Offset=nbp_lon
    17401740   
    17411741   
     
    17471747   
    17481748   
    1749     IF (is_north_pole) THEN
     1749    IF (is_north_pole_dyn) THEN
    17501750      DO i=1,dimsize
    17511751        DO ij=1,nbp_lon
     
    17551755    ENDIF
    17561756   
    1757     IF (is_south_pole) THEN
     1757    IF (is_south_pole_dyn) THEN
    17581758      DO i=1,dimsize
    17591759        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
     
    17821782   
    17831783    offset=ii_begin
    1784     IF (is_north_pole) Offset=nbp_lon
     1784    IF (is_north_pole_dyn) Offset=nbp_lon
    17851785   
    17861786   
     
    17921792   
    17931793   
    1794     IF (is_north_pole) THEN
     1794    IF (is_north_pole_dyn) THEN
    17951795      DO i=1,dimsize
    17961796        DO ij=1,nbp_lon
     
    18001800    ENDIF
    18011801   
    1802     IF (is_south_pole) THEN
     1802    IF (is_south_pole_dyn) THEN
    18031803      DO i=1,dimsize
    18041804        DO ij=nbp_lon*(jj_nb-1)+1,nbp_lon*jj_nb
     
    18241824
    18251825    offset=ii_begin
    1826     IF (is_north_pole) offset=nbp_lon
     1826    IF (is_north_pole_dyn) offset=nbp_lon
    18271827
    18281828    DO i=1,dimsize
     
    18321832    ENDDO
    18331833
    1834     IF (is_north_pole) THEN
     1834    IF (is_north_pole_dyn) THEN
    18351835      DO i=1,dimsize
    18361836        VarOut(1,i)=VarIn(1,i)
     
    18541854
    18551855    offset=ii_begin
    1856     IF (is_north_pole) offset=nbp_lon
     1856    IF (is_north_pole_dyn) offset=nbp_lon
    18571857
    18581858    DO i=1,dimsize
     
    18621862    ENDDO
    18631863
    1864     IF (is_north_pole) THEN
     1864    IF (is_north_pole_dyn) THEN
    18651865      DO i=1,dimsize
    18661866         VarOut(1,i)=VarIn(1,i)
     
    18831883
    18841884    offset=ii_begin
    1885     IF (is_north_pole) offset=nbp_lon
     1885    IF (is_north_pole_dyn) offset=nbp_lon
    18861886
    18871887    DO i=1,dimsize
     
    18911891    ENDDO
    18921892
    1893     IF (is_north_pole) THEN
     1893    IF (is_north_pole_dyn) THEN
    18941894      DO i=1,dimsize
    18951895        VarOut(1,i)=VarIn(1,i)
  • trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_omp_data.F90

    r1657 r1682  
    11!
    2 !$Id: mod_phys_lmdz_omp_data.F90 2326 2015-07-10 12:24:29Z emillour $
     2!$Id: mod_phys_lmdz_omp_data.F90 2429 2016-01-27 12:43:09Z fairhead $
    33!
    44MODULE mod_phys_lmdz_omp_data
     
    77  INTEGER,SAVE :: omp_rank
    88  LOGICAL,SAVE :: is_omp_root
     9  LOGICAL,SAVE :: is_omp_master  ! alias of is_omp_root
    910  LOGICAL,SAVE :: is_using_omp
     11  LOGICAL,SAVE :: is_north_pole_phy, is_south_pole_phy
    1012 
    1113  INTEGER,SAVE,DIMENSION(:),ALLOCATABLE :: klon_omp_para_nb
     
    1618  INTEGER,SAVE :: klon_omp_begin
    1719  INTEGER,SAVE :: klon_omp_end
    18 !$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,klon_omp_begin,klon_omp_end)
     20!$OMP  THREADPRIVATE(omp_rank,klon_omp,is_omp_root,is_omp_master,klon_omp_begin,klon_omp_end)
     21!$OMP  THREADPRIVATE(is_north_pole_phy, is_south_pole_phy)
    1922
    2023CONTAINS
    2124 
    2225  SUBROUTINE Init_phys_lmdz_omp_data(klon_mpi)
    23     USE dimphy
     26    USE dimphy
     27    USE mod_phys_lmdz_mpi_data, ONLY : is_north_pole_dyn, is_south_pole_dyn
    2428    IMPLICIT NONE
    2529    INTEGER, INTENT(in) :: klon_mpi
     
    4347        omp_size=OMP_GET_NUM_THREADS()
    4448!$OMP END MASTER
     49!$OMP BARRIER
    4550        omp_rank=OMP_GET_THREAD_NUM()   
    4651#else   
     
    5661   ELSE
    5762     abort_message = 'ANORMAL : OMP_MASTER /= 0'
    58      !-- abort_gcm only in the dynamics
    59      !CALL abort_gcm (modname,abort_message,1)
    60      print *,modname,abort_message
    61      STOP
     63     CALL abort_physic (modname,abort_message,1)
    6264   ENDIF
    6365!$OMP END MASTER
    64 
     66   is_omp_master=is_omp_root
    6567
    6668!$OMP MASTER
     69
    6770    ALLOCATE(klon_omp_para_nb(0:omp_size-1))
    6871    ALLOCATE(klon_omp_para_begin(0:omp_size-1))
     
    8386!$OMP END MASTER
    8487!$OMP BARRIER
     88
     89   if ((is_north_pole_dyn) .AND. (omp_rank == 0 )) then
     90      is_north_pole_phy = .TRUE.
     91    else
     92      is_north_pole_phy = .FALSE.
     93    endif
     94    if ((is_south_pole_dyn) .AND. (omp_rank == omp_size-1)) then
     95      is_south_pole_phy = .TRUE.
     96    else
     97      is_south_pole_phy = .FALSE.
     98    endif
    8599   
    86100    klon_omp=klon_omp_para_nb(omp_rank)
     
    93107
    94108  SUBROUTINE Print_module_data
     109  USE print_control_mod, ONLY: lunout
    95110  IMPLICIT NONE
    96   INCLUDE "iniprint.h"
    97111
    98112!$OMP CRITICAL 
  • trunk/LMDZ.MARS/libf/phy_common/mod_phys_lmdz_para.F90

    r1543 r1682  
    11!
    2 !$Header$
     2! $Id: mod_phys_lmdz_para.F90 2429 2016-01-27 12:43:09Z fairhead $
    33!
    44MODULE mod_phys_lmdz_para
     
    1111  LOGICAL,SAVE :: is_parallel
    1212  LOGICAL,SAVE :: is_master
     13
    1314 
    1415!$OMP THREADPRIVATE(klon_loc,is_master)
     
    1819  SUBROUTINE Init_phys_lmdz_para(nbp,nbp_lon,nbp_lat,communicator)
    1920  IMPLICIT NONE
    20     INTEGER,INTENT(in) :: nbp
    21     INTEGER,INTENT(in) :: nbp_lon
    22     INTEGER,INTENT(in) :: nbp_lat
    23     INTEGER,INTENT(in) :: communicator
     21    INTEGER,INTENT(IN) :: nbp
     22    INTEGER,INTENT(IN) :: nbp_lon
     23    INTEGER,INTENT(IN) :: nbp_lat
     24    INTEGER,INTENT(IN) :: communicator
    2425
    2526    CALL Init_phys_lmdz_mpi_data(nbp,nbp_lon,nbp_lat,communicator)
     
    4142       is_parallel=.FALSE.
    4243     ENDIF
     44
     45
    4346     
    4447  END SUBROUTINE Init_phys_lmdz_para
     
    4649  SUBROUTINE Test_transfert
    4750  USE mod_grid_phy_lmdz
     51  USE print_control_mod, ONLY: lunout
    4852  IMPLICIT NONE
    49     INCLUDE "iniprint.h"
    5053 
    5154    REAL :: Test_Field1d_glo(klon_glo,nbp_lev)
  • trunk/LMDZ.MARS/libf/phy_common/physics_distribution_mod.F90

    r1543 r1682  
    1010                                       nbp, nbp_lon, nbp_lat, nbp_lev, &
    1111                                       communicator)
    12   USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para
     12  USE mod_phys_lmdz_para, ONLY: init_phys_lmdz_para, klon_omp
    1313  USE mod_grid_phy_lmdz, ONLY: init_grid_phy_lmdz
     14  USE dimphy, ONLY : Init_dimphy
     15
    1416  IMPLICIT NONE
    1517    INTEGER,INTENT(IN) :: grid_type
     
    2426    CALL init_grid_phy_lmdz(grid_type,nvertex, nbp_lon,nbp_lat,nbp_lev)
    2527    CALL init_phys_lmdz_para(nbp,nbp_lon, nbp_lat, communicator)
     28!$OMP PARALLEL
     29    CALL init_dimphy(klon_omp,nbp_lev)
     30!$OMP END PARALLEL
    2631
    2732  END SUBROUTINE init_physics_distribution 
  • trunk/LMDZ.TITAN/libf/dynphy_lonlat/phytitan/iniphysiq_mod.F90

    r1647 r1682  
    7070! and do some initializations
    7171
    72 ! Initialize dimphy module
    73 call init_dimphy(klon_omp,nlayer)
     72! Initialize dimphy module => Now done in physics_distribution_mod
     73!call init_dimphy(klon_omp,nlayer)
    7474
    7575! copy over preff , ap() and bp()
  • trunk/LMDZ.VENUS/libf/phyvenus/conf_phys.F90

    r1661 r1682  
    88 &                     if_ebil)
    99
     10   use init_print_control_mod, only: init_print_control
     11   use print_control_mod, only: lunout
    1012   use IOIPSL
    1113   implicit none
     
    2527
    2628! Local
    27   integer              :: numout = 6
     29!  integer              :: numout = 6
     30
     31
     32  ! Initialize flags lunout, prt_level, debug (in print_control_mod)
     33  CALL init_print_control
    2834
    2935!
     
    472478!
    473479
    474   write(numout,*)' ##############################################'
    475   write(numout,*)' Configuration des parametres de la physique: '
    476   write(numout,*)' cycle_diurne = ', cycle_diurne
    477   write(numout,*)' soil_model = ', soil_model
    478   write(numout,*)' ok_orodr = ', ok_orodr
    479   write(numout,*)' ok_orolf = ', ok_orolf
    480   write(numout,*)' ok_gw_nonoro = ', ok_gw_nonoro
    481   write(numout,*)' nbapp_rad = ', nbapp_rad
    482   write(numout,*)' nbapp_chim = ', nbapp_chim
    483   write(numout,*)' iflag_con = ', iflag_con
    484   write(numout,*)' Sortie journaliere = ', ok_journe
    485   write(numout,*)' Sortie mensuelle = ', ok_mensuel
    486   write(numout,*)' Sortie instantanee = ', ok_instan
    487   write(numout,*)' frequence sorties = ', ecriphy 
    488   write(numout,*)' Sortie bilan d''energie, if_ebil =', if_ebil
    489   write(numout,*)' Excentricite = ',R_ecc
    490   write(numout,*)' Equinoxe = ',R_peri
    491   write(numout,*)' Inclinaison =',R_incl
    492   write(numout,*)' tr_scheme = ', tr_scheme
    493   write(numout,*)' iflag_pbl = ', iflag_pbl
    494   write(numout,*)' z0 = ',z0
    495   write(numout,*)' lmixmin = ',lmixmin
    496   write(numout,*)' ksta = ',ksta
    497   write(numout,*)' ok_kzmin = ',ok_kzmin
    498   write(numout,*)' inertie = ', inertie
    499   write(numout,*)' iflag_ajs = ', iflag_ajs
    500   write(numout,*)' lev_histins = ',lev_histins
    501   write(numout,*)' lev_histday = ',lev_histday
    502   write(numout,*)' lev_histmth = ',lev_histmth
    503   write(numout,*)' reinit_trac = ',reinit_trac
    504   write(numout,*)' ok_cloud = ',ok_cloud
    505   write(numout,*)' ok_chem = ',ok_chem
    506   write(numout,*)' ok_sedim = ',ok_sedim
    507   write(numout,*)' nb_mode = ',nb_mode
    508   write(numout,*)' callnlte = ',callnlte
    509   write(numout,*)' nltemodel = ',nltemodel
    510   write(numout,*)' callnirco2 = ',callnirco2
    511   write(numout,*)' nircorr = ',nircorr
    512   write(numout,*)' callthermos = ',callthermos
    513   write(numout,*)' solvarmod = ',solvarmod
    514   write(numout,*)' solarcondate = ',solarcondate
    515   write(numout,*)' euveff = ',euveff
     480  write(lunout,*)' ##############################################'
     481  write(lunout,*)' Configuration des parametres de la physique: '
     482  write(lunout,*)' cycle_diurne = ', cycle_diurne
     483  write(lunout,*)' soil_model = ', soil_model
     484  write(lunout,*)' ok_orodr = ', ok_orodr
     485  write(lunout,*)' ok_orolf = ', ok_orolf
     486  write(lunout,*)' ok_gw_nonoro = ', ok_gw_nonoro
     487  write(lunout,*)' nbapp_rad = ', nbapp_rad
     488  write(lunout,*)' nbapp_chim = ', nbapp_chim
     489  write(lunout,*)' iflag_con = ', iflag_con
     490  write(lunout,*)' Sortie journaliere = ', ok_journe
     491  write(lunout,*)' Sortie mensuelle = ', ok_mensuel
     492  write(lunout,*)' Sortie instantanee = ', ok_instan
     493  write(lunout,*)' frequence sorties = ', ecriphy 
     494  write(lunout,*)' Sortie bilan d''energie, if_ebil =', if_ebil
     495  write(lunout,*)' Excentricite = ',R_ecc
     496  write(lunout,*)' Equinoxe = ',R_peri
     497  write(lunout,*)' Inclinaison =',R_incl
     498  write(lunout,*)' tr_scheme = ', tr_scheme
     499  write(lunout,*)' iflag_pbl = ', iflag_pbl
     500  write(lunout,*)' z0 = ',z0
     501  write(lunout,*)' lmixmin = ',lmixmin
     502  write(lunout,*)' ksta = ',ksta
     503  write(lunout,*)' ok_kzmin = ',ok_kzmin
     504  write(lunout,*)' inertie = ', inertie
     505  write(lunout,*)' iflag_ajs = ', iflag_ajs
     506  write(lunout,*)' lev_histins = ',lev_histins
     507  write(lunout,*)' lev_histday = ',lev_histday
     508  write(lunout,*)' lev_histmth = ',lev_histmth
     509  write(lunout,*)' reinit_trac = ',reinit_trac
     510  write(lunout,*)' ok_cloud = ',ok_cloud
     511  write(lunout,*)' ok_chem = ',ok_chem
     512  write(lunout,*)' ok_sedim = ',ok_sedim
     513  write(lunout,*)' nb_mode = ',nb_mode
     514  write(lunout,*)' callnlte = ',callnlte
     515  write(lunout,*)' nltemodel = ',nltemodel
     516  write(lunout,*)' callnirco2 = ',callnirco2
     517  write(lunout,*)' nircorr = ',nircorr
     518  write(lunout,*)' callthermos = ',callthermos
     519  write(lunout,*)' solvarmod = ',solvarmod
     520  write(lunout,*)' solarcondate = ',solarcondate
     521  write(lunout,*)' euveff = ',euveff
    516522
    517523  return
  • trunk/LMDZ.VENUS/libf/phyvenus/physiq_mod.F

    r1665 r1682  
    8080      use infotrac_phy, only: iflag_trac, tname, ttext
    8181      use vertical_layers_mod, only: pseudoalt
     82      use mod_phys_lmdz_omp_data, ONLY: is_omp_master
    8283#ifdef CPP_XIOS     
    8384      use xios_output_mod, only: initialize_xios_output,
    8485     &                           update_xios_timestep,
    8586     &                           send_xios_field
     87      use wxios, only: wxios_context_init, xios_context_finalize
    8688#endif
    8789      IMPLICIT none
     
    429431         allocate(source(klon,nqmax))
    430432
     433#ifdef CPP_XIOS
     434        ! Initialize XIOS context
     435        write(*,*) "physiq: call wxios_context_init"
     436        CALL wxios_context_init
     437#endif
     438
    431439         CALL suphec ! initialiser constantes et parametres phys.
    432440
     
    18741882       CALL send_xios_field("d_qmoldifN2",d_q_moldif(:,:,i_n2))
    18751883      ENDIF
    1876      
     1884
     1885      if (lafin.and.is_omp_master) then
     1886        write(*,*) "physiq: call xios_context_finalize"
     1887        call xios_context_finalize
     1888      endif
     1889
    18771890#endif
    18781891
  • trunk/LMDZ.VENUS/libf/phyvenus/xios_output_mod.F90

    r1642 r1682  
    2626                                mpi_size, mpi_rank, klon_mpi, &
    2727                                is_sequential, is_south_pole_dyn
    28   USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo
     28  USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid_type, unstructured
    2929  USE print_control_mod, ONLY: lunout, prt_level
    3030  USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat
    3131  USE regular_lonlat_mod, ONLY: lon_reg, lat_reg
    3232  USE nrtype, ONLY: pi
    33   USE wxios
     33#ifdef CPP_XIOS
     34  USE xios
     35#endif
     36  USE wxios, ONLY: wxios_domain_param, wxios_domain_param_unstructured, wxios_closedef
    3437  IMPLICIT NONE
    3538 
     
    6063    ! 2. Declare horizontal domain
    6164    ! Set values for the mask:
    62     IF (mpi_rank == 0) THEN
    63         data_ibegin = 0
    64     ELSE
    65         data_ibegin = ii_begin - 1
    66     END IF
    67 
    68     IF (mpi_rank == mpi_size-1) THEN
    69         data_iend = nbp_lon
    70     ELSE
    71         data_iend = ii_end + 1
    72     END IF
    73 
    74     if (prt_level>=10) then
    75       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
    76       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
    77       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
    78       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
    79       write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
    80     endif
    81 
     65!    IF (mpi_rank == 0) THEN
     66!        data_ibegin = 0
     67!    ELSE
     68!        data_ibegin = ii_begin - 1
     69!    END IF
     70
     71!    IF (mpi_rank == mpi_size-1) THEN
     72!        data_iend = nbp_lon
     73!    ELSE
     74!        data_iend = ii_end + 1
     75!    END IF
     76
     77!    if (prt_level>=10) then
     78!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
     79!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
     80!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
     81!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
     82!      write(lunout,*) "initialize_xios_output: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
     83!    endif
     84
     85!$OMP END MASTER
     86!$OMP BARRIER
    8287    ! Initialize the XIOS domain corresponding to this process:
    8388    if (prt_level>=10) write(lunout,*) "initialize_xios_output: call wxios_domain_param"
    84     CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
    85                             1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
    86                             klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
     89!    CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
     90!                            1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
     91!                            klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
    8792! VENUS IS SEEN UPSIDE DOWN, SO CENTRAL SYMMETRY TO PUT NORTH UP AGAIN
    88                            -1.*lat_reg*(180./pi), -1.*lon_reg*(180./pi),                &
    89                             is_south_pole_dyn,mpi_rank)
    90 
     93!                           -1.*lat_reg*(180./pi), -1.*lon_reg*(180./pi),                &
     94!                            is_south_pole_dyn,mpi_rank)
     95
     96    IF (grid_type==unstructured) THEN
     97      CALL wxios_domain_param_unstructured("dom_glo",.true.)
     98    ELSE
     99      CALL wxios_domain_param("dom_glo",.true.)
     100    ENDIF
     101
     102!$OMP MASTER
    91103    ! 3. Declare calendar and time step
    92104    if (prt_level>=10) write(lunout,*) "initialize_xios_output: build calendar"
Note: See TracChangeset for help on using the changeset viewer.