da_jo_and_grady_gpspw.inc

References to this file elsewhere.
1 subroutine da_jo_and_grady_gpspw(iv, re, jo, jo_grad_y)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    type (ob_type), intent(in)   :: iv          ! Innovation vector.
10    type (y_type), intent(in)    :: re          ! Residual vector.
11    type (y_type), intent(inout) :: jo_grad_y   ! Grad_y(Jo)
12    type (jo_type), intent(inout):: jo          ! Obs cost function.
13 
14    integer                      :: n
15 
16    jo % gpspw_tpw = 0.0
17 
18    if (iv%num_Gpspw > 0) then
19       do n=1, iv%num_Gpspw
20          jo_grad_y%Gpspw(n)%tpw = -re%Gpspw(n)%tpw / &
21                                    (iv%Gpspw(n)%tpw%error * &
22                                      iv%Gpspw(n)%tpw%error)
23 
24          if (iv%gpspw(n)%loc%proc_domain) then
25            jo % gpspw_tpw = jo % gpspw_tpw - re%Gpspw(n)%tpw * &
26               jo_grad_y%Gpspw(n)%tpw
27          end if
28       end do
29 
30       jo % gpspw_tpw = 0.5 * jo % gpspw_tpw
31    end if
32 
33 end subroutine da_jo_and_grady_gpspw
34 
35