1 subroutine da_jo_and_grady_airsr(iv, re, jo, jo_grad_y)
3 !-------------------------------------------------------------------------
4 ! Purpose: Calculates cost function and its gradient at all AIRS
6 !-------------------------------------------------------------------------
10 type (iv_type), intent(in) :: iv ! Innovation vector.
11 type (y_type), intent(in) :: re ! Residual vector.
12 type (y_type), intent(inout) :: jo_grad_y ! Grad_y(Jo)
13 type (jo_type), intent(inout) :: jo ! Obs cost function.
17 if (trace_use_dull) call da_trace_entry("da_jo_and_grady_airsr")
22 do n=1, iv%info(airsr)%nlocal
23 do k=1, iv%info(airsr)%levels(n)
24 jo_grad_y%airsr(n)%t(k) = -re%airsr(n)%t(k) / (iv%airsr(n)%t(k)%error * iv%airsr(n)%t(k)%error)
25 jo_grad_y%airsr(n)%q(k) = -re%airsr(n)%q(k) / (iv%airsr(n)%q(k)%error * iv%airsr(n)%q(k)%error)
28 if (iv%info(airsr)%proc_domain(1,n)) then
29 do k=1, iv%info(airsr)%levels(n)
30 jo % airsr_t = jo % airsr_t - re%airsr(n)%t(k) * jo_grad_y%airsr(n)%t(k)
31 jo % airsr_q = jo % airsr_q - re%airsr(n)%q(k) * jo_grad_y%airsr(n)%q(k)
36 jo % airsr_t = 0.5 * jo % airsr_t
37 jo % airsr_q = 0.5 * jo % airsr_q
39 if (trace_use_dull) call da_trace_exit("da_jo_and_grady_airsr")
41 end subroutine da_jo_and_grady_airsr