Is there a bug in I4DVAR in case an observation lies exactly on the bottom-most rho point? In the vetting logic, there seems to be a logic bug around the cancellation of the background-extracted values at observation locations and the computation of the adjoint forcing. It might only occur if BGQC is undefined.
Consider the case where an observation lies exactly on the bottom-most rho point. The program flow for I4DVAR is something like:
Code: Select all
background(
wrtObsScale(ng)=.TRUE.
call main3d(
call output(
call obs_write(
CALL extract_obs3d(
IF ((Zobs(iobs).gt.0.0_r8).and.(Zobs(iobs).le.1.0_r8)) THEN
ObsVetting(iobs)=0.0_r8
! OBSVETTING IS SET TO ZERO, BECAUSE THE POINT LIES ON THE BOTTOM-MOST RHO POINT
END IF
)
ObsScale(iobs)=ObsVetting(iobs)
! OBSSCALE IS SET TO ZERO
NLmodVal(iobs)=ObsScale(iobs)*NLmodVal(iobs)
! NLMODVAL IS SET TO ZERO (!!!)
))))
increment(
call ad_main3d(
call ad_misfit(
ADmodVal(iobs)=ObsErr(iobs)*
(NLmodVal(iobs)+TLmodVal(iobs)-ObsVal(iobs))
! ADMODVAL IS SET TO OBSERR * (0-OBSVAL) (!!!)
ObsScale(ic)=ObsScaleGlobal(iobs)
! OBSSCALE IS SET TO 0
# ifdef BGQC
!
!-----------------------------------------------------------------------
! Reject observations that fail background quality control check.
!-----------------------------------------------------------------------
!
DO iobs=1,Nobs(ng)
ADmodVal(iobs)=ObsScale(iobs)*ADmodVal(iobs)
END DO
# endif
! IF BGQC IS DEFINED, THE BUG DOES NOT APPEAR SINCE ADJOINT FORCING IS SET TO ZERO