Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / da / da_chem_sfc / da_calculate_grady_chem_sfc.inc
blob6d21681ba9f6d786935f9f5982253201d11afc0a
1 subroutine da_calculate_grady_chem_sfc(iv, re, jo_grad_y)
3    !-------------------------------------------------------------------------
4    ! Purpose: Applies obs inverse on re-vector
5    !-------------------------------------------------------------------------
7    implicit none
9    type (iv_type), intent(in)     :: iv          ! Innovation vector.
10    type (y_type),  intent(inout)  :: re          ! Residual vector.
11    type (y_type),  intent(inout)  :: jo_grad_y   ! Grad_y(Jo)
13    integer                      :: n, ichem
15    if (trace_use_dull) call da_trace_entry("da_calculate_grady_chem_sfc")
17    do ichem = PARAM_FIRST_SCALAR ,num_chemic_surf
18    do n=1, iv%info(chemic_surf)%nlocal
19       if (iv%chemic_surf(n)%chem(ichem)%qc < obs_qc_pointer) re%chemic_surf(n)%chem(ichem) = 0.0
21       jo_grad_y%chemic_surf(n)%chem(ichem) = -re%chemic_surf(n)%chem(ichem) / &
22                                              (iv%chemic_surf(n)%chem(ichem)%error * iv%chemic_surf(n)%chem(ichem)%error)
23    end do
24    end do
26    if (trace_use_dull) call da_trace_exit("da_calculate_grady_chem_sfc")
27      
28 end subroutine da_calculate_grady_chem_sfc