updated top-level README and version_decl for V4.5 (#1847)
[WRF.git] / var / da / da_ssmi / da_jo_and_grady_ssmi_tb.inc
blobc31b620b8b0a605ed21d628380f457423601c7fd
1 subroutine da_jo_and_grady_ssmi_tb(iv, re, jo, jo_grad_y)
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
7    implicit none
9    type (iv_type), intent(in)    :: iv          ! Ob Inc. structure.
10    type (y_type),  intent(in)    :: re          ! Residual structure.
11    type (y_type),  intent(inout) :: jo_grad_y   ! Grad_y(Jo)
12    type (jo_type), intent(out)   :: jo          ! Obs cost function.
14    integer :: n
16    if (trace_use) call da_trace_entry("da_jo_and_grady_ssmi_tb")
18    jo % ssmi_tb19v = 0.0
19    jo % ssmi_tb19h = 0.0
20    jo % ssmi_tb22v = 0.0
21    jo % ssmi_tb37v = 0.0
22    jo % ssmi_tb37h = 0.0
23    jo % ssmi_tb85v = 0.0
24    jo % ssmi_tb85h = 0.0
26    do n=1, iv%info(ssmi_tb)%nlocal
28       jo_grad_y%ssmi_tb(n)%tb19v = - re%ssmi_tb(n)%tb19v / &
29          (iv%ssmi_tb(n)%tb19v%error * iv%ssmi_tb(n)%tb19v%error)
31       jo_grad_y%ssmi_tb(n)%tb19h = - re%ssmi_tb(n)%tb19h / &
32           (iv%ssmi_tb(n)%tb19h%error * iv%ssmi_tb(n)%tb19h%error)
34       jo_grad_y%ssmi_tb(n)%tb22v = - re%ssmi_tb(n)%tb22v / &
35          (iv%ssmi_tb(n)%tb22v%error * iv%ssmi_tb(n)%tb22v%error)
37       jo_grad_y%ssmi_tb(n)%tb37v = - re%ssmi_tb(n)%tb37v / &
38          (iv%ssmi_tb(n)%tb37v%error * iv%ssmi_tb(n)%tb37v%error)
40       jo_grad_y%ssmi_tb(n)%tb37h = - re%ssmi_tb(n)%tb37h / &
41          (iv%ssmi_tb(n)%tb37h%error * iv%ssmi_tb(n)%tb37h%error)
43       jo_grad_y%ssmi_tb(n)%tb85v = - re%ssmi_tb(n)%tb85v / &
44          (iv%ssmi_tb(n)%tb85v%error * iv%ssmi_tb(n)%tb85v%error)
46       jo_grad_y%ssmi_tb(n)%tb85h = - re%ssmi_tb(n)%tb85h / &
47          (iv%ssmi_tb(n)%tb85h%error * iv%ssmi_tb(n)%tb85h%error)
49       if (iv%info(ssmi_tb)%proc_domain(1,n)) then
50          jo % ssmi_tb19v = jo % ssmi_tb19v - re%ssmi_tb(n)%tb19v * jo_grad_y%ssmi_tb(n)%tb19v 
51          jo % ssmi_tb19h = jo % ssmi_tb19h - re%ssmi_tb(n)%tb19h * jo_grad_y%ssmi_tb(n)%tb19h
52          jo % ssmi_tb22v = jo % ssmi_tb22v - re%ssmi_tb(n)%tb22v * jo_grad_y%ssmi_tb(n)%tb22v
53          jo % ssmi_tb37v = jo % ssmi_tb37v - re%ssmi_tb(n)%tb37v * jo_grad_y%ssmi_tb(n)%tb37v
54          jo % ssmi_tb37h = jo % ssmi_tb37h - re%ssmi_tb(n)%tb37h * jo_grad_y%ssmi_tb(n)%tb37h
55          jo % ssmi_tb85v = jo % ssmi_tb85v - re%ssmi_tb(n)%tb85v * jo_grad_y%ssmi_tb(n)%tb85v
56          jo % ssmi_tb85h = jo % ssmi_tb85h - re%ssmi_tb(n)%tb85h * jo_grad_y%ssmi_tb(n)%tb85h
57       end if
58    end do
59    
60    jo % ssmi_tb19h = 0.5 * jo % ssmi_tb19h
61    jo % ssmi_tb19v = 0.5 * jo % ssmi_tb19v
62    jo % ssmi_tb22v = 0.5 * jo % ssmi_tb22v
63    jo % ssmi_tb37h = 0.5 * jo % ssmi_tb37h
64    jo % ssmi_tb37v = 0.5 * jo % ssmi_tb37v
65    jo % ssmi_tb85h = 0.5 * jo % ssmi_tb85h
66    jo % ssmi_tb85v = 0.5 * jo % ssmi_tb85v
68    if (trace_use) call da_trace_exit("da_jo_and_grady_ssmi_tb")
70 end subroutine da_jo_and_grady_ssmi_tb