1 subroutine da_div_profile_adj(grid,jo_grad_x, info, n, k, ADJ_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 (x_type), intent(inout) :: jo_grad_x ! grad_x(jo)
15 type (domain), intent(in) :: grid
16 type (infa_type), intent(in) :: info
17 integer, intent(in) :: n, k
18 real, intent(out) :: ADJ_div
20 integer :: ii, jj ! index dimension.
22 integer :: i, j ! OBS location
23 real :: dx, dxm ! interpolation weights.
24 real :: dy, dym ! interpolation weights.
26 real :: ADJ_div_m(2,2)
28 if (trace_use_dull) call da_trace_entry ("da_div_profile_adj")
37 ! avoid the boundary mistake
38 if(i == its) i = its + 1
39 if(i == ite) i = ite - 1
40 if(j == jts) j = jts + 1
41 if(j == jte) j = jte - 1
43 ADJ_div_m(1,1) = dym*dxm * ADJ_div
44 ADJ_div_m(2,1) = dym*dx * ADJ_div
45 ADJ_div_m(1,2) = dy*dxm* ADJ_div
46 ADJ_div_m(2,2) = dy*dx* ADJ_div
51 coeff = grid%xb%map_factor(ii,jj) * grid%xb%map_factor(ii,jj)*0.5/grid%xb%ds
53 jo_grad_x%u(ii+1,jj,k) = jo_grad_x%u(ii+1,jj,k) + ADJ_div_m(ii-i+1,jj-j+1)/grid%xb%map_factor(ii+1,jj)*coeff
55 jo_grad_x%u(ii-1,jj,k) = jo_grad_x%u(ii-1,jj,k) - ADJ_div_m(ii-i+1,jj-j+1)/grid%xb%map_factor(ii-1,jj)*coeff
57 jo_grad_x%v(ii,jj+1,k) = jo_grad_x%v(ii,jj+1,k) + ADJ_div_m(ii-i+1,jj-j+1)/grid%xb%map_factor(ii,jj+1)*coeff
59 jo_grad_x%v(ii,jj-1,k) = jo_grad_x%v(ii,jj-1,k) - ADJ_div_m(ii-i+1,jj-j+1)/grid%xb%map_factor(ii,jj-1)*coeff
63 if (trace_use_dull) call da_trace_exit("da_div_profile_adj")
65 end subroutine da_div_profile_adj