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 (iv_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    if (trace_use_dull) call da_trace_entry("da_jo_and_grady_gpspw")
17 
18    jo % gpspw_tpw = 0.0
19 
20    if (iv%info(gpspw)%nlocal > 0) then
21       do n=1, iv%info(gpspw)%nlocal
22          jo_grad_y%gpspw(n)%tpw = -re%gpspw(n)%tpw / (iv%gpspw(n)%tpw%error * iv%gpspw(n)%tpw%error)
23 
24          if (iv%info(gpspw)%proc_domain(1,n)) then
25             jo % gpspw_tpw = jo % gpspw_tpw - re%gpspw(n)%tpw * jo_grad_y%gpspw(n)%tpw
26          end if
27       end do
28 
29       jo % gpspw_tpw = 0.5 * jo % gpspw_tpw
30    end if
31 
32    if (trace_use_dull) call da_trace_exit("da_jo_and_grady_gpspw")
33 
34 end subroutine da_jo_and_grady_gpspw
35 
36