Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_physics / da_transform_xtoztd_lin.inc
blob0d2f768bee9ea0b339dd81bb8bfbcc8e729f8765
1 SUBROUTINE DA_Transform_XToZTD_Lin( grid )
3 !------------------------------------------------------------------------
4 !  Purpose: to compute the Zenith Total Delay, and save it to grid%xa%ztd.
6 !                                Yong-Run Guo  05/20/2008
7 !------------------------------------------------------------------------
9    implicit none
11    type (domain), intent(inout) :: grid
13    integer :: i, j, K
15    real    :: const, part, parta, term1, term2, wzd, hzd, zf
17 !--WEIGHTED SUM OF VERTICAL COLUMN
18    do j=jts, jte
19    do i=its, ite
21 ! Wet delay:
22       wzd = 0.0
23       do k=kts, kte
24         const  = (grid%xb%hf(i,j,k+1)-grid%xb%hf(i,j,k)) / a_ew
25         part   = grid%xb%p(i,j,k)*grid%xb%q(i,j,k) / grid%xb%t(i,j,k)
27         if ( consider_xap4ztd ) then
28            parta  = (grid%xb%q(i,j,k)*grid%xa%p(i,j,k) + grid%xb%p(i,j,k)*grid%xa%q(i,j,k) &
29                       - grid%xb%p(i,j,k)*grid%xb%q(i,j,k)*grid%xa%t(i,j,k) / grid%xb%t(i,j,k)) &
30                      / grid%xb%t(i,j,k)
31         else
32            parta  = ( grid%xb%p(i,j,k)*grid%xa%q(i,j,k) &
33                       - grid%xb%p(i,j,k)*grid%xb%q(i,j,k)*grid%xa%t(i,j,k) / grid%xb%t(i,j,k)) &
34                      / grid%xb%t(i,j,k)
35         end if
36         term1 = parta * const * wdk1
37         term2 = (parta * const * wdk2                                &
38                  - part * const * wdk2 * grid%xa%t(i,j,k) / grid%xb%t(i,j,k))  &
39                 / grid%xb%t(i,j,k)
40         wzd   = wzd + term1 + term2
41       enddo
43 ! Hydrostatic delay (Saastamoinen 1972):
44        zf = (1.0 - zdk2*cos(2.0*grid%xb%lat(i,j)*radian) - zdk3*grid%xb%terr(i,j))
45       hzd = zdk1 * grid%xa%psfc(i,j) / zf
47 !-----To save the ZTD in cm to ztd:
48       grid%xa%ztd(i,j) = (wzd + hzd) * 1.e2
49     enddo
50    enddo
52 END SUBROUTINE DA_Transform_XToZTD_Lin