updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / da / da_ssmi / da_jo_and_grady_ssmi_rv.inc
blob1e935136e61602d19668aee4368c89de0acc9737
1 subroutine da_jo_and_grady_ssmi_rv(iv, re, jo, jo_grad_y)
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
7    implicit none
9    type (iv_type), intent(in)    :: iv          ! Ob Inc. structure.
10    type (y_type),  intent(in)    :: re          ! Residual structure.
11    type (y_type),  intent(inout) :: jo_grad_y   ! Grad_y(Jo)
12    type (jo_type), intent(inout) :: jo          ! Obs cost function.
14    integer  :: n
16    if (trace_use) call da_trace_entry("da_jo_and_grady_ssmi_rv")
18    jo % ssmir_speed = 0.0
19    jo % ssmir_tpw   = 0.0
21    do n=1, iv%info(ssmi_rv)%nlocal
22       jo_grad_y%ssmi_rv(n)%speed = - re%ssmi_rv(n)%speed / &
23          (iv%ssmi_rv(n)%speed%error * iv%ssmi_rv(n)%speed%error)
25       jo_grad_y%ssmi_rv(n)%tpw = -re%ssmi_rv(n)%tpw / &
26           (iv%ssmi_rv(n)%tpw%error * iv%ssmi_rv(n)%tpw%error)
28       if (iv%info(ssmi_rv)%proc_domain(1,n)) then
30          jo%ssmir_speed = jo%ssmir_speed - re%ssmi_rv(n)%speed * jo_grad_y%ssmi_rv(n)%speed
31          jo%ssmir_tpw   = jo%ssmir_tpw   - re%ssmi_rv(n)%tpw   * jo_grad_y%ssmi_rv(n)%tpw
32       end if
33    end do
34    
35    jo % ssmir_speed = 0.5 * jo % ssmir_speed
36    jo % ssmir_tpw   = 0.5 * jo % ssmir_tpw
38    if (trace_use) call da_trace_exit("da_jo_and_grady_ssmi_rv")
40 end subroutine da_jo_and_grady_ssmi_rv