SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
prep_ver_teb.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 SUBROUTINE prep_ver_teb (B, T, TOP)
7 ! #################################################################################
8 !
9 !!**** *PREP_VER_TEB* - change in TEB variables due to altitude change
10 !!
11 !! PURPOSE
12 !! -------
13 !
14 !!** METHOD
15 !! ------
16 !!
17 !! REFERENCE
18 !! ---------
19 !!
20 !!
21 !! AUTHOR
22 !! ------
23 !! V. Masson
24 !!
25 !! MODIFICATIONS
26 !! -------------
27 !! Original 01/2004
28 !!------------------------------------------------------------------
29 !
30 
31 !
32 !
33 USE modd_bem_n, ONLY : bem_t
34 USE modd_teb_n, ONLY : teb_t
36 !
37 USE modd_prep, ONLY : xzs_ls, xt_clim_grad
38 USE modd_csts, ONLY : xrd, xg, xp00
39 !
40 USE mode_thermos
41 USE modi_prep_ver_snow
42 !
43 !
44 USE yomhook ,ONLY : lhook, dr_hook
45 USE parkind1 ,ONLY : jprb
46 !
47 IMPLICIT NONE
48 !
49 !* 0.1 declarations of arguments
50 !
51 !
52 !* 0.2 declarations of local variables
53 !
54 !
55 TYPE(bem_t), INTENT(INOUT) :: b
56 TYPE(teb_t), INTENT(INOUT) :: t
57 TYPE(teb_options_t), INTENT(INOUT) :: top
58 !
59 INTEGER :: jl ! loop counter
60 REAL, DIMENSION(:), ALLOCATABLE :: zt0 ! estimated temperature at sea level
61 REAL, DIMENSION(:), ALLOCATABLE :: zp_ls ! estimated pressure at XZS_LS
62 REAL, DIMENSION(:), ALLOCATABLE :: zt_ls ! temperature at XZS_LS
63 REAL, DIMENSION(:), ALLOCATABLE :: zp ! estimated pressure at XZS
64 REAL, DIMENSION(:,:), ALLOCATABLE :: zgrid ! wall or roof grid
65 REAL, DIMENSION(:), ALLOCATABLE :: zd ! wall or roof total thickness
66 REAL(KIND=JPRB) :: zhook_handle
67 !
68 !-------------------------------------------------------------------------------------
69 !
70 !* 1.1 Water reservoirs
71 !
72 !* nothing done
73 !
74 !* 1.2 Building temperature
75 !
76 !* nothing done
77 !
78 !* 1.3 Road deep temperature
79 !
80 IF (lhook) CALL dr_hook('PREP_VER_TEB',0,zhook_handle)
81 t%CUR%XTI_ROAD = t%CUR%XTI_ROAD + xt_clim_grad * (top%XZS - xzs_ls)
82 !
83 !* 1.4 Road Temperature profile
84 !
85 DO jl=1,SIZE(t%CUR%XT_ROAD,2)
86  t%CUR%XT_ROAD(:,jl) = t%CUR%XT_ROAD(:,jl) + xt_clim_grad * (top%XZS - xzs_ls)
87 END DO
88 !
89 !* 1.5 Wall Temperature profile
90 !
91 !* wall grid
92 ALLOCATE(zd(SIZE(t%CUR%XD_WALL,1)))
93 ALLOCATE(zgrid(SIZE(t%CUR%XD_WALL,1),SIZE(t%CUR%XD_WALL,2)))
94 zgrid(:,:) = 0.
95 zd(:) = 0.
96 !
97 DO jl=1,SIZE(t%CUR%XD_WALL,2)
98  zgrid(:,jl) = zd(:) + t%CUR%XD_WALL(:,jl)/2.
99  zd(:) = zd(:) + t%CUR%XD_WALL(:,jl)
100 END DO
101 !
102 !* surface temperature shift is given by climatological gradient
103 !* shift of temperatures within the wall is attenuated
104 !* shift is zero from internal wall to half of wall
105 DO jl=1,SIZE(t%CUR%XT_WALL_A,2)
106  t%CUR%XT_WALL_A(:,jl) = t%CUR%XT_WALL_A(:,jl) + xt_clim_grad * (top%XZS - xzs_ls) &
107  * max(1.-2.*zgrid(:,jl)/zd(:),0.)
108  t%CUR%XT_WALL_B(:,jl) = t%CUR%XT_WALL_B(:,jl) + xt_clim_grad * (top%XZS - xzs_ls) &
109  * max(1.-2.*zgrid(:,jl)/zd(:),0.)
110 END DO
111 !
112 DEALLOCATE(zd)
113 DEALLOCATE(zgrid)
114 !
115 !* 1.6 Roof Temperature profile
116 !
117 !* roof grid
118 ALLOCATE(zd(SIZE(t%CUR%XD_ROOF,1)))
119 ALLOCATE(zgrid(SIZE(t%CUR%XD_ROOF,1),SIZE(t%CUR%XD_ROOF,2)))
120 zgrid(:,:) = 0.
121 zd(:) = 0.
122 !
123 DO jl=1,SIZE(t%CUR%XD_ROOF,2)
124  zgrid(:,jl) = zd(:) + t%CUR%XD_ROOF(:,jl)/2.
125  zd(:) = zd(:) + t%CUR%XD_ROOF(:,jl)
126 END DO
127 !
128 !* surface temperature shift is given by climatological gradient
129 !* shift of temperatures within the wall is attenuated
130 !* shift is zero from internal wall to half of wall
131 DO jl=1,SIZE(t%CUR%XT_ROOF,2)
132  t%CUR%XT_ROOF(:,jl) = t%CUR%XT_ROOF(:,jl) + xt_clim_grad * (top%XZS - xzs_ls) &
133  * max(1.-2.*zgrid(:,jl)/zd(:),0.)
134 END DO
135 !
136 DEALLOCATE(zd)
137 DEALLOCATE(zgrid)
138 !
139 !
140 IF (top%CBEM=='BEM') THEN
141  !
142  !* 1.6bis Floor Temperature profile
143  !
144  !* Floor grid
145  ALLOCATE(zd(SIZE(b%CUR%XD_FLOOR,1)))
146  ALLOCATE(zgrid(SIZE(b%CUR%XD_FLOOR,1),SIZE(b%CUR%XD_FLOOR,2)))
147  zgrid(:,:) = 0.
148  zd(:) = 0.
149  !
150  DO jl=1,SIZE(b%CUR%XD_FLOOR,2)
151  zgrid(:,jl) = zd(:) + b%CUR%XD_FLOOR(:,jl)/2.
152  zd(:) = zd(:) + b%CUR%XD_FLOOR(:,jl)
153  END DO
154  !
155  !* deep ground temperature shift is given by climatological gradient
156  !* shift of temperatures within the floor is attenuated
157  !* shift is zero from internal floor layer to half of floor
158  DO jl=1,SIZE(b%CUR%XT_FLOOR,2)
159  b%CUR%XT_FLOOR(:,jl) = b%CUR%XT_FLOOR(:,jl) + xt_clim_grad * (top%XZS - xzs_ls) &
160  * max(2.*zgrid(:,jl)/zd(:)-1.,0.)
161  END DO
162  !
163  DEALLOCATE(zd)
164  DEALLOCATE(zgrid)
165  !
166  !* 1.6bis Mass Temperature profile
167  !
168  !* mass grid
169  ALLOCATE(zd(SIZE(b%CUR%XD_FLOOR,1)))
170  ALLOCATE(zgrid(SIZE(b%CUR%XD_FLOOR,1),SIZE(b%CUR%XD_FLOOR,2)))
171  zgrid(:,:) = 0.
172  zd(:) = 0.
173  !
174  DO jl=1,SIZE(b%CUR%XD_FLOOR,2)
175  zgrid(:,jl) = zd(:) + b%CUR%XD_FLOOR(:,jl)/2.
176  zd(:) = zd(:) + b%CUR%XD_FLOOR(:,jl)
177  END DO
178  !
179  !* deep ground temperature shift is given by climatological gradient
180  !* shift of temperatures within the floor is attenuated
181  !* shift is zero from internal floor layer to half of floor
182  DO jl=1,SIZE(b%CUR%XT_MASS,2)
183  b%CUR%XT_MASS(:,jl) = b%CUR%XT_MASS(:,jl) + xt_clim_grad * (top%XZS - xzs_ls) &
184  * max(2.*zgrid(:,jl)/zd(:)-1.,0.)
185  END DO
186  !
187  DEALLOCATE(zd)
188  DEALLOCATE(zgrid)
189  !
190 ENDIF
191 !
192 !* 1.7 Snow variables
193 !
194  CALL prep_ver_snow(t%CUR%TSNOW_ROOF,xzs_ls,top%XZS)
195  CALL prep_ver_snow(t%CUR%TSNOW_ROAD,xzs_ls,top%XZS)
196 !
197 !
198 !* 1.8 Canyon air temperature
199 !
200 !* estimation of temperature at sea level
201 !
202 ALLOCATE(zt0(SIZE(t%CUR%XQ_CANYON)))
203 zt0 = t%CUR%XT_CANYON - xt_clim_grad * xzs_ls
204 !
205 !* shift of canyon air temperature
206 !
207 ALLOCATE(zt_ls(SIZE(t%CUR%XQ_CANYON)))
208 zt_ls = t%CUR%XT_CANYON
209 !
210 t%CUR%XT_CANYON = t%CUR%XT_CANYON + xt_clim_grad * (top%XZS - xzs_ls)
211 !
212 !* 1.9 Canyon air humidity
213 !
214 !
215 !
216 !* estimation of pressure at large-scale orography
217 !
218 ALLOCATE(zp_ls(SIZE(t%CUR%XQ_CANYON)))
219 zp_ls = xp00 * exp(-(xg/xrd/zt0)*xzs_ls +(xg*xt_clim_grad/(2.*xrd*zt0**2))*xzs_ls**2)
220 !
221 !* estimation of pressure at output orography
222 !
223 ALLOCATE(zp(SIZE(t%CUR%XQ_CANYON)))
224 zp = xp00 * exp(-(xg/xrd/zt0)*top%XZS +(xg*xt_clim_grad/(2.*xrd*zt0**2))*top%XZS **2)
225 !
226 !* conservation of estimated relative humidity
227 !
228 t%CUR%XQ_CANYON = t%CUR%XQ_CANYON * qsat(t%CUR%XT_CANYON,zp) / qsat(zt_ls,zp_ls)
229 !
230 DEALLOCATE(zp_ls)
231 DEALLOCATE(zp )
232 DEALLOCATE(zt0 )
233 DEALLOCATE(zt_ls)
234 IF (lhook) CALL dr_hook('PREP_VER_TEB',1,zhook_handle)
235 !
236 !-------------------------------------------------------------------------------------
237 !
238 END SUBROUTINE prep_ver_teb
subroutine prep_ver_snow(TPSNOW, PZS_LS, PZS, PTG_LS, PTG, KDEEP_SOIL)
subroutine prep_ver_teb(B, T, TOP)
Definition: prep_ver_teb.F90:6