SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
param_cls.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 param_cls(PTA, PTS, PQA, PPA, PRHOA, PZONA, PMERA, PH, PHW, &
7  psfth, psftq, psfzon, psfmer, &
8  pt2m, pq2m, phu2m, pzon10m, pmer10m )
9 ! #####################################################################
10 !
11 !!**** *PARAMCLS* interpolates wind at 10m and temperature/humidity at 2m
12 !!
13 !! PURPOSE
14 !! -------
15 !
16 !
17 !
18 !!** METHOD
19 !! ------
20 !
21 !! EXTERNAL
22 !! --------
23 !!
24 !! none
25 !!
26 !! IMPLICIT ARGUMENTS
27 !! ------------------
28 !!
29 !!
30 !!
31 !! REFERENCE
32 !! ---------
33 !!
34 !!
35 !! AUTHOR
36 !! ------
37 !!
38 !! Rui Salgado
39 !!
40 !! MODIFICATIONS
41 !! -------------
42 !!
43 !! Original 26/10/98
44 !! 06/2003 (V. Masson) use of Paulson functions and
45 !! atmospheric level only
46 !! 11/2006 (P. LeMoigne) min value for LMO for unstable case
47 !! 01/2010 (S. Riette) XUNDEF is sent for wind where forcing
48 !! level is below heigt of diagnostic
49 !! (no extrapolation, only interpolation)
50 !-------------------------------------------------------------------------------
51 !
52 !* 0. DECLARATIONS
53 ! ------------
54 !
55 USE modd_surf_par, ONLY : xundef
56 USE modd_csts, ONLY : xkarman, xrd, xcpd, xp00, xrv, xg
57 !
58 USE mode_sbls
59 USE mode_thermos
60 !
61 !
62 USE yomhook ,ONLY : lhook, dr_hook
63 USE parkind1 ,ONLY : jprb
64 !
65 IMPLICIT NONE
66 !
67 !* 0.1 declarations of arguments
68 !
69 !
70 !
71 REAL, DIMENSION(:), INTENT(IN) :: pta ! atmospheric temperature
72 REAL, DIMENSION(:), INTENT(IN) :: pts ! surface temperature
73 REAL, DIMENSION(:), INTENT(IN) :: pqa ! atmospheric specific humidity
74 REAL, DIMENSION(:), INTENT(IN) :: ppa ! atmospheric level pressure
75 REAL, DIMENSION(:), INTENT(IN) :: prhoa ! air density
76 REAL, DIMENSION(:), INTENT(IN) :: pzona ! zonal wind
77 REAL, DIMENSION(:), INTENT(IN) :: pmera ! meridian wind
78 REAL, DIMENSION(:), INTENT(IN) :: ph ! atmospheric level height
79 REAL, DIMENSION(:), INTENT(IN) :: phw ! atmospheric level height for wind
80 REAL, DIMENSION(:), INTENT(IN) :: psfzon ! zonal friction
81 REAL, DIMENSION(:), INTENT(IN) :: psfmer ! meridian friction
82 REAL, DIMENSION(:), INTENT(IN) :: psfth ! heat flux (W/m2)
83 REAL, DIMENSION(:), INTENT(IN) :: psftq ! vapor flux (kg/m2/s)
84 !
85 REAL, DIMENSION(:), INTENT(OUT) :: pt2m ! temperature at 2 meters
86 REAL, DIMENSION(:), INTENT(OUT) :: pq2m ! specific humidity at 2 meters
87 REAL, DIMENSION(:), INTENT(OUT) :: phu2m ! relative humidity at 2 meters
88 REAL, DIMENSION(:), INTENT(OUT) :: pzon10m! zonal wind component at 10 meters
89 REAL, DIMENSION(:), INTENT(OUT) :: pmer10m! meridian wind component at 10 meters
90 !
91 !* 0.2 declarations of local variables
92 !
93 REAL, DIMENSION(SIZE(PTA)) :: zustar ! friction
94 REAL, DIMENSION(SIZE(PTA)) :: zth ! potential temperature
95 REAL, DIMENSION(SIZE(PTA)) :: zrv ! H2O mixing ratio
96 REAL, DIMENSION(SIZE(PTA)) :: zlmo ! Monin Obhukov length
97 REAL, DIMENSION(SIZE(PTA)) :: zh_o_lmo ! h/LMO
98 REAL, DIMENSION(SIZE(PTA)) :: z10m_o_lmo ! 10m/LMO
99 REAL, DIMENSION(SIZE(PTA)) :: z2m_o_lmo ! 2m/LMO
100 REAL, DIMENSION(SIZE(PTA)) :: ztstar ! Scale of Temperature
101 REAL, DIMENSION(SIZE(PTA)) :: zqstar ! Scale of humidity
102 REAL, DIMENSION(SIZE(PTA)) :: zth2m ! Potential temperature at 2m
103 REAL, DIMENSION(SIZE(PTA)) :: zp2m ! Pressure at 2m
104 REAL, DIMENSION(SIZE(PTA)) :: zqsat2m ! saturation specific humidity at 2m
105 REAL :: z10m ! 10m
106 REAL :: z2m ! 2m
107 REAL, DIMENSION(SIZE(PTA)) :: zwt ! potential temperature flux (Km/s)
108 REAL, DIMENSION(SIZE(PTA)) :: zwq ! water vapor flux (kg/kg*m/s)
109 REAL, DIMENSION(SIZE(PTA)) :: zexn ! Exner function
110 REAL :: zlmomin ! Minimum value of ZLMO for unstable cases
111 REAL(KIND=JPRB) :: zhook_handle
112 !-------------------------------------------------------------------------------
113 !
114 IF (lhook) CALL dr_hook('PARAM_CLS',0,zhook_handle)
115 z10m = 10.
116 z2m = 2.
117 !
118 !* friction
119 !
120 zustar(:) = sqrt(sqrt(psfzon(:)**2+psfmer(:)**2))
121 !
122 !* Exner function
123 !
124 zexn(:) = (ppa(:)/xp00)**(xrd/xcpd)
125 !
126 !* Potential temperature
127 !
128 zth(:) = pta(:) / zexn(:)
129 !
130 !* Vapor mixing ratio
131 !
132 WHERE (pqa(:)/=0.)
133  zrv = 1./(1./pqa(:) - 1.)
134 ELSEWHERE
135  zrv = 0.
136 END WHERE
137 !
138 !* Kinematic fluxes
139 !
140 zwt(:) = psfth(:) / (prhoa(:) * xcpd / zexn(:))
141 zwq(:) = psftq(:) / prhoa(:)
142 !
143 !
144 !* Monin Obhukov length
145 !
146 zlmo = lmo(zustar,zth,zrv,zwt,zwq)
147 !
148 ! min value of 1 meter for ZLMO for unstable case
149 !
150 zlmomin = 1.
151 zlmo = zlmo * (1.-sign(1.,zlmo))/2. + max(zlmomin,zlmo) * (1.+sign(1.,zlmo))/2.
152 !
153 !* h/LMO; 10m/LMO; 2m/LMO
154 !
155 zh_o_lmo = 0.
156 z10m_o_lmo = 0.
157 z2m_o_lmo = 0.
158 !
159 WHERE (zlmo/=xundef)
160  z10m_o_lmo = z10m/zlmo
161  z2m_o_lmo = z2m/zlmo
162 END WHERE
163 !
164 !-------------------------------------------------------------------------------
165 !
166 !* use of wind forcing height
167 !
168 WHERE (zlmo/=xundef)
169  zh_o_lmo = phw/zlmo
170 END WHERE
171 !
172 !* Wind at 10m
173 !
174 !* note : is set to zero value where the law does not apply correctly
175 ! (e.g. over high mountains)
176 ! and is set to XUNDEF when forcing level is below 10m diagnostic level
177 pzon10m(:) = xundef
178 pmer10m(:) = xundef
179 WHERE(phw(:)>=z10m)
180 WHERE (psfzon(:)>=0.)
181  pzon10m(:) = pzona(:) - sqrt( psfzon(:))/xkarman *( log( z10m/phw) &
182  - paulson_psim(z10m_o_lmo) &
183  + paulson_psim(zh_o_lmo) )
184  pzon10m(:) = min( 0., pzon10m(:) )
185 END WHERE
186 !
187 WHERE (psfzon(:)< 0.)
188  pzon10m(:) = pzona(:) + sqrt(-psfzon(:))/xkarman *( log( z10m/phw) &
189  - paulson_psim(z10m_o_lmo) &
190  + paulson_psim(zh_o_lmo) )
191  pzon10m(:) = max( 0., pzon10m(:) )
192 END WHERE
193 !
194 WHERE (psfmer(:)>=0.)
195  pmer10m(:) = pmera(:) - sqrt( psfmer(:))/xkarman *( log( z10m/phw) &
196  - paulson_psim(z10m_o_lmo) &
197  + paulson_psim(zh_o_lmo) )
198  pmer10m(:) = min( 0., pmer10m(:) )
199 END WHERE
200 !
201 WHERE (psfmer(:)< 0.)
202  pmer10m(:) = pmera(:) + sqrt(-psfmer(:))/xkarman *( log( z10m/phw) &
203  - paulson_psim(z10m_o_lmo) &
204  + paulson_psim(zh_o_lmo) )
205  pmer10m(:) = max( 0., pmer10m(:) )
206 END WHERE
207 END WHERE
208 !
209 !-------------------------------------------------------------------------------
210 !
211 !* use of temperature forcing height
212 !
213 WHERE (zlmo/=xundef)
214  zh_o_lmo = ph/zlmo
215 END WHERE
216 !
217 !* Temperature scale
218 !
219 ztstar(:) = - zwt(:) / max(zustar,0.01)
220 !
221 !* Potential Temperature at 2m
222 !
223 zth2m(:) = zth(:) + 0.74 * ztstar(:)/xkarman *( log( z2m/ph) &
224  - paulson_psih(z2m_o_lmo) &
225  + paulson_psih(zh_o_lmo) )
226 !
227 !* Pressure at 2m
228 !
229 zp2m(:) = ppa(:) - xg * prhoa(:) * (z2m-ph(:))
230 !
231 !* Temperature at 2m
232 !
233 WHERE (zwt(:) > 0. .OR. pts(:) == xundef)
234  ! Businger formulation in unstable case
235  pt2m(:) = zth2m(:) * (zp2m(:)/xp00)**(xrd/xcpd)
236 ELSEWHERE
237  ! Linear interpolation between Ts and Ta in stable case
238  pt2m(:) = pts(:) + (pta(:)-pts(:))*z2m/ph(:)
239 END WHERE
240 !
241 !-------------------------------------------------------------------------------
242 !
243 !* Humidity scale
244 !
245 zqstar(:) = - zwq(:) / max(zustar,0.01)
246 !
247 !* Specific humidity at 2m
248 !
249 pq2m(:) = pqa(:) + 0.74 * zqstar(:)/xkarman *( log( z2m/ph) &
250  - paulson_psih(z2m_o_lmo) &
251  + paulson_psih(zh_o_lmo) )
252 !
253 !* must be below saturation
254 !
255 zqsat2m(:) = qsat(pt2m(:),zp2m(:))
256 pq2m(:) = min(zqsat2m(:),pq2m(:))
257 !
258 phu2m(:) = pq2m(:) / zqsat2m(:)
259 IF (lhook) CALL dr_hook('PARAM_CLS',1,zhook_handle)
260 !
261 !-------------------------------------------------------------------------------
262 !
263 END SUBROUTINE param_cls
subroutine param_cls(PTA, PTS, PQA, PPA, PRHOA, PZONA, PMERA, PH, PHW, PSFTH, PSFTQ, PSFZON, PSFMER, PT2M, PQ2M, PHU2M, PZON10M, PMER10M)
Definition: param_cls.F90:6