!OCL  SCALAR
SUBROUTINE SUDYN_SETGFLATTR

!------------------------------------------------------------------------------
!**** *SUDYN_SETGFLATTR*   - Set GFL attributes.

!     Purpose.
!     --------
!           Set GFL attributes.

!**   Interface.
!     ----------
!        *CALL* *SUDYN_SETGFLATTR

!        Explicit arguments :
!        --------------------
!         none

!        Implicit arguments :
!        --------------------

!     Method.
!     -------
!        See documentation

!     Externals.
!     ----------

!     Called by SUDYN.

!     Reference.
!     ----------
!        ECMWF Research Department documentation of the IFS

!     Author.
!     -------
!        Mats Hamrud *ECMWF* (original code in SUDYN)
!        K. Yessad (move in SUDYN_SETGFLATTR, Feb 2007)

! Modifications
! -------------
!   Original : Feb 2007.
!   28-Aug-2007 F. Vana: removing 4-points splines interpolation 
!   22-03-2007 S. Serrar: define attributes for the ERA40 GFL fields
!   27-07-2007 E. Holm: add LADV5 (background advection) to GFL properties
!   N. Wedi and K. Yessad (Jan 2008): different dev for NH model and PC scheme
!   JJMorcrette 20090217 PP of aerosol and UV processor output fields
! End Modifications
!------------------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

USE YOMPHY   , ONLY : LMPHYS
USE YOMCT0   , ONLY : LSLAG    ,LTWOTL   ,LPC_FULL , LPC_CHEAP
USE YOEPHY   , ONLY : NEPHYS_PCFULL      ,LEPHYS
USE YOMSLPHY , ONLY : LSLPHY
USE YOMSIMPHL, ONLY : LSIMPH
USE YOM_YGFL , ONLY : YL, YI, YS, YR, YG, YH, YTKE, YA, YO3, YSRC, YEXT,YQ, &
 & YCPF, YSPF, YAERO, YGRG, YGRGTEND, YFORC, YEZDIAG, YGHG, &
 & YCVGQ, YTRAC, YSDSAT, YCVV, YQVA, &
 & YUOM, YUAL, YDOM, YDAL, YUEN, YUNEBH, YERA40, YNOGW, YSLDIA, &
 & YQ_NL, YI_NL, YS_NL, YR_NL, YG_NL, YH_NL, YTKE_NL, YA_NL, YO3_NL, YSRC_NL,&
 & YL_NL, YEXT_NL, YCPF_NL, YSPF_NL, YAERO_NL, YGRG_NL, YFORC_NL, &
 & YEZDIAG_NL, YGHG_NL, YCVGQ_NL, YTRAC_NL, YSDSAT_NL, YCVV_NL, YQVA_NL, &
 & YUOM_NL, YUAL_NL, YDOM_NL, YDAL_NL, YUEN_NL, YUNEBH_NL, YERA40_NL, YSLDIA_NL, YNOGW_NL, &
 & NGFL_EXT, NAERO, NGRG, NGFL_FORC, NGFL_EZDIAG, NGHG, NTRAC, NERA40, NSLDIA, NNOGW, &
 & YLRCH4_NL, YLRCH4, YCH4S_NL, YCH4S, NGRG_CPLO4, YGRGTEND_NL, &
 & YAEROUT, YAEROUT_NL, NAEROUT, YUVP, YUVP_NL, NUVP, &
!>>dod
 & YCDNC, YCDNC_NL, YICNC, YICNC_NL, YRE_LIQ, YRE_LIQ_NL, YRE_ICE, YRE_ICE_NL
!<<dod
USE GFL_SUBS_MOD , ONLY : SET_GFL_ATTR,PRINT_GFL

!     ------------------------------------------------------------------

IMPLICIT NONE

INTEGER(KIND=JPIM) :: JGFL

LOGICAL :: LLT9,LLPT,LLPC,LLPC0
LOGICAL :: LLAD
LOGICAL :: LLDIAB

CHARACTER(LEN=12) :: CLSLINT

REAL(KIND=JPRB) :: ZHOOK_HANDLE

!     ------------------------------------------------------------------

#include "sucslint.intfb.h"

!     ------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('SUDYN_SETGFLATTR',0,ZHOOK_HANDLE)

!     ------------------------------------------------------------------

!*       1.    SET GFL ATTRIBUTES
!              ------------------

! * Note that in this part the order of the GFL variables is no longer
!   the "SUGFL-standard order" (cf. in SUGFL) but a random order which reduces
!   the risk of "hidden" bugs.
!   This SUDYN_SETGFLATTR-order is used to order the GFL variables at time
!   "t-dt".

IF (LPC_FULL.AND..NOT.LPC_CHEAP) THEN
  ! EUL: true; SL3TL: not yet coded; SL2TL: false.
  LLPC0=.NOT.LTWOTL
ELSEIF (LPC_FULL.AND.LPC_CHEAP.AND.LTWOTL) THEN
  ! EUL: not coded; SL3TL: not yet coded; SL2TL: true.
  LLPC0=.TRUE.
ELSE
  LLPC0=.FALSE.
ENDIF
LLT9 = (.NOT. LTWOTL) .OR. LPC_FULL

! ky: quid for HIRLAM physics? LLDIAB must be probably T in this case too.
LLDIAB=LEPHYS.OR.LMPHYS.OR.LSIMPH

! * Ozone:
IF(YO3%LACTIVE) THEN
  CALL SUCSLINT(YO3_NL%LSLHD,YO3_NL%LVSPLIP,YO3_NL%LHV, &
   & YO3_NL%LQM,YO3_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. LSLAG .AND. (YO3_NL%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YO3_NL%LPC
  CALL SET_GFL_ATTR(YO3,LDADV=YO3_NL%LADV,LDADV5=YO3_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YO3_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YO3_NL%REFVALC)  
ENDIF

! * Specific humidity:
IF(YQ%LACTIVE) THEN
  CALL SUCSLINT(YQ_NL%LSLHD,YQ_NL%LVSPLIP,YQ_NL%LHV, &
   & YQ_NL%LQM,YQ_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. LSLAG .AND. (YQ_NL%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YQ_NL%LPC 
  CALL SET_GFL_ATTR(YQ,LDADV=YQ_NL%LADV,LDADV5=YQ_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YQ_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YQ_NL%REFVALC)  
ENDIF

! * Cloud fraction:
IF(YA%LACTIVE) THEN
  CALL SUCSLINT(YA_NL%LSLHD,YA_NL%LVSPLIP,YA_NL%LHV, &
   & YA_NL%LQM,YA_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. LSLAG .AND. (YA_NL%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YA_NL%LPC
  CALL SET_GFL_ATTR(YA,LDADV=YA_NL%LADV,LDADV5=YA_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YA_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YA_NL%REFVALC)
ENDIF

! * Second order flux (for AROME physics):
IF(YSRC%LACTIVE) THEN
  CALL SUCSLINT(YSRC_NL%LSLHD,YSRC_NL%LVSPLIP,YSRC_NL%LHV, &
   & YSRC_NL%LQM,YSRC_NL%LQMH,CLSLINT)
  ! Notice : this field is not supposed to be pronostic !
  LLPT=LPC_FULL .AND. LLDIAB .AND. YSRC_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YSRC_NL%LPC
  CALL SET_GFL_ATTR(YSRC,LDADV=YSRC_NL%LADV,LDADV5=YSRC_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YSRC_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YSRC_NL%REFVALC)  
ENDIF

! * Liquid water:
IF(YL%LACTIVE) THEN
  CALL SUCSLINT(YL_NL%LSLHD,YL_NL%LVSPLIP,YL_NL%LHV, &
   & YL_NL%LQM,YL_NL%LQMH,CLSLINT) 
  LLPT=LPC_FULL .AND. LLDIAB .AND. LSLAG .AND. (YL_NL%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YL_NL%LPC
  CALL SET_GFL_ATTR(YL,LDADV=YL_NL%LADV,LDADV5=YL_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YL_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YL_NL%REFVALC)
ENDIF

! * Ice:
IF(YI%LACTIVE) THEN
  CALL SUCSLINT(YI_NL%LSLHD,YI_NL%LVSPLIP,YI_NL%LHV, &
   & YI_NL%LQM,YI_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. LSLAG .AND. (YI_NL%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YI_NL%LPC
  CALL SET_GFL_ATTR(YI,LDADV=YI_NL%LADV,LDADV5=YI_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YI_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YI_NL%REFVALC)
ENDIF

! * Snow:
IF(YS%LACTIVE) THEN
  CALL SUCSLINT(YS_NL%LSLHD,YS_NL%LVSPLIP,YS_NL%LHV, &
   & YS_NL%LQM,YS_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YS_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YS_NL%LPC
  CALL SET_GFL_ATTR(YS,LDADV=YS_NL%LADV,LDADV5=YS_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YS_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YS_NL%REFVALC)
ENDIF

! * Rain:
IF(YR%LACTIVE) THEN
  CALL SUCSLINT(YR_NL%LSLHD,YR_NL%LVSPLIP,YR_NL%LHV, &
   & YR_NL%LQM,YR_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YR_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YR_NL%LPC
  CALL SET_GFL_ATTR(YR,LDADV=YR_NL%LADV,LDADV5=YR_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YR_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YR_NL%REFVALC)
ENDIF

! * Graupels:
IF(YG%LACTIVE) THEN
  CALL SUCSLINT(YG_NL%LSLHD,YG_NL%LVSPLIP,YG_NL%LHV, &
   & YG_NL%LQM,YG_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YG_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YG_NL%LPC
  CALL SET_GFL_ATTR(YG,LDADV=YG_NL%LADV,LDADV5=YG_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YG_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YG_NL%REFVALC)
ENDIF

! * Hail:
IF(YH%LACTIVE) THEN
  CALL SUCSLINT(YH_NL%LSLHD,YH_NL%LVSPLIP,YH_NL%LHV, &
   & YH_NL%LQM,YH_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YH_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YH_NL%LPC
  CALL SET_GFL_ATTR(YH,LDADV=YH_NL%LADV,LDADV5=YH_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YH_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YH_NL%REFVALC)
ENDIF

! * CVGQ:
LLAD=YCVGQ%LGP
IF(YCVGQ%LACTIVE) THEN
  CALL SUCSLINT(YCVGQ_NL%LSLHD,YCVGQ_NL%LVSPLIP, &
   & YCVGQ_NL%LHV,YCVGQ_NL%LQM,YCVGQ_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YCPF_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YCPF_NL%LPC
  CALL SET_GFL_ATTR(YCVGQ,LDADV=LLAD,LDADV5=YCVGQ_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,&
   & LDPC=LLPC,KCOUPLING=0,CDSLINT=CLSLINT,PREFVALC=YCVGQ_NL%REFVALC)
ENDIF

! * TKE:
IF(YTKE%LACTIVE) THEN
  CALL SUCSLINT(YTKE_NL%LSLHD,YTKE_NL%LVSPLIP, & 
   & YTKE_NL%LHV,YTKE_NL%LQM,YTKE_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YTKE_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YTKE_NL%LPC
  CALL SET_GFL_ATTR(YTKE,LDADV=YTKE_NL%LADV,LDADV5=YTKE_NL%LADV5,LDT9=LLT9, &
   & LDPHY=LSLPHY,LDPT=LLPT,LDPC=LLPC,KCOUPLING=YTKE_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YTKE_NL%REFVALC)
ENDIF

! * Convective precipitation flux:
IF(YCPF%LACTIVE) THEN
  CALL SUCSLINT(YCPF_NL%LSLHD,YCPF_NL%LVSPLIP, &
   & YCPF_NL%LHV,YCPF_NL%LQM,YCPF_NL%LQMH,CLSLINT)
  ! Notice : this field is not supposed to be pronostic !
  LLPT=LPC_FULL .AND. LLDIAB .AND. YCPF_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YCPF_NL%LPC
  CALL SET_GFL_ATTR(YCPF,LDADV=.FALSE.,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YCPF_NL%NCOUPLING, &
   & PREFVALC=YCPF_NL%REFVALC)
ENDIF

! * Stratiform precipitation flux:
IF(YSPF%LACTIVE) THEN
  CALL SUCSLINT(YSPF_NL%LSLHD,YSPF_NL%LVSPLIP, &
   & YSPF_NL%LHV,YSPF_NL%LQM,YSPF_NL%LQMH,CLSLINT)
  ! Notice : this field is not supposed to be pronostic !
  LLPT=LPC_FULL .AND. LLDIAB .AND. YSPF_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YSPF_NL%LPC
  CALL SET_GFL_ATTR(YSPF,LDADV=.FALSE.,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YSPF_NL%NCOUPLING, &
   & PREFVALC=YSPF_NL%REFVALC)
ENDIF

! * Standard deviation of the saturation depression:
IF(YSDSAT%LACTIVE) THEN
  CALL SUCSLINT(YSDSAT_NL%LSLHD,YSDSAT_NL%LVSPLIP, &
   & YSDSAT_NL%LHV,YSDSAT_NL%LQM,YSDSAT_NL%LQMH,CLSLINT)
  ! Notice : this field is not supposed to be pronostic !
  LLPT=LPC_FULL .AND. LLDIAB .AND. YSDSAT_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YSDSAT_NL%LPC
  CALL SET_GFL_ATTR(YSDSAT,LDADV=YSDSAT_NL%LADV,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YSDSAT_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YSDSAT_NL%REFVALC)
ENDIF

! * Convective vertical velocity:
IF(YCVV%LACTIVE) THEN
  CALL SUCSLINT(YCVV_NL%LSLHD,YCVV_NL%LVSPLIP, &
   & YCVV_NL%LHV,YCVV_NL%LQM,YCVV_NL%LQMH,CLSLINT)
  ! Notice : this field is not supposed to be pronostic !
  LLPT=LPC_FULL .AND. LLDIAB .AND. YCVV_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YCVV_NL%LPC
  CALL SET_GFL_ATTR(YCVV,LDADV=YCVV_NL%LADV,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YCVV_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YCVV_NL%REFVALC)
ENDIF

! * Total humidity variation (for HIRLAM physics):
IF(YQVA%LACTIVE) THEN
  ! prepare variable YQVA used in HIRLAM cloud- and condensation. 
  CALL SUCSLINT(YQVA_NL%LSLHD,YQVA_NL%LVSPLIP, &
   & YQVA_NL%LHV,YQVA_NL%LQM,YQVA_NL%LQMH,CLSLINT)
  ! Notice : this field is not supposed to be pronostic 
  LLPT=LPC_FULL .AND. LLDIAB .AND. YQVA_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YQVA_NL%LPC
  CALL SET_GFL_ATTR(YQVA,LDADV=.FALSE.,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YQVA_NL%NCOUPLING, &
   & PREFVALC=YQVA_NL%REFVALC)
ENDIF

! * "Prognostic convection" variables (for ALARO physics):
!   interpolations like for q.
IF(YUOM%LACTIVE) THEN
  CALL SUCSLINT(YUOM_NL%LSLHD,YUOM_NL%LVSPLIP, &
   & YUOM_NL%LHV,YUOM_NL%LQM,YUOM_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YUOM_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YUOM_NL%LPC 
  CALL SET_GFL_ATTR(YUOM,LDADV=YUOM_NL%LADV,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YUOM_NL%NCOUPLING, & 
   & CDSLINT=CLSLINT,PREFVALC=YUOM_NL%REFVALC)
ENDIF
IF(YUAL%LACTIVE) THEN
  CALL SUCSLINT(YUAL_NL%LSLHD,YUAL_NL%LVSPLIP, &
   & YUAL_NL%LHV,YUAL_NL%LQM,YUAL_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YUAL_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YUAL_NL%LPC 
  CALL SET_GFL_ATTR(YUAL,LDADV=YUAL_NL%LADV,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YUAL_NL%NCOUPLING, & 
   & CDSLINT=CLSLINT,PREFVALC=YUAL_NL%REFVALC)
ENDIF
IF(YDOM%LACTIVE) THEN
  CALL SUCSLINT(YDOM_NL%LSLHD,YDOM_NL%LVSPLIP, &
   & YDOM_NL%LHV,YDOM_NL%LQM,YDOM_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YDOM_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YDOM_NL%LPC 
  CALL SET_GFL_ATTR(YDOM,LDADV=YDOM_NL%LADV,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YDOM_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YDOM_NL%REFVALC)
ENDIF
IF(YDAL%LACTIVE) THEN
  CALL SUCSLINT(YDAL_NL%LSLHD,YDAL_NL%LVSPLIP, &
   & YDAL_NL%LHV,YDAL_NL%LQM,YDAL_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YDAL_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YDAL_NL%LPC 
  CALL SET_GFL_ATTR(YDAL,LDADV=YDAL_NL%LADV,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YDAL_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YDAL_NL%REFVALC)
ENDIF
IF(YUEN%LACTIVE) THEN
  CALL SUCSLINT(YUEN_NL%LSLHD,YUEN_NL%LVSPLIP, &
   & YUEN_NL%LHV,YUEN_NL%LQM,YUEN_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YUEN_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YUEN_NL%LPC 
  CALL SET_GFL_ATTR(YUEN,LDADV=YUEN_NL%LADV,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YUEN_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YUEN_NL%REFVALC)
ENDIF
IF(YUNEBH%LACTIVE) THEN
  CALL SUCSLINT(YUNEBH_NL%LSLHD,YUNEBH_NL%LVSPLIP, &
   & YUNEBH_NL%LHV,YUNEBH_NL%LQM,YUNEBH_NL%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YUNEBH_NL%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YUNEBH_NL%LPC 
  CALL SET_GFL_ATTR(YUNEBH,LDADV=YUNEBH_NL%LADV,LDT9=LLT9,LDPHY=LSLPHY, &
   & LDPT=LLPT,LDPC=LLPC,KCOUPLING=YUNEBH_NL%NCOUPLING, &
   & CDSLINT=CLSLINT,PREFVALC=YUNEBH_NL%REFVALC)
ENDIF

! * LRCH4:
IF(NGHG > 0 .AND. YLRCH4%LACTIVE) THEN
  CALL SUCSLINT(YLRCH4_NL%LSLHD,YLRCH4_NL%LVSPLIP,YLRCH4_NL%LHV, &
   & YLRCH4_NL%LQM,YLRCH4_NL%LQMH,CLSLINT) 
  LLPT=LPC_FULL.AND.LLDIAB.AND.LSLAG.AND.(YLRCH4_NL%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YLRCH4_NL%LPC
  CALL SET_GFL_ATTR(YLRCH4,LDADV=YLRCH4_NL%LADV,LDADV5=YLRCH4_NL%LADV5, &
   & LDT9=LLT9,LDPHY=.FALSE.,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YLRCH4_NL%NCOUPLING,CDSLINT=CLSLINT,&
   & PREFVALC=YLRCH4_NL%REFVALC)
ENDIF

! * LCH4S:
IF(NGHG > 0 .AND. YCH4S%LACTIVE) THEN
  CALL SUCSLINT(YCH4S_NL%LSLHD,YCH4S_NL%LVSPLIP,YCH4S_NL%LHV, &
   & YCH4S_NL%LQM,YCH4S_NL%LQMH,CLSLINT) 
  LLPT=LPC_FULL.AND.LLDIAB.AND.LSLAG.AND.(YCH4S_NL%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YCH4S_NL%LPC
  CALL SET_GFL_ATTR(YCH4S,LDADV=YCH4S_NL%LADV,LDADV5=YCH4S_NL%LADV5, &
   & LDT9=LLT9,LDPHY=.FALSE.,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YCH4S_NL%NCOUPLING,CDSLINT=CLSLINT,&
   & PREFVALC=YCH4S_NL%REFVALC)
ENDIF

! Aerosols, greenhouse gases, tracers, reactive gases:
!   Remark k.y.: these variables are currently used for ECMWF applications
!    and LDADV=LSLAG, LDPHY=LSLPHY in the CALL of SET_GFL_ATTR
!    (that means that the namelist value of Y[X]_NL(JGFL)%LADV and
!    Y[X]_NL(JGFL)%LPHY is not taken into account). The calls to SET_GFL_ATTR
!    must be probably revised if some other teams wanted to use such GFL for
!    their own applications.
DO JGFL=1,NAERO
  CALL SUCSLINT(YAERO_NL(JGFL)%LSLHD, &
   & YAERO_NL(JGFL)%LVSPLIP,YAERO_NL(JGFL)%LHV, & 
   & YAERO_NL(JGFL)%LQM,YAERO_NL(JGFL)%LQMH,CLSLINT)
  LLPT = LPC_FULL .AND. LLDIAB .AND. YAERO_NL(JGFL)%LPT .AND. LSLAG
  LLPC = LLPC0.AND.YAERO_NL(JGFL)%LPC
  !-- equivalent to original cy31
  !  CALL SET_GFL_ATTR(YAERO(JGFL),LDADV=YAERO_NL(JGFL)%LADV,&
  !   & LDADV5=YAERO_NL(JGFL)%LADV5,LDT9=LLT9,&
  !   & LDPHY=YAERO_NL(JGFL)%LPHY,LDPT=LLPT,LDPC=LLPC,&
  !   & KCOUPLING=YAERO_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
  !   & PREFVALC=YAERO_NL(JGFL)%REFVALC)
  !-- equivalent to what was in cy30R2
  CALL SET_GFL_ATTR(YAERO(JGFL),LDADV=YAERO_NL(JGFL)%LADV,LDADV5=YAERO_NL(JGFL)%LADV5, &
   & LDT9=LLT9,LDPHY=.FALSE.,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YAERO_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
   & PREFVALC=YAERO_NL(JGFL)%REFVALC)
ENDDO
DO JGFL=1,NGHG
  CALL SUCSLINT(YGHG_NL(JGFL)%LSLHD, &
   & YGHG_NL(JGFL)%LVSPLIP,YGHG_NL(JGFL)%LHV, & 
   & YGHG_NL(JGFL)%LQM,YGHG_NL(JGFL)%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YGHG_NL(JGFL)%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YGHG_NL(JGFL)%LPC
  !-- equivalent to original cy31
  !  CALL SET_GFL_ATTR(YGHG(JGFL),LDADV=YGHG_NL(JGFL)%LADV, &
  !   & LDADV5=YGHG_NL(JGFL)%LADV5,LDT9=LLT9,&
  !   & LDPHY=YGHG_NL(JGFL)%LPHY,LDPT=LLPT,LDPC=LLPC,&
  !   & KCOUPLING=YGHG_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
  !   & PREFVALC=YGHG_NL(JGFL)%REFVALC)
  !-- equivalent to what was in cy30R2
  CALL SET_GFL_ATTR(YGHG(JGFL),LDADV=YGHG_NL(JGFL)%LADV,LDADV5=YGHG_NL(JGFL)%LADV5,&
   & LDT9=LLT9,LDPHY=.FALSE.,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YGHG_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
   & PREFVALC=YGHG_NL(JGFL)%REFVALC)
ENDDO
DO JGFL=1,NTRAC
  CALL SUCSLINT(YTRAC_NL(JGFL)%LSLHD, &
   & YTRAC_NL(JGFL)%LVSPLIP,YTRAC_NL(JGFL)%LHV, &
   & YTRAC_NL(JGFL)%LQM,YTRAC_NL(JGFL)%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YTRAC_NL(JGFL)%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YTRAC_NL(JGFL)%LPC
  !-- equivalent to original cy31
  !  CALL SET_GFL_ATTR(YTRAC(JGFL),LDADV=YTRAC_NL(JGFL)%LADV, &
  !   & LDADV5=YTRAC_NL(JGFL)%LADV5,LDT9=LLT9,&
  !   & LDPHY=YTRAC_NL(JGFL)%LPHY,LDPT=LLPT,LDPC=LLPC,&
  !   & KCOUPLING=YTRAC_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
  !   & PREFVALC=YTRAC_NL(JGFL)%REFVALC)
  !-- equivalent to what was in cy30R2
  CALL SET_GFL_ATTR(YTRAC(JGFL),LDADV=YTRAC_NL(JGFL)%LADV,LDADV5=YTRAC_NL(JGFL)%LADV5, &
   & LDT9=LLT9,LDPHY=.FALSE.,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YTRAC_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
   & PREFVALC=YTRAC_NL(JGFL)%REFVALC)
ENDDO
DO JGFL=1,NGRG
  CALL SUCSLINT(YGRG_NL(JGFL)%LSLHD, &
   & YGRG_NL(JGFL)%LVSPLIP,YGRG_NL(JGFL)%LHV, & 
   & YGRG_NL(JGFL)%LQM,YGRG_NL(JGFL)%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. YGRG_NL(JGFL)%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YGRG_NL(JGFL)%LPC
  !-- equivalent to original cy31
  !  CALL SET_GFL_ATTR(YGRG(JGFL),LDADV=YGRG_NL(JGFL)%LADV,&
  !   & LDADV5=YGRG_NL(JGFL)%LADV5,LDT9=LLT9,&
  !   & LDPHY=YGRG_NL(JGFL)%LPHY,LDPT=LLPT,LDPC=LLPC,&
  !   & KCOUPLING=YGRG_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
  !   & PREFVALC=YGRG_NL(JGFL)%REFVALC)
  !-- equivalent to what was in cy30R2
  CALL SET_GFL_ATTR(YGRG(JGFL),LDADV=YGRG_NL(JGFL)%LADV,LDADV5=YGRG_NL(JGFL)%LADV5,&
   & LDT9=LLT9,LDPHY=.FALSE.,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YGRG_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
   & PREFVALC=YGRG_NL(JGFL)%REFVALC)
ENDDO
DO JGFL=1,NGRG_CPLO4
  CALL SUCSLINT(YGRGTEND_NL(JGFL)%LSLHD, &
   & YGRGTEND_NL(JGFL)%LVSPLIP,YGRGTEND_NL(JGFL)%LHV, & 
   & YGRGTEND_NL(JGFL)%LQM,YGRGTEND_NL(JGFL)%LQMH,CLSLINT)
!  CLSLINT=''
  LLPT=LPC_FULL .AND. LLDIAB .AND. YGRGTEND_NL(JGFL)%LPT.AND.LSLAG
  LLPC = LLPC0.AND.YGRGTEND_NL(JGFL)%LPC
  !-- equivalent to original cy31
  !  CALL SET_GFL_ATTR(YGRGTEND(JGFL),LDADV=YGRGTEND_NL(JGFL)%LADV,&
  !   & LDADV5=YGRGTEND_NL(JGFL)%LADV5,LDT9=LLT9,&
  !   & LDPHY=YGRGTEND_NL(JGFL)%LPHY,LDPT=LLPT,LDPC=LLPC,&
  !   & KCOUPLING=YGRGTEND_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
  !   & PREFVALC=YGRGTEND_NL(JGFL)%REFVALC)
  !-- equivalent to what was in cy30R2
  CALL SET_GFL_ATTR(YGRGTEND(JGFL),LDADV=YGRGTEND_NL(JGFL)%LADV, &
   & LDADV5=YGRGTEND_NL(JGFL)%LADV5,LDT9=LLT9,&
   & LDPHY=.FALSE.,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YGRGTEND_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
   & PREFVALC=YGRGTEND_NL(JGFL)%REFVALC)
ENDDO

! ERA40 fields: these variables are currently used for ECMWF applications.
DO JGFL=1,NERA40
  LLPT = .FALSE.
  LLPC = .FALSE. 
  LLT9 = .FALSE.
  CALL SET_GFL_ATTR(YERA40(JGFL),LDADV=.FALSE.,LDT9=LLT9,&
   & LDPHY=.FALSE.,LDPT=LLPT, LDPC=LLPC,&
   & KCOUPLING=YERA40_NL(JGFL)%NCOUPLING,&
   & PREFVALC=YERA40_NL(JGFL)%REFVALC)
ENDDO

! NOGW fields: noro gwd scheme fields used for ECMWF applications
DO JGFL=1,NNOGW
  LLPT = .FALSE.
  LLPC = .FALSE.
  LLT9 = .FALSE.
  CALL SET_GFL_ATTR(YNOGW(JGFL),LDADV=.FALSE.,LDT9=LLT9,&
   & LDPHY=.FALSE.,LDPT=LLPT, LDPC=LLPC,&
   & KCOUPLING=YNOGW_NL(JGFL)%NCOUPLING,&
   & PREFVALC=YNOGW_NL(JGFL)%REFVALC)
ENDDO

! NUVP fields: UV processor output fields used for ECMWF applications
DO JGFL=1,NUVP
  LLPT = .FALSE.
  LLPC = .FALSE.
  LLT9 = .FALSE.
  CALL SET_GFL_ATTR(YUVP(JGFL),LDADV=.FALSE.,LDT9=LLT9,&
   & LDPHY=.FALSE.,LDPT=LLPT, LDPC=LLPC,&
   & KCOUPLING=YUVP_NL(JGFL)%NCOUPLING,&
   & PREFVALC=YUVP_NL(JGFL)%REFVALC)
ENDDO

! NAEROUT fields: aerosol output fields used for ECMWF applications
DO JGFL=1,NAEROUT
  LLPT = .FALSE.
  LLPC = .FALSE.
  LLT9 = .FALSE.
  CALL SET_GFL_ATTR(YAEROUT(JGFL),LDADV=.FALSE.,LDT9=LLT9,&
   & LDPHY=.FALSE.,LDPT=LLPT, LDPC=LLPC,&
   & KCOUPLING=YAEROUT_NL(JGFL)%NCOUPLING,&
   & PREFVALC=YAEROUT_NL(JGFL)%REFVALC)
ENDDO


! Semi-Lagrangian diagnostic fields: these variables are currently used for ECMWF applications.
DO JGFL=1,NSLDIA
  LLPT = .FALSE.
  LLPC = .FALSE. 
  LLT9 = .FALSE.
  CALL SET_GFL_ATTR(YSLDIA(JGFL),LDADV=.FALSE.,LDT9=LLT9,&
   & LDPHY=.FALSE.,LDPT=LLPT, LDPC=LLPC,&
   & KCOUPLING=YSLDIA_NL(JGFL)%NCOUPLING,&
   & PREFVALC=YSLDIA_NL(JGFL)%REFVALC)
ENDDO

! * Forcings (FORC):
DO JGFL=1,NGFL_FORC
  CALL SUCSLINT(YFORC_NL(JGFL)%LSLHD, &
   & YFORC_NL(JGFL)%LVSPLIP,YFORC_NL(JGFL)%LHV, &
   & YFORC_NL(JGFL)%LQM,YFORC_NL(JGFL)%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. LSLAG .AND. &
   & (YFORC_NL(JGFL)%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YFORC_NL(JGFL)%LPC
  CALL SET_GFL_ATTR(YFORC(JGFL),LDADV=YFORC_NL(JGFL)%LADV,LDT9=LLT9,&
   & LDPHY=YFORC_NL(JGFL)%LPHY,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YFORC_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
   & PREFVALC=YFORC_NL(JGFL)%REFVALC)
ENDDO

!>>dod
! Aerosol-cloud interaction fields, EC-EARTH
IF (YCDNC%LACTIVE) THEN
  CALL SET_GFL_ATTR(YCDNC, LDADV=.FALSE., LDT9=.FALSE., LDPHY=.FALSE.) 
END IF
IF (YICNC%LACTIVE) THEN
  CALL SET_GFL_ATTR(YICNC, LDADV=.FALSE., LDT9=.FALSE., LDPHY=.FALSE.) 
END IF
IF (YRE_LIQ%LACTIVE) THEN
  CALL SET_GFL_ATTR(YRE_LIQ, LDADV=.FALSE., LDT9=.FALSE., LDPHY=.FALSE.) 
END IF
IF (YRE_ICE%LACTIVE) THEN
  CALL SET_GFL_ATTR(YRE_ICE, LDADV=.FALSE., LDT9=.FALSE., LDPHY=.FALSE.) 
END IF
!<<dod

! * Easy diagnostics (EZDIAG):
DO JGFL=1,NGFL_EZDIAG
  CALL SUCSLINT(YEZDIAG_NL(JGFL)%LSLHD, &
   & YEZDIAG_NL(JGFL)%LVSPLIP,YEZDIAG_NL(JGFL)%LHV, &
   & YEZDIAG_NL(JGFL)%LQM,YEZDIAG_NL(JGFL)%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. LSLAG .AND. &
   & (YEZDIAG_NL(JGFL)%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YEZDIAG_NL(JGFL)%LPC
  CALL SET_GFL_ATTR(YEZDIAG(JGFL),LDADV=YEZDIAG_NL(JGFL)%LADV,LDT9=.FALSE.,&
   & LDPHY=YEZDIAG_NL(JGFL)%LPHY,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YEZDIAG_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT,&
   & PREFVALC=YEZDIAG_NL(JGFL)%REFVALC)
ENDDO

! * Extra-GFL variables:
DO JGFL=1,NGFL_EXT
  CALL SUCSLINT(YEXT_NL(JGFL)%LSLHD, &
   & YEXT_NL(JGFL)%LVSPLIP,YEXT_NL(JGFL)%LHV, &
   & YEXT_NL(JGFL)%LQM,YEXT_NL(JGFL)%LQMH,CLSLINT)
  LLPT=LPC_FULL .AND. LLDIAB .AND. LSLAG .AND. &
   & (YEXT_NL(JGFL)%LPT.OR.NEPHYS_PCFULL==2)
  LLPC = LLPC0.AND.YEXT_NL(JGFL)%LPC
  CALL SET_GFL_ATTR(YEXT(JGFL),LDADV=YEXT_NL(JGFL)%LADV,LDT9=LLT9,&
   & LDPHY=YEXT_NL(JGFL)%LPHY,LDPT=LLPT,LDPC=LLPC,&
   & KCOUPLING=YEXT_NL(JGFL)%NCOUPLING,CDSLINT=CLSLINT, &
   & PREFVALC=YEXT_NL(JGFL)%REFVALC)
ENDDO

!     ------------------------------------------------------------------

!*       2.    PRINT GFL ATTRIBUTES
!              --------------------

CALL PRINT_GFL

!     ------------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('SUDYN_SETGFLATTR',1,ZHOOK_HANDLE)
END SUBROUTINE SUDYN_SETGFLATTR
