updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / da / da_ssmi / da_transform_xtoseasfcwind_lin.inc
blob046e2402decfcee40d9920d5c4eb023ddc199167
1 subroutine da_transform_xtoseasfcwind_lin(grid)
3    !----------------------------------------------------------------------------
4    ! Purpose: Convert (U-V in m/s) components into wind speed (Speed in m/s)
5    !----------------------------------------------------------------------------
7    implicit none
9    type (domain), intent(inout) :: grid
11    real    :: const, rgh_fac, height
12    integer :: i, j, k
14    if (trace_use) call da_trace_entry("da_transform_xtoseasfcwind_lin")
16    const = log(10.0/0.0001)
17    k = grid%xb%kts
18     
19    do j=jts,jte
20       do i=its,ite
22         height = grid%xb%h(i,j,k) - grid%xb%terr(i,j)
23          if (height <= 0.0) then
24             message(1) = "Negative height found"
25             write(unit=message(2),FMT='(2I6,A,F10.2,A,F10.2)') &
26                i,j,' ht = ',grid%xb%h(i,j,k) ,' terr =  ',grid%xb%terr(i,j)
27             call da_error(__FILE__,__LINE__,message(1:2))
28          end if
30          rgh_fac = const/log(height/0.0001) ! roughness = 0.0001
31          grid%xa%speed(i,j) = (grid%xa%u(i,j,k)*grid%xb%u(i,j,k) &
32             + grid%xa%v(i,j,k)*grid%xb%v(i,j,k)) * rgh_fac*rgh_fac / grid%xb%speed(i,j)
33       end do
34    end do
36    if (trace_use) call da_trace_exit("da_transform_xtoseasfcwind_lin")
38 end subroutine da_transform_xtoseasfcwind_lin