da_thickness.inc
References to this file elsewhere.
1 subroutine da_thickness(pre_ma,tv_ma,ks,ke,tv1,tv2,layer1,layer2,pre1,pre2,thk)
2
3 !-----------------------------------------------------------------------
4 ! Purpose: calculates the thickness between two layers
5 ! using vertical integration of virtual temperatures.
6 ! pre1 and pre2 are two pressures for the two layers
7 !-----------------------------------------------------------------------
8
9 implicit none
10
11 integer,intent(in) :: layer1,layer2 ! two layers
12 real,intent(in) :: tv1,tv2 ! virtual temp.
13 real,intent(in) :: pre1,pre2 ! pressure
14
15 integer,intent(in) :: ks,ke
16 real, dimension(ks-1:ke+1),intent(in) :: pre_ma,tv_ma ! Tv profile
17
18 real,intent(out) :: thk ! thickness
19
20
21 integer :: k
22 real, dimension(ks-1:ke+1) :: p_tmp
23
24 ! Thickness at the top and bottom parts of the layer.
25
26 thk = 0.5 * gas_constant/gravity * (tv1*log(pre_ma(layer1-1)/pre1) + &
27 tv2*log(pre2/pre_ma(layer2)) )
28
29 ! Temporary pressure
30
31 p_tmp(layer1) = pre1
32 p_tmp(layer2-1) = pre2
33 do k = layer2, layer1-1
34 p_tmp(k) = pre_ma(k)
35 end do
36
37 ! Vertical integration of the virtual temperature
38
39 do k=layer2,layer1-1
40 thk = thk + 0.5 * gas_constant/gravity * tv_ma(k) * &
41 log(p_tmp(k-1)/p_tmp(k+1))
42 end do
43
44 end subroutine da_thickness
45
46