Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_physics / da_transform_xtotpw.inc
blob2460bad1178ec64558e2ada406634a7dd037d563
1 subroutine da_transform_xtotpw(grid)
3    !---------------------------------------------------------------------
4    ! Purpose: weighted sum of vertical column
5    !---------------------------------------------------------------------
7    implicit none
8    
9    type (domain),  intent(inout) :: grid
11    integer :: i, j, k
13    real    :: pw
15    if (trace_use) call da_trace_entry("da_transform_xtotpw")
17    do j=jts, jte
18       do i=its, ite
19          pw = 0.0
20          do k=kts, kte
21             pw = pw + (grid%xb%hf(i,j,k+1)-grid%xb%hf(i,j,k)) &
22                     * (grid%xa%q(i,j,k)*grid%xb%rho(i,j,k) &
23                     +  grid%xb%q(i,j,k)*grid%xa%rho(i,j,k))
24          end do
26          ! To convert the unit of PW to cm:
27          grid%xa%tpw(i,j) = 0.1*pw
28       end do
29    end do
31    if (trace_use) call da_trace_exit("da_transform_xtotpw")
33 end subroutine da_transform_xtotpw