1 subroutine da_div_profile_tl(grid, info, n, k, div)
3 !--------------------------------------------------------------------------
4 ! Purpose: Calculates divergence (div) on each level at the observed location (i,j).
5 ! dx, dxm, dy, dym are horizontal interpolation weighting.
7 ! Div = m^2 *[---(---) + ---(---) ]
9 ! Authors: Z Chen (zchen@fjnu.edu.cn), Jenny Sun (NCAR), X Qie (IAP)
10 !--------------------------------------------------------------------------
14 type (domain), intent(in) :: grid
15 type (infa_type), intent(in) :: info
16 integer, intent(in) :: n, k
17 real, intent(inout) :: div
19 integer :: ii, jj ! index dimension.
20 real :: div_m(2,2) ! divergence
22 integer :: i, j ! OBS location
23 real :: dx, dxm ! interpolation weights.
24 real :: dy, dym ! interpolation weights.
27 if (trace_use_dull) call da_trace_entry("da_div_profile_tl")
36 ! calculate layered divergence
37 if(i == its) i = its + 1
38 if(i == ite) i = ite - 1
39 if(j == jts) j = jts + 1
40 if(j == jte) j = jte - 1
44 coeff = grid%xb%map_factor(ii,jj)*grid%xb%map_factor(ii,jj)*0.5/grid%xb%ds
46 div_m(ii-i+1,jj-j+1) = (grid%xa%u(ii+1,jj,k)/grid%xb%map_factor(ii+1,jj) - &
47 grid%xa%u(ii-1,jj,k)/grid%xb%map_factor(ii-1,jj) + &
48 grid%xa%v(ii,jj+1,k)/grid%xb%map_factor(ii,jj+1) - &
49 grid%xa%v(ii,jj-1,k)/grid%xb%map_factor(ii,jj-1))* coeff
53 ! Horizontal interpolation to the obs. pt.
54 div = dym*(dxm*div_m(1,1)+dx*div_m(2,1))+dy*(dxm*div_m(1,2)+dx*div_m(2,2))
56 if (trace_use_dull) call da_trace_exit("da_div_profile_tl")
58 end subroutine da_div_profile_tl