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    if (trace_use) call da_trace_entry("da_ref_height")
18 
19    aa = 0.5 * rovg * base_lapse
20    bb = rovg * t0
21 
22    cc = log(pres/base_pres)
23    ref_height = -(bb + aa * cc) * cc
24 
25    if (base_temp > 0.0) then
26       p0iso=base_pres*exp((base_temp-t0)/base_lapse)
27       cc=log(p0iso/base_pres)
28       ziso=-(aa*cc+bb)*cc
29 
30       if (ref_height > ziso) then
31          ref_height=ziso+rovg*base_temp*log(p0iso/pres)
32       end if
33    end if
34 
35    if (trace_use) call da_trace_exit("da_ref_height")
36 
37 end subroutine da_ref_height
38 
39