da_ref_pres.inc

References to this file elsewhere.
1 subroutine da_ref_pres(height, ref_pres)
2 
3    !---------------------------------------------------------------------------
4    ! Purpose: To calculate the reference pressure from the height.
5    !---------------------------------------------------------------------------
6 
7    implicit none
8 
9    real, intent(in)  :: height
10    real, intent(out) :: ref_pres
11 
12    real, parameter :: rovg = gas_constant/gravity
13 
14    real :: aa, bb, cc, hh, htop, ziso, p0iso
15 
16    if (trace_use_frequent) call da_trace_entry("da_ref_pres")
17 
18    call da_ref_height(ptop, htop)
19 
20    bb = rovg * t0
21    aa = rovg * base_lapse * 0.5
22 
23    hh = min(htop, height)
24    cc = (-bb + sqrt(bb * bb - 4.0 * aa * hh))/(2.0*aa)
25    ref_pres = base_pres * exp(cc)
26 
27    if (base_temp > 0.0) then
28       p0iso=base_pres*exp((base_temp-t0)/base_lapse)
29       cc=log(p0iso/base_pres)
30       ziso=-(aa*cc+bb)*cc
31 
32       if (height > ziso) then
33          ref_pres = p0iso/exp((height-ziso)/(rovg*base_temp))
34       end if
35    end if
36 
37    if (trace_use_frequent) call da_trace_exit("da_ref_pres")
38 
39 end subroutine da_ref_pres
40 
41