obukhov.f90 3.5 KB
Newer Older
1
real function obukhov(ps,tsurf,tdsurf,tlev,ustar,hf,akm,bkm,plev,metdata_format)
Matthias Langer's avatar
 
Matthias Langer committed
2
3
4
5
6
7

  !********************************************************************
  !                                                                   *
  !                       Author: G. WOTAWA                           *
  !                       Date:   1994-06-27                          *
  !                                                                   *
8
9
  !     This program calculates Obukhov scale height from surface     *
  !     meteorological data and sensible heat flux.                   *
Matthias Langer's avatar
 
Matthias Langer committed
10
11
12
  !                                                                   *
  !********************************************************************
  !                                                                   *
13
14
15
16
17
18
19
20
  !  Update: A. Stohl, 2000-09-25, avoid division by zero by          *
  !  setting ustar to minimum value                                   *
  !  CHANGE: 17/11/2005 Caroline Forster NCEP GFS version             *
  !                                                                   *
  !   Unified ECMWF and GFS builds                                    *
  !   Marian Harustak, 12.5.2017                                      *
  !     - Merged obukhov and obukhov_gfs into one routine using       *
  !       if-then for meteo-type dependent code                       *
Matthias Langer's avatar
 
Matthias Langer committed
21
22
23
24
25
26
27
28
29
30
31
32
33
  !                                                                   *
  !********************************************************************
  !                                                                   *
  !     INPUT:                                                        *
  !                                                                   *
  !     ps      surface pressure [Pa]                                 *
  !     tsurf   surface temperature [K]                               *
  !     tdsurf  surface dew point [K]                                 *
  !     tlev    temperature first model level [K]                     *
  !     ustar   scale velocity [m/s]                                  *
  !     hf      surface sensible heat flux [W/m2]                     *
  !     akm     ECMWF vertical discretization parameter               *
  !     bkm     ECMWF vertical discretization parameter               *
34
35
  !     plev                                                          *
  !     metdata_format format of metdata (ecmwf/gfs)                  *
Matthias Langer's avatar
 
Matthias Langer committed
36
37
38
39
  !                                                                   *
  !********************************************************************

  use par_mod
40
  use class_gribfile
Matthias Langer's avatar
 
Matthias Langer committed
41
42
43

  implicit none

44
  integer :: metdata_format
Matthias Langer's avatar
 
Matthias Langer committed
45
46
47
48
49
50
51
52
  real :: akm(nwzmax),bkm(nwzmax)
  real :: ps,tsurf,tdsurf,tlev,ustar,hf,e,ew,tv,rhoa,plev
  real :: ak1,bk1,theta,thetastar


  e=ew(tdsurf)                           ! vapor pressure
  tv=tsurf*(1.+0.378*e/ps)               ! virtual temperature
  rhoa=ps/(r_air*tv)                      ! air density
53
  if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then
Matthias Langer's avatar
 
Matthias Langer committed
54
55
56
  ak1=(akm(1)+akm(2))/2.
  bk1=(bkm(1)+bkm(2))/2.
  plev=ak1+bk1*ps                        ! Pressure level 1
57
  end if
Matthias Langer's avatar
 
Matthias Langer committed
58
59
60
61
62
63
64
65
66
67
68
69
  theta=tlev*(100000./plev)**(r_air/cpa) ! potential temperature
  if (ustar.le.0.) ustar=1.e-8
  thetastar=hf/(rhoa*cpa*ustar)           ! scale temperature
  if(abs(thetastar).gt.1.e-10) then
     obukhov=theta*ustar**2/(karman*ga*thetastar)
  else
     obukhov=9999                        ! zero heat flux
  endif
  if (obukhov.gt. 9999.) obukhov= 9999.
  if (obukhov.lt.-9999.) obukhov=-9999.

end function obukhov