SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
topd_to_df.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 topd_to_df (I, &
8  ki,pwg)
9 ! ##########################
10 !
11 !!
12 !! PURPOSE
13 !! -------
14 ! This routines updates the soil water content of ISBA DIF afeter TOPODYN
15 ! lateral distribution
16 !
17 !!** METHOD
18 !! ------
19 !
20 !! EXTERNAL
21 !! --------
22 !!
23 !! none
24 !!
25 !! IMPLICIT ARGUMENTS
26 !! ------------------
27 !!
28 !! REFERENCE
29 !! ---------
30 !!
31 !! AUTHOR
32 !! ------
33 !!
34 !! ELYAZIDI/HEYMES/RISTOR * Meteo-France *
35 !!
36 !! MODIFICATIONS
37 !! -------------
38 !!
39 !! Original 02/2011
40 !-------------------------------------------------------------------------------
41 !
42 !* 0. DECLARATIONS
43 ! ------------
44 !
45 !
46 !
47 USE modd_isba_n, ONLY : isba_t
48 !
49 USE modd_surf_par, ONLY : xundef, nundef
50 USE modd_coupling_topd, ONLY : xtotbv_in_mesh, xfrac_d3
51 USE modd_isba_par, ONLY : xwgmin
52 !
53 USE yomhook , ONLY : lhook, dr_hook
54 USE parkind1 , ONLY : jprb
55 !
56 IMPLICIT NONE
57 !
58 !* 0.1 declarations of arguments
59 
60 !
61 TYPE(isba_t), INTENT(INOUT) :: i
62 !
63  INTEGER, INTENT(IN) :: ki
64  REAL, DIMENSION(:,:), INTENT(IN) :: pwg
65 !
66 !* 0.2 declarations of local variables
67 REAL :: zwork ! numbers of layers in root and deep zones
68 INTEGER :: idepth
69 INTEGER :: ji, jlayer, jpatch ! loop indexes
70 REAL(KIND=JPRB) :: zhook_handle
71 !-------------------------------------------------------------------------------
72 !
73 IF (lhook) CALL dr_hook('TOPD_TO_DF',0,zhook_handle)
74 !
75 DO jpatch=1,i%NPATCH
76 
77  IF (i%NSIZE_NATURE_P(jpatch) == 0 ) cycle
78 
79  DO jlayer = 1,i%NGROUND_LAYER
80 
81  DO ji=1,ki
82 
83  idepth=i%NWG_LAYER(ji,jpatch)
84 
85  IF(jlayer<=idepth.AND.idepth/=nundef.AND.(xtotbv_in_mesh(ji)/=0.0).AND.(xtotbv_in_mesh(ji)/=xundef)) THEN
86 
87  ! root layers
88  IF (i%XDZG(ji,jlayer,jpatch)/=xundef.AND.i%XDG2(ji,jpatch)/=xundef.AND.i%XDG(ji,jlayer,jpatch)/=xundef)&!
89  zwork=min(i%XDZG(ji,jlayer,jpatch),max(0.0,i%XDG2(ji,jpatch)-i%XDG(ji,jlayer,jpatch)+i%XDZG(ji,jlayer,jpatch)))
90 
91  IF ((pwg(ji,2)/=xundef).AND.(zwork>0.).AND.(zwork/=xundef))&
92  i%XWG(ji,jlayer,jpatch)=min(max(pwg(ji,2),xwgmin),i%XWSAT(ji,jlayer))
93 
94  ! deep layers
95  IF ((xfrac_d3(ji)/=0.0).AND.(xfrac_d3(ji)/=xundef)) THEN
96 
97  IF (i%XDZG(ji,jlayer,jpatch)/=xundef.AND.i%XDG2(ji,jpatch)/=xundef.AND.i%XDG(ji,jlayer,jpatch)/=xundef) &
98  zwork=min(i%XDZG(ji,jlayer,jpatch),max(0.0,i%XDG(ji,jlayer,jpatch)-i%XDG2(ji,jpatch)))
99 
100  IF ((pwg(ji,3)/=xundef).AND.(zwork>0.).AND.(zwork/=xundef)) &!
101  i%XWG(ji,jlayer,jpatch)=min(max(pwg(ji,3),xwgmin),i%XWSAT(ji,jlayer))
102 
103  ENDIF
104 
105  ENDIF
106 
107  ENDDO
108  ENDDO
109 ENDDO
110 !
111 IF (lhook) CALL dr_hook('TOPD_TO_DF',1,zhook_handle)
112 
113 END SUBROUTINE topd_to_df
114 
115 
subroutine topd_to_df(I, KI, PWG)
Definition: topd_to_df.F90:7