Merge remote-tracking branch 'origin/release-v4.5.2'
[WRF.git] / var / da / da_physics / da_transform_xtowtq.inc
blob2f143bedcf0c208a16c7fa0eb7054563c9f95f87
1 subroutine da_transform_xtowtq (grid)
3    !--------------------------------------------------------------------------
4    ! Purpose: TBD
5    !--------------------------------------------------------------------------
6  
7    implicit none
9    type (domain), intent(inout) :: grid
11    integer :: i, j
12    real    :: height
14    if (trace_use) call da_trace_entry("da_transform_xtowtq")
16    !------------------------------------------------------------------------
17    ! [1.0] Calculate surface variable(1-m wind, 2-m moisture and temperature)
18    !------------------------------------------------------------------------
20    !------------------------------------------------------------------------
21    ! [2.0] Calculate sfc variable perturbations at the cross point
22    !------------------------------------------------------------------------
24    do j=jts, jte
25       do i=its, ite
26          grid%xa%tgrn(i,j) = 0.0
27          height = grid%xb%h(i,j,kts) - grid%xb%terr(i,j)                 
28          if (height <= 0.0) then
29             message(1) = "Negative height found"
30             write(unit=message(2),FMT='(2I6,A,F10.2,A,F10.2)') &
31                i,j,' ht = ',grid%xb%h(i,j,kts) ,' terr =  ',grid%xb%terr(i,j)
32             call da_error(__FILE__,__LINE__,message(1:2))
33          end if
34          call da_sfc_wtq_lin(grid%xb%psfc(i,j), grid%xb%tgrn(i,j), &
35             grid%xb%p(i,j,kts), grid%xb%t(i,j,kts), grid%xb%q(i,j,kts), &
36             grid%xb%u(i,j,kts), grid%xb%v(i,j,kts), &
37             grid%xb%regime(i,j), &
38             grid%xa%psfc(i,j), grid%xa%tgrn(i,j), &
39             grid%xa%p(i,j,kts), grid%xa%t(i,j,kts), grid%xa%q(i,j,kts), &
40             grid%xa%u(i,j,kts), grid%xa%v(i,j,kts), &
41             height      , grid%xb%rough(i,j), grid%xb%xland(i,j), grid%xb%ds, & ! Modified by Eric Chiang (AUG 2010)
42             grid%xa%u10(i,j), grid%xa%v10(i,j), &
43             grid%xa%t2(i,j),  grid%xa%q2(i,j))
44       end do
45    end do
47    if (trace_use) call da_trace_exit("da_transform_xtowtq")
49 end subroutine da_transform_xtowtq