Changeset 3055 for trunk/LMDZ.MARS/libf


Ignore:
Timestamp:
Sep 27, 2023, 2:54:29 PM (13 months ago)
Author:
emillour
Message:

Mars PCM:
Add extra tests for XIOS output: only combine and send fields to XIOS if the
user requests them in one of the output files.
EM

Location:
trunk/LMDZ.MARS/libf/phymars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/write_output_mod.F90

    r2976 r3055  
    1717  ! For a surface field
    1818#ifdef CPP_XIOS
     19  use xios_output_mod, only: xios_is_active_field
    1920  use xios_output_mod, only: send_xios_field
    2021#endif
     
    3031  call writediagfi(ngrid,field_name,title,units,0,field)
    3132#ifdef CPP_XIOS
    32   call send_xios_field(field_name,field)
     33  if (xios_is_active_field(field_name)) then
     34    ! only send the field to xios if the user asked for it
     35    call send_xios_field(field_name,field)
     36  endif
    3337#endif
    3438 
     
    3842  ! For a surface field
    3943#ifdef CPP_XIOS
     44  use xios_output_mod, only: xios_is_active_field
    4045  use xios_output_mod, only: send_xios_field
    4146#endif
     
    5156  call writediagfi(ngrid,field_name,title,units,2,field)
    5257#ifdef CPP_XIOS
    53   call send_xios_field(field_name,field)
     58  if (xios_is_active_field(field_name)) then
     59    ! only send the field to xios if the user asked for it
     60    call send_xios_field(field_name,field)
     61  endif
    5462#endif
    5563 
     
    5967  ! For a "3D" horizontal-vertical field
    6068#ifdef CPP_XIOS
     69  use xios_output_mod, only: xios_is_active_field
    6170  use xios_output_mod, only: send_xios_field
    6271#endif
     
    7887  endif
    7988#ifdef CPP_XIOS
    80   call send_xios_field(field_name,field)
     89  if (xios_is_active_field(field_name)) then
     90    ! only send the field to xios if the user asked for it
     91    call send_xios_field(field_name,field)
     92  endif
    8193#endif
    8294 
     
    8698  ! For a surface field
    8799#ifdef CPP_XIOS
     100  use xios_output_mod, only: xios_is_active_field
    88101  use xios_output_mod, only: send_xios_field
    89102#endif
     
    99112  call writediagfi(ngrid,field_name,title,units,0,real(field))
    100113#ifdef CPP_XIOS
    101   call send_xios_field(field_name,real(field))
     114  if (xios_is_active_field(field_name)) then
     115    ! only send the field to xios if the user asked for it
     116    call send_xios_field(field_name,real(field))
     117  endif
    102118#endif
    103119 
     
    107123  ! For a surface field
    108124#ifdef CPP_XIOS
     125  use xios_output_mod, only: xios_is_active_field
    109126  use xios_output_mod, only: send_xios_field
    110127#endif
     
    120137  call writediagfi(ngrid,field_name,title,units,2,real(field))
    121138#ifdef CPP_XIOS
    122   call send_xios_field(field_name,real(field))
     139  if (xios_is_active_field(field_name)) then
     140    ! only send the field to xios if the user asked for it
     141    call send_xios_field(field_name,real(field))
     142  endif
    123143#endif
    124144 
     
    128148  ! For a "3D" horizontal-vertical field
    129149#ifdef CPP_XIOS
     150  use xios_output_mod, only: xios_is_active_field
    130151  use xios_output_mod, only: send_xios_field
    131152#endif
     
    147168  endif
    148169#ifdef CPP_XIOS
    149   call send_xios_field(field_name,real(field))
     170  if (xios_is_active_field(field_name)) then
     171    ! only send the field to xios if the user asked for it
     172    call send_xios_field(field_name,real(field))
     173  endif
    150174#endif
    151175 
     
    155179  ! For a surface field
    156180#ifdef CPP_XIOS
     181  use xios_output_mod, only: xios_is_active_field
    157182  use xios_output_mod, only: send_xios_field
    158183#endif
     
    173198  call writediagfi(ngrid,field_name,title,units,0,field_real)
    174199#ifdef CPP_XIOS
    175   call send_xios_field(field_name,field_real)
     200  if (xios_is_active_field(field_name)) then
     201    ! only send the field to xios if the user asked for it
     202    call send_xios_field(field_name,field_real)
     203  endif
    176204#endif
    177205 
     
    181209  ! For a surface field
    182210#ifdef CPP_XIOS
     211  use xios_output_mod, only: xios_is_active_field
    183212  use xios_output_mod, only: send_xios_field
    184213#endif
     
    202231  call writediagfi(ngrid,field_name,title,units,2,field_real(:))
    203232#ifdef CPP_XIOS
    204   call send_xios_field(field_name,field_real)
     233  if (xios_is_active_field(field_name)) then
     234    ! only send the field to xios if the user asked for it
     235    call send_xios_field(field_name,field_real)
     236  endif
    205237#endif
    206238 
     
    210242  ! For a "3D" horizontal-vertical field
    211243#ifdef CPP_XIOS
     244  use xios_output_mod, only: xios_is_active_field
    212245  use xios_output_mod, only: send_xios_field
    213246#endif
     
    242275
    243276#ifdef CPP_XIOS
    244   call send_xios_field(field_name,field_real)
     277  if (xios_is_active_field(field_name)) then
     278    ! only send the field to xios if the user asked for it
     279    call send_xios_field(field_name,field_real)
     280  endif
    245281#endif
    246282 
  • trunk/LMDZ.MARS/libf/phymars/xios_output_mod.F90

    r2941 r3055  
    293293  END SUBROUTINE histwrite3d_xios
    294294
     295!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     296
     297 FUNCTION xios_is_active_field(field_id)
     298 USE xios, only: xios_field_is_active
     299 USE mod_phys_lmdz_para, only: bcast_omp
     300 IMPLICIT NONE
     301   LOGICAL ::  xios_is_active_field
     302   CHARACTER(LEN=*) :: field_id
     303 
     304 ! check with XIOS if "field_id" is requested by the user
     305 ! to be in the output file(s)
     306
     307!$OMP MASTER
     308   xios_is_active_field = xios_field_is_active(field_id)
     309!$OMP END MASTER
     310   CALL bcast_omp(xios_is_active_field)
     311 END FUNCTION xios_is_active_field
     312
    295313#endif
    296314
Note: See TracChangeset for help on using the changeset viewer.