da_ref_height.inc

References to this file elsewhere.
1 subroutine da_ref_height(pres, ref_height)
2 
3    !---------------------------------------------------------------------------
4    ! Purpose: To calculate the height from the reference pressure
5    !---------------------------------------------------------------------------
6 
7    implicit none
8 
9    real, intent(in)  :: pres
10    real, intent(out) :: ref_height
11 
12    real              :: aa, bb, cc
13    real              :: p0iso, ziso
14 
15    real, parameter   :: rovg = gas_constant/gravity
16 
17    aa = 0.5 * rovg * tlp
18    bb = rovg * ts0
19 
20    cc = log(pres/ps0)
21    ref_height = -(bb + aa * cc) * cc
22 
23    if (tis0 > 0.0) then
24       p0iso=ps0*exp((tis0-ts0)/tlp)
25       cc=log(p0iso/ps0)
26       ziso=-(aa*cc+bb)*cc
27 
28       if (ref_height > ziso) then
29          ref_height=ziso+rovg*tis0*log(p0iso/pres)
30       end if
31    end if
32 
33 end subroutine da_ref_height
34 
35