1 subroutine da_jo_and_grady_chem_sfc(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 ! the following "global" objects are used only when testing
17 type (iv_type) :: iv_glob ! Global Innovation vector (O-B).
18 type (y_type) :: re_glob ! Global Residual vector (O-A).
19 type (y_type) :: jo_grad_y_glob ! Global Grad_y(Jo)
21 if (trace_use_dull) call da_trace_entry("da_jo_and_grady_chem_sfc")
23 jo % chemic_surf = 0.0
25 if (test_dm_exact) then
26 if (iv%info(chemic_surf)%ntotal == 0) then
27 if (trace_use_dull) call da_trace_exit("da_jo_and_grady_chem_sfc")
31 if (iv%info(chemic_surf)%nlocal < 1) then
32 if (trace_use_dull) call da_trace_exit("da_jo_and_grady_chem_sfc")
37 do ichem = PARAM_FIRST_SCALAR, num_chemic_surf
38 do n=1, iv%info(chemic_surf)%nlocal
39 jo_grad_y%chemic_surf(n)%chem(ichem) = -re%chemic_surf(n)%chem(ichem) / (iv%chemic_surf(n)%chem(ichem)%error * iv%chemic_surf(n)%chem(ichem)%error)
43 call da_jo_chem_sfc(iv, re, jo_grad_y, jo)
45 jo % chemic_surf = 0.5 * jo % chemic_surf
47 if (trace_use_dull) call da_trace_exit("da_jo_and_grady_chem_sfc")
49 end subroutine da_jo_and_grady_chem_sfc