Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_tools / da_set_boundary_xb.inc
blob6f18d4584a9156cd29009a15cc2017624a6a1f69
1 subroutine da_set_boundary_xb(grid)
3    !------------------------------------------------------------------------
4    ! Purpose:  
5    !
6    ! Merge East-West boundary values for the desired grid%xb-type variables 
7    !------------------------------------------------------------------------
9    implicit none
11    type (domain), intent(inout) :: grid       ! first guess state.
13    integer :: n, j, k
15    if ((its /= ids) .or. (ite /= ide)) return
17    if (trace_use) call da_trace_entry("da_set_boundary_xb")
19    ! 2d
20    k = kte + 1
21    do j=jms, jme
22       do n=1,bdyzone
23          grid%xb%lat(ids-n,j)        = grid%xb%lat(ide+1-n,j)
24          grid%xb%lon(ids-n,j)        = grid%xb%lon(ide+1-n,j)
25          grid%xb%cori(ids-n,j)       = grid%xb%cori(ide+1-n,j)
26          grid%xb%terr(ids-n,j)       = grid%xb%terr(ide+1-n,j)
27          grid%xb%psfc(ids-n,j)       = grid%xb%psfc(ide+1-n,j)
28          grid%xb%map_factor(ids-n,j) = grid%xb%map_factor(ide+1-n,j)
29          grid%xb%coefx(ids-n,j)      = grid%xb%coefx(ide+1-n,j)
30          grid%xb%coefy(ids-n,j)      = grid%xb%coefy(ide+1-n,j)
31          grid%xb%w(ids-n,j,k)        = grid%xb%w(ide+1-n,j,k)
32          ! grid%xb%h(ids-n,j,k)        = grid%xb%h(ide+1-n,j,k)
34          grid%xb%lat(ide+n,j)        = grid%xb%lat(ids-1+n,j)
35          grid%xb%lon(ide+n,j)        = grid%xb%lon(ids-1+n,j)
36          grid%xb%cori(ide+n,j)       = grid%xb%cori(ids-1+n,j)
37          grid%xb%terr(ide+n,j)       = grid%xb%terr(ids-1+n,j)
38          grid%xb%psfc(ide+n,j)       = grid%xb%psfc(ids-1+n,j)
39          grid%xb%map_factor(ide+n,j) = grid%xb%map_factor(ids-1+n,j)
40          grid%xb%coefx(ide+n,j)      = grid%xb%coefx(ids-1+n,j)
41          grid%xb%coefy(ide+n,j)      = grid%xb%coefy(ids-1+n,j)
42          grid%xb%w(ide+n,j,k)        = grid%xb%w(ids-1+n,j,k)
43          ! grid%xb%h(ide+n,j,k)        = grid%xb%h(ids-1+n,j,k)
45          ! Zhiquan Liu add some RTTOV variables
46          !--------------------------------------
47          grid%xb%t2(ide+n,j) = grid%xb%t2(ids-1+n,j)
48          grid%xb%q2(ide+n,j) = grid%xb%q2(ids-1+n,j)
49          grid%xb%u10(ide+n,j) = grid%xb%u10(ids-1+n,j)
50          grid%xb%v10(ide+n,j) = grid%xb%v10(ids-1+n,j)
51          grid%xb%tsk(ide+n,j) = grid%xb%tsk(ids-1+n,j)
52          grid%xb%tgrn(ide+n,j) = grid%xb%tgrn(ids-1+n,j)
53          grid%xb%landmask(ide+n,j) = grid%xb%landmask(ids-1+n,j)
54          grid%xb%snow(ide+n,j) = grid%xb%snow(ids-1+n,j)
55          grid%xb%xland(ide+n,j) = grid%xb%xland(ids-1+n,j)
57          grid%xb%smois(ide+n,j) = grid%xb%smois(ids-1+n,j)
58          grid%xb%tslb(ide+n,j) = grid%xb%tslb(ids-1+n,j)
59          grid%xb%xice(ide+n,j) = grid%xb%xice(ids-1+n,j)
60          grid%xb%ivgtyp(ide+n,j) = grid%xb%ivgtyp(ids-1+n,j)
61          grid%xb%isltyp(ide+n,j) = grid%xb%isltyp(ids-1+n,j)
62          grid%xb%vegfra(ide+n,j) = grid%xb%vegfra(ids-1+n,j)
63          grid%xb%snowh(ide+n,j) = grid%xb%snowh(ids-1+n,j)
65       end do
66    end do
68    ! 3d
69    do k=kts, kte
70       do j=jms, jme
71          do n=1,bdyzone
72             grid%xb%h(ids-n,j,k) = grid%xb%h(ide+1-n,j,k)
73             grid%xb%u(ids-n,j,k) = grid%xb%u(ide+1-n,j,k)
74             grid%xb%v(ids-n,j,k) = grid%xb%v(ide+1-n,j,k)
75             grid%xb%w(ids-n,j,k) = grid%xb%w(ide+1-n,j,k)
76             grid%xb%t(ids-n,j,k) = grid%xb%t(ide+1-n,j,k)
77             grid%xb%p(ids-n,j,k) = grid%xb%p(ide+1-n,j,k)
78             grid%xb%q(ids-n,j,k) = grid%xb%q(ide+1-n,j,k)
79             grid%xb%qs(ids-n,j,k) = grid%xb%qs(ide+1-n,j,k)
80             grid%xb%es(ids-n,j,k) = grid%xb%es(ide+1-n,j,k)
81             grid%xb%rh(ids-n,j,k) = grid%xb%rh(ide+1-n,j,k)
82             grid%xb%td(ids-n,j,k) = grid%xb%td(ide+1-n,j,k)
83             grid%xb%rho(ids-n,j,k)= grid%xb%rho(ide+1-n,j,k)
85             grid%xb%h(ide+n,j,k) = grid%xb%h(ids-1+n,j,k)
86             grid%xb%u(ide+n,j,k) = grid%xb%u(ids-1+n,j,k)
87             grid%xb%v(ide+n,j,k) = grid%xb%v(ids-1+n,j,k)
88             grid%xb%w(ide+n,j,k) = grid%xb%w(ids-1+n,j,k)
89             grid%xb%t(ide+n,j,k) = grid%xb%t(ids-1+n,j,k)
90             grid%xb%p(ide+n,j,k) = grid%xb%p(ids-1+n,j,k)
91             grid%xb%q(ide+n,j,k) = grid%xb%q(ids-1+n,j,k)
92             grid%xb%qs(ide+n,j,k) = grid%xb%qs(ids-1+n,j,k)
93             grid%xb%es(ide+n,j,k) = grid%xb%es(ids-1+n,j,k)
94             grid%xb%rh(ide+n,j,k) = grid%xb%rh(ids-1+n,j,k)
95             grid%xb%td(ide+n,j,k) = grid%xb%td(ids-1+n,j,k)
96             grid%xb%rho(ide+n,j,k) = grid%xb%rho(ids-1+n,j,k)
97          end do
98       end do
99    end do
101    if (trace_use) call da_trace_exit("da_set_boundary_xb")
103 end subroutine da_set_boundary_xb