SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
mode_sfcflx.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 ! File %M% from Library %Q%
6 ! Version %I% from %G% extracted: %H%
7 !------------------------------------------------------------------------------
8 
9 MODULE mode_sfcflx
10 
11 !------------------------------------------------------------------------------
12 !
13 ! Description:
14 !
15 ! The main program unit of
16 ! the atmospheric surface-layer parameterization scheme "sfcflx".
17 ! "sfcflx" is used to compute fluxes
18 ! of momentum and of sensible and latent heat over lakes.
19 ! The surface-layer scheme developed by Mironov (1991) was used as the starting point.
20 ! It was modified and further developed to incorporate new results as to
21 ! the roughness lenghts for scalar quantities,
22 ! heat and mass transfer in free convection,
23 ! and the effect of limited fetch on the momentum transfer.
24 ! Apart from the momentum flux and sensible and latent heat fluxes,
25 ! the long-wave radiation flux from the water surface and
26 ! the long-wave radiation flux from the atmosphere can also be computed.
27 ! The atmospheric long-wave radiation flux is computed with simple empirical formulae,
28 ! where the atmospheric emissivity is taken to be dependent on
29 ! the water vapour pressure and cloud fraction.
30 !
31 ! A description of sfcflx is available from the author.
32 ! Dmitrii Mironov
33 ! German Weather Service, Kaiserleistr. 29/35, D-63067 Offenbach am Main, Germany.
34 ! dmitrii.mironov@dwd.de
35 !
36 ! Lines embraced with "!_tmp" contain temporary parts of the code.
37 ! Lines embraced/marked with "!_dev" may be replaced
38 ! as improved parameterizations are developed and tested.
39 ! Lines embraced/marked with "!_dm" are DM's comments
40 ! that may be helpful to a user.
41 ! Lines embraced/marked with "!_dbg" are used
42 ! for debugging purposes only.
43 !
44 !
45 ! Current Code Owner: DWD, Dmitrii Mironov
46 ! Phone: +49-69-8062 2705
47 ! Fax: +49-69-8062 3721
48 ! E-mail: dmitrii.mironov@dwd.de
49 !
50 ! History:
51 ! Version Date Name
52 ! ---------- ---------- ----
53 ! 1.00 2005/11/17 Dmitrii Mironov
54 ! Initial release
55 ! !VERSION! !DATE! <Your name>
56 ! <Modification comments>
57 !
58 ! Code Description:
59 ! Language: Fortran 90.
60 ! Software Standards: "European Standards for Writing and
61 ! Documenting Exchangeable Fortran 90 Code".
62 !==============================================================================
63 !
64 ! Declarations:
65 !
66 ! Modules used:
67 
68 !USE modd_data_parameters , ONLY : &
69 ! ireals , &! KIND-type parameter for real variables
70 ! iintegers ! KIND-type parameter for "normal" integer variables
71 
72 USE modd_flake_parameters , ONLY : &
73  tpl_grav , &! Acceleration due to gravity [m s^{-2}]
74  tpl_t_f , &! Fresh water freezing point [K]
75  tpl_rho_w_r , &! Maximum density of fresh water [kg m^{-3}]
76  tpl_c_w , &! Specific heat of water [J kg^{-1} K^{-1}]
77  tpl_l_f , &! Latent heat of fusion [J kg^{-1}]
78  h_ice_min_flk ! Minimum ice thickness [m]
79 
80 !==============================================================================
81 
82 !
83 USE yomhook ,ONLY : lhook, dr_hook
84 USE parkind1 ,ONLY : jprb
85 !
86 IMPLICIT NONE
87 
88 !==============================================================================
89 !
90 ! Declarations
91 
92 ! Dimensionless constants in the Monin-Obukhov surface-layer
93 ! similarity relations and in the expressions for the roughness lengths.
94 REAL , PARAMETER :: &
95  c_Karman = 0.40 , &! The von Karman constant
96  Pr_neutral = 1.0 , &! Turbulent Prandtl number at neutral static stability
97  Sc_neutral = 1.0 , &! Turbulent Schmidt number at neutral static stability
98  c_MO_u_stab = 5.0 , &! Constant of the MO theory (wind, stable stratification)
99  c_MO_t_stab = 5.0 , &! Constant of the MO theory (temperature, stable stratification)
100  c_MO_q_stab = 5.0 , &! Constant of the MO theory (humidity, stable stratification)
101  c_MO_u_conv = 15.0 , &! Constant of the MO theory (wind, convection)
102  c_MO_t_conv = 15.0 , &! Constant of the MO theory (temperature, convection)
103  c_MO_q_conv = 15.0 , &! Constant of the MO theory (humidity, convection)
104  c_MO_u_exp = 0.25 , &! Constant of the MO theory (wind, exponent)
105  c_MO_t_exp = 0.5 , &! Constant of the MO theory (temperature, exponent)
106  c_MO_q_exp = 0.5 , &! Constant of the MO theory (humidity, exponent)
107  z0u_ice_rough = 1.0E-03 , &! Aerodynamic roughness of the ice surface [m] (rough flow)
108  c_z0u_smooth = 0.1 , &! Constant in the expression for z0u (smooth flow)
109  c_z0u_rough = 1.23E-02 , &! The Charnock constant in the expression for z0u (rough flow)
110  c_z0u_rough_L = 1.00E-01 , &! An increased Charnock constant (used as the upper limit)
111  c_z0u_ftch_f = 0.70 , &! Factor in the expression for fetch-dependent Charnock parameter
112  c_z0u_ftch_ex = 0.3333333 , &! Exponent in the expression for fetch-dependent Charnock parameter
113  c_z0t_rough_1 = 4.0 , &! Constant in the expression for z0t (factor)
114  c_z0t_rough_2 = 3.2 , &! Constant in the expression for z0t (factor)
115  c_z0t_rough_3 = 0.5 , &! Constant in the expression for z0t (exponent)
116  c_z0q_rough_1 = 4.0 , &! Constant in the expression for z0q (factor)
117  c_z0q_rough_2 = 4.2 , &! Constant in the expression for z0q (factor)
118  c_z0q_rough_3 = 0.5 , &! Constant in the expression for z0q (exponent)
119  c_z0t_ice_b0s = 1.250 , &! Constant in the expression for z0t over ice
120  c_z0t_ice_b0t = 0.149 , &! Constant in the expression for z0t over ice
121  c_z0t_ice_b1t = -0.550 , &! Constant in the expression for z0t over ice
122  c_z0t_ice_b0r = 0.317 , &! Constant in the expression for z0t over ice
123  c_z0t_ice_b1r = -0.565 , &! Constant in the expression for z0t over ice
124  c_z0t_ice_b2r = -0.183 , &! Constant in the expression for z0t over ice
125  c_z0q_ice_b0s = 1.610 , &! Constant in the expression for z0q over ice
126  c_z0q_ice_b0t = 0.351 , &! Constant in the expression for z0q over ice
127  c_z0q_ice_b1t = -0.628 , &! Constant in the expression for z0q over ice
128  c_z0q_ice_b0r = 0.396 , &! Constant in the expression for z0q over ice
129  c_z0q_ice_b1r = -0.512 , &! Constant in the expression for z0q over ice
130  c_z0q_ice_b2r = -0.180 , &! Constant in the expression for z0q over ice
131  Re_z0s_ice_t = 2.5 , &! Threshold value of the surface Reynolds number
132  ! used to compute z0t and z0q over ice (Andreas 2002)
133  re_z0u_thresh = 0.1 ! Threshold value of the roughness Reynolds number
134  ! [value from Zilitinkevich, Grachev, and Fairall (200),
135  ! currently not used]
136 
137 ! Dimensionless constants
138 REAL , PARAMETER :: &
139  c_free_conv = 0.14 ! Constant in the expressions for fluxes in free convection
140 
141 ! Dimensionless constants
142 REAL , PARAMETER :: &
143  c_lwrad_emis = 0.99 ! Surface emissivity with respect to the long-wave radiation
144 
145 ! Thermodynamic parameters
146 REAL , PARAMETER :: &
147  tpsf_C_StefBoltz = 5.67E-08 , &! The Stefan-Boltzmann constant [W m^{-2} K^{-4}]
148  tpsf_R_dryair = 2.8705E+02 , &! Gas constant for dry air [J kg^{-1} K^{-1}]
149  tpsf_R_watvap = 4.6151E+02 , &! Gas constant for water vapour [J kg^{-1} K^{-1}]
150  tpsf_c_a_p = 1.005E+03 , &! Specific heat of air at constant pressure [J kg^{-1} K^{-1}]
151  tpsf_L_evap = 2.501E+06 , &! Specific heat of evaporation [J kg^{-1}]
152  tpsf_nu_u_a = 1.50E-05 , &! Kinematic molecular viscosity of air [m^{2} s^{-1}]
153  tpsf_kappa_t_a = 2.20E-05 , &! Molecular temperature conductivity of air [m^{2} s^{-1}]
154  tpsf_kappa_q_a = 2.40E-05 ! Molecular diffusivity of air for water vapour [m^{2} s^{-1}]
155 
156 ! Derived thermodynamic parameters
157 REAL , PARAMETER :: &
158  tpsf_Rd_o_Rv = tpsf_R_dryair/tpsf_R_watvap , &! Ratio of gas constants (Rd/Rv)
159  tpsf_alpha_q = (1.-tpsf_Rd_o_Rv)/tpsf_Rd_o_Rv ! Diemsnionless ratio
160 
161 ! Thermodynamic parameters
162 REAL , PARAMETER :: &
163  P_a_ref = 1.0E+05 ! Reference pressure [N m^{-2} = kg m^{-1} s^{-2}]
164 
165 
166 ! The variables declared below
167 ! are accessible to all program units of the MODULE "sfcflx"
168 ! and to the driving routines that use "sfcflx".
169 ! These are basically the quantities computed by sfcflx.
170 ! Apart from these quantities, there a few local scalars
171 ! used by sfcflx routines mainly for security reasons.
172 ! All variables declared below have a suffix "sf".
173 
174 ! sfcflx variables of type REAL
175 
176 !RJ: provide default unreasonable value to init for 'ifort -fpic -openmp', to avoid ICE
177 REAL,PARAMETER,PRIVATE :: Z_=-HUGE(0.0)
178 
179 ! Roughness lengths
180 REAL :: &
181  z0u_sf=Z_ , &! Roughness length with respect to wind velocity [m]
182  z0t_sf=Z_ , &! Roughness length with respect to potential temperature [m]
183  z0q_sf=Z_ ! Roughness length with respect to specific humidity [m]
184 !$OMP THREADPRIVATE(z0u_sf,z0t_sf,z0q_sf)
185 ! Security constants
186 REAL , PARAMETER :: &
187  u_wind_min_sf = 1.0E-02 , &! Minimum wind speed [m s^{-1}]
188  u_star_min_sf = 1.0E-04 , &! Minimum value of friction velocity [m s^{-1}]
189  z0t_min_sf = 1.0E-11 , &! Minimum value of thermal roughness length [m s^{-1}]
190  c_accur_sf = 1.0E-07 , &! A small number (accuracy)
191  c_small_sf = 1.0E-04 ! A small number (used to compute fluxes)
192 
193 ! Useful constants
194 REAL , PARAMETER :: &
195  num_1o3_sf = 1./3. ! 1/3
196 
197 !==============================================================================
198 ! Procedures
199 !==============================================================================
200 
201  CONTAINS
202 
203 !==============================================================================
204 ! The codes of the sfcflx procedures are stored in separate "*.incf" files
205 ! and are included below.
206 !------------------------------------------------------------------------------
207 
208 !==============================================================================
209 ! For SURFEX needs, separate *.incf files are explicitly expanded
210 !==============================================================================
211 !SURFEX include 'sfcflx_lwradatm.incf'
212 ! File %M% from Library %Q%
213 ! Version %I% from %G% extracted: %H%
214 !------------------------------------------------------------------------------
215 
216 !SURFEX REAL FUNCTION sfcflx_lwradatm (T_a, e_a, cl_tot, cl_low)
217 FUNCTION sfcflx_lwradatm (T_a, e_a, cl_tot, cl_low)
218 
219 !------------------------------------------------------------------------------
220 !
221 ! Description:
222 !
223 ! Computes the long-wave radiation flux from the atmosphere
224 ! as function of air temperature, water vapour pressure and cloud fraction.
225 !
226 !
227 ! Current Code Owner: DWD, Dmitrii Mironov
228 ! Phone: +49-69-8062 2705
229 ! Fax: +49-69-8062 3721
230 ! E-mail: dmitrii.mironov@dwd.de
231 !
232 ! History:
233 ! Version Date Name
234 ! ---------- ---------- ----
235 ! 1.00 2005/11/17 Dmitrii Mironov
236 ! Initial release
237 ! !VERSION! !DATE! <Your name>
238 ! <Modification comments>
239 !
240 ! Code Description:
241 ! Language: Fortran 90.
242 ! Software Standards: "European Standards for Writing and
243 ! Documenting Exchangeable Fortran 90 Code".
244 !==============================================================================
245 !
246 ! Declarations:
247 !
248 ! Modules used:
249 
250 !_dm Parameters are USEd in module "sfcflx".
251 !_nu USE modd_data_parameters , ONLY : &
252 !_nu ireals, & ! KIND-type parameter for real variables
253 !_nu iintegers ! KIND-type parameter for "normal" integer variables
254 
255 !==============================================================================
256 
257 IMPLICIT NONE
258 
259 !==============================================================================
260 !
261 ! Declarations
262 
263 ! Input (function argument)
264 REAL , INTENT(IN) :: &
265  t_a , &! Air temperature [K]
266  e_a , &! Water vapour pressure [N m^{-2} = kg m^{-1} s^{-2}]
267  cl_tot , &! Total cloud cover [0,1]
268  cl_low ! Lowe-level cloud cover [0,1]
269 
270 ! Output (function result)
271 REAL :: &
272  sfcflx_lwradatm ! Long-wave radiation flux [W m^{-2}]
273 
274 
275 ! Local parameters
276 
277 ! Coefficients in the empirical formulation
278 ! developed at the Main Geophysical Observatory (MGO), St. Petersburg, Russia.
279 REAL , PARAMETER :: &
280  c_lmmgo_1 = 43.057924 , &! Empirical coefficient
281  c_lmmgo_2 = 540.795 ! Empirical coefficient
282 ! Temperature-dependent cloud-correction coefficients in the MGO formula
283 INTEGER , PARAMETER :: &
284  nband_coef = 6 ! Number of temperature bands
285 REAL , PARAMETER, DIMENSION (nband_coef) :: &
286  corr_cl_tot = (/0.70, 0.45, 0.32, &
287  0.23, 0.18, 0.13/) , &! Total clouds
288  corr_cl_low = (/0.76, 0.49, 0.35, &
289  0.26, 0.20, 0.15/) , &! Low-level clouds
290  corr_cl_midhigh = (/0.46, 0.30, 0.21, &
291  0.15, 0.12, 0.09/) ! Mid- and high-level clouds
292 REAL , PARAMETER :: &
293  t_low = 253.15 , &! Low-limit temperature in the interpolation formula [K]
294  del_t = 10.0 ! Temperature step in the interpolation formula [K]
295 
296 ! Coefficients in the empirical water-vapour correction function
297 ! (see Fung et al. 1984, Zapadka and Wozniak 2000, Zapadka et al. 2001).
298 REAL , PARAMETER :: &
299  c_watvap_corr_min = 0.6100 , &! Empirical coefficient (minimum value of the correction function)
300  c_watvap_corr_max = 0.7320 , &! Empirical coefficient (maximum value of the correction function)
301  c_watvap_corr_e = 0.0050 ! Empirical coefficient [(N m^{-2})^{-1/2}]
302 
303 ! Local variables of type INTEGER
304 INTEGER :: &
305  i ! Loop index
306 
307 ! Local variables of type REAL
308 REAL :: &
309  c_cl_tot_corr , &! The MGO cloud correction coefficient, total clouds
310  c_cl_low_corr , &! The MGO cloud correction coefficient, low-level clouds
311  c_cl_midhigh_corr , &! The MGO cloud correction coefficient, mid- and high-level clouds
312  t_corr , &! Temperature used to compute the MGO cloud correction [K]
313  f_wvpres_corr , &! Correction function with respect to water vapour
314  f_cloud_corr ! Correction function with respect to cloudiness
315 REAL(KIND=JPRB) :: zhook_handle
316 
317 !==============================================================================
318 ! Start calculations
319 !------------------------------------------------------------------------------
320 
321 ! Water-vapour correction function
322  IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_LWRADATM',0,zhook_handle)
323  f_wvpres_corr = c_watvap_corr_min + c_watvap_corr_e*sqrt(e_a)
324  f_wvpres_corr = min(f_wvpres_corr, c_watvap_corr_max)
325 
326 ! Cloud-correction coefficients using the MGO formulation with linear interpolation
327 IF(t_a.LT.t_low) THEN
328  c_cl_tot_corr = corr_cl_tot(1)
329  c_cl_low_corr = corr_cl_low(1)
330  c_cl_midhigh_corr = corr_cl_midhigh(1)
331 ELSE IF(t_a.GE.t_low+(nband_coef-1)*del_t) THEN
332  c_cl_tot_corr = corr_cl_tot(nband_coef)
333  c_cl_low_corr = corr_cl_low(nband_coef)
334  c_cl_midhigh_corr = corr_cl_midhigh(nband_coef)
335 ELSE
336  t_corr = t_low
337  DO i=1, nband_coef-1
338  IF(t_a.GE.t_corr.AND.t_a.LT.t_corr+del_t) THEN
339  c_cl_tot_corr = (t_a-t_corr)/del_t
340  c_cl_low_corr = corr_cl_low(i) + (corr_cl_low(i+1)-corr_cl_low(i))*c_cl_tot_corr
341  c_cl_midhigh_corr = corr_cl_midhigh(i) + (corr_cl_midhigh(i+1)-corr_cl_midhigh(i))*c_cl_tot_corr
342  c_cl_tot_corr = corr_cl_tot(i) + (corr_cl_tot(i+1)-corr_cl_tot(i))*c_cl_tot_corr
343  END IF
344  t_corr = t_corr + del_t
345  END DO
346 END IF
347 ! Cloud correction function
348 IF(cl_low.LT.0.) THEN ! Total cloud cover only
349  f_cloud_corr = 1. + c_cl_tot_corr*cl_tot*cl_tot
350 ELSE ! Total and low-level cloud cover
351  f_cloud_corr = (1. + c_cl_low_corr*cl_low*cl_low) &
352  * (1. + c_cl_midhigh_corr*(cl_tot*cl_tot-cl_low*cl_low))
353 END IF
354 
355 ! Long-wave radiation flux [W m^{-2}]
356 
357 ! The MGO formulation
358 !_nu The MGO formulation
359 !_nu sfcflx_lwradatm = -sfcflx_lwradatm*c_lwrad_emis &
360 !_nu * (c_lmMGO_1*SQRT(tpsf_C_StefBoltz*T_a**4)-c_lmMGO_2)
361 !_nu
362 
363 ! "Conventional" formulation
364 ! (see Fung et al. 1984, Zapadka and Wozniak 2000, Zapadka et al. 2001)
365 sfcflx_lwradatm = -c_lwrad_emis*tpsf_c_stefboltz*t_a**4 &
366  * f_wvpres_corr*f_cloud_corr
367 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_LWRADATM',1,zhook_handle)
368 
369 !------------------------------------------------------------------------------
370 ! End calculations
371 !==============================================================================
372 
373 END FUNCTION sfcflx_lwradatm
374 
375 
376 !==============================================================================
377 !SURFEX include 'sfcflx_lwradwsfc.incf'
378 ! File %M% from Library %Q%
379 ! Version %I% from %G% extracted: %H%
380 !------------------------------------------------------------------------------
381 
382 !SURFEX REAL FUNCTION sfcflx_lwradwsfc (zts)
383 FUNCTION sfcflx_lwradwsfc (emis,pts)
384 
385 !------------------------------------------------------------------------------
386 !
387 ! Description:
388 !
389 ! Computes the surface long-wave radiation flux
390 ! as function of temperature.
391 !
392 !
393 ! Current Code Owner: DWD, Dmitrii Mironov
394 ! Phone: +49-69-8062 2705
395 ! Fax: +49-69-8062 3721
396 ! E-mail: dmitrii.mironov@dwd.de
397 !
398 ! History:
399 ! Version Date Name
400 ! ---------- ---------- ----
401 ! 1.00 2005/11/17 Dmitrii Mironov
402 ! Initial release
403 ! !VERSION! !DATE! <Your name>
404 ! <Modification comments>
405 !
406 ! Code Description:
407 ! Language: Fortran 90.
408 ! Software Standards: "European Standards for Writing and
409 ! Documenting Exchangeable Fortran 90 Code".
410 !==============================================================================
411 !
412 ! Declarations:
413 !
414 ! Modules used:
415 
416 !_dm Parameters are USEd in module "sfcflx".
417 !_nu USE modd_data_parameters , ONLY : &
418 !_nu ireals, & ! KIND-type parameter for real variables
419 !_nu iintegers ! KIND-type parameter for "normal" integer variables
420 
421 !==============================================================================
422 
423 IMPLICIT NONE
424 
425 !==============================================================================
426 !
427 ! Declarations
428 
429 ! Input (function argument)
430 REAL , INTENT(IN) :: &
431  emis , & ! Emissivity
432  pts ! Temperature [K]
433 
434 ! Output (function result)
435 REAL :: &
436  sfcflx_lwradwsfc ! Long-wave radiation flux [W m^{-2}]
437 REAL(KIND=JPRB) :: zhook_handle
438 
439 !==============================================================================
440 ! Start calculations
441 !------------------------------------------------------------------------------
442 
443 ! Long-wave radiation flux [W m^{-2}]
444 
445 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_LWRADWSFC',0,zhook_handle)
446 sfcflx_lwradwsfc = emis*tpsf_c_stefboltz*pts**4
447 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_LWRADWSFC',1,zhook_handle)
448 
449 !------------------------------------------------------------------------------
450 ! End calculations
451 !==============================================================================
452 
453 END FUNCTION sfcflx_lwradwsfc
454 
455 
456 !==============================================================================
457 !SURFEX include 'sfcflx_momsenlat.incf'
458 ! File %M% from Library %Q%
459 ! Version %I% from %G% extracted: %H%
460 !------------------------------------------------------------------------------
461 
462 SUBROUTINE sfcflx_momsenlat ( height_u, height_tq, fetch, &
463  u_a, t_a, q_a, t_s, p_a, h_ice, &
464  q_momentum, q_sensible, q_latent, q_watvap,&
465  ri, z0u_ini, z0t_ini, qsat_out, &
466  q_latenti, q_sublim )
467 
468 !------------------------------------------------------------------------------
469 !
470 ! Description:
471 !
472 ! The sfcflx routine
473 ! where fluxes of momentum and of sensible and latent heat
474 ! at the air-water or air-ice (air-snow) interface are computed.
475 !
476 ! Lines embraced with "!_tmp" contain temporary parts of the code.
477 ! Lines embraced/marked with "!_dev" may be replaced
478 ! as improved parameterizations are developed and tested.
479 ! Lines embraced/marked with "!_dm" are DM's comments
480 ! that may be helpful to a user.
481 ! Lines embraced/marked with "!_dbg" are used
482 ! for debugging purposes only.
483 !
484 !
485 ! Current Code Owner: DWD, Dmitrii Mironov
486 ! Phone: +49-69-8062 2705
487 ! Fax: +49-69-8062 3721
488 ! E-mail: dmitrii.mironov@dwd.de
489 !
490 ! History:
491 ! Version Date Name
492 ! ---------- ---------- ----
493 ! 1.00 2005/11/17 Dmitrii Mironov
494 ! Initial release
495 ! !VERSION! !DATE! <Your name>
496 ! <Modification comments>
497 !
498 ! Code Description:
499 ! Language: Fortran 90.
500 ! Software Standards: "European Standards for Writing and
501 ! Documenting Exchangeable Fortran 90 Code".
502 !==============================================================================
503 !
504 ! Declarations:
505 !
506 ! Modules used:
507 
508 !_dm Parameters are USEd in module "sfcflx".
509 !_nu USE modd_data_parameters , ONLY : &
510 !_nu ireals, & ! KIND-type parameter for real variables
511 !_nu iintegers ! KIND-type parameter for "normal" integer variables
512 
513 !==============================================================================
514 
515 USE mode_thermos
516 USE modd_surf_atm, ONLY : xrimax
517 
518 IMPLICIT NONE
519 
520 !==============================================================================
521 !
522 ! Declarations
523 
524 ! Input (procedure arguments)
525 
526 REAL , INTENT(IN) :: &
527  height_u , &! Height where wind is measured [m]
528  height_tq , &! Height where temperature and humidity are measured [m]
529  fetch , &! Typical wind fetch [m]
530  u_a , &! Wind speed [m s^{-1}]
531  t_a , &! Air temperature [K]
532  q_a , &! Air specific humidity [-]
533  t_s , &! Surface temperature (water, ice or snow) [K]
534  p_a , &! Surface air pressure [N m^{-2} = kg m^{-1} s^{-2}]
535  h_ice , &! Ice thickness [m]
536  !
537  !plm add z0u_ini and z0t_ini as input to fill z0u_sf and z0t_sf used in
538  ! flake interface for roughness length
539  z0u_ini , &! Initial roughness for momentum
540  z0t_ini ! Initial roughness for heat
541 
542 ! Output (procedure arguments)
543 
544 REAL , INTENT(INOUT) :: &
545  q_momentum ! Momentum flux [N m^{-2}]
546 REAL , INTENT(OUT) :: &
547  q_sensible , &! Sensible heat flux [W m^{-2}]
548  q_latent , &! Laten heat flux [W m^{-2}]
549  q_latenti , &! Sublimation Latent heat flux [W m^{-2}]
550  q_watvap , &! Flux of water vapout [kg m^{-2} s^{-1}]
551  q_sublim , &! Flux of sublimation [kg m^{-2} s^{-1}]
552  ri , &! Gradient Richardson number
553  qsat_out ! specific humidity at saturation [kg.kg-1]
554 
555 
556 ! Local parameters of type INTEGER
557 INTEGER , PARAMETER :: &
558  n_iter_max = 5 ! Maximum number of iterations
559 
560 ! Local variables of type LOGICAL
561 LOGICAL :: &
562  l_conv_visc , &! Switch, TRUE = viscous free convection, the Nu=C Ra^(1/3) law is used
563  l_conv_cbl ! Switch, TRUE = CBL scale convective structures define surface fluxes
564 
565 ! Local variables of type INTEGER
566 INTEGER :: &
567  i , &! Loop index
568  n_iter ! Number of iterations performed
569 
570 ! Local variables of type REAL
571 REAL :: &
572  rho_a , &! Air density [kg m^{-3}]
573  wvpres_s , &! Saturation water vapour pressure at T=T_s [N m^{-2}]
574  q_s ! Saturation specific humidity at T=T_s [-]
575 
576 ! Local variables of type REAL
577 REAL :: &
578  q_mom_tur , &! Turbulent momentum flux [N m^{-2}]
579  q_sen_tur , &! Turbulent sensible heat flux [W m^{-2}]
580  q_lat_tur , &! Turbulent laten heat flux [W m^{-2}]
581  q_mom_mol , &! Molecular momentum flux [N m^{-2}]
582  q_sen_mol , &! Molecular sensible heat flux [W m^{-2}]
583  q_lat_mol , &! Molecular laten heat flux [W m^{-2}]
584  q_mom_con , &! Momentum flux in free convection [N m^{-2}]
585  q_sen_con , &! Sensible heat flux in free convection [W m^{-2}]
586  q_lat_con ! Laten heat flux in free convection [W m^{-2}]
587 
588 ! Local variables of type REAL
589 REAL :: &
590  par_conv_visc , &! Viscous convection stability parameter
591  par_conv_cbl , &! CBL convection stability parameter
592  c_z0u_fetch , &! Fetch-dependent Charnock parameter
593  u_a_thresh , &! Threshld value of the wind speed [m s^{-1}]
594  u_star_thresh , &! Threshld value of friction velocity [m s^{-1}]
595  u_star_previter , &! Friction velocity from previous iteration [m s^{-1}]
596  u_star_n , &! Friction velocity at neutral stratification [m s^{-1}]
597  u_star_st , &! Friction velocity with due regard for stratification [m s^{-1}]
598  zol , &! The z/L ratio, z=height_u
599  !salgado: Ri is passed as an argument (OUT) in order to be available in flake_interface
600  !Ri , & ! Gradient Richardson number
601  ri_cr , &! Critical value of Ri
602  r_z , &! Ratio of "height_tq" to "height_u"
603  fun , &! A function of generic variable "x"
604  fun_prime , &! Derivative of "Fun" with respect to "x"
605  delta , &! Relative error
606  psi_u , &! The MO stability function for wind profile
607  psi_t , &! The MO stability function for temperature profile
608  psi_q ! The MO stability function for specific humidity profile
609 REAL(KIND=JPRB) :: zhook_handle
610 
611 
612 !==============================================================================
613 ! Start calculations
614 !------------------------------------------------------------------------------
615 
616 !_dm All fluxes are positive when directed upwards.
617 
618 !------------------------------------------------------------------------------
619 ! Compute saturation specific humidity and the air density at T=T_s
620 !------------------------------------------------------------------------------
621 
622 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_MOMSENLAT',0,zhook_handle)
623 q_s = qsat(t_s,p_a)
624 rho_a = sfcflx_rhoair(t_s, q_s, p_a) ! Air density at T_s and q_s (surface values)
625 !------------------------------------------------------------------------------
626 ! Compute molecular fluxes of momentum and of sensible and latent heat
627 !------------------------------------------------------------------------------
628 
629 !_dm The fluxes are in kinematic units
630 q_mom_mol = -tpsf_nu_u_a*u_a/height_u
631 q_sen_mol = -tpsf_kappa_t_a*(t_a-t_s)/height_tq
632 q_lat_mol = -tpsf_kappa_q_a*(q_a-q_s)/height_tq
633 
634 !------------------------------------------------------------------------------
635 ! Compute fluxes in free convection
636 !------------------------------------------------------------------------------
637 
638 par_conv_visc = (t_s-t_a)/t_s*sqrt(tpsf_kappa_t_a) + (q_s-q_a)*tpsf_alpha_q*sqrt(tpsf_kappa_q_a)
639 IF(par_conv_visc.GT.0.) THEN ! Viscous convection takes place
640  l_conv_visc = .true.
641  par_conv_visc = (par_conv_visc*tpl_grav/tpsf_nu_u_a)**num_1o3_sf
642  q_sen_con = c_free_conv*sqrt(tpsf_kappa_t_a)*par_conv_visc
643  q_sen_con = q_sen_con*(t_s-t_a)
644  q_lat_con = c_free_conv*sqrt(tpsf_kappa_q_a)*par_conv_visc
645  q_lat_con = q_lat_con*(q_s-q_a)
646 ELSE ! No viscous convection, set fluxes to zero
647  l_conv_visc = .false.
648  q_sen_con = 0.
649  q_lat_con = 0.
650 END IF
651 q_mom_con = 0. ! Momentum flux in free (viscous or CBL-scale) convection is zero
652 
653 !------------------------------------------------------------------------------
654 ! Compute turbulent fluxes
655 !------------------------------------------------------------------------------
656 
657 r_z = height_tq/height_u ! Ratio of "height_tq" to "height_u"
658 ri_cr = c_mo_t_stab/c_mo_u_stab**2*r_z ! Critical Ri
659 ri = tpl_grav*((t_a-t_s)/t_s+tpsf_alpha_q*(q_a-q_s))/max(u_a,u_wind_min_sf)**2
660 ri = min(xrimax,ri*height_u/pr_neutral) ! Gradient Richardson number
661 
662 turb_fluxes: IF(u_a.LT.u_wind_min_sf.OR.ri.GT.ri_cr-c_small_sf) THEN ! Low wind or Ri>Ri_cr
663 
664 u_star_st = 0. ! Set turbulent fluxes to zero
665 q_mom_tur = 0.
666 q_sen_tur = 0.
667 q_lat_tur = 0.
668 z0u_sf = z0u_ini
669 z0t_sf = z0t_ini
670 
671 ELSE turb_fluxes ! Compute turbulent fluxes using MO similarity
672 
673 ! Compute z/L, where z=height_u
674 IF(ri.GE.0.) THEN ! Stable stratification
675  zol = sqrt(1.-4.*(c_mo_u_stab-r_z*c_mo_t_stab)*ri)
676  zol = zol - 1. + 2.*c_mo_u_stab*ri
677  zol = zol/2./c_mo_u_stab/c_mo_u_stab/(ri_cr-ri)
678 ELSE ! Convection
679  n_iter = 0
680  delta = 1. ! Set initial error to a large value (as compared to the accuracy)
681  u_star_previter = ri*max(1., sqrt(r_z*c_mo_t_conv/c_mo_u_conv)) ! Initial guess for ZoL
682  DO WHILE (delta.GT.c_accur_sf.AND.n_iter.LT.n_iter_max)
683  fun = u_star_previter**2*(c_mo_u_conv*u_star_previter-1.) &
684  + ri**2*(1.-r_z*c_mo_t_conv*u_star_previter)
685  fun_prime = 3.*c_mo_u_conv*u_star_previter**2 &
686  - 2.*u_star_previter - r_z*c_mo_t_conv*ri**2
687  zol = u_star_previter - fun/fun_prime
688  delta = abs(zol-u_star_previter)/max(c_accur_sf, abs(zol+u_star_previter))
689  u_star_previter = zol
690  n_iter = n_iter + 1
691  END DO
692 !_dbg
693 ! IF(n_iter.GE.n_iter_max-1) &
694 ! WRITE(*,*) 'ZoL: Max No. iters. exceeded (n_iter = ', n_iter, ')!'
695 !_dbg
696 END IF
697 
698 ! Compute fetch-dependent Charnock parameter, use "u_star_min_sf"
699  CALL sfcflx_roughness(fetch, u_a, u_star_min_sf, h_ice, c_z0u_fetch, u_star_thresh, z0u_sf, z0t_sf, z0q_sf)
700 
701 ! Threshold value of wind speed
702 u_star_st = u_star_thresh
703  CALL sfcflx_roughness(fetch, u_a, u_star_st, h_ice, c_z0u_fetch, u_star_thresh, z0u_sf, z0t_sf, z0q_sf)
704 IF(zol.GT.0.) THEN ! MO function in stable stratification
705  psi_u = c_mo_u_stab*zol*(1.-min(z0u_sf/height_u, 1.))
706 ELSE ! MO function in convection
707  psi_t = (1.-c_mo_u_conv*zol)**c_mo_u_exp
708  psi_q = (1.-c_mo_u_conv*zol*min(z0u_sf/height_u, 1.))**c_mo_u_exp
709  psi_u = 2.*(atan(psi_t)-atan(psi_q)) &
710  + 2.*log((1.+psi_q)/(1.+psi_t)) &
711  + log((1.+psi_q*psi_q)/(1.+psi_t*psi_t))
712 END IF
713 u_a_thresh = u_star_thresh/c_karman*(log(height_u/z0u_sf)+psi_u)
714 
715 ! Compute friction velocity
716 n_iter = 0
717 delta = 1. ! Set initial error to a large value (as compared to the accuracy)
718 !u_star_previter = u_star_thresh ! Initial guess for friction velocity
719 !* modif. V. Masson (Meteo-France) : uses previous time-step momentum flux for ustar guess
720 u_star_previter = max( sqrt( - q_momentum / rho_a ) , u_star_thresh )
721 !
722 
723 IF(u_a.LE.u_a_thresh) THEN ! Smooth surface
724  DO WHILE (delta.GT.c_accur_sf.AND.n_iter.LT.n_iter_max)
725  CALL sfcflx_roughness(fetch, u_a, min(u_star_thresh, u_star_previter), h_ice, &
726  c_z0u_fetch, u_star_thresh, z0u_sf, z0t_sf, z0q_sf)
727  IF(zol.GE.0.) THEN ! Stable stratification
728  psi_u = c_mo_u_stab*zol*(1.-min(z0u_sf/height_u, 1.))
729  fun = log(height_u/z0u_sf) + psi_u
730  fun_prime = (fun + 1. + c_mo_u_stab*zol*min(z0u_sf/height_u, 1.))/c_karman
731  fun = fun*u_star_previter/c_karman - u_a
732  ELSE ! Convection
733  psi_t = (1.-c_mo_u_conv*zol)**c_mo_u_exp
734  psi_q = (1.-c_mo_u_conv*zol*min(z0u_sf/height_u, 1.))**c_mo_u_exp
735  psi_u = 2.*(atan(psi_t)-atan(psi_q)) &
736  + 2.*log((1.+psi_q)/(1.+psi_t)) &
737  + log((1.+psi_q*psi_q)/(1.+psi_t*psi_t))
738  fun = log(height_u/z0u_sf) + psi_u
739  fun_prime = (fun + 1./psi_q)/c_karman
740  fun = fun*u_star_previter/c_karman - u_a
741  END IF
742  u_star_st = u_star_previter - fun/fun_prime
743  delta = abs((u_star_st-u_star_previter)/(u_star_st+u_star_previter))
744  u_star_previter = u_star_st
745  n_iter = n_iter + 1
746  END DO
747 ELSE ! Rough surface
748  DO WHILE (delta.GT.c_accur_sf.AND.n_iter.LT.n_iter_max.AND.z0t_sf>z0t_min_sf)
749  CALL sfcflx_roughness(fetch, u_a, max(u_star_thresh, u_star_previter), h_ice, &
750  c_z0u_fetch, u_star_thresh, z0u_sf, z0t_sf, z0q_sf)
751  IF(zol.GE.0.) THEN ! Stable stratification
752  psi_u = c_mo_u_stab*zol*(1.-min(z0u_sf/height_u, 1.))
753  fun = log(height_u/z0u_sf) + psi_u
754  fun_prime = (fun - 2. - 2.*c_mo_u_stab*zol*min(z0u_sf/height_u, 1.))/c_karman
755  fun = fun*u_star_previter/c_karman - u_a
756  ELSE ! Convection
757  psi_t = (1.-c_mo_u_conv*zol)**c_mo_u_exp
758  psi_q = (1.-c_mo_u_conv*zol*min(z0u_sf/height_u, 1.))**c_mo_u_exp
759  psi_u = 2.*(atan(psi_t)-atan(psi_q)) &
760  + 2.*log((1.+psi_q)/(1.+psi_t)) &
761  + log((1.+psi_q*psi_q)/(1.+psi_t*psi_t))
762  fun = log(height_u/z0u_sf) + psi_u
763  fun_prime = (fun - 2./psi_q)/c_karman
764  fun = fun*u_star_previter/c_karman - u_a
765  END IF
766  IF(h_ice.GE.h_ice_min_flk) THEN ! No iteration is required for rough flow over ice
767  u_star_st = c_karman*u_a/max(c_small_sf, log(height_u/z0u_sf)+psi_u)
768  u_star_previter = u_star_st
769  ELSE ! Iterate in case of open water
770  u_star_st = u_star_previter - fun/fun_prime
771  END IF
772  delta = abs((u_star_st-u_star_previter)/(u_star_st+u_star_previter))
773  u_star_previter = u_star_st
774  n_iter = n_iter + 1
775  END DO
776 END IF
777 !
778 !* Modification: V. Masson (Meteo-France)
779 !* in case convergence did not occur :
780 ! - one keeps the values of the previous time-step for momentum roughness length
781 ! - one recomputes the thermal and water vapor roughness lengthes
782 ! - one estimates the momentum flux using neutral law
783 IF (n_iter == n_iter_max .OR. z0t_sf<=z0t_min_sf) THEN
784  u_star_st = max( sqrt( - q_momentum / rho_a ) , u_star_min_sf )
785  CALL sfcflx_roughness(fetch, u_a, u_star_st, h_ice, &
786  c_z0u_fetch, u_star_previter, z0u_sf, z0t_sf, z0q_sf)
787  z0u_sf = z0u_ini
788  u_star_st = c_karman*u_a/max(c_small_sf, log(height_u/z0u_sf))
789 END IF
790 
791 !_dbg
792 ! WRITE(*,*) 'MO stab. func. psi_u = ', psi_u, ' n_iter = ', n_iter
793 ! WRITE(*,*) ' Wind speed = ', U_a, ' u_* = ', u_star_st
794 ! WRITE(*,*) ' Fun = ', Fun
795 !_dbg
796 
797 !_dbg
798 ! IF(n_iter.GE.n_iter_max-1) &
799 ! WRITE(*,*) 'u_*: Max No. iters. exceeded (n_iter = ', n_iter, ')!'
800 !_dbg
801 
802 ! Momentum flux
803 q_mom_tur = -u_star_st*u_star_st
804 
805 ! Temperature and specific humidity fluxes
806  CALL sfcflx_roughness(fetch, u_a, u_star_st, h_ice, c_z0u_fetch, u_star_thresh, z0u_sf, z0t_sf, z0q_sf)
807 !
808 IF(zol.GE.0.) THEN ! Stable stratification
809  psi_t = c_mo_t_stab*r_z*zol*(1.-min(z0t_sf/height_tq, 1.))
810  psi_q = c_mo_q_stab*r_z*zol*(1.-min(z0q_sf/height_tq, 1.))
811 !_dbg
812 ! WRITE(*,*) 'STAB: psi_t = ', psi_t, ' psi_q = ', psi_q
813 !_dbg
814 ELSE ! Convection
815  psi_u = (1.-c_mo_t_conv*r_z*zol)**c_mo_t_exp
816  psi_t = (1.-c_mo_t_conv*r_z*zol*min(z0t_sf/height_tq, 1.))**c_mo_t_exp
817  psi_t = 2.*log((1.+psi_t)/(1.+psi_u))
818  psi_u = (1.-c_mo_q_conv*r_z*zol)**c_mo_q_exp
819  psi_q = (1.-c_mo_q_conv*r_z*zol*min(z0q_sf/height_tq, 1.))**c_mo_q_exp
820  psi_q = 2.*log((1.+psi_q)/(1.+psi_u))
821 !_dbg
822 ! WRITE(*,*) 'CONV: psi_t = ', psi_t, ' psi_q = ', psi_q
823 !_dbg
824 END IF
825 
826 q_sen_tur = -(t_a-t_s)*u_star_st*c_karman/pr_neutral &
827  / max(c_small_sf, log(height_tq/z0t_sf)+psi_t)
828 q_lat_tur = -(q_a-q_s)*u_star_st*c_karman/sc_neutral &
829  / max(c_small_sf, log(height_tq/z0q_sf)+psi_q)
830 
831 END IF turb_fluxes
832 
833 !------------------------------------------------------------------------------
834 ! Decide between turbulent, molecular, and convective fluxes
835 !------------------------------------------------------------------------------
836 
837 q_momentum = min(q_mom_tur, q_mom_mol, q_mom_con) ! Momentum flux is negative
838 IF(l_conv_visc) THEN ! Convection, take fluxes that are maximal in magnitude
839  IF(abs(q_sen_tur).GE.abs(q_sen_con)) THEN
840  q_sensible = q_sen_tur
841  ELSE
842  q_sensible = q_sen_con
843  END IF
844  IF(abs(q_sensible).LT.abs(q_sen_mol)) THEN
845  q_sensible = q_sen_mol
846  END IF
847  IF(abs(q_lat_tur).GE.abs(q_lat_con)) THEN
848  q_latent = q_lat_tur
849  ELSE
850  q_latent = q_lat_con
851  END IF
852  IF(abs(q_latent).LT.abs(q_lat_mol)) THEN
853  q_latent = q_lat_mol
854  END IF
855 ELSE ! Stable or neutral stratification, chose fluxes that are maximal in magnitude
856  IF(abs(q_sen_tur).GE.abs(q_sen_mol)) THEN
857  q_sensible = q_sen_tur
858  ELSE
859  q_sensible = q_sen_mol
860  END IF
861  IF(abs(q_lat_tur).GE.abs(q_lat_mol)) THEN
862  q_latent = q_lat_tur
863  ELSE
864  q_latent = q_lat_mol
865  END IF
866 END IF
867 
868 !------------------------------------------------------------------------------
869 ! Set output (notice that fluxes are no longer in kinematic units)
870 !------------------------------------------------------------------------------
871 !
872 q_momentum = q_momentum*rho_a
873 q_sensible = q_sensible*rho_a*tpsf_c_a_p
874 q_watvap = q_latent*rho_a
875 !
876 IF(h_ice.GE.h_ice_min_flk)THEN
877  q_latent = q_watvap * (tpsf_l_evap + tpl_l_f) ! Add latent heat of fusion over ice
878  q_latenti = q_watvap * (tpsf_l_evap + tpl_l_f)
879  q_sublim = q_watvap
880 ELSE
881  q_latent = q_watvap * tpsf_l_evap
882  q_latenti = 0.0
883  q_sublim = 0.0
884 ENDIF
885 !
886 qsat_out = q_s
887 !
888 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_MOMSENLAT',1,zhook_handle)
889 
890 !------------------------------------------------------------------------------
891 ! End calculations
892 !==============================================================================
893 
894 END SUBROUTINE sfcflx_momsenlat
895 
896 
897 !==============================================================================
898 
899 !==============================================================================
900 !SURFEX include 'sfcflx_rhoair.incf'
901 ! File %M% from Library %Q%
902 ! Version %I% from %G% extracted: %H%
903 !------------------------------------------------------------------------------
904 
905 !SURFEX REAL FUNCTION sfcflx_rhoair (T, q, P)
906 FUNCTION sfcflx_rhoair (T, q, P)
907 
908 !------------------------------------------------------------------------------
909 !
910 ! Description:
911 !
912 ! Computes the air density as function
913 ! of temperature, specific humidity and pressure.
914 !
915 !
916 ! Current Code Owner: DWD, Dmitrii Mironov
917 ! Phone: +49-69-8062 2705
918 ! Fax: +49-69-8062 3721
919 ! E-mail: dmitrii.mironov@dwd.de
920 !
921 ! History:
922 ! Version Date Name
923 ! ---------- ---------- ----
924 ! 1.00 2005/11/17 Dmitrii Mironov
925 ! Initial release
926 ! !VERSION! !DATE! <Your name>
927 ! <Modification comments>
928 !
929 ! Code Description:
930 ! Language: Fortran 90.
931 ! Software Standards: "European Standards for Writing and
932 ! Documenting Exchangeable Fortran 90 Code".
933 !==============================================================================
934 !
935 ! Declarations:
936 !
937 ! Modules used:
938 
939 !_dm Parameters are USEd in module "sfcflx".
940 !_nu USE modd_data_parameters , ONLY : &
941 !_nu ireals, & ! KIND-type parameter for real variables
942 !_nu iintegers ! KIND-type parameter for "normal" integer variables
943 
944 !==============================================================================
945 
946 IMPLICIT NONE
947 
948 !==============================================================================
949 !
950 ! Declarations
951 
952 ! Input (function argument)
953 REAL , INTENT(IN) :: &
954  t , &! Temperature [K]
955  q , &! Specific humidity
956  p ! Pressure [N m^{-2} = kg m^{-1} s^{-2}]
957 
958 ! Output (function result)
959 REAL :: &
960  sfcflx_rhoair ! Air density [kg m^{-3}]
961 REAL(KIND=JPRB) :: zhook_handle
962 
963 !==============================================================================
964 ! Start calculations
965 !------------------------------------------------------------------------------
966 
967 ! Air density [kg m^{-3}]
968 
969 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_RHOAIR',0,zhook_handle)
970 sfcflx_rhoair = p/tpsf_r_dryair/t/(1.+(1./tpsf_rd_o_rv-1.)*q)
971 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_RHOAIR',1,zhook_handle)
972 
973 !------------------------------------------------------------------------------
974 ! End calculations
975 !==============================================================================
976 
977 END FUNCTION sfcflx_rhoair
978 
979 
980 !==============================================================================
981 !SURFEX include 'sfcflx_roughness.incf'
982 ! File %M% from Library %Q%
983 ! Version %I% from %G% extracted: %H%
984 !------------------------------------------------------------------------------
985 
986 SUBROUTINE sfcflx_roughness (fetch, U_a, u_star, h_ice, &
987  c_z0u_fetch, u_star_thresh, z0u, z0t, z0q)
988 
989 !------------------------------------------------------------------------------
990 !
991 ! Description:
992 !
993 ! Computes the water-surface or the ice-surface roughness lengths
994 ! with respect to wind velocity, potential temperature and specific humidity.
995 !
996 ! The water-surface roughness lengths with respect to wind velocity is computed
997 ! from the Charnock formula when the surface is aerodynamically rough.
998 ! A simple empirical formulation is used to account for the dependence
999 ! of the Charnock parameter on the wind fetch.
1000 ! When the flow is aerodynamically smooth, the roughness length with respect to
1001 ! wind velocity is proportional to the depth of the viscous sub-layer.
1002 ! The water-surface roughness lengths for scalars are computed using the power-law
1003 ! formulations in terms of the roughness Reynolds number (Zilitinkevich et al. 2001).
1004 ! The ice-surface aerodynamic roughness is taken to be constant.
1005 ! The ice-surface roughness lengths for scalars
1006 ! are computed through the power-law formulations
1007 ! in terms of the roughness Reynolds number (Andreas 2002).
1008 !
1009 !
1010 ! Current Code Owner: DWD, Dmitrii Mironov
1011 ! Phone: +49-69-8062 2705
1012 ! Fax: +49-69-8062 3721
1013 ! E-mail: dmitrii.mironov@dwd.de
1014 !
1015 ! History:
1016 ! Version Date Name
1017 ! ---------- ---------- ----
1018 ! 1.00 2005/11/17 Dmitrii Mironov
1019 ! Initial release
1020 ! !VERSION! !DATE! <Your name>
1021 ! <Modification comments>
1022 !
1023 ! Code Description:
1024 ! Language: Fortran 90.
1025 ! Software Standards: "European Standards for Writing and
1026 ! Documenting Exchangeable Fortran 90 Code".
1027 !==============================================================================
1028 !
1029 ! Declarations:
1030 !
1031 ! Modules used:
1032 
1033 !_dm Parameters are USEd in module "sfcflx".
1034 !_nu USE modd_data_parameters , ONLY : &
1035 !_nu ireals , & ! KIND-type parameter for real variables
1036 !_nu iintegers ! KIND-type parameter for "normal" integer variables
1037 
1038 !==============================================================================
1039 
1040 IMPLICIT NONE
1041 
1042 !==============================================================================
1043 !
1044 ! Declarations
1045 
1046 ! Input (procedure arguments)
1047 REAL , INTENT(IN) :: &
1048  fetch , &! Typical wind fetch [m]
1049  u_a , &! Wind speed [m s^{-1}]
1050  u_star , &! Friction velocity in the surface air layer [m s^{-1}]
1051  h_ice ! Ice thickness [m]
1052 
1053 ! Output (procedure arguments)
1054 REAL , INTENT(OUT) :: &
1055  c_z0u_fetch , &! Fetch-dependent Charnock parameter
1056  u_star_thresh , &! Threshold value of friction velocity [m s^{-1}]
1057  z0u , &! Roughness length with respect to wind velocity [m]
1058  z0t , &! Roughness length with respect to potential temperature [m]
1059  z0q ! Roughness length with respect to specific humidity [m]
1060 
1061 ! Local variables of type REAL
1062 REAL :: &
1063  re_s , &! Surface Reynolds number
1064  re_s_thresh ! Threshold value of Re_s
1065 REAL(KIND=JPRB) :: zhook_handle
1066 
1067 !==============================================================================
1068 ! Start calculations
1069 !------------------------------------------------------------------------------
1070 
1071 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_ROUGHNESS',0,zhook_handle)
1072 water_or_ice: IF(h_ice.LT.h_ice_min_flk) THEN ! Water surface
1073 
1074 ! The Charnock parameter as dependent on dimensionless fetch
1075  c_z0u_fetch = max(u_a, u_wind_min_sf)**2/tpl_grav/fetch ! Inverse dimensionless fetch
1076  c_z0u_fetch = c_z0u_rough + c_z0u_ftch_f*c_z0u_fetch**c_z0u_ftch_ex
1077  c_z0u_fetch = min(c_z0u_fetch, c_z0u_rough_l) ! Limit Charnock parameter
1078 
1079 ! Threshold value of friction velocity
1080  u_star_thresh = (c_z0u_smooth/c_z0u_fetch*tpl_grav*tpsf_nu_u_a)**num_1o3_sf
1081 
1082 ! Surface Reynolds number and its threshold value
1083  re_s = u_star**3/tpsf_nu_u_a/tpl_grav
1084  re_s_thresh = c_z0u_smooth/c_z0u_fetch
1085 
1086 ! Aerodynamic roughness
1087  IF(re_s.LE.re_s_thresh) THEN
1088  z0u = c_z0u_smooth*tpsf_nu_u_a/u_star ! Smooth flow
1089  ELSE
1090  z0u = c_z0u_fetch*u_star*u_star/tpl_grav ! Rough flow
1091  END IF
1092 ! Roughness for scalars
1093  z0q = c_z0u_fetch*max(re_s, re_s_thresh)
1094  z0t = c_z0t_rough_1*z0q**c_z0t_rough_3 - c_z0t_rough_2
1095  z0q = c_z0q_rough_1*z0q**c_z0q_rough_3 - c_z0q_rough_2
1096  z0t = z0u*exp(-c_karman/pr_neutral*z0t)
1097  z0q = z0u*exp(-c_karman/sc_neutral*z0q)
1098 
1099 ELSE water_or_ice ! Ice surface
1100 
1101 ! The Charnock parameter is not used over ice, formally set "c_z0u_fetch" to its minimum value
1102  c_z0u_fetch = c_z0u_rough
1103 
1104 ! Threshold value of friction velocity
1105  u_star_thresh = c_z0u_smooth*tpsf_nu_u_a/z0u_ice_rough
1106 
1107 ! Aerodynamic roughness
1108  z0u = max(z0u_ice_rough, c_z0u_smooth*tpsf_nu_u_a/u_star)
1109 
1110 ! Roughness Reynolds number
1111  re_s = max(u_star*z0u/tpsf_nu_u_a, c_accur_sf)
1112 
1113 ! Roughness for scalars
1114  IF(re_s.LE.re_z0s_ice_t) THEN
1115  z0t = c_z0t_ice_b0t + c_z0t_ice_b1t*log(re_s)
1116  z0t = min(z0t, c_z0t_ice_b0s)
1117  z0q = c_z0q_ice_b0t + c_z0q_ice_b1t*log(re_s)
1118  z0q = min(z0q, c_z0q_ice_b0s)
1119  ELSE
1120  z0t = c_z0t_ice_b0r + c_z0t_ice_b1r*log(re_s) + c_z0t_ice_b2r*log(re_s)**2
1121  z0q = c_z0q_ice_b0r + c_z0q_ice_b1r*log(re_s) + c_z0q_ice_b2r*log(re_s)**2
1122  END IF
1123  z0t = z0u*exp(z0t)
1124  z0q = z0u*exp(z0q)
1125 
1126 END IF water_or_ice
1127 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_ROUGHNESS',1,zhook_handle)
1128 
1129 !------------------------------------------------------------------------------
1130 ! End calculations
1131 !==============================================================================
1132 
1133 END SUBROUTINE sfcflx_roughness
1134 
1135 !==============================================================================
1136 !SURFEX include 'sfcflx_satwvpres.incf'
1137 ! File %M% from Library %Q%
1138 ! Version %I% from %G% extracted: %H%
1139 !------------------------------------------------------------------------------
1140 
1141 !SURFEX REAL FUNCTION sfcflx_satwvpres (T, h_ice)
1142 FUNCTION sfcflx_satwvpres (T, h_ice)
1143 
1144 !------------------------------------------------------------------------------
1145 !
1146 ! Description:
1147 !
1148 ! Computes saturation water vapour pressure
1149 ! over the water surface or over the ice surface
1150 ! as function of temperature.
1151 !
1152 !
1153 ! Current Code Owner: DWD, Dmitrii Mironov
1154 ! Phone: +49-69-8062 2705
1155 ! Fax: +49-69-8062 3721
1156 ! E-mail: dmitrii.mironov@dwd.de
1157 !
1158 ! History:
1159 ! Version Date Name
1160 ! ---------- ---------- ----
1161 ! 1.00 2005/11/17 Dmitrii Mironov
1162 ! Initial release
1163 ! !VERSION! !DATE! <Your name>
1164 ! <Modification comments>
1165 !
1166 ! Code Description:
1167 ! Language: Fortran 90.
1168 ! Software Standards: "European Standards for Writing and
1169 ! Documenting Exchangeable Fortran 90 Code".
1170 !==============================================================================
1171 !
1172 ! Declarations:
1173 !
1174 ! Modules used:
1175 
1176 !_dm Parameters are USEd in module "sfcflx".
1177 !_nu USE modd_data_parameters , ONLY : &
1178 !_nu ireals, & ! KIND-type parameter for real variables
1179 !_nu iintegers ! KIND-type parameter for "normal" integer variables
1180 
1181 !_dm The variable is USEd in module "sfcflx".
1182 !_nu USE flake_parameters , ONLY : &
1183 !_nu h_Ice_min_flk ! Minimum ice thickness [m]
1184 
1185 !==============================================================================
1186 
1187 IMPLICIT NONE
1188 
1189 !==============================================================================
1190 !
1191 ! Declarations
1192 
1193 ! Input (function argument)
1194 REAL , INTENT(IN) :: &
1195  t , &! Temperature [K]
1196  h_ice ! Ice thickness [m]
1197 
1198 ! Output (function result)
1199 REAL :: &
1200  sfcflx_satwvpres ! Saturation water vapour pressure [N m^{-2} = kg m^{-1} s^{-2}]
1201 
1202 ! Local parameters
1203 REAL , PARAMETER :: &
1204  b1_vap = 610.78 , &! Coefficient [N m^{-2} = kg m^{-1} s^{-2}]
1205  b3_vap = 273.16 , &! Triple point [K]
1206  b2w_vap = 17.2693882 , &! Coefficient (water)
1207  b2i_vap = 21.8745584 , &! Coefficient (ice)
1208  b4w_vap = 35.86 , &! Coefficient (temperature) [K]
1209  b4i_vap = 7.66 ! Coefficient (temperature) [K]
1210 REAL(KIND=JPRB) :: zhook_handle
1211 
1212 !==============================================================================
1213 ! Start calculations
1214 !------------------------------------------------------------------------------
1215 
1216 ! Saturation water vapour pressure [N m^{-2} = kg m^{-1} s^{-2}]
1217 
1218 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_SATWVPRES',0,zhook_handle)
1219 IF(h_ice.LT.h_ice_min_flk) THEN ! Water surface
1220  sfcflx_satwvpres = b1_vap*exp(b2w_vap*(t-b3_vap)/(t-b4w_vap))
1221 ELSE ! Ice surface
1222  sfcflx_satwvpres = b1_vap*exp(b2i_vap*(t-b3_vap)/(t-b4i_vap))
1223 END IF
1224 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_SATWVPRES',1,zhook_handle)
1225 
1226 !------------------------------------------------------------------------------
1227 ! End calculations
1228 !==============================================================================
1229 
1230 END FUNCTION sfcflx_satwvpres
1231 
1232 
1233 !==============================================================================
1234 !SURFEX include 'sfcflx_spechum.incf'
1235 ! File %M% from Library %Q%
1236 ! Version %I% from %G% extracted: %H%
1237 !------------------------------------------------------------------------------
1238 
1239 !SURFEX REAL FUNCTION sfcflx_spechum (wvpres, P)
1240 FUNCTION sfcflx_spechum (wvpres, P)
1241 
1242 !------------------------------------------------------------------------------
1243 !
1244 ! Description:
1245 !
1246 ! Computes specific humidity as function
1247 ! of water vapour pressure and air pressure.
1248 !
1249 !
1250 ! Current Code Owner: DWD, Dmitrii Mironov
1251 ! Phone: +49-69-8062 2705
1252 ! Fax: +49-69-8062 3721
1253 ! E-mail: dmitrii.mironov@dwd.de
1254 !
1255 ! History:
1256 ! Version Date Name
1257 ! ---------- ---------- ----
1258 ! 1.00 2005/11/17 Dmitrii Mironov
1259 ! Initial release
1260 ! !VERSION! !DATE! <Your name>
1261 ! <Modification comments>
1262 !
1263 ! Code Description:
1264 ! Language: Fortran 90.
1265 ! Software Standards: "European Standards for Writing and
1266 ! Documenting Exchangeable Fortran 90 Code".
1267 !==============================================================================
1268 !
1269 ! Declarations:
1270 !
1271 ! Modules used:
1272 
1273 !_dm Parameters are USEd in module "sfcflx".
1274 !_nu USE modd_data_parameters , ONLY : &
1275 !_nu ireals, & ! KIND-type parameter for real variables
1276 !_nu iintegers ! KIND-type parameter for "normal" integer variables
1277 
1278 !==============================================================================
1279 
1280 IMPLICIT NONE
1281 
1282 !==============================================================================
1283 !
1284 ! Declarations
1285 
1286 ! Input (function argument)
1287 REAL , INTENT(IN) :: &
1288  wvpres , &! Water vapour pressure [N m^{-2} = kg m^{-1} s^{-2}]
1289  p ! Air pressure [N m^{-2} = kg m^{-1} s^{-2}]
1290 
1291 ! Output (function result)
1292 REAL :: &
1293  sfcflx_spechum ! Specific humidity
1294 REAL(KIND=JPRB) :: zhook_handle
1295 
1296 !==============================================================================
1297 ! Start calculations
1298 !------------------------------------------------------------------------------
1299 
1300 ! Specific humidity
1301 
1302 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_SPECHUM',0,zhook_handle)
1303 sfcflx_spechum = tpsf_rd_o_rv*wvpres/(p-(1.-tpsf_rd_o_rv)*wvpres)
1304 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_SPECHUM',1,zhook_handle)
1305 
1306 !------------------------------------------------------------------------------
1307 ! End calculations
1308 !==============================================================================
1309 
1310 END FUNCTION sfcflx_spechum
1311 
1312 
1313 !==============================================================================
1314 !SURFEX include 'sfcflx_wvpreswetbulb.incf'
1315 ! File %M% from Library %Q%
1316 ! Version %I% from %G% extracted: %H%
1317 !------------------------------------------------------------------------------
1318 
1319 !SURFEX REAL FUNCTION sfcflx_wvpreswetbulb (T_dry, T_wetbulb, satwvpres_bulb, P)
1320 FUNCTION sfcflx_wvpreswetbulb (T_dry, T_wetbulb, satwvpres_bulb, P)
1321 
1322 !------------------------------------------------------------------------------
1323 !
1324 ! Description:
1325 !
1326 ! Computes water vapour pressure as function of air temperature,
1327 ! wet bulb temperature, satururation vapour pressure at wet-bulb temperature,
1328 ! and air pressure.
1329 !
1330 !
1331 ! Current Code Owner: DWD, Dmitrii Mironov
1332 ! Phone: +49-69-8062 2705
1333 ! Fax: +49-69-8062 3721
1334 ! E-mail: dmitrii.mironov@dwd.de
1335 !
1336 ! History:
1337 ! Version Date Name
1338 ! ---------- ---------- ----
1339 ! 1.00 2005/11/17 Dmitrii Mironov
1340 ! Initial release
1341 ! !VERSION! !DATE! <Your name>
1342 ! <Modification comments>
1343 !
1344 ! Code Description:
1345 ! Language: Fortran 90.
1346 ! Software Standards: "European Standards for Writing and
1347 ! Documenting Exchangeable Fortran 90 Code".
1348 !==============================================================================
1349 !
1350 ! Declarations:
1351 !
1352 ! Modules used:
1353 
1354 !_dm Parameters are USEd in module "sfcflx".
1355 !_nu USE modd_data_parameters , ONLY : &
1356 !_nu ireals, & ! KIND-type parameter for real variables
1357 !_nu iintegers ! KIND-type parameter for "normal" integer variables
1358 
1359 !==============================================================================
1360 
1361 IMPLICIT NONE
1362 
1363 !==============================================================================
1364 !
1365 ! Declarations
1366 
1367 ! Input (function argument)
1368 REAL , INTENT(IN) :: &
1369  t_dry , &! Dry air temperature [K]
1370  t_wetbulb , &! Wet bulb temperature [K]
1371  satwvpres_bulb , &! Satururation vapour pressure at wet-bulb temperature [N m^{-2}]
1372  p ! Atmospheric pressure [N m^{-2}]
1373 
1374 ! Output (function result)
1375 REAL :: &
1376  sfcflx_wvpreswetbulb ! Water vapour pressure [N m^{-2} = kg m^{-1} s^{-2}]
1377 REAL(KIND=JPRB) :: zhook_handle
1378 
1379 !==============================================================================
1380 ! Start calculations
1381 !------------------------------------------------------------------------------
1382 
1383 ! Water vapour pressure [N m^{-2} = kg m^{-1} s^{-2}]
1384 
1385 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_WVPRESWETBULB',0,zhook_handle)
1386 sfcflx_wvpreswetbulb = satwvpres_bulb &
1387  - tpsf_c_a_p*p/tpsf_l_evap/tpsf_rd_o_rv*(t_dry-t_wetbulb)
1388 IF (lhook) CALL dr_hook('SFCFLX:SFCFLX_WVPRESWETBULB',1,zhook_handle)
1389 
1390 
1391 !------------------------------------------------------------------------------
1392 ! End calculations
1393 !==============================================================================
1394 
1395 END FUNCTION sfcflx_wvpreswetbulb
1396 
1397 
1398 END MODULE mode_sfcflx
1399 
real function sfcflx_lwradwsfc(emis, pts)
subroutine sfcflx_momsenlat(height_u, height_tq, fetch, U_a, T_a, q_a, T_s, P_a, h_ice, Q_momentum, Q_sensible, Q_latent, Q_watvap, Ri, z0u_ini, z0t_ini, Qsat_out, Q_latenti, Q_sublim)
real function sfcflx_spechum(wvpres, P)
real function sfcflx_lwradatm(T_a, e_a, cl_tot, cl_low)
subroutine sfcflx_roughness(fetch, U_a, u_star, h_ice, c_z0u_fetch, u_star_thresh, z0u, z0t, z0q)
real function sfcflx_rhoair(T, q, P)
real function sfcflx_wvpreswetbulb(T_dry, T_wetbulb, satwvpres_bulb, P)
real function sfcflx_satwvpres(T, h_ice)