Changeset 4606 for LMDZ6/trunk/libf/misc


Ignore:
Timestamp:
Jul 5, 2023, 11:35:57 AM (18 months ago)
Author:
acozic
Message:

Fixe a bug on declaration of group using XIOS routines
This need to be done before xios_close_context and before Xios inheritance
(Anne Cozic)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/misc/wxios.F90

    r4477 r4606  
    159159        g_ctx = xios_ctx
    160160
     161        CALL wxios_add_group_init
     162       
    161163        IF (prt_level >= 10) THEN
    162164          WRITE(lunout,*) "wxios_context_init: Current context is ",trim(g_ctx_name)
     
    168170    END SUBROUTINE wxios_context_init
    169171
     172
     173   
     174    SUBROUTINE wxios_add_group_init
     175
     176      ! routine create by Anne Cozic (2023)
     177      ! This routine will create field associated to group defined without description of fields in field.xml file
     178      ! This routine need to be call before "xios_sole_inheritance" after an !$OMP MASTER directive
     179     
     180      USE infotrac_phy, ONLY: nbtr, nqtot, nqo, type_trac, tracers, niso, ntiso
     181      USE strings_mod,  ONLY: maxlen
     182
     183      IMPLICIT NONE
     184
     185      TYPE(xios_fieldgroup) :: group_handle
     186      TYPE(xios_field) :: child
     187      INTEGER :: k, iq
     188      CHARACTER(len=12) :: nvar   
     189      CHARACTER(LEN=maxlen) :: varname, dn
     190      CHARACTER(LEN=maxlen) :: unt
     191   
     192
     193      ! group create for StratAER variables
     194      !On ajoute les variables 3D traceurs par l interface fortran
     195      CALL xios_get_handle("fields_strataer_trac_3D", group_handle)
     196      ! On boucle sur les traceurs pour les ajouter au groupe puis fixer les attributs
     197      DO iq = 1, nqtot
     198         IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
     199         dn = 'd'//TRIM(tracers(iq)%name)//'_'
     200
     201         unt = "kg kg-1"
     202         varname=trim(tracers(iq)%name)
     203         CALL xios_add_child(group_handle, child, varname)
     204         CALL xios_set_attr(child, name=varname, unit=unt)
     205         
     206         unt = "kg kg-1 s-1"
     207         varname=TRIM(dn)//'vdf'
     208         CALL xios_add_child(group_handle, child, varname)
     209         CALL xios_set_attr(child, name=varname, unit=unt)
     210         varname=TRIM(dn)//'the'
     211         CALL xios_add_child(group_handle, child, varname)
     212         CALL xios_set_attr(child, name=varname, unit=unt)
     213         varname=TRIM(dn)//'con'
     214         CALL xios_add_child(group_handle, child, varname)
     215         CALL xios_set_attr(child, name=varname, unit=unt)
     216         varname=TRIM(dn)//'lessi_impa'
     217         CALL xios_add_child(group_handle, child, varname)
     218         CALL xios_set_attr(child, name=varname, unit=unt)
     219         varname=TRIM(dn)//'lessi_nucl'
     220         CALL xios_add_child(group_handle, child, varname)
     221         CALL xios_set_attr(child, name=varname, unit=unt)
     222         varname=TRIM(dn)//'insc'
     223         CALL xios_add_child(group_handle, child, varname)
     224         CALL xios_set_attr(child, name=varname, unit=unt)
     225         varname=TRIM(dn)//'bcscav'
     226         CALL xios_add_child(group_handle, child, varname)
     227         CALL xios_set_attr(child, name=varname, unit=unt)
     228         varname=TRIM(dn)//'evapls'
     229         CALL xios_add_child(group_handle, child, varname)
     230         CALL xios_set_attr(child, name=varname, unit=unt)
     231         varname=TRIM(dn)//'ls'
     232         CALL xios_add_child(group_handle, child, varname)
     233         CALL xios_set_attr(child, name=varname, unit=unt)
     234         varname=TRIM(dn)//'trsp'
     235         CALL xios_add_child(group_handle, child, varname)
     236         CALL xios_set_attr(child, name=varname, unit=unt)
     237         varname=TRIM(dn)//'sscav'
     238         CALL xios_add_child(group_handle, child, varname)
     239         CALL xios_set_attr(child, name=varname, unit=unt)
     240         varname=TRIM(dn)//'sat'
     241         CALL xios_add_child(group_handle, child, varname)
     242         CALL xios_set_attr(child, name=varname, unit=unt)
     243         varname=TRIM(dn)//'uscav'
     244         CALL xios_add_child(group_handle, child, varname)
     245         CALL xios_set_attr(child, name=varname, unit=unt)
     246      END DO
     247      !On ajoute les variables 2D traceurs par l interface fortran
     248      CALL xios_get_handle("fields_strataer_trac_2D", group_handle)
     249      ! On boucle sur les traceurs pour les ajouter au groupe puis fixer les attributs
     250      DO iq = 1, nqtot
     251         IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
     252         
     253         unt = "kg m-2"
     254         varname='cum'//trim(tracers(iq)%name)
     255         
     256         CALL xios_add_child(group_handle, child, varname)
     257         CALL xios_set_attr(child, name=varname, unit=unt)
     258         
     259         unt = "kg m-2 s-1"
     260         varname='cumd'//trim(tracers(iq)%name)//'_dry'
     261         CALL xios_add_child(group_handle, child, varname)
     262         CALL xios_set_attr(child, name=varname, unit=unt)
     263      ENDDO
     264
     265
     266    END SUBROUTINE wxios_add_group_init
    170267
    171268    SUBROUTINE wxios_set_context()
Note: See TracChangeset for help on using the changeset viewer.