214 & LBi, UBi, LBj, UBj, LBij, UBij, &
215 & IminS, ImaxS, JminS, JmaxS, &
216 & Lold, Lnew, outLoop, &
218 & rmask, umask, vmask, &
220# ifdef ADJUST_BOUNDARY
222 & t_obc_std, u_obc_std, v_obc_std, &
224 & ubar_obc_std, vbar_obc_std, &
227# ifdef ADJUST_WSTRESS
228 & sustr_std, svstr_std, &
230# if defined ADJUST_STFLUX && defined SOLVE3D
234 & t_std, u_std, v_std, &
235# if defined WEAK_CONSTRAINT && defined TIME_CONV
236 & ubar_std, vbar_std, &
239 & ubar_std, vbar_std, &
242# ifdef ADJUST_BOUNDARY
244 & nl_t_obc, nl_u_obc, nl_v_obc, &
246 & nl_ubar_obc, nl_vbar_obc, &
249# ifdef ADJUST_WSTRESS
250 & nl_ustr, nl_vstr, &
256 & nl_t, nl_u, nl_v, &
257# if defined WEAK_CONSTRAINT && defined TIME_CONV
258 & nl_ubar, nl_vbar, &
261 & nl_ubar, nl_vbar, &
264# ifdef ADJUST_BOUNDARY
266 & tl_t_obc, tl_u_obc, tl_v_obc, &
268 & tl_ubar_obc, tl_vbar_obc, &
271# ifdef ADJUST_WSTRESS
272 & tl_ustr, tl_vstr, &
278 & tl_t, tl_u, tl_v, &
279# if defined WEAK_CONSTRAINT && defined TIME_CONV
280 & tl_ubar, tl_vbar, &
283 & tl_ubar, tl_vbar, &
286# ifdef ADJUST_BOUNDARY
288 & ad_t_obc, ad_u_obc, ad_v_obc, &
290 & ad_ubar_obc, ad_vbar_obc, &
293# ifdef ADJUST_WSTRESS
294 & ad_ustr, ad_vstr, &
300 & ad_t, ad_u, ad_v, &
301# if defined WEAK_CONSTRAINT && defined TIME_CONV
302 & ad_ubar, ad_vbar, &
305 & ad_ubar, ad_vbar, &
312 integer,
intent(in) :: ng, tile, model
313 integer,
intent(in) :: LBi, UBi, LBj, UBj, LBij, UBij
314 integer,
intent(in) :: IminS, ImaxS, JminS, JmaxS
315 integer,
intent(in) :: Lold, Lnew, outLoop
319 real(r8),
intent(in) :: rmask(LBi:,LBj:)
320 real(r8),
intent(in) :: umask(LBi:,LBj:)
321 real(r8),
intent(in) :: vmask(LBi:,LBj:)
323# ifdef ADJUST_BOUNDARY
325 real(r8),
intent(in) :: t_obc_std(LBij:,:,:,:)
326 real(r8),
intent(in) :: u_obc_std(LBij:,:,:)
327 real(r8),
intent(in) :: v_obc_std(LBij:,:,:)
329 real(r8),
intent(in) :: ubar_obc_std(LBij:,:)
330 real(r8),
intent(in) :: vbar_obc_std(LBij:,:)
331 real(r8),
intent(in) :: zeta_obc_std(LBij:,:)
333# ifdef ADJUST_WSTRESS
334 real(r8),
intent(in) :: sustr_std(LBi:,LBj:)
335 real(r8),
intent(in) :: svstr_std(LBi:,LBj:)
337# if defined ADJUST_STFLUX && defined SOLVE3D
338 real(r8),
intent(in) :: stflx_std(LBi:,LBj:,:)
341 real(r8),
intent(in) :: t_std(LBi:,LBj:,:,:,:)
342 real(r8),
intent(in) :: u_std(LBi:,LBj:,:,:)
343 real(r8),
intent(in) :: v_std(LBi:,LBj:,:,:)
344# if defined WEAK_CONSTRAINT && defined TIME_CONV
345 real(r8),
intent(in) :: ubar_std(LBi:,LBj:,:)
346 real(r8),
intent(in) :: vbar_std(LBi:,LBj:,:)
349 real(r8),
intent(in) :: ubar_std(LBi:,LBj:,:)
350 real(r8),
intent(in) :: vbar_std(LBi:,LBj:,:)
352 real(r8),
intent(in) :: zeta_std(LBi:,LBj:,:)
353# ifdef ADJUST_BOUNDARY
355 real(r8),
intent(inout) :: ad_t_obc(LBij:,:,:,:,:,:)
356 real(r8),
intent(inout) :: ad_u_obc(LBij:,:,:,:,:)
357 real(r8),
intent(inout) :: ad_v_obc(LBij:,:,:,:,:)
359 real(r8),
intent(inout) :: ad_ubar_obc(LBij:,:,:,:)
360 real(r8),
intent(inout) :: ad_vbar_obc(LBij:,:,:,:)
361 real(r8),
intent(inout) :: ad_zeta_obc(LBij:,:,:,:)
363# ifdef ADJUST_WSTRESS
364 real(r8),
intent(inout) :: ad_ustr(LBi:,LBj:,:,:)
365 real(r8),
intent(inout) :: ad_vstr(LBi:,LBj:,:,:)
369 real(r8),
intent(inout) :: ad_tflux(LBi:,LBj:,:,:,:)
371 real(r8),
intent(inout) :: ad_t(LBi:,LBj:,:,:,:)
372 real(r8),
intent(inout) :: ad_u(LBi:,LBj:,:,:)
373 real(r8),
intent(inout) :: ad_v(LBi:,LBj:,:,:)
374# if defined WEAK_CONSTRAINT && defined TIME_CONV
375 real(r8),
intent(inout) :: ad_ubar(LBi:,LBj:,:)
376 real(r8),
intent(inout) :: ad_vbar(LBi:,LBj:,:)
379 real(r8),
intent(inout) :: ad_ubar(LBi:,LBj:,:)
380 real(r8),
intent(inout) :: ad_vbar(LBi:,LBj:,:)
382 real(r8),
intent(inout) :: ad_zeta(LBi:,LBj:,:)
383# ifdef ADJUST_BOUNDARY
385 real(r8),
intent(inout) :: nl_t_obc(LBij:,:,:,:,:,:)
386 real(r8),
intent(inout) :: nl_u_obc(LBij:,:,:,:,:)
387 real(r8),
intent(inout) :: nl_v_obc(LBij:,:,:,:,:)
389 real(r8),
intent(inout) :: nl_ubar_obc(LBij:,:,:,:)
390 real(r8),
intent(inout) :: nl_vbar_obc(LBij:,:,:,:)
391 real(r8),
intent(inout) :: nl_zeta_obc(LBij:,:,:,:)
393# ifdef ADJUST_WSTRESS
394 real(r8),
intent(inout) :: nl_ustr(LBi:,LBj:,:,:)
395 real(r8),
intent(inout) :: nl_vstr(LBi:,LBj:,:,:)
399 real(r8),
intent(inout) :: nl_tflux(LBi:,LBj:,:,:,:)
401 real(r8),
intent(inout) :: nl_t(LBi:,LBj:,:,:,:)
402 real(r8),
intent(inout) :: nl_u(LBi:,LBj:,:,:)
403 real(r8),
intent(inout) :: nl_v(LBi:,LBj:,:,:)
404# if defined WEAK_CONSTRAINT && defined TIME_CONV
405 real(r8),
intent(inout) :: nl_ubar(LBi:,LBj:,:)
406 real(r8),
intent(inout) :: nl_vbar(LBi:,LBj:,:)
409 real(r8),
intent(inout) :: nl_ubar(LBi:,LBj:,:)
410 real(r8),
intent(inout) :: nl_vbar(LBi:,LBj:,:)
412 real(r8),
intent(inout) :: nl_zeta(LBi:,LBj:,:)
413# ifdef ADJUST_BOUNDARY
415 real(r8),
intent(inout) :: tl_t_obc(LBij:,:,:,:,:,:)
416 real(r8),
intent(inout) :: tl_u_obc(LBij:,:,:,:,:)
417 real(r8),
intent(inout) :: tl_v_obc(LBij:,:,:,:,:)
419 real(r8),
intent(inout) :: tl_ubar_obc(LBij:,:,:,:)
420 real(r8),
intent(inout) :: tl_vbar_obc(LBij:,:,:,:)
421 real(r8),
intent(inout) :: tl_zeta_obc(LBij:,:,:,:)
423# ifdef ADJUST_WSTRESS
424 real(r8),
intent(inout) :: tl_ustr(LBi:,LBj:,:,:)
425 real(r8),
intent(inout) :: tl_vstr(LBi:,LBj:,:,:)
429 real(r8),
intent(inout) :: tl_tflux(LBi:,LBj:,:,:,:)
431 real(r8),
intent(inout) :: tl_t(LBi:,LBj:,:,:,:)
432 real(r8),
intent(inout) :: tl_u(LBi:,LBj:,:,:)
433 real(r8),
intent(inout) :: tl_v(LBi:,LBj:,:,:)
434# if defined WEAK_CONSTRAINT && defined TIME_CONV
435 real(r8),
intent(inout) :: tl_ubar(LBi:,LBj:,:)
436 real(r8),
intent(inout) :: tl_vbar(LBi:,LBj:,:)
439 real(r8),
intent(inout) :: tl_ubar(LBi:,LBj:,:)
440 real(r8),
intent(inout) :: tl_vbar(LBi:,LBj:,:)
442 real(r8),
intent(inout) :: tl_zeta(LBi:,LBj:,:)
447 real(r8),
intent(in) :: rmask(LBi:UBi,LBj:UBj)
448 real(r8),
intent(in) :: umask(LBi:UBi,LBj:UBj)
449 real(r8),
intent(in) :: vmask(LBi:UBi,LBj:UBj)
451# ifdef ADJUST_BOUNDARY
453 real(r8),
intent(in) :: t_obc_std(LBij:UBij,N(ng),4,NT(ng))
454 real(r8),
intent(in) :: u_obc_std(LBij:UBij,N(ng),4)
455 real(r8),
intent(in) :: v_obc_std(LBij:UBij,N(ng),4)
457 real(r8),
intent(in) :: ubar_obc_std(LBij:UBij,4)
458 real(r8),
intent(in) :: vbar_obc_std(LBij:UBij,4)
459 real(r8),
intent(in) :: zeta_obc_std(LBij:UBij,4)
461# ifdef ADJUST_WSTRESS
462 real(r8),
intent(in) :: sustr_std(LBi:,LBj:)
463 real(r8),
intent(in) :: svstr_std(LBi:,LBj:)
465# if defined ADJUST_STFLUX && defined SOLVE3D
466 real(r8),
intent(in) :: stflx_std(LBi:UBi,LBj:UBj,NT(ng))
469 real(r8),
intent(in) :: t_std(LBi:UBi,LBj:UBj,N(ng),NSA,NT(ng))
470 real(r8),
intent(in) :: u_std(LBi:UBi,LBj:UBj,N(ng),NSA)
471 real(r8),
intent(in) :: v_std(LBi:UBi,LBj:UBj,N(ng),NSA)
472# if defined WEAK_CONSTRAINT && defined TIME_CONV
473 real(r8),
intent(in) :: ubar_std(LBi:UBi,LBj:UBj,NSA)
474 real(r8),
intent(in) :: vbar_std(LBi:UBi,LBj:UBj,NSA)
477 real(r8),
intent(in) :: ubar_std(LBi:UBi,LBj:UBj,NSA)
478 real(r8),
intent(in) :: vbar_std(LBi:UBi,LBj:UBj,NSA)
480 real(r8),
intent(in) :: zeta_std(LBi:UBi,LBj:UBj,NSA)
481# ifdef ADJUST_BOUNDARY
483 real(r8),
intent(inout) :: ad_t_obc(LBij:UBij,N(ng),4, &
484 & Nbrec(ng),2,NT(ng))
485 real(r8),
intent(inout) :: ad_u_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
486 real(r8),
intent(inout) :: ad_v_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
488 real(r8),
intent(inout) :: ad_ubar_obc(LBij:UBij,4,Nbrec(ng),2)
489 real(r8),
intent(inout) :: ad_vbar_obc(LBij:UBij,4,Nbrec(ng),2)
490 real(r8),
intent(inout) :: ad_zeta_obc(LBij:UBij,4,Nbrec(ng),2)
492# ifdef ADJUST_WSTRESS
493 real(r8),
intent(inout) :: ad_ustr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
494 real(r8),
intent(inout) :: ad_vstr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
498 real(r8),
intent(inout) :: ad_tflux(LBi:UBi,LBj:UBj, &
499 & Nfrec(ng),2,NT(ng))
501 real(r8),
intent(inout) :: ad_t(LBi:UBi,LBj:UBj,N(ng),3,NT(ng))
502 real(r8),
intent(inout) :: ad_u(LBi:UBi,LBj:UBj,N(ng),2)
503 real(r8),
intent(inout) :: ad_v(LBi:UBi,LBj:UBj,N(ng),2)
504# if defined WEAK_CONSTRAINT && defined TIME_CONV
505 real(r8),
intent(inout) :: ad_ubar(LBi:UBi,LBj:UBj,:)
506 real(r8),
intent(inout) :: ad_vbar(LBi:UBi,LBj:UBj,:)
509 real(r8),
intent(inout) :: ad_ubar(LBi:UBi,LBj:UBj,:)
510 real(r8),
intent(inout) :: ad_vbar(LBi:UBi,LBj:UBj,:)
512 real(r8),
intent(inout) :: ad_zeta(LBi:UBi,LBj:UBj,:)
513# ifdef ADJUST_BOUNDARY
515 real(r8),
intent(inout) :: nl_t_obc(LBij:UBij,N(ng),4, &
516 & Nbrec(ng),2,NT(ng))
517 real(r8),
intent(inout) :: nl_u_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
518 real(r8),
intent(inout) :: nl_v_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
520 real(r8),
intent(inout) :: nl_ubar_obc(LBij:UBij,4,Nbrec(ng),2)
521 real(r8),
intent(inout) :: nl_vbar_obc(LBij:UBij,4,Nbrec(ng),2)
522 real(r8),
intent(inout) :: nl_zeta_obc(LBij:UBij,4,Nbrec(ng),2)
524# ifdef ADJUST_WSTRESS
525 real(r8),
intent(inout) :: nl_ustr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
526 real(r8),
intent(inout) :: nl_vstr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
530 real(r8),
intent(inout) :: nl_tflux(LBi:UBi,LBj:UBj, &
531 & Nfrec(ng),2,NT(ng))
533 real(r8),
intent(inout) :: nl_t(LBi:UBi,LBj:UBj,N(ng),3,NT(ng))
534 real(r8),
intent(inout) :: nl_u(LBi:UBi,LBj:UBj,N(ng),2)
535 real(r8),
intent(inout) :: nl_v(LBi:UBi,LBj:UBj,N(ng),2)
536# if defined WEAK_CONSTRAINT && defined TIME_CONV
537 real(r8),
intent(inout) :: nl_ubar(LBi:UBi,LBj:UBj,:)
538 real(r8),
intent(inout) :: nl_vbar(LBi:UBi,LBj:UBj,:)
541 real(r8),
intent(inout) :: nl_ubar(LBi:UBi,LBj:UBj,:)
542 real(r8),
intent(inout) :: nl_vbar(LBi:UBi,LBj:UBj,:)
544 real(r8),
intent(inout) :: nl_zeta(LBi:UBi,LBj:UBj,:)
545# ifdef ADJUST_BOUNDARY
547 real(r8),
intent(inout) :: tl_t_obc(LBij:UBij,N(ng),4, &
548 & Nbrec(ng),2,NT(ng))
549 real(r8),
intent(inout) :: tl_u_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
550 real(r8),
intent(inout) :: tl_v_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
552 real(r8),
intent(inout) :: tl_ubar_obc(LBij:UBij,4,Nbrec(ng),2)
553 real(r8),
intent(inout) :: tl_vbar_obc(LBij:UBij,4,Nbrec(ng),2)
554 real(r8),
intent(inout) :: tl_zeta_obc(LBij:UBij,4,Nbrec(ng),2)
556# ifdef ADJUST_WSTRESS
557 real(r8),
intent(inout) :: tl_ustr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
558 real(r8),
intent(inout) :: tl_vstr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
562 real(r8),
intent(inout) :: tl_tflux(LBi:UBi,LBj:UBj, &
563 & Nfrec(ng),2,NT(ng))
565 real(r8),
intent(inout) :: tl_t(LBi:UBi,LBj:UBj,N(ng),3,NT(ng))
566 real(r8),
intent(inout) :: tl_u(LBi:UBi,LBj:UBj,N(ng),2)
567 real(r8),
intent(inout) :: tl_v(LBi:UBi,LBj:UBj,N(ng),2)
568# if defined WEAK_CONSTRAINT && defined TIME_CONV
569 real(r8),
intent(inout) :: tl_ubar(LBi:UBi,LBj:UBj,:)
570 real(r8),
intent(inout) :: tl_vbar(LBi:UBi,LBj:UBj,:)
573 real(r8),
intent(inout) :: tl_ubar(LBi:UBi,LBj:UBj,:)
574 real(r8),
intent(inout) :: tl_vbar(LBi:UBi,LBj:UBj,:)
576 real(r8),
intent(inout) :: tl_zeta(LBi:UBi,LBj:UBj,:)
584 integer :: Linp, Lout, Lscale, Lwrk, Lwrk1, i, j, ic
585 integer :: info, ivec, jvec, rec
587 real(r8) :: fac, fac1, fac2
591 character (len=256) :: ncname
593# include "set_bounds.h"
600# if defined POSTERIOR_ERROR_I
602# elif defined POSTERIOR_ERROR_F
614 10
FORMAT (/,
' <<<< Full Posterior Error Covariance Matrix >>>>',/)
644 IF (
master)
WRITE (
stdout,*)
' Error in DPOTRF: info = ', info
657 IF (
master)
WRITE (
stdout,*)
' Error in DPOTRI: info = ', info
688 & lbi, ubi, lbj, ubj, lbij, ubij, &
691 & rmask, umask, vmask, &
693# ifdef ADJUST_BOUNDARY
695 & tl_t_obc, tl_u_obc, tl_v_obc, &
697 & tl_ubar_obc, tl_vbar_obc, &
700# ifdef ADJUST_WSTRESS
701 & tl_ustr, tl_vstr, &
707 & tl_t, tl_u, tl_v, &
709 & tl_ubar, tl_vbar, &
725 & lbi, ubi, lbj, ubj, lbij, ubij, &
727 & 0,
hss(ng)%ncid, ncname, &
729 & rmask, umask, vmask, &
731# ifdef ADJUST_BOUNDARY
733 & ad_t_obc, ad_u_obc, ad_v_obc, &
735 & ad_ubar_obc, ad_vbar_obc, &
738# ifdef ADJUST_WSTRESS
739 & ad_ustr, ad_vstr, &
745 & ad_t, ad_u, ad_v, &
747 & ad_ubar, ad_vbar, &
755 & lbi, ubi, lbj, ubj, lbij, ubij, &
757 & rmask, umask, vmask, &
759# ifdef ADJUST_BOUNDARY
761 & ad_t_obc(:,:,:,:,l1,:), &
762 & ad_t_obc(:,:,:,:,l1,:), &
763 & nl_t_obc(:,:,:,:,l1,:), &
764 & ad_u_obc(:,:,:,:,l1), &
765 & ad_u_obc(:,:,:,:,l1), &
766 & nl_u_obc(:,:,:,:,l1), &
767 & ad_v_obc(:,:,:,:,l1), &
768 & ad_v_obc(:,:,:,:,l1), &
769 & nl_v_obc(:,:,:,:,l1), &
771 & ad_ubar_obc(:,:,:,l1), &
772 & ad_ubar_obc(:,:,:,l1), &
773 & nl_ubar_obc(:,:,:,l1), &
774 & ad_vbar_obc(:,:,:,l1), &
775 & ad_vbar_obc(:,:,:,l1), &
776 & nl_vbar_obc(:,:,:,l1), &
777 & ad_zeta_obc(:,:,:,l1), &
778 & ad_zeta_obc(:,:,:,l1), &
779 & nl_zeta_obc(:,:,:,l1), &
781# ifdef ADJUST_WSTRESS
782 & ad_ustr(:,:,:,l1), &
783 & ad_ustr(:,:,:,l1), &
784 & nl_ustr(:,:,:,l1), &
785 & ad_vstr(:,:,:,l1), &
786 & ad_vstr(:,:,:,l1), &
787 & nl_vstr(:,:,:,l1), &
791 & ad_tflux(:,:,:,l1,:), &
792 & ad_tflux(:,:,:,l1,:), &
793 & nl_tflux(:,:,:,l1,:), &
795 & ad_t(:,:,:,l1,:), &
796 & ad_t(:,:,:,l1,:), &
797 & nl_t(:,:,:,l1,:), &
822 & lbi, ubi, lbj, ubj, lbij, ubij, &
823 & l1, l1, l1, fac1, fac2, &
825 & rmask, umask, vmask, &
827# ifdef ADJUST_BOUNDARY
829 & tl_t_obc, nl_t_obc, &
830 & tl_u_obc, nl_u_obc, &
831 & tl_v_obc, nl_v_obc, &
833 & tl_ubar_obc, nl_ubar_obc, &
834 & tl_vbar_obc, nl_vbar_obc, &
835 & tl_zeta_obc, nl_zeta_obc, &
837# ifdef ADJUST_WSTRESS
838 & tl_ustr, nl_ustr, &
839 & tl_vstr, nl_vstr, &
843 & tl_tflux, nl_tflux, &
848# if defined WEAK_CONSTRAINT && defined TIME_CONV
849 & tl_ubar, nl_ubar, &
850 & tl_vbar, nl_vbar, &
853 & tl_ubar, nl_ubar, &
854 & tl_vbar, nl_vbar, &
865 & lbi, ubi, lbj, ubj, lbij, ubij, &
867 & 0,
hss(ng)%ncid, ncname, &
869 & rmask, umask, vmask, &
871# ifdef ADJUST_BOUNDARY
873 & ad_t_obc, ad_u_obc, ad_v_obc, &
875 & ad_ubar_obc, ad_vbar_obc, &
878# ifdef ADJUST_WSTRESS
879 & ad_ustr, ad_vstr, &
885 & ad_t, ad_u, ad_v, &
887 & ad_ubar, ad_vbar, &
895 & lbi, ubi, lbj, ubj, lbij, ubij, &
897 & rmask, umask, vmask, &
899# ifdef ADJUST_BOUNDARY
901 & ad_t_obc(:,:,:,:,l1,:), &
902 & ad_t_obc(:,:,:,:,l2,:), &
903 & nl_t_obc(:,:,:,:,l1,:), &
904 & ad_u_obc(:,:,:,:,l1), &
905 & ad_u_obc(:,:,:,:,l2), &
906 & nl_u_obc(:,:,:,:,l1), &
907 & ad_v_obc(:,:,:,:,l1), &
908 & ad_v_obc(:,:,:,:,l2), &
909 & nl_v_obc(:,:,:,:,l1), &
911 & ad_ubar_obc(:,:,:,l1), &
912 & ad_ubar_obc(:,:,:,l2), &
913 & nl_ubar_obc(:,:,:,l1), &
914 & ad_vbar_obc(:,:,:,l1), &
915 & ad_vbar_obc(:,:,:,l2), &
916 & nl_vbar_obc(:,:,:,l1), &
917 & ad_zeta_obc(:,:,:,l1), &
918 & ad_zeta_obc(:,:,:,l2), &
919 & nl_zeta_obc(:,:,:,l1), &
921# ifdef ADJUST_WSTRESS
922 & ad_ustr(:,:,:,l1), &
923 & ad_ustr(:,:,:,l2), &
924 & nl_ustr(:,:,:,l1), &
925 & ad_vstr(:,:,:,l1), &
926 & ad_vstr(:,:,:,l2), &
927 & nl_vstr(:,:,:,l1), &
931 & ad_tflux(:,:,:,l1,:), &
932 & ad_tflux(:,:,:,l2,:), &
933 & nl_tflux(:,:,:,l1,:), &
935 & ad_t(:,:,:,l1,:), &
936 & ad_t(:,:,:,l2,:), &
937 & nl_t(:,:,:,l1,:), &
962 & lbi, ubi, lbj, ubj, lbij, ubij, &
963 & l1, l1, l1, fac1, fac2, &
965 & rmask, umask, vmask, &
967# ifdef ADJUST_BOUNDARY
969 & tl_t_obc, nl_t_obc, &
970 & tl_u_obc, nl_u_obc, &
971 & tl_v_obc, nl_v_obc, &
973 & tl_ubar_obc, nl_ubar_obc, &
974 & tl_vbar_obc, nl_vbar_obc, &
975 & tl_zeta_obc, nl_zeta_obc, &
977# ifdef ADJUST_WSTRESS
978 & tl_ustr, nl_ustr, &
979 & tl_vstr, nl_vstr, &
983 & tl_tflux, nl_tflux, &
988# if defined WEAK_CONSTRAINT && defined TIME_CONV
989 & tl_ubar, nl_ubar, &
990 & tl_vbar, nl_vbar, &
993 & tl_ubar, nl_ubar, &
994 & tl_vbar, nl_vbar, &
1004 & lbi, ubi, lbj, ubj, lbij, ubij, &
1007 & rmask, umask, vmask, &
1009# ifdef ADJUST_BOUNDARY
1011 & t_obc_std, u_obc_std, v_obc_std, &
1013 & ubar_obc_std, vbar_obc_std, zeta_obc_std, &
1015# ifdef ADJUST_WSTRESS
1016 & sustr_std, svstr_std, &
1019# ifdef ADJUST_STFLUX
1022 & t_std, u_std, v_std, &
1024 & ubar_std, vbar_std, &
1027# ifdef ADJUST_BOUNDARY
1029 & tl_t_obc, tl_u_obc, tl_v_obc, &
1031 & tl_ubar_obc, tl_vbar_obc, tl_zeta_obc, &
1033# ifdef ADJUST_WSTRESS
1034 & tl_ustr, tl_vstr, &
1037# ifdef ADJUST_STFLUX
1040 & tl_t, tl_u, tl_v, &
1042 & tl_ubar, tl_vbar, &
1051 & LBi, UBi, LBj, UBj, LBij, UBij, &
1054 & rmask, umask, vmask, &
1056# ifdef ADJUST_BOUNDARY
1058 & t_obc_std, u_obc_std, v_obc_std, &
1060 & ubar_obc_std, vbar_obc_std, &
1063# ifdef ADJUST_WSTRESS
1064 & sustr_std, svstr_std, &
1067# ifdef ADJUST_STFLUX
1070 & t_std, u_std, v_std, &
1072 & ubar_std, vbar_std, &
1075# ifdef ADJUST_BOUNDARY
1077 & s1_t_obc, s1_u_obc, s1_v_obc, &
1079 & s1_ubar_obc, s1_vbar_obc, &
1082# ifdef ADJUST_WSTRESS
1083 & s1_sustr, s1_svstr, &
1086# ifdef ADJUST_STFLUX
1089 & s1_t, s1_u, s1_v, &
1091 & s1_ubar, s1_vbar, &
1098 integer,
intent(in) :: ng, tile, model, Lout
1099 integer,
intent(in) :: LBi, UBi, LBj, UBj, LBij, UBij
1100 logical,
intent(in) :: Lweak
1102# ifdef ASSUMED_SHAPE
1104 real(r8),
intent(in) :: rmask(LBi:,LBj:)
1105 real(r8),
intent(in) :: umask(LBi:,LBj:)
1106 real(r8),
intent(in) :: vmask(LBi:,LBj:)
1108# ifdef ADJUST_BOUNDARY
1110 real(r8),
intent(inout) :: s1_t_obc(LBij:,:,:,:,:,:)
1111 real(r8),
intent(inout) :: s1_u_obc(LBij:,:,:,:,:)
1112 real(r8),
intent(inout) :: s1_v_obc(LBij:,:,:,:,:)
1114 real(r8),
intent(inout) :: s1_ubar_obc(LBij:,:,:,:)
1115 real(r8),
intent(inout) :: s1_vbar_obc(LBij:,:,:,:)
1116 real(r8),
intent(inout) :: s1_zeta_obc(LBij:,:,:,:)
1118# ifdef ADJUST_WSTRESS
1119 real(r8),
intent(inout) :: s1_sustr(LBi:,LBj:,:,:)
1120 real(r8),
intent(inout) :: s1_svstr(LBi:,LBj:,:,:)
1123# ifdef ADJUST_STFLUX
1124 real(r8),
intent(inout) :: s1_tflux(LBi:,LBj:,:,:,:)
1126 real(r8),
intent(inout) :: s1_t(LBi:,LBj:,:,:,:)
1127 real(r8),
intent(inout) :: s1_u(LBi:,LBj:,:,:)
1128 real(r8),
intent(inout) :: s1_v(LBi:,LBj:,:,:)
1130 real(r8),
intent(inout) :: s1_ubar(LBi:,LBj:,:)
1131 real(r8),
intent(inout) :: s1_vbar(LBi:,LBj:,:)
1133 real(r8),
intent(inout) :: s1_zeta(LBi:,LBj:,:)
1134# ifdef ADJUST_BOUNDARY
1136 real(r8),
intent(in) :: t_obc_std(LBij:,:,:,:)
1137 real(r8),
intent(in) :: u_obc_std(LBij:,:,:)
1138 real(r8),
intent(in) :: v_obc_std(LBij:,:,:)
1140 real(r8),
intent(in) :: ubar_obc_std(LBij:,:)
1141 real(r8),
intent(in) :: vbar_obc_std(LBij:,:)
1142 real(r8),
intent(in) :: zeta_obc_std(LBij:,:)
1144# ifdef ADJUST_WSTRESS
1145 real(r8),
intent(in) :: sustr_std(LBi:,LBj:)
1146 real(r8),
intent(in) :: svstr_std(LBi:,LBj:)
1148# if defined ADJUST_STFLUX && defined SOLVE3D
1149 real(r8),
intent(in) :: stflx_std(LBi:,LBj:,:)
1152 real(r8),
intent(in) :: t_std(LBi:,LBj:,:,:,:)
1153 real(r8),
intent(in) :: u_std(LBi:,LBj:,:,:)
1154 real(r8),
intent(in) :: v_std(LBi:,LBj:,:,:)
1156 real(r8),
intent(in) :: ubar_std(LBi:,LBj:,:)
1157 real(r8),
intent(in) :: vbar_std(LBi:,LBj:,:)
1159 real(r8),
intent(in) :: zeta_std(LBi:,LBj:,:)
1164 real(r8),
intent(in) :: rmask(LBi:UBi,LBj:UBj)
1165 real(r8),
intent(in) :: umask(LBi:UBi,LBj:UBj)
1166 real(r8),
intent(in) :: vmask(LBi:UBi,LBj:UBj)
1169# ifdef ADJUST_BOUNDARY
1171 real(r8),
intent(inout) :: s1_t_obc(LBij:UBij,N(ng),4, &
1172 & Nbrec(ng),2,NT(ng))
1173 real(r8),
intent(inout) :: s1_u_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
1174 real(r8),
intent(inout) :: s1_v_obc(LBij:UBij,N(ng),4,Nbrec(ng),2)
1176 real(r8),
intent(inout) :: s1_ubar_obc(LBij:UBij,4,Nbrec(ng),2)
1177 real(r8),
intent(inout) :: s1_vbar_obc(LBij:UBij,4,Nbrec(ng),2)
1178 real(r8),
intent(inout) :: s1_zeta_obc(LBij:UBij,4,Nbrec(ng),2)
1180# ifdef ADJUST_WSTRESS
1181 real(r8),
intent(inout) :: s1_sustr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
1182 real(r8),
intent(inout) :: s1_svstr(LBi:UBi,LBj:UBj,Nfrec(ng),2)
1185# ifdef ADJUST_STFLUX
1186 real(r8),
intent(inout) :: s1_tflux(LBi:UBi,LBj:UBj, &
1187 & Nfrec(ng),2,NT(ng))
1189 real(r8),
intent(inout) :: s1_t(LBi:UBi,LBj:UBj,N(ng),3,NT(ng))
1190 real(r8),
intent(inout) :: s1_u(LBi:UBi,LBj:UBj,N(ng),2)
1191 real(r8),
intent(inout) :: s1_v(LBi:UBi,LBj:UBj,N(ng),2)
1193 real(r8),
intent(inout) :: s1_ubar(LBi:UBi,LBj:UBj,:)
1194 real(r8),
intent(inout) :: s1_vbar(LBi:UBi,LBj:UBj,:)
1196 real(r8),
intent(inout) :: s1_zeta(LBi:UBi,LBj:UBj,:)
1197# ifdef ADJUST_BOUNDARY
1199 real(r8),
intent(in) :: t_obc_std(LBij:UBij,N(ng),4,NT(ng))
1200 real(r8),
intent(in) :: u_obc_std(LBij:UBij,N(ng),4)
1201 real(r8),
intent(in) :: v_obc_std(LBij:UBij,N(ng),4)
1203 real(r8),
intent(in) :: ubar_obc_std(LBij:UBij,4)
1204 real(r8),
intent(in) :: vbar_obc_std(LBij:UBij,4)
1205 real(r8),
intent(in) :: zeta_obc_std(LBij:UBij,4)
1207# ifdef ADJUST_WSTRESS
1208 real(r8),
intent(in) :: sustr_std(LBi:,LBj:)
1209 real(r8),
intent(in) :: svstr_std(LBi:,LBj:)
1211# if defined ADJUST_STFLUX && defined SOLVE3D
1212 real(r8),
intent(in) :: stflx_std(LBi:UBi,LBj:UBj,NT(ng))
1215 real(r8),
intent(in) :: t_std(LBi:UBi,LBj:UBj,N(ng),NSA,NT(ng))
1216 real(r8),
intent(in) :: u_std(LBi:UBi,LBj:UBj,N(ng),NSA)
1217 real(r8),
intent(in) :: v_std(LBi:UBi,LBj:UBj,N(ng),NSA)
1219 real(r8),
intent(in) :: ubar_std(LBi:UBi,LBj:UBj,NSA)
1220 real(r8),
intent(in) :: vbar_std(LBi:UBi,LBj:UBj,NSA)
1222 real(r8),
intent(in) :: zeta_std(LBi:UBi,LBj:UBj,NSA)
1227 integer :: NSUB, i, j, k
1228 integer :: ir, it, rec
1232# include "set_bounds.h"
1252 cff=zeta_std(i,j,rec)*zeta_std(i,j,rec)- &
1257 s1_zeta(i,j,lout)=cff
1261# ifdef ADJUST_BOUNDARY
1268 &
domain(ng)%Western_Edge(tile))
THEN
1270 cff=zeta_obc_std(j,
iwest)*zeta_obc_std(j,
iwest)- &
1271 & s1_zeta_obc(j,
iwest,ir,lout)
1273 cff=cff*rmask(istr-1,j)
1275 s1_zeta_obc(j,
iwest,ir,lout)=cff
1279 &
domain(ng)%Eastern_Edge(tile))
THEN
1281 cff=zeta_obc_std(j,
ieast)*zeta_obc_std(j,
ieast)- &
1282 & s1_zeta_obc(j,
ieast,ir,lout)
1284 cff=cff*rmask(iend+1,j)
1286 s1_zeta_obc(j,
ieast,ir,lout)=cff
1290 &
domain(ng)%Southern_Edge(tile))
THEN
1293 & s1_zeta_obc(i,
isouth,ir,lout)
1295 cff=cff*rmask(i,jstr-1)
1297 s1_zeta_obc(i,
isouth,ir,lout)=cff
1301 &
domain(ng)%Northern_Edge(tile))
THEN
1304 & s1_zeta_obc(i,
inorth,ir,lout)
1306 cff=cff*rmask(i,jend+1)
1308 s1_zeta_obc(i,
inorth,ir,lout)=cff
1321 cff=ubar_std(i,j,rec)*ubar_std(i,j,rec)- &
1326 s1_ubar(i,j,lout)=cff
1331# ifdef ADJUST_BOUNDARY
1338 &
domain(ng)%Western_Edge(tile))
THEN
1340 cff=ubar_obc_std(j,
iwest)*ubar_obc_std(j,
iwest)- &
1341 & s1_ubar_obc(j,
iwest,ir,lout)
1343 cff=cff*umask(istr,j)
1345 s1_ubar_obc(j,
iwest,ir,lout)=cff
1349 &
domain(ng)%Eastern_Edge(tile))
THEN
1351 cff=ubar_obc_std(j,
ieast)*ubar_obc_std(j,
ieast)- &
1352 & s1_ubar_obc(j,
ieast,ir,lout)
1354 cff=cff*umask(iend+1,j)
1356 s1_ubar_obc(j,
ieast,ir,lout)=cff
1360 &
domain(ng)%Southern_Edge(tile))
THEN
1363 & s1_ubar_obc(i,
isouth,ir,lout)
1365 cff=cff*umask(i,jstr-1)
1367 s1_ubar_obc(i,
isouth,ir,lout)=cff
1371 &
domain(ng)%Northern_Edge(tile))
THEN
1374 & s1_ubar_obc(i,
inorth,ir,lout)
1376 cff=cff*umask(i,jend+1)
1378 s1_ubar_obc(i,
inorth,ir,lout)=cff
1391 cff=vbar_std(i,j,rec)*vbar_std(i,j,rec)- &
1396 s1_vbar(i,j,lout)=cff
1401# ifdef ADJUST_BOUNDARY
1408 &
domain(ng)%Western_Edge(tile))
THEN
1410 cff=vbar_obc_std(j,
iwest)*vbar_obc_std(j,
iwest)- &
1411 & s1_vbar_obc(j,
iwest,ir,lout)
1413 cff=cff*vmask(istr-1,j)
1415 s1_vbar_obc(j,
iwest,ir,lout)=cff
1419 &
domain(ng)%Eastern_Edge(tile))
THEN
1421 cff=vbar_obc_std(j,
ieast)*vbar_obc_std(j,
ieast)- &
1422 & s1_vbar_obc(j,
ieast,ir,lout)
1424 cff=cff*vmask(iend+1,j)
1426 s1_vbar_obc(j,
ieast,ir,lout)=cff
1430 &
domain(ng)%Southern_Edge(tile))
THEN
1433 & s1_vbar_obc(i,
isouth,ir,lout)
1435 cff=cff*vmask(i,jstr)
1437 s1_vbar_obc(i,
isouth,ir,lout)=cff
1441 &
domain(ng)%Northern_Edge(tile))
THEN
1444 & s1_vbar_obc(i,
inorth,ir,lout)
1446 cff=cff*vmask(i,jend+1)
1448 s1_vbar_obc(i,
inorth,ir,lout)=cff
1455# ifdef ADJUST_WSTRESS
1462 cff=sustr_std(i,j)*sustr_std(i,j)- &
1463 & s1_sustr(i,j,ir,lout)
1467 s1_sustr(i,j,ir,lout)=cff
1472 cff=svstr_std(i,j)*svstr_std(i,j)- &
1473 & s1_svstr(i,j,ir,lout)
1477 s1_svstr(i,j,ir,lout)=cff
1490 cff=u_std(i,j,k,rec)*u_std(i,j,k,rec)- &
1495 s1_u(i,j,k,lout)=cff
1500# ifdef ADJUST_BOUNDARY
1507 &
domain(ng)%Western_Edge(tile))
THEN
1510 cff=u_obc_std(j,k,
iwest)*u_obc_std(j,k,
iwest)- &
1511 & s1_u_obc(j,k,
iwest,ir,lout)
1513 cff=cff*umask(istr,j)
1515 s1_u_obc(j,k,
iwest,ir,lout)=cff
1520 &
domain(ng)%Eastern_Edge(tile))
THEN
1523 cff=u_obc_std(j,k,
ieast)*u_obc_std(j,k,
ieast)- &
1524 & s1_u_obc(j,k,
ieast,ir,lout)
1526 cff=cff*umask(iend+1,j)
1528 s1_u_obc(j,k,
ieast,ir,lout)=cff
1533 &
domain(ng)%Southern_Edge(tile))
THEN
1537 & s1_u_obc(i,k,
isouth,ir,lout)
1539 cff=cff*umask(i,jstr-1)
1541 s1_u_obc(i,k,
isouth,ir,lout)=cff
1546 &
domain(ng)%Northern_Edge(tile))
THEN
1550 & s1_u_obc(i,k,
inorth,ir,lout)
1552 cff=cff*umask(i,jend+1)
1554 s1_u_obc(i,k,
inorth,ir,lout)=cff
1567 cff=v_std(i,j,k,rec)*v_std(i,j,k,rec)- &
1572 s1_v(i,j,k,lout)=cff
1577# ifdef ADJUST_BOUNDARY
1584 &
domain(ng)%Western_Edge(tile))
THEN
1587 cff=v_obc_std(j,k,
iwest)*v_obc_std(j,k,
iwest)- &
1588 & s1_v_obc(j,k,
iwest,ir,lout)
1590 cff=cff*vmask(istr-1,j)
1592 s1_v_obc(j,k,
iwest,ir,lout)=cff
1597 &
domain(ng)%Eastern_Edge(tile))
THEN
1600 cff=v_obc_std(j,k,
ieast)*v_obc_std(j,k,
ieast)- &
1601 & s1_v_obc(j,k,
ieast,ir,lout)
1603 cff=cff*vmask(iend+1,j)
1605 s1_v_obc(j,k,
ieast,ir,lout)=cff
1610 &
domain(ng)%Southern_Edge(tile))
THEN
1614 & s1_v_obc(i,k,
isouth,ir,lout)
1616 cff=cff*vmask(i,jstr)
1618 s1_v_obc(i,k,
isouth,ir,lout)=cff
1623 &
domain(ng)%Northern_Edge(tile))
THEN
1627 & s1_v_obc(i,k,
inorth,ir,lout)
1629 cff=cff*vmask(i,jend+1)
1631 s1_v_obc(i,k,
inorth,ir,lout)=cff
1645 cff=t_std(i,j,k,rec,it)*t_std(i,j,k,rec,it)- &
1646 & s1_t(i,j,k,lout,it)
1650 s1_t(i,j,k,lout,it)=cff
1656# ifdef ADJUST_BOUNDARY
1664 &
domain(ng)%Western_Edge(tile))
THEN
1667 cff=t_obc_std(j,k,
iwest,it)*t_obc_std(j,k,
iwest,it)- &
1668 & s1_t_obc(j,k,
iwest,ir,lout,it)
1670 cff=cff*rmask(istr-1,j)
1672 s1_t_obc(j,k,
iwest,ir,lout,it)=cff
1677 &
domain(ng)%Eastern_Edge(tile))
THEN
1680 cff=t_obc_std(j,k,
ieast,it)*t_obc_std(j,k,
ieast,it)- &
1681 & s1_t_obc(j,k,
ieast,ir,lout,it)
1683 cff=cff*rmask(iend+1,j)
1685 s1_t_obc(j,k,
ieast,ir,lout,it)=cff
1690 &
domain(ng)%Southern_Edge(tile))
THEN
1693 cff=t_obc_std(i,k,
isouth,it)*t_obc_std(i,k,
isouth,it)-&
1694 & s1_t_obc(i,k,
isouth,ir,lout,it)
1696 cff=cff*rmask(i,jstr-1)
1698 s1_t_obc(i,k,
isouth,ir,lout,it)=cff
1703 &
domain(ng)%Northern_Edge(tile))
THEN
1706 cff=t_obc_std(i,k,
inorth,it)*t_obc_std(i,k,
inorth,it)-&
1707 & s1_t_obc(i,k,
inorth,ir,lout,it)
1709 cff=cff*rmask(i,jend+1)
1711 s1_t_obc(i,k,
inorth,ir,lout,it)=cff
1720# ifdef ADJUST_STFLUX
1729 cff=stflx_std(i,j,it)*stflx_std(i,j,it)- &
1730 & s1_tflux(i,j,ir,lout,it)
1734 s1_tflux(i,j,ir,lout,it)=cff
subroutine posterior_var_tile(ng, tile, model, lbi, ubi, lbj, ubj, lbij, ubij, imins, imaxs, jmins, jmaxs, lold, lnew, outloop, rmask, umask, vmask, t_obc_std, u_obc_std, v_obc_std, ubar_obc_std, vbar_obc_std, zeta_obc_std, sustr_std, svstr_std, stflx_std, t_std, u_std, v_std, ubar_std, vbar_std, zeta_std, nl_t_obc, nl_u_obc, nl_v_obc, nl_ubar_obc, nl_vbar_obc, nl_zeta_obc, nl_ustr, nl_vstr, nl_tflux, nl_t, nl_u, nl_v, nl_ubar, nl_vbar, nl_zeta, tl_t_obc, tl_u_obc, tl_v_obc, tl_ubar_obc, tl_vbar_obc, tl_zeta_obc, tl_ustr, tl_vstr, tl_tflux, tl_t, tl_u, tl_v, tl_ubar, tl_vbar, tl_zeta, ad_t_obc, ad_u_obc, ad_v_obc, ad_ubar_obc, ad_vbar_obc, ad_zeta_obc, ad_ustr, ad_vstr, ad_tflux, ad_t, ad_u, ad_v, ad_ubar, ad_vbar, ad_zeta)