1 subroutine da_thickness(pre_ma,tv_ma,ks,ke,tv1,tv2,layer1,layer2,pre1,pre2,thk)
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 !-----------------------------------------------------------------------
11 integer,intent(in) :: layer1,layer2 ! two layers
12 real, intent(in) :: tv1,tv2 ! virtual temp.
13 real, intent(in) :: pre1,pre2 ! pressure
15 integer,intent(in) :: ks,ke
16 real, intent(in) :: pre_ma(ks-1:ke+1)
17 real, intent(in) :: tv_ma(ks-1:ke+1)
18 real, intent(out) :: thk ! thickness
21 real :: p_tmp(ks-1:ke+1)
23 if (trace_use_dull) call da_trace_entry("da_thickness")
25 ! Thickness at the top and bottom parts of the layer.
27 thk = 0.5 * gas_constant/gravity * (tv1*log(pre_ma(layer1-1)/pre1) + &
28 tv2*log(pre2/pre_ma(layer2)) )
33 p_tmp(layer2-1) = pre2
34 do k = layer2, layer1-1
38 ! Vertical integration of the virtual temperature
41 thk = thk + 0.5 * gas_constant/gravity * tv_ma(k) * log(p_tmp(k-1)/p_tmp(k+1))
44 if (trace_use_dull) call da_trace_exit("da_thickness")
46 end subroutine da_thickness