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(iv_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 if (trace_use_dull) call da_trace_entry("da_jo_and_grady_gpsref")
21
22 jo % gpsref_ref = 0.0
23
24 do n=1, iv%info(gpsref)%nlocal
25 do k=1, iv%info(gpsref)%levels(n)
26 jo_grad_y%gpsref(n)%ref(k) = -re%gpsref(n)%ref(k) / &
27 ( iv%gpsref(n)%ref(k)%error * iv%gpsref(n)%ref(k)%error)
28 end do
29
30 if (iv%info(gpsref)%proc_domain(1,n)) then
31 do k=1, iv%info(gpsref)%levels(n)
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
37 jo % gpsref_ref = 0.5 * jo % gpsref_ref
38 end do
39
40 if (trace_use_dull) call da_trace_exit("da_jo_and_grady_gpsref")
41
42 end subroutine da_jo_and_grady_gpsref
43
44