SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
prep_teb_unif.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_unif(KLUOUT,HSURF,PFIELD)
7 ! #################################################################################
8 !
9 !!**** *PREP_TEB_UNIF* - prepares TEB field from prescribed values
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 USE modd_surf_par, ONLY : xundef
32 USE modd_prep, ONLY : cinterp_type, xzs_ls
33 USE modd_prep_teb, ONLY : xgrid_road, xgrid_wall, xgrid_roof, xgrid_floor, &
34  xws_roof, xws_road, xts_road, xts_roof, xts_wall, &
35  xti_bld, xti_road, xt_can, xq_can, xhui_bld
36 USE modd_csts, ONLY : xg, xp00
37 !
38 !
39 USE yomhook ,ONLY : lhook, dr_hook
40 USE parkind1 ,ONLY : jprb
41 !
42 USE modi_abor1_sfx
43 USE mode_thermos
44 !
45 IMPLICIT NONE
46 !
47 !* 0.1 declarations of arguments
48 !
49 INTEGER, INTENT(IN) :: kluout ! output listing logical unit
50  CHARACTER(LEN=7), INTENT(IN) :: hsurf ! type of field
51 REAL, POINTER, DIMENSION(:,:) :: pfield ! field to interpolate horizontally
52 !
53 !* 0.2 declarations of local variables
54 REAL, DIMENSION(:), ALLOCATABLE :: zps ! surface pressure
55 REAL, DIMENSION(:), ALLOCATABLE :: zti_bld ! indoor building temperature
56 REAL, PARAMETER :: zrhoa=1.19! air volumic mass at 20C and 1015hPa
57 !
58 REAL(KIND=JPRB) :: zhook_handle
59 !
60 !-------------------------------------------------------------------------------------
61 !
62 IF (lhook) CALL dr_hook('PREP_TEB_UNIF',0,zhook_handle)
63 SELECT CASE(hsurf)
64 !
65 !* 3.0 Orography
66 !
67  CASE('ZS ')
68  ALLOCATE(pfield(1,1))
69  pfield = 0.
70 !
71 !* 3.1 Profile of temperatures in roads
72 !
73  CASE('T_ROAD ')
74  ALLOCATE(pfield(1,SIZE(xgrid_road)))
75  CALL put_unif_on_ref_grid('ROAD',xgrid_road)
76 
77 !* 3.2 Profile of temperatures in walls
78 
79  CASE('T_WALLA','T_WALLB')
80  ALLOCATE(pfield(1,SIZE(xgrid_wall)))
81  CALL put_unif_on_ref_grid('WALL',xgrid_wall)
82 
83 !* 3.3 Profile of temperatures in roofs
84 
85  CASE('T_ROOF ')
86  ALLOCATE(pfield(1,SIZE(xgrid_roof)))
87  CALL put_unif_on_ref_grid('ROOF',xgrid_roof)
88 
89 !* 3.4bis Profile of temperatures in floors
90 
91  CASE('T_FLOOR')
92  ALLOCATE(pfield(1,SIZE(xgrid_floor)))
93  CALL put_unif_on_ref_grid('FLOO',xgrid_floor)
94 
95  CASE('T_MASS')
96  ALLOCATE(pfield(1,SIZE(xgrid_floor)))
97  CALL put_unif_on_ref_grid('MASS',xgrid_floor)
98 
99 !* 3.4 Other quantities
100 
101  CASE('WS_ROOF')
102  ALLOCATE(pfield(1,1))
103  pfield = xws_roof
104 
105  CASE('WS_ROAD')
106  ALLOCATE(pfield(1,1))
107  pfield = xws_road
108 
109  CASE('TI_BLD ')
110  ALLOCATE(pfield(1,1))
111  pfield = xti_bld
112 
113  CASE('QI_BLD ')
114  ALLOCATE(pfield(SIZE(xzs_ls),1))
115  ALLOCATE(zps(SIZE(xzs_ls)))
116  ALLOCATE(zti_bld(SIZE(xzs_ls)))
117  zps = xp00 - zrhoa*xg*xzs_ls
118  zti_bld = xti_bld
119  pfield(:,1) = xhui_bld * qsat(zti_bld, zps)
120  DEALLOCATE(zps)
121  DEALLOCATE(zti_bld)
122 
123  CASE('T_WIN1 ')
124  ALLOCATE(pfield(1,1))
125  pfield = xts_wall
126 
127  CASE('T_WIN2 ')
128  ALLOCATE(pfield(1,1))
129  pfield = xti_bld
130 
131  CASE('TI_ROAD')
132  ALLOCATE(pfield(1,1))
133  pfield = xti_road
134 
135  CASE('T_CAN ')
136  ALLOCATE(pfield(1,1))
137  pfield = xt_can
138 
139  CASE('Q_CAN ')
140  ALLOCATE(pfield(1,1))
141  pfield = xq_can
142 
143 END SELECT
144 !
145 !* 4. Interpolation method
146 ! --------------------
147 !
148  cinterp_type='UNIF '
149 !
150 !-------------------------------------------------------------------------------------
151 !-------------------------------------------------------------------------------------
152 !
153 IF (lhook) CALL dr_hook('PREP_TEB_UNIF',1,zhook_handle)
154  CONTAINS
155 !
156 !-------------------------------------------------------------------------------------
157 !-------------------------------------------------------------------------------------
158 SUBROUTINE put_unif_on_ref_grid(HSURFTYPE,PGRID)
159 !-------------------------------------------------------------------------------------
160 !
161 USE modd_surf_par, ONLY : xundef
163 !
164  CHARACTER(LEN=4), INTENT(IN) :: hsurftype ! surface type
165 REAL, DIMENSION(:), INTENT(IN) :: pgrid ! reference grid
166 !
167 REAL :: zts! surface temperature
168 REAL :: zti! internal temperature
169 REAL, DIMENSION(1,2) :: zt ! temperature profile
170 REAL, DIMENSION(1,2) :: zd ! normalized depth profile
171 REAL(KIND=JPRB) :: zhook_handle
172 !
173 !-------------------------------------------------------------------------------------
174 
175 !* get surface temperature
176 
177 IF (lhook) CALL dr_hook('PUT_UNIF_ON_REF_GRID',0,zhook_handle)
178 SELECT CASE(hsurftype)
179  CASE('ROOF')
180  zts = xts_roof
181  CASE('ROAD')
182  zts = xts_road
183  CASE('WALL')
184  zts = xts_wall
185  CASE('FLOO')
186  zts = xti_bld
187  CASE('MASS')
188  zts = xti_bld
189 END SELECT
190 
191 !* get deep road or building interior temperature
192 
193 SELECT CASE(hsurftype)
194  CASE('ROOF', 'WALL', 'MASS')
195  zti = xti_bld
196  CASE('ROAD', 'FLOO')
197  IF (xti_road/= xundef) THEN
198  zti = xti_road
199  ELSE
200  WRITE(kluout,*) 'Error in PREParation of TEB fields'
201  WRITE(kluout,*) 'When Road Surface Temperature is prescribed,'
202  WRITE(kluout,*) 'Deep Road Temperature XTI_ROAD must also be prescribed'
203  CALL abor1_sfx('PREP_TEB_UNIF: XTI_ROAD MUST BE PRESCRIBED')
204  END IF
205 END SELECT
206 
207 !* group all this information in one profile
208 
209 zt(1,1) = zts
210 zt(1,2) = zti
211 
212 zd(1,1) = 0.
213 zd(1,2) = 1.
214 
215 !* interpolate this field on the required grid
216 !
217  CALL interp_grid(zd,zt,pgrid,pfield)
218 IF (lhook) CALL dr_hook('PUT_UNIF_ON_REF_GRID',1,zhook_handle)
219 !
220 !-------------------------------------------------------------------------------------
221 !
222 END SUBROUTINE put_unif_on_ref_grid
223 !
224 !-------------------------------------------------------------------------------------
225 END SUBROUTINE prep_teb_unif
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:6
subroutine put_unif_on_ref_grid(HSURFTYPE, PGRID)
subroutine prep_teb_unif(KLUOUT, HSURF, PFIELD)