SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
dg_dfto3l.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 !
6 ! ##########################
7  SUBROUTINE dg_dfto3l (I, &
8  ki,pdg)
9 ! ##########################
10 !
11 !!
12 !! PURPOSE
13 !! -------
14 ! from AVERAGE_DIAG_MISC_ISBA_n
15 !
16 !!** METHOD
17 !! ------
18 !
19 !! EXTERNAL
20 !! --------
21 !!
22 !! none
23 !!
24 !! IMPLICIT ARGUMENTS
25 !! ------------------
26 !!
27 !! REFERENCE
28 !! ---------
29 !!
30 !! AUTHOR
31 !! ------
32 !!
33 !! ELYAZIDI/HEYMES/RISTOR * Meteo-France *
34 !!
35 !! MODIFICATIONS
36 !! -------------
37 !!
38 !! Original 02/2011
39 !-------------------------------------------------------------------------------
40 !
41 !* 0. DECLARATIONS
42 ! ------------
43 !
44 !
45 !
46 USE modd_isba_n, ONLY : isba_t
47 !
48 USE modd_surf_par, ONLY : xundef, nundef
49 USE yomhook , ONLY : lhook, dr_hook
50 USE parkind1 , ONLY : jprb
51 !
52 !
53 IMPLICIT NONE
54 !
55 !* 0.1 declarations of arguments
56 
57 !
58 TYPE(isba_t), INTENT(INOUT) :: i
59 !
60  INTEGER, INTENT(IN) :: ki
61  REAL, DIMENSION(:,:), INTENT(OUT) :: pdg
62 !
63 !* 0.2 declarations of local variables
64  INTEGER :: jj, jlayer, jpatch ! loop indexes
65  INTEGER :: idepth
66  INTEGER :: ini, inp
67  REAL :: zwork
68  !
69  REAL(KIND=JPRB) :: zhook_handle
70 !-------------------------------------------------------------------------------
71 IF (lhook) CALL dr_hook('DG_DFTO3L',0,zhook_handle)
72 ini=SIZE(i%XPATCH,1)
73 inp=SIZE(i%XPATCH,2)
74 !
75 pdg(:,:)=0.0
76 !
77  DO jpatch=1,inp
78 !
79  IF (i%NSIZE_NATURE_P(jpatch) == 0 ) cycle
80  DO jlayer = 1,i%NGROUND_LAYER
81  DO jj=1,ini
82  idepth=i%NWG_LAYER(jj,jpatch)
83  IF(jlayer<=idepth.AND.idepth/=nundef.AND.i%XPATCH(jj,jpatch)/=xundef)THEN
84  !
85  pdg(jj,1) = pdg(jj,1) + i%XDG(jj,1,jpatch) * i%XPATCH(jj,jpatch)
86  ! ISBA-FR-DG2 comparable soil wetness index, liquid water and ice contents
87  zwork=min(i%XDZG(jj,jlayer,jpatch),max(0.0,i%XDG2(jj,jpatch)-i%XDG(jj,jlayer,jpatch)+i%XDZG(jj,jlayer,jpatch)))
88  pdg(jj,2) = pdg(jj,2) + zwork * i%XPATCH(jj,jpatch)
89  !
90  ! ISBA-FR-DG3 comparable soil wetness index, liquid water and ice contents
91  zwork=min(i%XDZG(jj,jlayer,jpatch),max(0.0,i%XDG(jj,jlayer,jpatch)-i%XDG2(jj,jpatch)))
92  pdg(jj,3) = pdg(jj,3) + zwork * i%XPATCH(jj,jpatch)
93  !
94  ENDIF
95  ENDDO
96  ENDDO
97 !
98  ENDDO
99  !
100  pdg(:,3) = pdg(:,2) + pdg(:,3)
101  WHERE (pdg(:,:)==0.0)
102  pdg(:,:)=xundef
103  ENDWHERE
104 !
105 IF (lhook) CALL dr_hook('DG_DFTO3L',1,zhook_handle)
106 
107 END SUBROUTINE dg_dfto3l
108 
109 
subroutine dg_dfto3l(I, KI, PDG)
Definition: dg_dfto3l.F90:7