SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
prep_teb_grib.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_grib(HPROGRAM,HSURF,HFILE,KLUOUT,PFIELD)
7 ! #################################################################################
8 !
9 !!**** *PREP_TEB_GRIB* - prepares TEB field from operational GRIB
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 !
33 !
34 USE modi_prep_grib_grid
37 !
38 USE modd_prep, ONLY : cingrid_type, cinterp_type
39 USE modd_grid_grib, ONLY : cgrib_file, 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  xhui_bld_def
43 USE modd_surf_par, ONLY : xundef
44 !
45 !
46 !USE YOMHOOK ,ONLY : LHOOK, DR_HOOK
47 !USE PARKIND1 ,ONLY : JPRB
48 !
49 IMPLICIT NONE
50 !
51 !* 0.1 declarations of arguments
52 !
53  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling surf. schemes
54  CHARACTER(LEN=7), INTENT(IN) :: hsurf ! type of field
55  CHARACTER(LEN=28), INTENT(IN) :: hfile ! name of file
56 INTEGER, INTENT(IN) :: kluout ! logical unit of output listing
57 REAL,DIMENSION(:,:), POINTER :: pfield ! field to interpolate horizontally
58 !
59 !* 0.2 declarations of local variables
60 !
61 TYPE (date_time) :: tztime_grib ! current date and time
62  CHARACTER(LEN=6) :: yinmodel ! model from which GRIB file originates
63 REAL, DIMENSION(:) , POINTER :: zmask => null() ! Land mask
64 REAL, DIMENSION(:), POINTER :: zfield1d => null() ! 1D field read
65 REAL, DIMENSION(:,:), POINTER :: zfield => null() ! field read
66 REAL, DIMENSION(:,:), POINTER :: zd => null() ! depth of field in the soil
67 REAL :: zti_bld !indoor air temperature
68 !REAL(KIND=JPRB) :: ZHOOK_HANDLE
69 !
70 !-------------------------------------------------------------------------------------
71 !
72 !* 1. Reading of grid
73 ! ---------------
74 !
75 !IF (LHOOK) CALL DR_HOOK('PREP_TEB_GRIB',0,ZHOOK_HANDLE)
76 !
77 IF (trim(hfile).NE.cgrib_file) cgrib_file=""
78 !
79  CALL prep_grib_grid(hfile,kluout,yinmodel,cingrid_type,tztime_grib)
80 !
81  CALL read_grib_land_mask(hfile,kluout,yinmodel,zmask)
82 !
83 IF (hsurf=='T_FLOOR' .OR. hsurf(1:6)=='T_WALL' .OR. hsurf=='T_ROOF' .OR. &
84  hsurf=='T_WIN2' .OR. hsurf=='TI_BLD' .OR. hsurf=='T_MASS') THEN
85  zti_bld = xti_bld_def
86  IF (xti_bld/=xundef) zti_bld=xti_bld
87 ENDIF
88 !
89 !---------------------------------------------------------------------------------------
90 SELECT CASE(hsurf)
91 !---------------------------------------------------------------------------------------
92 !
93 !* 2. Orography
94 ! ---------
95 !
96  CASE('ZS ')
97  SELECT CASE (yinmodel)
98  CASE ('ECMWF ','ARPEGE','ALADIN','MOCAGE')
99  CALL read_grib_zs_land(hfile,kluout,yinmodel,zmask,zfield1d)
100  ALLOCATE(pfield(SIZE(zfield1d),1))
101  pfield(:,1) = zfield1d(:)
102  DEALLOCATE(zfield1d)
103  END SELECT
104 !
105 !* 3. Profile of temperatures in roads
106 ! --------------------------------
107 !
108  CASE('T_ROAD')
109  !* reading of the profile and its depth definition
110  SELECT CASE(yinmodel)
111  CASE('ECMWF ')
112  CALL read_grib_tg_ecmwf(hfile,kluout,yinmodel,zmask,zfield,zd)
113  CASE('ARPEGE','ALADIN','MOCAGE')
114  CALL read_grib_tg_meteo_france(hfile,kluout,yinmodel,zmask,zfield,zd)
115  END SELECT
116  !* if deep road temperature is prescribed
117  IF (xti_road/=xundef) THEN
118  zfield(:,2:) = xti_road
119  END IF
120  CALL teb_profile_grib(xgrid_road)
121 !
122 !* 3.bis Profile of temperatures in floors
123 ! --------------------------------
124 
125  CASE('T_FLOOR')
126  !* reading of the profile and its depth definition
127  SELECT CASE(yinmodel)
128  CASE('ECMWF ','ARPEGE','ALADIN','MOCAGE')
129  CALL read_grib_tf_teb(hfile,kluout,yinmodel,zti_bld,zmask,zfield,zd)
130  END SELECT
131  !* if deep road temperature is prescribed
132  IF (xti_road/=xundef) THEN
133  zfield(:,2:) = xti_road
134  END IF
135  CALL teb_profile_grib(xgrid_floor)
136 !
137 !* 4. Profile of temperatures in walls
138 ! --------------------------------
139 
140  CASE('T_WALLA','T_WALLB')
141  CALL read_grib_t_teb(hfile,kluout,yinmodel,zti_bld,zmask,zfield,zd)
142  CALL teb_profile_grib(xgrid_wall)
143 
144  CASE('T_WIN1')
145  SELECT CASE (yinmodel)
146  CASE ('ECMWF ','ARPEGE','ALADIN','MOCAGE')
147  CALL read_grib_ts(hfile,kluout,yinmodel,zmask,zfield1d)
148  ALLOCATE(pfield(nni,1))
149  pfield(:,1) = zfield1d(:)
150  DEALLOCATE(zfield1d)
151  END SELECT
152 !
153 !* 5. Profile of temperatures in roofs
154 ! --------------------------------
155 !
156  CASE('T_ROOF')
157  CALL read_grib_t_teb(hfile,kluout,yinmodel,zti_bld,zmask,zfield,zd)
158  CALL teb_profile_grib(xgrid_roof)
159 !
160 !* 5.bis Profile of temperatures in thermal mass
161 ! -----------------------------------------
162 !
163  CASE('T_MASS')
164  ALLOCATE(pfield(nni,3))
165  pfield(:,:) = zti_bld
166 !
167 !* 6. Canyon air temperature
168 ! ----------------------
169 !
170  CASE('T_CAN ')
171  SELECT CASE (yinmodel)
172  CASE ('ECMWF ','ARPEGE','ALADIN','MOCAGE')
173  CALL read_grib_t2(hfile,kluout,yinmodel,zmask,zfield1d)
174  ALLOCATE(pfield(SIZE(zfield1d),1))
175  pfield(:,1) = zfield1d(:)
176  DEALLOCATE(zfield1d)
177  END SELECT
178 !
179 !* 7. Canyon air humidity
180 ! -------------------
181 !
182  CASE('Q_CAN ')
183  SELECT CASE (yinmodel)
184  CASE ('ECMWF ','ARPEGE','ALADIN','MOCAGE')
185  ALLOCATE(pfield(nni,1))
186  pfield(:,1) = 0.01
187  END SELECT
188 
189 !
190 !* 9. Deep road temperature
191 ! ---------------------
192 
193  CASE('TI_ROAD')
194  IF (xti_road==xundef) THEN
195  CALL read_grib_t2(hfile,kluout,yinmodel,zmask,zfield1d)
196  ALLOCATE(pfield(SIZE(zfield1d),1))
197  pfield(:,1) = zfield1d(:)
198  DEALLOCATE(zfield1d)
199  ELSE
200  ALLOCATE(pfield(nni,1))
201  pfield = xti_road
202  END IF
203 
204 
205 !* 9. Building temperatures/moisture
206 ! --------------------
207 
208  CASE('TI_BLD ')
209  ALLOCATE(pfield(nni,1))
210  pfield = zti_bld
211 
212  CASE('T_WIN2')
213  ALLOCATE(pfield(nni,1))
214  pfield = zti_bld
215 
216  CASE('QI_BLD ')
217  ALLOCATE(pfield(nni,1))
218  pfield(:,1) = xundef
219 
220 !* 10. Other quantities (water reservoirs)
221 ! ----------------
222 
223  CASE default
224  ALLOCATE(pfield(nni,1))
225  pfield = 0.
226 
227 END SELECT
228 !
229 DEALLOCATE(zmask)
230 !
231 !* 4. Interpolation method
232 ! --------------------
233 !
234  cinterp_type='HORIBL'
235 !
236 !-------------------------------------------------------------------------------------
237 !-------------------------------------------------------------------------------------
238 !
239 !IF (LHOOK) CALL DR_HOOK('PREP_TEB_GRIB',1,ZHOOK_HANDLE)
240  CONTAINS
241 !
242 !-------------------------------------------------------------------------------------
243 !-------------------------------------------------------------------------------------
244 SUBROUTINE teb_profile_grib(PGRID)
245 !-------------------------------------------------------------------------------------
246 !
247 REAL, DIMENSION(:), INTENT(IN) :: pgrid ! destination grid
248 !REAL(KIND=JPRB) :: ZHOOK_HANDLE
249 !
250 !
251 !-------------------------------------------------------------------------------------
252 !
253 !* interpolation on fine vertical grid
254 !IF (LHOOK) CALL DR_HOOK('TEB_PROFILE_GRIB',0,ZHOOK_HANDLE)
255 ALLOCATE(pfield(SIZE(zfield,1),SIZE(pgrid)))
256  CALL interp_grid(zd,zfield,pgrid,pfield)
257 !
258 !* end
259 DEALLOCATE(zfield)
260 DEALLOCATE(zd)
261 !IF (LHOOK) CALL DR_HOOK('TEB_PROFILE_GRIB',1,ZHOOK_HANDLE)
262 
263 END SUBROUTINE teb_profile_grib
264 !
265 !-------------------------------------------------------------------------------------
266 END SUBROUTINE prep_teb_grib
subroutine read_grib_tf_teb(HGRIB, KLUOUT, HINMODEL, PTI, PMASK, PTF, PD)
subroutine read_grib_zs_land(HGRIB, KLUOUT, HINMODEL, PMASK, PZSL)
subroutine read_grib_tg_meteo_france(HGRIB, KLUOUT, HINMODEL, PMASK, PTG, PDT)
subroutine read_grib_land_mask(HGRIB, KLUOUT, HINMODEL, PMASK)
subroutine teb_profile_grib(PGRID)
subroutine prep_teb_grib(HPROGRAM, HSURF, HFILE, KLUOUT, PFIELD)
subroutine read_grib_tg_ecmwf(HGRIB, KLUOUT, HINMODEL, PMASK, PTG, PD)
subroutine read_grib_t2(HGRIB, KLUOUT, HINMODEL, PMASK, PT2)
subroutine read_grib_t_teb(HGRIB, KLUOUT, HINMODEL, PTI, PMASK, PT, PD)
subroutine prep_grib_grid(HGRIB, KLUOUT, HINMODEL, HGRIDTYPE, TPTIME_GRIB)
subroutine read_grib_ts(HGRIB, KLUOUT, HINMODEL, PMASK, PTS)