1 | ! SPDX-FileCopyrightText: FLEXPART 1998-2019, see flexpart_license.txt |
---|
2 | ! SPDX-License-Identifier: GPL-3.0-or-later |
---|
3 | |
---|
4 | real function obukhov(ps,tsurf,tdsurf,tlev,ustar,hf,akm,bkm,plev,metdata_format) |
---|
5 | |
---|
6 | !******************************************************************** |
---|
7 | ! * |
---|
8 | ! Author: G. WOTAWA * |
---|
9 | ! Date: 1994-06-27 * |
---|
10 | ! * |
---|
11 | ! This program calculates Obukhov scale height from surface * |
---|
12 | ! meteorological data and sensible heat flux. * |
---|
13 | ! * |
---|
14 | !******************************************************************** |
---|
15 | ! * |
---|
16 | ! Update: A. Stohl, 2000-09-25, avoid division by zero by * |
---|
17 | ! setting ustar to minimum value * |
---|
18 | ! CHANGE: 17/11/2005 Caroline Forster NCEP GFS version * |
---|
19 | ! * |
---|
20 | ! Unified ECMWF and GFS builds * |
---|
21 | ! Marian Harustak, 12.5.2017 * |
---|
22 | ! - Merged obukhov and obukhov_gfs into one routine using * |
---|
23 | ! if-then for meteo-type dependent code * |
---|
24 | ! * |
---|
25 | !******************************************************************** |
---|
26 | ! * |
---|
27 | ! INPUT: * |
---|
28 | ! * |
---|
29 | ! ps surface pressure [Pa] * |
---|
30 | ! tsurf surface temperature [K] * |
---|
31 | ! tdsurf surface dew point [K] * |
---|
32 | ! tlev temperature first model level [K] * |
---|
33 | ! ustar scale velocity [m/s] * |
---|
34 | ! hf surface sensible heat flux [W/m2] * |
---|
35 | ! akm ECMWF vertical discretization parameter * |
---|
36 | ! bkm ECMWF vertical discretization parameter * |
---|
37 | ! plev * |
---|
38 | ! metdata_format format of metdata (ecmwf/gfs) * |
---|
39 | ! * |
---|
40 | !******************************************************************** |
---|
41 | |
---|
42 | use par_mod |
---|
43 | use class_gribfile |
---|
44 | |
---|
45 | implicit none |
---|
46 | |
---|
47 | integer :: metdata_format |
---|
48 | real :: akm(nwzmax),bkm(nwzmax) |
---|
49 | real :: ps,tsurf,tdsurf,tlev,ustar,hf,e,ew,tv,rhoa,plev |
---|
50 | real :: ak1,bk1,theta,thetastar |
---|
51 | |
---|
52 | |
---|
53 | e=ew(tdsurf) ! vapor pressure |
---|
54 | tv=tsurf*(1.+0.378*e/ps) ! virtual temperature |
---|
55 | rhoa=ps/(r_air*tv) ! air density |
---|
56 | if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then |
---|
57 | ak1=(akm(1)+akm(2))/2. |
---|
58 | bk1=(bkm(1)+bkm(2))/2. |
---|
59 | plev=ak1+bk1*ps ! Pressure level 1 |
---|
60 | end if |
---|
61 | theta=tlev*(100000./plev)**(r_air/cpa) ! potential temperature |
---|
62 | if (ustar.le.0.) ustar=1.e-8 |
---|
63 | thetastar=hf/(rhoa*cpa*ustar) ! scale temperature |
---|
64 | if(abs(thetastar).gt.1.e-10) then |
---|
65 | obukhov=theta*ustar**2/(karman*ga*thetastar) |
---|
66 | else |
---|
67 | obukhov=9999 ! zero heat flux |
---|
68 | endif |
---|
69 | if (obukhov.gt. 9999.) obukhov= 9999. |
---|
70 | if (obukhov.lt.-9999.) obukhov=-9999. |
---|
71 | |
---|
72 | end function obukhov |
---|