4#if defined ADJOINT && defined FOUR_DVAR && defined OBSERVATIONS && \
38 integer,
intent(in) :: ng, tile, model
45 & lbi, ubi, lbj, ubj, &
46 & imins, imaxs, jmins, jmaxs, &
63 &
ocean(ng) % ad_ubar, &
64 &
ocean(ng) % ad_vbar, &
65 &
ocean(ng) % ad_zeta)
71 & LBi, UBi, LBj, UBj, &
72 & IminS, ImaxS, JminS, JmaxS, &
78 & rmask, umask, vmask, &
84 & ad_ubar, ad_vbar, ad_zeta)
104 integer,
intent(in) :: ng, tile, model
105 integer,
intent(in) :: LBi, UBi, LBj, UBj
106 integer,
intent(in) :: IminS, ImaxS, JminS, JmaxS
107 integer,
intent(in) :: kstp
109 integer,
intent(in) :: nstp
114 real(r8),
intent(in) :: rmask(LBi:,LBj:)
115 real(r8),
intent(in) :: umask(LBi:,LBj:)
116 real(r8),
intent(in) :: vmask(LBi:,LBj:)
119 real(r8),
intent(in) :: z_r(LBi:,LBj:,:)
120 real(r8),
intent(inout) :: z_v(LBi:,LBj:,:)
121 real(r8),
intent(inout) :: ad_u(LBi:,LBj:,:,:)
122 real(r8),
intent(inout) :: ad_v(LBi:,LBj:,:,:)
123 real(r8),
intent(inout) :: ad_t(LBi:,LBj:,:,:,:)
125 real(r8),
intent(inout) :: ad_ubar(LBi:,LBj:,:)
126 real(r8),
intent(inout) :: ad_vbar(LBi:,LBj:,:)
127 real(r8),
intent(inout) :: ad_zeta(LBi:,LBj:,:)
130 real(r8),
intent(in) :: rmask(LBi:UBi,LBj:UBj)
131 real(r8),
intent(in) :: umask(LBi:UBi,LBj:UBj)
132 real(r8),
intent(in) :: vmask(LBi:UBi,LBj:UBj)
135 real(r8),
intent(in) :: z_r(LBi:UBi,LBj:UBj,N(ng))
136 real(r8),
intent(inout) :: z_v(LBi:UBi,LBj:UBj,N(ng))
137 real(r8),
intent(inout) :: ad_u(LBi:UBi,LBj:UBj,N(ng),2)
138 real(r8),
intent(inout) :: ad_v(LBi:UBi,LBj:UBj,N(ng),2)
139 real(r8),
intent(inout) :: ad_t(LBi:UBi,LBj:UBj,N(ng),3,NT(ng))
141 real(r8),
intent(inout) :: ad_ubar(LBi:UBi,LBj:UBj,:)
142 real(r8),
intent(inout) :: ad_vbar(LBi:UBi,LBj:UBj,:)
143 real(r8),
intent(inout) :: ad_zeta(LBi:UBi,LBj:UBj,:)
148 integer :: ObsSum, ObsVoid
149 integer :: i, ic, ie, iobs, is, kfrc
151 integer :: itrc, j, k, nfrc
155 real(r8),
parameter :: IniVal = 0.0_r8
157 real(r8) :: ad_uradial(Mobs), ad_vradial(Mobs)
159# include "set_bounds.h"
233 & lbi, ubi, lbj, ubj, &
235 & mobs, 1,
nobs(ng), &
241 & ad_zeta(:,:,kfrc), &
254 & lbi, ubi, lbj, ubj, &
256 & mobs, 1,
nobs(ng), &
262 & ad_ubar(:,:,kfrc), &
275 & lbi, ubi, lbj, ubj, &
277 & mobs, 1,
nobs(ng), &
283 & ad_vbar(:,:,kfrc), &
300 z_v(i,j,k)=0.5_r8*(z_r(i-1,j,k)+ &
306 & lbi, ubi, lbj, ubj, 1, n(ng), &
308 & mobs, 1,
nobs(ng), &
314 & ad_u(:,:,:,nfrc), &
330 z_v(i,j,k)=0.5_r8*(z_r(i,j-1,k)+ &
336 & lbi, ubi, lbj, ubj, 1, n(ng), &
338 & mobs, 1,
nobs(ng), &
344 & ad_v(:,:,:,nfrc), &
356# ifdef RADIAL_ANGLE_CCW_EAST
387 ad_uradial(iobs)=inival
388 ad_vradial(iobs)=inival
392# ifdef RADIAL_ANGLE_CCW_EAST
395 ad_uradial(iobs)=ad_uradial(iobs)+ &
397 ad_vradial(iobs)=ad_vradial(iobs)+ &
400 ad_uradial(iobs)=ad_uradial(iobs)+ &
402 ad_vradial(iobs)=ad_vradial(iobs)+ &
408 ad_uradial(iobs)=ad_uradial(iobs)+ &
410 ad_vradial(iobs)=ad_vradial(iobs)+ &
413 ad_uradial(iobs)=ad_uradial(iobs)+ &
415 ad_vradial(iobs)=ad_vradial(iobs)+ &
424 z_v(i,j,k)=0.5_r8*(z_r(i,j-1,k)+ &
430 & lbi, ubi, lbj, ubj, 1, n(ng), &
432 & mobs, 1,
nobs(ng), &
438 & ad_v(:,:,:,nfrc), z_v, &
446 z_v(i,j,k)=0.5_r8*(z_r(i-1,j,k)+ &
452 & lbi, ubi, lbj, ubj, 1, n(ng), &
454 & mobs, 1,
nobs(ng), &
460 & ad_u(:,:,:,nfrc), z_v, &
474 & lbi, ubi, lbj, ubj, 1, n(ng), &
476 & mobs, 1,
nobs(ng), &
482 & ad_t(:,:,:,nfrc,itrc), &
552 IF (
domain(ng)%SouthWest_Test(tile))
THEN
558 IF (
fourdvar(ng)%ObsCount(i).gt.0)
THEN
561 & ie-is+1,
fourdvar(ng)%ObsReject(i)
563 obssum=obssum+
fourdvar(ng)%ObsCount(i)
564 obsvoid=obsvoid+
fourdvar(ng)%ObsReject(i)
567 WRITE (
stdout,20) obssum, obsvoid, &
572 10
FORMAT (10x,a,t25,4(1x,i10))
573 20
FORMAT (/,10x,
'Total',t47,2(1x,i10), &
574 & /,10x,
'Obs Tally',t47,2(1x,i10),/)
575 30
FORMAT (2x,
' AD_MISFIT - Added observations misfit ', &
576 &
'forcing,',t75,a,/,22x,
'(Observation ', &
577 &
'records = ',i0,
' - ',i0,
', iic = ',i0,
')')
subroutine ad_misfit(ng, tile, model)
subroutine ad_misfit_tile(ng, tile, model, lbi, ubi, lbj, ubj, imins, imaxs, jmins, jmaxs, kstp, nstp, rmask, umask, vmask, z_r, z_v, ad_u, ad_v, ad_t, ad_ubar, ad_vbar, ad_zeta)
type(t_fourdvar), dimension(:), allocatable fourdvar
integer, dimension(:), allocatable nobs
real(r8), dimension(:), allocatable obsvetting
integer, dimension(:), allocatable nobsvar
real(r8), dimension(:), allocatable obsval
real(r8), dimension(:), allocatable obsangler
real(r8), dimension(:), allocatable obsscale
real(r8), dimension(:), allocatable obserr
real(r8), dimension(:), allocatable obsmeta
integer, dimension(:), allocatable obstype
real(r8), dimension(:), allocatable admodval
real(r8), dimension(:), allocatable zobs
real(r8), dimension(:), allocatable nlmodval
real(dp), dimension(:), allocatable tobs
real(r8), dimension(:), allocatable xobs
integer, dimension(:), allocatable obsstate2type
real(r8), dimension(:), allocatable yobs
character(len=40), dimension(:), allocatable obsname
integer, dimension(:), allocatable nstrobs
logical, dimension(:), allocatable processobs
integer, dimension(:), allocatable nendobs
type(t_grid), dimension(:), allocatable grid
real(r8), dimension(:), allocatable rymin
real(r8), dimension(:), allocatable vymin
real(r8), dimension(:), allocatable rymax
real(r8), dimension(:), allocatable uymin
real(r8), dimension(:), allocatable vymax
real(r8), dimension(:), allocatable uxmin
real(r8), dimension(:), allocatable uxmax
real(r8), dimension(:), allocatable rxmax
integer, dimension(:), allocatable istvar
real(r8), dimension(:), allocatable uymax
real(r8), dimension(:), allocatable vxmin
real(r8), dimension(:), allocatable vxmax
real(r8), dimension(:), allocatable rxmin
type(t_ocean), dimension(:), allocatable ocean
type(t_domain), dimension(:), allocatable domain
integer, dimension(:), allocatable lm
integer, dimension(:), allocatable mm
integer, dimension(:), allocatable iic
real(dp), dimension(:), allocatable dt
character(len=22), dimension(:), allocatable time_code
real(dp), dimension(:), allocatable time
integer, dimension(:), allocatable kstp
integer, dimension(:), allocatable nstp