1 subroutine da_jo_and_grady_bogus(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_bogus")
24 if (iv%info(bogus)%nlocal > 0) then
25 do n=1, iv%info(bogus)%nlocal
26 jo_grad_y%bogus(n)%slp = -re%bogus(n)%slp &
27 / (iv%bogus(n)%slp%error * iv%bogus(n)%slp%error)
28 do k=1, iv%info(bogus)%levels(n)
29 jo_grad_y%bogus(n)%u(k) = -re%bogus(n)%u(k) &
30 / (iv%bogus(n)%u(k)%error *iv%bogus(n)%u(k)%error)
31 jo_grad_y%bogus(n)%v(k) = -re%bogus(n)%v(k) &
32 /(iv%bogus(n)%v(k)%error * iv%bogus(n)%v(k)%error)
33 jo_grad_y%bogus(n)%t(k) = -re%bogus(n)%t(k) &
34 / (iv%bogus(n)%t(k)%error * iv%bogus(n)%t(k)%error)
35 jo_grad_y%bogus(n)%q(k) = -re%bogus(n)%q(k) &
36 / (iv%bogus(n)%q(k)%error * iv%bogus(n)%q(k)%error)
39 if (iv%info(bogus)%proc_domain(1,n)) then
40 jo%bogus_slp = jo%bogus_slp - re%bogus(n)%slp * jo_grad_y%bogus(n)%slp
42 do k=1, iv%info(bogus)%levels(n)
43 jo%bogus_u = jo%bogus_u - re%bogus(n)%u(k) * jo_grad_y%bogus(n)%u(k)
44 jo%bogus_v = jo%bogus_v - re%bogus(n)%v(k) * jo_grad_y%bogus(n)%v(k)
45 jo%bogus_t = jo%bogus_t - re%bogus(n)%t(k) * jo_grad_y%bogus(n)%t(k)
46 jo%bogus_q = jo%bogus_q - re%bogus(n)%q(k) * jo_grad_y%bogus(n)%q(k)
51 jo % bogus_slp = 0.5 * jo % bogus_slp
52 jo % bogus_u = 0.5 * jo % bogus_u
53 jo % bogus_v = 0.5 * jo % bogus_v
54 jo % bogus_t = 0.5 * jo % bogus_t
55 jo % bogus_q = 0.5 * jo % bogus_q
58 if (trace_use_dull) call da_trace_exit("da_jo_and_grady_bogus")
60 end subroutine da_jo_and_grady_bogus