1 subroutine da_jo_and_grady_ships(iv, re, jo, jo_grad_y)
3 !-----------------------------------------------------------------------
5 !-----------------------------------------------------------------------
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.
16 if (trace_use_dull) call da_trace_entry("da_jo_and_grady_ships")
24 do n=1, iv%info(ships)%nlocal
25 jo_grad_y%ships(n)%u = -re%ships(n)%u / &
26 (iv%ships(n)%u%error * iv%ships(n)%u%error)
27 jo_grad_y%ships(n)%v = -re%ships(n)%v / &
28 (iv%ships(n)%v%error * iv%ships(n)%v%error)
29 jo_grad_y%ships(n)%t = -re%ships(n)%t / &
30 (iv%ships(n)%t%error * iv%ships(n)%t%error)
31 jo_grad_y%ships(n)%p = -re%ships(n)%p / &
32 (iv%ships(n)%p%error * iv%ships(n)%p%error)
33 jo_grad_y%ships(n)%q = -re%ships(n)%q / &
34 (iv%ships(n)%q%error * iv%ships(n)%q%error)
36 if (iv%info(ships)%proc_domain(1,n)) then
37 jo % ships_u = jo % ships_u - re%ships(n)%u * jo_grad_y%ships(n)%u
38 jo % ships_v = jo % ships_v - re%ships(n)%v * jo_grad_y%ships(n)%v
39 jo % ships_t = jo % ships_t - re%ships(n)%t * jo_grad_y%ships(n)%t
40 jo % ships_p = jo % ships_p - re%ships(n)%p * jo_grad_y%ships(n)%p
41 jo % ships_q = jo % ships_q - re%ships(n)%q * jo_grad_y%ships(n)%q
45 jo % ships_u = 0.5 * jo % ships_u
46 jo % ships_v = 0.5 * jo % ships_v
47 jo % ships_t = 0.5 * jo % ships_t
48 jo % ships_p = 0.5 * jo % ships_p
49 jo % ships_q = 0.5 * jo % ships_q
51 if (trace_use_dull) call da_trace_exit("da_jo_and_grady_ships")
53 end subroutine da_jo_and_grady_ships