Ignore:
Timestamp:
Jul 10, 2023, 1:40:39 AM (17 months ago)
Author:
yann meurdesoif
Message:

Suppress usage of preprocessing key CPP_XIOS.
Wrapper file is used to suppress XIOS symbol when xios is not linked and not used (-io ioipsl)
The CPP_XIOS key is replaced in model by "using_xios" boolean variable to switch between IOIPSL or XIOS output.

YM

Location:
LMDZ6/trunk/libf/phydev
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phydev/iophy.F90

    r2588 r4619  
    1313 
    1414
    15 #ifdef CPP_XIOS
    1615! interfaces for both IOIPSL and XIOS
    1716  INTERFACE histwrite_phy
    1817    MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy,histwrite2d_xios,histwrite3d_xios
    1918  END INTERFACE
    20 #else
    21 ! interfaces for IOIPSL
    22   INTERFACE histwrite_phy
    23     MODULE PROCEDURE histwrite2d_phy,histwrite3d_phy
    24   END INTERFACE
    25 #endif
    26 
    27 #ifdef CPP_XIOS
     19
    2820! interfaces for both IOIPSL and XIOS
    2921  INTERFACE histbeg_phy_all
    3022    MODULE PROCEDURE histbeg_phy, histbeg_phyxios
    3123  END INTERFACE
    32 #else
    33 ! interfaces for IOIPSL
    34   INTERFACE histbeg_phy_all
    35     MODULE PROCEDURE histbeg_phy
    36   END INTERFACE
    37 #endif
    3824
    3925contains
     
    5137  USE ioipsl, only: flio_dom_set
    5238#endif
    53 #ifdef CPP_XIOS
    54   use wxios, only: wxios_domain_param
    55 #endif
     39  use wxios, only: wxios_domain_param, using_xios
    5640  implicit none
    5741    real,dimension(klon),intent(in) :: rlon
     
    122106                      'APPLE',phys_domain_id)
    123107#endif
    124 #ifdef CPP_XIOS
    125     ! Set values for the mask:
    126     IF (mpi_rank == 0) THEN
    127         data_ibegin = 0
    128     ELSE
    129         data_ibegin = ii_begin - 1
    130     END IF
    131 
    132     IF (mpi_rank == mpi_size-1) THEN
    133         data_iend = nbp_lon
    134     ELSE
    135         data_iend = ii_end + 1
    136     END IF
    137 
    138     if (prt_level>=10) then
    139       write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
    140       write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
    141       write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
    142       write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
    143       write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
    144     endif
    145 
    146     ! Initialize the XIOS domain coreesponding to this process:
    147     CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
    148                             1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
    149                             klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
    150                             io_lat, io_lon,is_south_pole_dyn,mpi_rank)
    151 #endif
     108    IF (using_xios) THEN
     109      ! Set values for the mask:
     110      IF (mpi_rank == 0) THEN
     111          data_ibegin = 0
     112      ELSE
     113          data_ibegin = ii_begin - 1
     114      END IF
     115
     116      IF (mpi_rank == mpi_size-1) THEN
     117          data_iend = nbp_lon
     118      ELSE
     119          data_iend = ii_end + 1
     120      END IF
     121
     122      if (prt_level>=10) then
     123        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," iibegin=",ii_begin , " ii_end=",ii_end," jjbegin=",jj_begin," jj_nb=",jj_nb," jj_end=",jj_end
     124        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," nbp_lon=",nbp_lon," nbp_lat=",nbp_lat
     125        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
     126        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," data_ibegin=",data_ibegin," data_iend=",data_iend
     127        write(lunout,*) "init_iophy_new: mpirank=",mpi_rank," is_south_pole=",is_south_pole_dyn
     128      endif
     129
     130      ! Initialize the XIOS domain coreesponding to this process:
     131      CALL wxios_domain_param("dom_glo", is_sequential, nbp_lon, jj_nb, nbp_lon, nbp_lat, &
     132                              1, nbp_lon, ii_begin, ii_end, jj_begin, jj_end,             &
     133                              klon_mpi+2*(nbp_lon-1), data_ibegin, data_iend,             &
     134                              io_lat, io_lon,is_south_pole_dyn,mpi_rank)
     135    ENDIF
    152136!$OMP END MASTER
    153137     
     
    184168!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    185169
    186 #ifdef CPP_XIOS
    187170
    188171! SUBROUTINE histbeg_phyxios(name,itau0,zjulian,dtime,ffreq,lev,nhori,nid_day)
     
    213196  END SUBROUTINE histbeg_phyxios
    214197
    215 #endif
    216198
    217199!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    339321
    340322! VERSION DES HISTWRITE DEDIEES AU TOUT-XIOS-XML DEJA UTILISEE DANS PHYDEV
    341 #ifdef CPP_XIOS
     323
    342324  SUBROUTINE histwrite2d_xios(field_name,field)
    343325  USE dimphy, only: klon
    344326  USE mod_phys_lmdz_para, only: gather_omp, grid1Dto2D_mpi, &
    345327                                jj_nb, klon_mpi
    346   USE xios, only: xios_send_field
     328  USE lmdz_xios, only: xios_send_field
    347329  USE print_control_mod, ONLY: prt_level, lunout
    348330  USE mod_grid_phy_lmdz, ONLY: nbp_lon
     
    368350    IF (prt_level >= 10) WRITE(lunout,*)'End histrwrite2d_xios ',trim(field_name)
    369351  END SUBROUTINE histwrite2d_xios
    370 #endif
    371352
    372353!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    373354
    374355! VERSION DES HISTWRITE DEDIEES AU TOUT-XIOS-XML DEJA UTILISEE DANS PHYDEV
    375 #ifdef CPP_XIOS
     356
    376357  SUBROUTINE histwrite3d_xios(field_name, field)
    377358  USE dimphy, only: klon, klev
    378359  USE mod_phys_lmdz_para, only: gather_omp, grid1Dto2D_mpi, &
    379360                                jj_nb, klon_mpi
    380   USE xios, only: xios_send_field
     361  USE lmdz_xios, only: xios_send_field
    381362  USE print_control_mod, ONLY: prt_level,lunout
    382363  USE mod_grid_phy_lmdz, ONLY: nbp_lon
     
    407388    IF (prt_level >= 10) write(lunout,*)'End histrwrite3d_xios ',trim(field_name)
    408389  END SUBROUTINE histwrite3d_xios
    409 #endif
    410390
    411391end module iophy
  • LMDZ6/trunk/libf/phydev/physiq_mod.F90

    r2643 r4619  
    2323      USE mod_grid_phy_lmdz, ONLY: nbp_lon,nbp_lat
    2424
    25 #ifdef CPP_XIOS
    26       USE xios, ONLY: xios_update_calendar
     25      USE lmdz_xios, ONLY: xios_update_calendar, using_xios
    2726      USE wxios, only: wxios_add_vaxis, wxios_set_cal, wxios_closedef
    2827      USE iophy, ONLY: histwrite_phy
    29 #endif
    3028
    3129      IMPLICIT none
     
    126124#endif
    127125
    128 #ifdef CPP_XIOS
     126    IF (using_xios) THEN
    129127!XIOS
    130     ! Declare available vertical axes to be used in output files:   
    131     CALL wxios_add_vaxis("presnivs", klev, presnivs)
     128      ! Declare available vertical axes to be used in output files:   
     129      CALL wxios_add_vaxis("presnivs", klev, presnivs)
    132130
    133     ! Declare calendar and time step
    134     CALL wxios_set_cal(dtime,"earth_360d",1,1,1,0.0,1,1,1,0.0)
     131      ! Declare calendar and time step
     132      CALL wxios_set_cal(dtime,"earth_360d",1,1,1,0.0,1,1,1,0.0)
    135133   
    136     !Finalize the context:
    137     CALL wxios_closedef()
    138 #endif
     134      !Finalize the context:
     135      CALL wxios_closedef()
     136    ENDIF
    139137!$OMP END MASTER
    140138!$OMP BARRIER
     
    176174
    177175!XIOS
    178 #ifdef CPP_XIOS
    179 !$OMP MASTER
     176IF (using_xios) THEN
     177  !$OMP MASTER
    180178    !Increment XIOS time
    181179    CALL xios_update_calendar(itau)
    182 !$OMP END MASTER
    183 !$OMP BARRIER
     180  !$OMP END MASTER
     181  !$OMP BARRIER
    184182
    185183    !Send fields to XIOS: (NB these fields must also be defined as
     
    190188    CALL histwrite_phy("v",v)
    191189    CALL histwrite_phy("ps",paprs(:,1))
    192 #endif
     190ENDIF
    193191
    194192! if lastcall, then it is time to write "restartphy.nc" file
Note: See TracChangeset for help on using the changeset viewer.