Ignore:
Timestamp:
Nov 8, 2024, 10:57:27 AM (2 weeks ago)
Author:
afalco
Message:

Pluto: import write_output function from Mars.
xios specific outputs.
AF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.PLUTO/libf/phypluto/xios_output_mod.F90

    r3501 r3506  
    1111
    1212 INTERFACE send_xios_field
    13     MODULE PROCEDURE histwrite0d_xios,histwrite2d_xios,histwrite3d_xios!,histwrite1d_xios
     13    MODULE PROCEDURE histwrite0d_xios,histwrite1d_xios,histwrite2d_xios,histwrite3d_xios
    1414 END INTERFACE
    1515
     
    1717CONTAINS
    1818
    19   SUBROUTINE initialize_xios_output(day,timeofday,dtphys,daysec,&
    20                                     yearday,presnivs,pseudoalt,wnoi,wnov)
    21 !  USE mod_phys_lmdz_para, only: gather, bcast, &
    22 !                                jj_nb, jj_begin, jj_end, ii_begin, ii_end, &
    23 !                                mpi_size, mpi_rank, klon_mpi, &
    24 !                                is_sequential, is_south_pole_dyn
     19  SUBROUTINE initialize_xios_output(day,timeofday,dtphys,daysec,yearday,   &
     20                                    presnivs,pseudoalt,mlayer,wnoi,wnov)
    2521  USE mod_phys_lmdz_para, ONLY: jj_nb, jj_begin, jj_end, ii_begin, ii_end, &
    2622                                mpi_size, mpi_rank, klon_mpi, &
     
    4440  REAL,INTENT(IN) :: presnivs(:) ! vertical grid approximate pressure (Pa)
    4541  REAL,INTENT(IN) :: pseudoalt(:) ! vertical grid approximate altitude (km)
     42  REAL,INTENT(IN) :: mlayer(:) ! soil layer depth at intermediate level (m)
    4643  REAL,INTENT(IN) :: wnoi(:) ! Array of wavenumbers at the spectral interval centers for the infrared.
    4744  real,intent(in) :: wnov (:) !Array of wavenumbers at the spectral interval centers for the visible.
     45
    4846
    4947  INTEGER :: data_ibegin, data_iend
     
    6260    CALL xios_set_axis_attr("altitude", n_glo=size(pseudoalt), value=pseudoalt,&
    6361                            unit="km",positive="up")
     62    CALL xios_set_axis_attr("interlayer", n_glo=size(pseudoalt)+1,&
     63                            unit="km",positive="up")
     64    IF (prt_level>=10) WRITE(lunout,*) "initialize_xios_output: call xios_set_axis_attr for soil"
     65    CALL xios_set_axis_attr("soil_layers", n_glo=size(mlayer), value=mlayer,&
     66                            unit="m",positive="down")
    6467    if (prt_level >=10) write(lunout,*) "initialize_xios_output: call xios_set_axis_attr for IR_Wavenumber"
    6568    write(lunout,*) "writing IR_Wavenumber now in initialize_xios_output"
     
    139142    ! Now define the start time of this simulation
    140143    ! NB: we substract dtphys because we want to set the origin of the time axis
    141     start_date=time_origin+xios_duration(0,0,day,0,0,timeofday*daysec-dtphys)
     144    start_date=time_origin
    142145    call xios_set_start_date(start_date=start_date)
    143146    if (prt_level>=10) then
     
    148151    if (prt_level>=10) write(*,*) "initialize_xios_output: call wxios_closedef"
    149152    CALL wxios_closedef()
     153    if (prt_level>=10) write(*,*) "initialize_xios_output: after call wxios_closedef"
    150154
    151155!$OMP END MASTER
     
    211215
    212216  END SUBROUTINE histwrite0d_xios
     217
     218!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     219
     220  SUBROUTINE histwrite1d_xios(field_name,field,dimens)
     221  USE xios, ONLY: xios_send_field
     222  USE print_control_mod, ONLY: prt_level, lunout
     223  IMPLICIT NONE
     224
     225    CHARACTER(LEN=*), INTENT(IN) :: field_name
     226    REAL, DIMENSION(:), INTENT(IN) :: field
     227    INTEGER, INTENT(IN) :: dimens
     228    IF (prt_level >= 10) WRITE(lunout,*)'Begin histrwrite1d_xios ',trim(field_name)
     229!$OMP MASTER
     230    CALL xios_send_field(field_name,field)
     231!$OMP END MASTER
     232
     233    IF (prt_level >= 10) WRITE(lunout,*)'End histrwrite1d_xios ',trim(field_name)
     234
     235  END SUBROUTINE histwrite1d_xios
    213236
    214237!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    221244  USE print_control_mod, ONLY: prt_level, lunout
    222245  USE mod_grid_phy_lmdz, ONLY: nbp_lon
    223   USE radinc_h ,only: L_NSPECTI,L_NSPECTV
    224246  IMPLICIT NONE
    225247
     
    230252    REAL :: Field2d(nbp_lon,jj_nb)
    231253
     254    CHARACTER(len=128) :: msg
     255
    232256    IF (prt_level >= 10) WRITE(lunout,*)'Begin histrwrite2d_xios ',trim(field_name)
    233     if ((size(field) .eq. L_NSPECTI) .or. (size(field) .eq. L_NSPECTV)) then
    234 !$OMP MASTER
    235       ! only for spectral stuff: IR_Bandwidth and VI_Bandwidth
    236       call xios_send_field(field_name,field)
    237 !$OMP END MASTER
    238       return
    239     endif
    240     IF (SIZE(field)/=klon) CALL abort_physic('iophy::histwrite2d_xios','Field first DIMENSION not equal to klon',1)
    241 
     257    IF (SIZE(field)/=klon) THEN
     258      WRITE(msg,*) "Pb with field "//trim(field_name)//&
     259                   " : Field first DIMENSION not equal to klon"
     260      CALL abort_physic('iophy::histwrite2d_xios',trim(msg),1)
     261    ENDIF
    242262    CALL Gather_omp(field,buffer_omp)
    243263!$OMP MASTER
     
    269289    INTEGER :: ip, n, nlev
    270290
     291    CHARACTER(len=128) :: msg
     292
    271293  IF (prt_level >= 10) write(lunout,*)'Begin histrwrite3d_xios ',trim(field_name)
    272294
    273     !Et on.... écrit
    274     IF (SIZE(field,1)/=klon) CALL abort_physic('iophy::histwrite3d','Field first DIMENSION not equal to klon',1)
     295    !And we write...
     296    IF (SIZE(field,1)/=klon) THEN
     297      WRITE(msg,*) "Pb with field "//trim(field_name)//&
     298                   " : Field first DIMENSION not equal to klon"
     299      CALL abort_physic('iophy::histwrite3d',trim(msg),1)
     300    ENDIF
     301
    275302    nlev=SIZE(field,2)
    276303
     
    286313  END SUBROUTINE histwrite3d_xios
    287314
     315!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     316
     317 FUNCTION xios_is_active_field(field_id)
     318 USE xios, only: xios_field_is_active
     319 USE mod_phys_lmdz_omp_transfert, only: bcast_omp
     320 IMPLICIT NONE
     321   LOGICAL ::  xios_is_active_field
     322   CHARACTER(LEN=*) :: field_id
     323
     324 ! check with XIOS if "field_id" is requested by the user
     325 ! to be in the output file(s)
     326
     327!$OMP BARRIER
     328!$OMP MASTER
     329   xios_is_active_field = xios_field_is_active(field_id)
     330!$OMP END MASTER
     331   CALL bcast_omp(xios_is_active_field)
     332 END FUNCTION xios_is_active_field
     333
    288334#endif
    289335
Note: See TracChangeset for help on using the changeset viewer.