da_jo_and_grady_gpsref.inc

References to this file elsewhere.
1 subroutine da_jo_and_grady_gpsref( iv, re, jo, jo_grad_y)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    !----------------------------------------------------------------------
8    ! Called by da_minimisation/da_jo_and_grady.inc
9    !----------------------------------------------------------------------
10 
11    implicit none
12 
13    type(ob_type), intent(in)   :: iv          ! Innovation vector.
14    type(y_type), intent(in)    :: re          ! Residual vector.
15    type(y_type), intent(inout) :: jo_grad_y   ! Grad_y(Jo)
16    type(jo_type), intent(inout):: jo          ! Obs cost function.
17 
18    integer                      :: n, k
19 
20    jo % gpsref_ref = 0.0
21 
22    if (iv%num_GPSRef > 0) then
23       do n=1, iv%num_GPSRef
24          do k=1, iv%gpsref(n)%info%levels
25             jo_grad_y%GPSRef(n)%ref(k) = -re%GPSRef(n)%ref(k) / &
26                                   ( iv%GPSRef(n)%ref(k)%error * &
27                                      iv%GPSRef(n)%ref(k)%error)
28          end do
29 
30          if (iv%gpsref(n)%loc%proc_domain) then
31             do k=1, iv%gpsref(n)%info%levels
32                jo % gpsref_ref = jo % gpsref_ref - &
33                    re%GPSRef(n)%ref(k) * jo_grad_y%GPSRef(n)%ref(k)
34             end do
35          end if
36       end do
37       
38       jo % gpsref_ref = 0.5 * jo % gpsref_ref
39       
40    end if
41 
42 end subroutine da_jo_and_grady_gpsref
43 
44