154 & LBi, UBi, LBj, UBj, LBij, UBij, &
155 & IminS, ImaxS, JminS, JmaxS, &
158 & rmask, umask, vmask, &
160# ifdef ADJUST_BOUNDARY
162 & ad_t_obc, ad_u_obc, ad_v_obc, &
164 & ad_ubar_obc, ad_vbar_obc, &
167# ifdef ADJUST_WSTRESS
168 & ad_ustr, ad_vstr, &
170# if defined ADJUST_STFLUX && defined SOLVE3D
174 & ad_t, ad_u, ad_v, &
176 & ad_ubar, ad_vbar, &
179# ifdef ADJUST_BOUNDARY
181 & tl_t_obc, tl_u_obc, tl_v_obc, &
183 & tl_ubar_obc, tl_vbar_obc, &
186# ifdef ADJUST_WSTRESS
187 & tl_ustr, tl_vstr, &
189# if defined ADJUST_STFLUX && defined SOLVE3D
193 & tl_t, tl_u, tl_v, &
195 & tl_ubar, tl_vbar, &
202 integer,
intent(in) :: ng, tile
203 integer,
intent(in) :: LBi, UBi, LBj, UBj, LBij, UBij
204 integer,
intent(in) :: IminS, ImaxS, JminS, JmaxS
205 integer,
intent(in) :: Ladj, Lini
209 real(r8),
intent(in) :: rmask(LBi:,LBj:)
210 real(r8),
intent(in) :: umask(LBi:,LBj:)
211 real(r8),
intent(in) :: vmask(LBi:,LBj:)
213# ifdef ADJUST_BOUNDARY
215 real(r8),
intent(inout) :: ad_t_obc(LBij:,:,:,:,:,:)
216 real(r8),
intent(inout) :: ad_u_obc(LBij:,:,:,:,:)
217 real(r8),
intent(inout) :: ad_v_obc(LBij:,:,:,:,:)
219 real(r8),
intent(inout) :: ad_ubar_obc(LBij:,:,:,:)
220 real(r8),
intent(inout) :: ad_vbar_obc(LBij:,:,:,:)
221 real(r8),
intent(inout) :: ad_zeta_obc(LBij:,:,:,:)
223# ifdef ADJUST_WSTRESS
224 real(r8),
intent(inout) :: ad_ustr(LBi:,LBj:,:,:)
225 real(r8),
intent(inout) :: ad_vstr(LBi:,LBj:,:,:)
227# if defined ADJUST_STFLUX && defined SOLVE3D
228 real(r8),
intent(inout) :: ad_tflux(LBi:,LBj:,:,:,:)
231 real(r8),
intent(inout) :: ad_t(LBi:,LBj:,:,:,:)
232 real(r8),
intent(inout) :: ad_u(LBi:,LBj:,:,:)
233 real(r8),
intent(inout) :: ad_v(LBi:,LBj:,:,:)
235 real(r8),
intent(inout) :: ad_ubar(LBi:,LBj:,:)
236 real(r8),
intent(inout) :: ad_vbar(LBi:,LBj:,:)
238 real(r8),
intent(inout) :: ad_zeta(LBi:,LBj:,:)
239# ifdef ADJUST_BOUNDARY
241 real(r8),
intent(inout) :: tl_t_obc(LBij:,:,:,:,:,:)
242 real(r8),
intent(inout) :: tl_u_obc(LBij:,:,:,:,:)
243 real(r8),
intent(inout) :: tl_v_obc(LBij:,:,:,:,:)
245 real(r8),
intent(inout) :: tl_ubar_obc(LBij:,:,:,:)
246 real(r8),
intent(inout) :: tl_vbar_obc(LBij:,:,:,:)
247 real(r8),
intent(inout) :: tl_zeta_obc(LBij:,:,:,:)
249# ifdef ADJUST_WSTRESS
250 real(r8),
intent(inout) :: tl_ustr(LBi:,LBj:,:,:)
251 real(r8),
intent(inout) :: tl_vstr(LBi:,LBj:,:,:)
253# if defined ADJUST_STFLUX && defined SOLVE3D
254 real(r8),
intent(inout) :: tl_tflux(LBi:,LBj:,:,:,:)
257 real(r8),
intent(inout) :: tl_t(LBi:,LBj:,:,:,:)
258 real(r8),
intent(inout) :: tl_u(LBi:,LBj:,:,:)
259 real(r8),
intent(inout) :: tl_v(LBi:,LBj:,:,:)
261 real(r8),
intent(inout) :: tl_ubar(LBi:,LBj:,:)
262 real(r8),
intent(inout) :: tl_vbar(LBi:,LBj:,:)
264 real(r8),
intent(inout) :: tl_zeta(LBi:,LBj:,:)
267 real(r8),
intent(in) :: rmask(LBi:UBi,LBj:UBj)
268 real(r8),
intent(in) :: umask(LBi:UBi,LBj:UBj)
269 real(r8),
intent(in) :: vmask(LBi:UBi,LBj:UBj)
271# ifdef ADJUST_BOUNDARY
273 real(r8),
intent(inout) :: ad_t_obc(LBij:UBij,N(ng),4, &
274 & Nbrec(ng),2,NT(ng))
275 real(r8),
intent(inout) :: ad_u_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
276 real(r8),
intent(inout) :: ad_v_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
278 real(r8),
intent(inout) :: ad_ubar_obc(LBij:UBij,4,Nbrec(ng),2)
279 real(r8),
intent(inout) :: ad_vbar_obc(LBij:UBij,4,Nbrec(ng),2)
280 real(r8),
intent(inout) :: ad_zeta_obc(LBij:UBij,4,Nbrec(ng),2)
282# ifdef ADJUST_WSTRESS
283 real(r8),
intent(inout) :: ad_ustr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
284 real(r8),
intent(inout) :: ad_vstr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
286# if defined ADJUST_STFLUX && defined SOLVE3D
287 real(r8),
intent(inout) :: ad_tflux(LBi:UBi,LBj:UBj, &
288 & Nfrec(ng),2,NT(ng))
291 real(r8),
intent(inout) :: ad_t(LBi:UBi,LBj:UBj,N(ng),3,NT(ng))
292 real(r8),
intent(inout) :: ad_u(LBi:UBi,LBj:UBj,N(ng),2)
293 real(r8),
intent(inout) :: ad_v(LBi:UBi,LBj:UBj,N(ng),2)
295 real(r8),
intent(inout) :: ad_ubar(LBi:UBi,LBj:UBj,:)
296 real(r8),
intent(inout) :: ad_vbar(LBi:UBi,LBj:UBj,:)
298 real(r8),
intent(inout) :: ad_zeta(LBi:UBi,LBj:UBj,:)
299# ifdef ADJUST_BOUNDARY
301 real(r8),
intent(inout) :: tl_t_obc(LBij:UBij,N(ng),4, &
302 & Nbrec(ng),2,NT(ng))
303 real(r8),
intent(inout) :: tl_u_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
304 real(r8),
intent(inout) :: tl_v_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
306 real(r8),
intent(inout) :: tl_ubar_obc(LBij:UBij,4,Nbrec(ng),2)
307 real(r8),
intent(inout) :: tl_vbar_obc(LBij:UBij,4,Nbrec(ng),2)
308 real(r8),
intent(inout) :: tl_zeta_obc(LBij:UBij,4,Nbrec(ng),2)
310# ifdef ADJUST_WSTRESS
311 real(r8),
intent(inout) :: tl_ustr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
312 real(r8),
intent(inout) :: tl_vstr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
314# if defined ADJUST_STFLUX && defined SOLVE3D
315 real(r8),
intent(inout) :: tl_tflux(LBi:UBi,LBj:UBj, &
316 & Nfrec(ng),2,NT(ng))
319 real(r8),
intent(inout) :: tl_t(LBi:UBi,LBj:UBj,N(ng),3,NT(ng))
320 real(r8),
intent(inout) :: tl_u(LBi:UBi,LBj:UBj,N(ng),2)
321 real(r8),
intent(inout) :: tl_v(LBi:UBi,LBj:UBj,N(ng),2)
323 real(r8),
intent(inout) :: tl_ubar(LBi:UBi,LBj:UBj,:)
324 real(r8),
intent(inout) :: tl_vbar(LBi:UBi,LBj:UBj,:)
326 real(r8),
intent(inout) :: tl_zeta(LBi:UBi,LBj:UBj,:)
331 integer :: Lwrk, i, j, lstr, ndefLCZ, outLoop, rec
336 real(r8) :: fac, fac1, fac2
339 real(r8),
dimension(0:NstateVar(ng)) :: dot
340 real(r8),
dimension(Ninner) :: DotProd
341 real(r8),
dimension(Ninner) :: bvector
342 real(r8),
dimension(Ninner) :: zgamma
344 character (len=256) :: ncname
346 character (len=*),
parameter :: MyFile = &
347 & __FILE__//
", ini_lanczos_tile"
349# include "set_bounds.h"
361 SELECT CASE (
lcz(ng)%IOtype)
364 &
'ndefADJ', ndeflcz)
366# if defined PIO_LIB && defined DISTRIBUTE
369 &
'ndefADJ', ndeflcz)
384 IF (ndeflcz.gt.0)
THEN
385 lstr=len_trim(
lcz(ng)%name)
386 WRITE (ncname,10)
lcz(ng)%name(1:lstr-8),
inner
387 10
FORMAT (a,
'_',i4.4,
'.nc')
397 & lbi, ubi, lbj, ubj, lbij, ubij, &
399 & ndeflcz,
lcz(ng)%ncid, &
400# if defined PIO_LIB && defined DISTRIBUTE
405 & rmask, umask, vmask, &
407# ifdef ADJUST_BOUNDARY
409 & tl_t_obc, tl_u_obc, tl_v_obc, &
411 & tl_ubar_obc, tl_vbar_obc, &
414# ifdef ADJUST_WSTRESS
415 & tl_ustr, tl_vstr, &
417# if defined ADJUST_STFLUX && defined SOLVE3D
421 & tl_t, tl_u, tl_v, &
423 & tl_ubar, tl_vbar, &
435 & lbi, ubi, lbj, ubj, lbij, ubij, &
438 & rmask, umask, vmask, &
440# ifdef ADJUST_BOUNDARY
442 & ad_t_obc(:,:,:,:,ladj,:), &
443 & tl_t_obc(:,:,:,:,lwrk,:), &
444 & ad_u_obc(:,:,:,:,ladj), &
445 & tl_u_obc(:,:,:,:,lwrk), &
446 & ad_v_obc(:,:,:,:,ladj), &
447 & tl_v_obc(:,:,:,:,lwrk), &
449 & ad_ubar_obc(:,:,:,ladj), &
450 & tl_ubar_obc(:,:,:,lwrk), &
451 & ad_vbar_obc(:,:,:,ladj), &
452 & tl_vbar_obc(:,:,:,lwrk), &
453 & ad_zeta_obc(:,:,:,ladj), &
454 & tl_zeta_obc(:,:,:,lwrk), &
456# ifdef ADJUST_WSTRESS
457 & ad_ustr(:,:,:,ladj), tl_ustr(:,:,:,lwrk), &
458 & ad_vstr(:,:,:,ladj), tl_vstr(:,:,:,lwrk), &
460# if defined ADJUST_STFLUX && defined SOLVE3D
461 & ad_tflux(:,:,:,ladj,:), &
462 & tl_tflux(:,:,:,lwrk,:), &
465 & ad_t(:,:,:,ladj,:), tl_t(:,:,:,lwrk,:), &
466 & ad_u(:,:,:,ladj), tl_u(:,:,:,lwrk), &
467 & ad_v(:,:,:,ladj), tl_v(:,:,:,lwrk), &
469 & ad_ubar(:,:,ladj), tl_ubar(:,:,lwrk), &
470 & ad_vbar(:,:,ladj), tl_vbar(:,:,lwrk), &
472 & ad_zeta(:,:,ladj), tl_zeta(:,:,lwrk))
476 dotprod(
inner)=dot(0)
498 bvector(1)=dotprod(1)/zbeta
500 zgamma(i)=
cg_beta(i,outloop)/zbeta
502 bvector(i)=(dotprod(i)-
cg_beta(i,outloop)*bvector(i-1))/zbeta
508 bvector(i)=bvector(i)-zgamma(i+1)*bvector(i+1)
520 & lbi, ubi, lbj, ubj, lbij, ubij, &
523 & rmask, umask, vmask, &
525# ifdef ADJUST_BOUNDARY
527 & tl_t_obc, tl_u_obc, tl_v_obc, &
529 & tl_ubar_obc, tl_vbar_obc, &
532# ifdef ADJUST_WSTRESS
533 & tl_ustr, tl_vstr, &
535# if defined ADJUST_STFLUX && defined SOLVE3D
539 & tl_t, tl_u, tl_v, &
541 & tl_ubar, tl_vbar, &
555 IF (ndeflcz.gt.0)
THEN
556 lstr=len_trim(
lcz(ng)%name)
557 WRITE (ncname,10)
lcz(ng)%name(1:lstr-8),
inner
562 & lbi, ubi, lbj, ubj, lbij, ubij, &
564 & ndeflcz,
lcz(ng)%ncid, &
565# if defined PIO_LIB && defined DISTRIBUTE
570 & rmask, umask, vmask, &
572# ifdef ADJUST_BOUNDARY
574 & ad_t_obc, ad_u_obc, ad_v_obc, &
576 & ad_ubar_obc, ad_vbar_obc, &
579# ifdef ADJUST_WSTRESS
580 & ad_ustr, ad_vstr, &
582# if defined ADJUST_STFLUX && defined SOLVE3D
586 & ad_t, ad_u, ad_v, &
588 & ad_ubar, ad_vbar, &
604 & lbi, ubi, lbj, ubj, lbij, ubij, &
605 & lini, lwrk, lini, fac1, fac2, &
607 & rmask, umask, vmask, &
609# ifdef ADJUST_BOUNDARY
611 & tl_t_obc, ad_t_obc, &
612 & tl_u_obc, ad_u_obc, &
613 & tl_v_obc, ad_v_obc, &
615 & tl_ubar_obc, ad_ubar_obc, &
616 & tl_vbar_obc, ad_vbar_obc, &
617 & tl_zeta_obc, ad_zeta_obc, &
619# ifdef ADJUST_WSTRESS
620 & tl_ustr, ad_ustr, &
621 & tl_vstr, ad_vstr, &
623# if defined ADJUST_STFLUX && defined SOLVE3D
624 & tl_tflux, ad_tflux, &
631 & tl_ubar, ad_ubar, &
632 & tl_vbar, ad_vbar, &