SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
prep_teb_buffer.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_teb_buffer(HPROGRAM,HSURF,KLUOUT,PFIELD)
7 ! #################################################################################
8 !
9 !!**** *PREP_TEB_BUFFER* - prepares TEB field from operational BUFFER
10 !!
11 !! PURPOSE
12 !! -------
13 !
14 !!** METHOD
15 !! ------
16 !!
17 !! REFERENCE
18 !! ---------
19 !!
20 !!
21 !! AUTHOR
22 !! ------
23 !! S. Malardel
24 !!
25 !! MODIFICATIONS
26 !! -------------
27 !! Original 03/2005
28 !!------------------------------------------------------------------
29 !
30 
31 !
33 !
34 USE modi_prep_buffer_grid
37 !
38 USE modd_prep, ONLY : cinterp_type
39 USE modd_grid_buffer, ONLY : nni
40 USE modd_prep_teb, ONLY : xgrid_road, xgrid_wall, xgrid_roof, xgrid_floor, &
41  xti_bld, xti_road, xhui_bld, xti_bld_def
42 USE modd_surf_par, ONLY : xundef
43 !
44 !
45 USE yomhook ,ONLY : lhook, dr_hook
46 USE parkind1 ,ONLY : jprb
47 !
48 IMPLICIT NONE
49 !
50 !* 0.1 declarations of arguments
51 !
52  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling surf. schemes
53  CHARACTER(LEN=7), INTENT(IN) :: hsurf ! type of field
54 INTEGER, INTENT(IN) :: kluout ! logical unit of output listing
55 REAL,DIMENSION(:,:), POINTER :: pfield ! field to interpolate horizontally
56 !
57 !* 0.2 declarations of local variables
58 !
59 TYPE (date_time) :: tztime_buf ! current date and time
60  CHARACTER(LEN=6) :: yinmodel ! model from which BUFFER originates
61 REAL, DIMENSION(:), POINTER :: zfield1d ! 1D field read
62 REAL, DIMENSION(:,:), POINTER :: zfield ! field read
63 REAL, DIMENSION(:,:), POINTER :: zd ! depth of field in the soil
64 REAL :: zti_bld ! internal building temperature
65 REAL(KIND=JPRB) :: zhook_handle
66 !
67 !-------------------------------------------------------------------------------------
68 !
69 !* 1. Reading of grid
70 ! ---------------
71 !
72 IF (lhook) CALL dr_hook('PREP_TEB_BUFFER',0,zhook_handle)
73  CALL prep_buffer_grid(kluout,yinmodel,tztime_buf)
74 !
75 IF (hsurf=='T_FLOOR' .OR. hsurf=='T_WALL' .OR. hsurf=='T_ROOF' .OR. hsurf=='T_WIN2' .OR. hsurf=='TI_BLD') THEN
76  zti_bld = xti_bld_def
77  IF (xti_bld/=xundef) zti_bld=xti_bld
78 ENDIF
79 !---------------------------------------------------------------------------------------
80 SELECT CASE(hsurf)
81 !---------------------------------------------------------------------------------------
82 !
83 !* 2. Orography
84 ! ---------
85 !
86  CASE('ZS ')
87  SELECT CASE (yinmodel)
88  CASE ('ALADIN')
89  CALL read_buffer_zs(kluout,yinmodel,zfield1d)
90  ALLOCATE(pfield(nni,1))
91  pfield(:,1) = zfield1d(:)
92  DEALLOCATE(zfield1d)
93  END SELECT
94 !
95 !* 3. Profile of temperatures in roads
96 ! --------------------------------
97 !
98  CASE('T_ROAD')
99  !* reading of the profile and its depth definition
100  SELECT CASE(yinmodel)
101  CASE('ALADIN')
102  CALL read_buffer_tg(kluout,yinmodel,zfield,zd)
103  END SELECT
104  !* if deep road temperature is prescribed
105  IF (xti_road/=xundef) THEN
106  zfield(:,2:) = xti_road
107  END IF
108  CALL teb_profile_buffer(xgrid_road)
109 !
110 !* 3.bis Profile of temperatures in floors
111 ! --------------------------------
112 
113  CASE('T_FLOOR')
114  !* reading of the profile and its depth definition
115  SELECT CASE(yinmodel)
116  CASE('ALADIN')
117  CALL read_buffer_tf_teb(kluout,yinmodel,zti_bld,zfield,zd)
118  END SELECT
119  !* if deep road temperature is prescribed
120  IF (xti_road/=xundef) THEN
121  zfield(:,2:) = xti_road
122  END IF
123  CALL teb_profile_buffer(xgrid_floor)
124 
125 !* 4. Profile of temperatures in walls
126 ! --------------------------------
127 
128  CASE('T_WALLA','T_WALLB')
129  CALL read_buffer_t_teb(kluout,yinmodel,zti_bld,zfield,zd)
130  CALL teb_profile_buffer(xgrid_wall)
131 
132  CASE('T_WIN1')
133  SELECT CASE (yinmodel)
134  CASE ('ALADIN')
135  CALL read_buffer_ts(kluout,yinmodel,zfield1d)
136  ALLOCATE(pfield(nni,1))
137  pfield(:,1) = zfield1d(:)
138  DEALLOCATE(zfield1d)
139  END SELECT
140 
141 !* 5. Profile of temperatures in roofs
142 ! --------------------------------
143 
144  CASE('T_ROOF')
145  CALL read_buffer_t_teb(kluout,yinmodel,zti_bld,zfield,zd)
146  CALL teb_profile_buffer(xgrid_roof)
147 
148 !* 5.bis Profile of temperatures in thermal mass
149 ! -----------------------------------------
150 !
151  CASE('T_MASS')
152  ALLOCATE(pfield(nni,3))
153  pfield(:,:) = zti_bld
154  CALL teb_profile_buffer(xgrid_floor)
155 !
156 !* 6. Canyon air temperature
157 ! ----------------------
158 !
159  CASE('T_CAN ')
160  SELECT CASE (yinmodel)
161  CASE ('ALADIN')
162  CALL read_buffer_t2(kluout,yinmodel,zfield1d)
163  ALLOCATE(pfield(nni,1))
164  pfield(:,1) = zfield1d(:)
165  DEALLOCATE(zfield1d)
166  END SELECT
167 !
168 !* 7. Canyon air humidity
169 ! -------------------
170 !
171  CASE('Q_CAN ')
172  SELECT CASE (yinmodel)
173  CASE ('ALADIN')
174  ALLOCATE(pfield(nni,1))
175  pfield(:,1) = 0.01
176  END SELECT
177 
178 !
179 !* 9. Deep road temperature
180 ! ---------------------
181 
182  CASE('TI_ROAD')
183  IF (xti_road==xundef) THEN
184  CALL read_buffer_t2(kluout,yinmodel,zfield1d)
185  ALLOCATE(pfield(nni,1))
186  pfield(:,1) = zfield1d(:)
187  DEALLOCATE(zfield1d)
188  ELSE
189  ALLOCATE(pfield(nni,1))
190  pfield = xti_road
191  END IF
192 
193 
194 !* 9. Building temperatures/moisture
195 ! --------------------
196 
197  CASE('TI_BLD ')
198  ALLOCATE(pfield(nni,1))
199  pfield(:,:) = zti_bld
200 !
201  CASE('T_WIN2')
202  ALLOCATE(pfield(nni,1))
203  pfield(:,:) = zti_bld
204 
205  CASE('QI_BLD ')
206  ALLOCATE(pfield(nni,1))
207  pfield(:,1) = xundef
208 
209 !* 10. Other quantities (water reservoirs)
210 ! ----------------
211 
212  CASE default
213  ALLOCATE(pfield(nni,1))
214  pfield = 0.
215 
216 END SELECT
217 !
218 !* 4. Interpolation method
219 ! --------------------
220 !
221  cinterp_type='BUFFER'
222 !
223 !-------------------------------------------------------------------------------------
224 !-------------------------------------------------------------------------------------
225 !
226 IF (lhook) CALL dr_hook('PREP_TEB_BUFFER',1,zhook_handle)
227  CONTAINS
228 !
229 !-------------------------------------------------------------------------------------
230 !-------------------------------------------------------------------------------------
231 SUBROUTINE teb_profile_buffer(PGRID)
232 !-------------------------------------------------------------------------------------
233 !
234 REAL, DIMENSION(:), INTENT(IN) :: pgrid ! destination grid
235 REAL(KIND=JPRB) :: zhook_handle
236 !
237 !-------------------------------------------------------------------------------------
238 !
239 !* interpolation on fine vertical grid
240 IF (lhook) CALL dr_hook('TEB_PROFILE_BUFFER',0,zhook_handle)
241 ALLOCATE(pfield(SIZE(zfield,1),SIZE(pgrid)))
242  CALL interp_grid(zd,zfield,pgrid,pfield)
243 !
244 !* end
245 DEALLOCATE(zfield)
246 DEALLOCATE(zd)
247 IF (lhook) CALL dr_hook('TEB_PROFILE_BUFFER',1,zhook_handle)
248 
249 END SUBROUTINE teb_profile_buffer
250 !
251 !-------------------------------------------------------------------------------------
252 END SUBROUTINE prep_teb_buffer
subroutine read_buffer_tg(KLUOUT, HINMODEL, PFIELD, PD)
subroutine read_buffer_ts(KLUOUT, HINMODEL, PFIELD)
subroutine read_buffer_t_teb(KLUOUT, HINMODEL, PTI, PFIELD, PD)
subroutine prep_buffer_grid(KLUOUT, HINMODEL, TPTIME_BUF)
subroutine read_buffer_tf_teb(KLUOUT, HINMODEL, PTI, PFIELD, PD)
subroutine teb_profile_buffer(PGRID)
subroutine read_buffer_t2(KLUOUT, HINMODEL, PFIELD)
subroutine prep_teb_buffer(HPROGRAM, HSURF, KLUOUT, PFIELD)
subroutine read_buffer_zs(KLUOUT, HINMODEL, PFIELD)