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/LMDZ.COMMON/libf/phy_common
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.