2 ! ======================================================================================
3 ! This file was generated by the version 4.3.7 of ADG on 07/17/2010. The Adjoint Code
4 ! Generator (ADG) was developed and sponsored by LASG of IAP (1999-2010)
5 ! The Copyright of the ADG system was declared by Walls at LASG, 1999-2010
6 ! ======================================================================================
8 MODULE a_module_advect_em
11 USE module_model_constants
16 ! Generated by TAPENADE (INRIA, Tropics team)
17 ! Tapenade 3.5 (r3785) - 22 Mar 2011 18:35
19 ! Differentiation of advect_u in reverse (adjoint) mode:
20 ! gradient of useful results: rom u tendency u_old ru rv
22 ! with respect to varying inputs: rom u tendency u_old ru rv
24 ! RW status of diff variables: rom:incr u:incr tendency:in-out
25 ! u_old:incr ru:incr rv:incr mut:incr
26 SUBROUTINE A_ADVECT_U(u, ub0, u_old, u_oldb, tendency, tendencyb, ru, &
27 & rub, rv, rvb, rom, romb, mut, mutb, time_step, config_flags, msfux, &
28 & msfuy, msfvx, msfvy, msftx, msfty, fzm, fzp, rdx, rdy, rdzw, ids, ide&
29 & , jds, jde, kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, jte&
33 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
34 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
35 & jme, kms, kme, its, ite, jts, jte, kts, kte
36 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: u, u_old, ru&
38 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: ub0, u_oldb, rub, rvb, &
40 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut
41 REAL, DIMENSION(ims:ime, jms:jme) :: mutb
42 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
43 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: tendencyb
44 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
46 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzw
47 REAL, INTENT(IN) :: rdx, rdy
48 INTEGER, INTENT(IN) :: time_step
50 INTEGER :: i, j, k, itf, jtf, ktf
51 INTEGER :: i_start, i_end, j_start, j_end
52 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
53 INTEGER :: jmin, jmax, jp, jm, imin, imax, im, ip
54 INTEGER :: jp1, jp0, jtmp
55 INTEGER :: horz_order, vert_order
56 REAL :: mrdx, mrdy, ub, vb, uw, vw, dvm, dvp
57 REAL :: ubb, vbb, vwb, dvmb, dvpb
58 REAL, DIMENSION(its:ite, kts:kte) :: vflux
59 REAL, DIMENSION(its:ite, kts:kte) :: vfluxb
60 REAL, DIMENSION(its - 1:ite + 1, kts:kte) :: fqx
61 REAL, DIMENSION(its-1:ite+1, kts:kte) :: fqxb
62 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqy
63 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqyb
64 LOGICAL :: degrade_xs, degrade_ys
65 LOGICAL :: degrade_xe, degrade_ye
66 ! definition of flux operators, 3rd, 4th, 5th or 6th order
67 REAL :: flux3, flux4, flux5, flux6
68 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel
352 IF (config_flags%specified .OR. config_flags%nested) specified = &
354 ! set order for vertical and horzontal flux operators
355 horz_order = config_flags%h_mom_adv_order
356 vert_order = config_flags%v_mom_adv_order
357 IF (kte .GT. kde - 1) THEN
362 ! begin with horizontal flux divergence
363 IF (horz_order .EQ. 6) THEN
364 ! determine boundary mods for flux operators
365 ! We degrade the flux operators from 3rd/4th order
366 ! to second order one gridpoint in from the boundaries for
367 ! all boundary conditions except periodic and symmetry - these
368 ! conditions have boundary zone data fill for correct application
369 ! of the higher order flux stencils
374 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
375 & its .GT. ids + 3) degrade_xs = .false.
376 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
377 & ite .LT. ide - 2) degrade_xe = .false.
378 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
379 & jts .GT. jds + 3) degrade_ys = .false.
380 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
381 & jte .LT. jde - 4) degrade_ye = .false.
382 !--------------- y - advection first
385 IF (config_flags%open_xs .OR. specified) THEN
386 IF (ids + 1 .LT. its) THEN
392 IF (config_flags%open_xe .OR. specified) THEN
393 IF (ide - 1 .GT. ite) THEN
399 IF (config_flags%periodic_x) i_start = its
400 IF (config_flags%periodic_x) i_end = ite
402 IF (jte .GT. jde - 1) THEN
407 ! higher order flux has a 5 or 7 point stencil, so compute
408 ! bounds so we can switch to second order flux close to the boundary
412 IF (jts .LT. jds + 1) THEN
420 IF (jte .GT. jde - 2) THEN
427 IF (config_flags%polar) THEN
428 IF (jte .GT. jde - 1) THEN
434 ! compute fluxes, 5th or 6th order
438 j_loop_y_flux_6:DO j=ad_from42,j_end+1
439 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
444 CALL PUSHINTEGER4(i - 1)
445 CALL PUSHINTEGER4(ad_from34)
447 CALL PUSHCONTROL3B(0)
448 ELSE IF (j .EQ. jds + 1) THEN
449 ! we must be close to some boundary where we need to reduce the order of the stencil
450 ! 2nd order flux next to south boundary
454 CALL PUSHINTEGER4(i - 1)
455 CALL PUSHINTEGER4(ad_from35)
457 CALL PUSHCONTROL3B(1)
458 ELSE IF (j .EQ. jds + 2) THEN
459 ! third of 4th order flux 2 in from south boundary
463 CALL PUSHINTEGER4(i - 1)
464 CALL PUSHINTEGER4(ad_from36)
466 CALL PUSHCONTROL3B(2)
467 ELSE IF (j .EQ. jde - 1) THEN
468 ! 2nd order flux next to north boundary
472 CALL PUSHINTEGER4(i - 1)
473 CALL PUSHINTEGER4(ad_from37)
475 CALL PUSHCONTROL3B(3)
476 ELSE IF (j .EQ. jde - 2) THEN
477 ! 3rd order flux 2 in from north boundary
481 CALL PUSHINTEGER4(i - 1)
482 CALL PUSHINTEGER4(ad_from38)
484 CALL PUSHCONTROL3B(4)
486 CALL PUSHCONTROL3B(5)
488 ! y flux-divergence into tendency
489 ! (j > j_start) will miss the u(,,jds) tendency
490 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
494 CALL PUSHINTEGER4(i - 1)
495 CALL PUSHINTEGER4(ad_from39)
497 CALL PUSHCONTROL2B(0)
498 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
499 ! This would be seen by (j > j_start) but we need to zero out the NP tendency
503 CALL PUSHINTEGER4(i - 1)
504 CALL PUSHINTEGER4(ad_from40)
506 CALL PUSHCONTROL2B(1)
507 ELSE IF (j .GT. j_start) THEN
512 CALL PUSHINTEGER4(i - 1)
513 CALL PUSHINTEGER4(ad_from41)
515 CALL PUSHCONTROL2B(2)
517 CALL PUSHCONTROL2B(3)
520 CALL PUSHINTEGER4(jp1)
522 CALL PUSHINTEGER4(jp0)
524 END DO j_loop_y_flux_6
525 CALL PUSHINTEGER4(j - 1)
526 CALL PUSHINTEGER4(ad_from42)
527 ! next, x - flux divergence
531 IF (jte .GT. jde - 1) THEN
536 ! higher order flux has a 5 or 7 point stencil, so compute
537 ! bounds so we can switch to second order flux close to the boundary
541 IF (ids + 1 .LT. its) THEN
549 IF (ide - 1 .GT. ite) THEN
559 ! 5th or 6th order flux
563 ! lower order fluxes close to boundaries (if not periodic or symmetric)
564 ! specified uses upstream normal wind at boundaries
566 IF (i_start .EQ. ids + 1) THEN
568 ! second order flux next to the boundary
573 IF (specified .AND. u(i, k, j) .LT. 0.) THEN
575 CALL PUSHCONTROL1B(0)
577 CALL PUSHCONTROL1B(1)
580 CALL PUSHCONTROL1B(0)
582 CALL PUSHCONTROL1B(1)
586 CALL PUSHCONTROL1B(0)
588 CALL PUSHCONTROL1B(1)
591 IF (i_end .EQ. ide - 1) THEN
593 ! second order flux next to the boundary
598 IF (specified .AND. u(i-1, k, j) .GT. 0.) THEN
600 CALL PUSHCONTROL1B(0)
602 CALL PUSHCONTROL1B(1)
605 CALL PUSHCONTROL1B(1)
607 CALL PUSHCONTROL1B(0)
612 CALL PUSHCONTROL1B(1)
614 CALL PUSHCONTROL1B(0)
616 ! x flux-divergence into tendency
621 CALL PUSHINTEGER4(i - 1)
622 CALL PUSHINTEGER4(ad_from43)
625 CALL PUSHINTEGER4(j - 1)
626 CALL PUSHINTEGER4(ad_from44)
627 CALL PUSHCONTROL3B(0)
628 ELSE IF (horz_order .EQ. 5) THEN
629 ! 5th order horizontal flux calculation
630 ! This code is EXACTLY the same as the 6th order code
631 ! EXCEPT the 5th order and 3rd operators are used in
632 ! place of the 6th and 4th order operators
633 ! determine boundary mods for flux operators
634 ! We degrade the flux operators from 3rd/4th order
635 ! to second order one gridpoint in from the boundaries for
636 ! all boundary conditions except periodic and symmetry - these
637 ! conditions have boundary zone data fill for correct application
638 ! of the higher order flux stencils
643 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
644 & its .GT. ids + 3) degrade_xs = .false.
645 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
646 & ite .LT. ide - 2) degrade_xe = .false.
647 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
648 & jts .GT. jds + 3) degrade_ys = .false.
649 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
650 & jte .LT. jde - 4) degrade_ye = .false.
651 !--------------- y - advection first
654 IF (config_flags%open_xs .OR. specified) THEN
655 IF (ids + 1 .LT. its) THEN
661 IF (config_flags%open_xe .OR. specified) THEN
662 IF (ide - 1 .GT. ite) THEN
668 IF (config_flags%periodic_x) i_start = its
669 IF (config_flags%periodic_x) i_end = ite
671 IF (jte .GT. jde - 1) THEN
676 ! higher order flux has a 5 or 7 point stencil, so compute
677 ! bounds so we can switch to second order flux close to the boundary
681 IF (jts .LT. jds + 1) THEN
689 IF (jte .GT. jde - 2) THEN
696 IF (config_flags%polar) THEN
697 IF (jte .GT. jde - 1) THEN
703 ! compute fluxes, 5th or 6th order
707 j_loop_y_flux_5:DO j=ad_from7,j_end+1
708 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
713 CALL PUSHINTEGER4(i - 1)
714 CALL PUSHINTEGER4(ad_from)
716 CALL PUSHCONTROL3B(0)
717 ELSE IF (j .EQ. jds + 1) THEN
718 ! we must be close to some boundary where we need to reduce the order of the stencil
719 ! 2nd order flux next to south boundary
723 CALL PUSHINTEGER4(i - 1)
724 CALL PUSHINTEGER4(ad_from0)
726 CALL PUSHCONTROL3B(1)
727 ELSE IF (j .EQ. jds + 2) THEN
728 ! third of 4th order flux 2 in from south boundary
732 CALL PUSHINTEGER4(i - 1)
733 CALL PUSHINTEGER4(ad_from1)
735 CALL PUSHCONTROL3B(2)
736 ELSE IF (j .EQ. jde - 1) THEN
737 ! 2nd order flux next to north boundary
741 CALL PUSHINTEGER4(i - 1)
742 CALL PUSHINTEGER4(ad_from2)
744 CALL PUSHCONTROL3B(3)
745 ELSE IF (j .EQ. jde - 2) THEN
746 ! 3rd order flux 2 in from north boundary
750 CALL PUSHINTEGER4(i - 1)
751 CALL PUSHINTEGER4(ad_from3)
753 CALL PUSHCONTROL3B(4)
755 CALL PUSHCONTROL3B(5)
757 ! y flux-divergence into tendency
758 ! (j > j_start) will miss the u(,,jds) tendency
759 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
763 CALL PUSHINTEGER4(i - 1)
764 CALL PUSHINTEGER4(ad_from4)
766 CALL PUSHCONTROL2B(0)
767 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
768 ! This would be seen by (j > j_start) but we need to zero out the NP tendency
772 CALL PUSHINTEGER4(i - 1)
773 CALL PUSHINTEGER4(ad_from5)
775 CALL PUSHCONTROL2B(1)
776 ELSE IF (j .GT. j_start) THEN
781 CALL PUSHINTEGER4(i - 1)
782 CALL PUSHINTEGER4(ad_from6)
784 CALL PUSHCONTROL2B(2)
786 CALL PUSHCONTROL2B(3)
789 CALL PUSHINTEGER4(jp1)
791 CALL PUSHINTEGER4(jp0)
793 END DO j_loop_y_flux_5
794 CALL PUSHINTEGER4(j - 1)
795 CALL PUSHINTEGER4(ad_from7)
796 ! next, x - flux divergence
800 IF (jte .GT. jde - 1) THEN
805 ! higher order flux has a 5 or 7 point stencil, so compute
806 ! bounds so we can switch to second order flux close to the boundary
810 IF (ids + 1 .LT. its) THEN
818 IF (ide - 1 .GT. ite) THEN
828 ! 5th or 6th order flux
832 ! lower order fluxes close to boundaries (if not periodic or symmetric)
833 ! specified uses upstream normal wind at boundaries
835 IF (i_start .EQ. ids + 1) THEN
837 ! second order flux next to the boundary
842 IF (specified .AND. u(i, k, j) .LT. 0.) THEN
844 CALL PUSHCONTROL1B(0)
846 CALL PUSHCONTROL1B(1)
849 CALL PUSHCONTROL1B(0)
851 CALL PUSHCONTROL1B(1)
855 CALL PUSHCONTROL1B(0)
857 CALL PUSHCONTROL1B(1)
860 IF (i_end .EQ. ide - 1) THEN
862 ! second order flux next to the boundary
867 IF (specified .AND. u(i-1, k, j) .GT. 0.) THEN
869 CALL PUSHCONTROL1B(0)
871 CALL PUSHCONTROL1B(1)
874 CALL PUSHCONTROL1B(1)
876 CALL PUSHCONTROL1B(0)
881 CALL PUSHCONTROL1B(1)
883 CALL PUSHCONTROL1B(0)
885 ! x flux-divergence into tendency
890 CALL PUSHINTEGER4(i - 1)
891 CALL PUSHINTEGER4(ad_from8)
894 CALL PUSHINTEGER4(j - 1)
895 CALL PUSHINTEGER4(ad_from9)
896 CALL PUSHCONTROL3B(1)
897 ELSE IF (horz_order .EQ. 4) THEN
898 ! determine boundary mods for flux operators
899 ! We degrade the flux operators from 3rd/4th order
900 ! to second order one gridpoint in from the boundaries for
901 ! all boundary conditions except periodic and symmetry - these
902 ! conditions have boundary zone data fill for correct application
903 ! of the higher order flux stencils
908 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
909 & its .GT. ids + 2) degrade_xs = .false.
910 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
911 & ite .LT. ide - 1) degrade_xe = .false.
912 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
913 & jts .GT. jds + 2) degrade_ys = .false.
914 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
915 & jte .LT. jde - 3) degrade_ye = .false.
916 !--------------- x - advection first
920 IF (jte .GT. jde - 1) THEN
925 ! 3rd or 4th order flux has a 5 point stencil, so compute
926 ! bounds so we can switch to second order flux close to the boundary
931 i_start_f = i_start + 1
943 ! second order flux close to boundaries (if not periodic or symmetric)
944 ! specified uses upstream normal wind at boundaries
951 IF (specified .AND. u(i, k, j) .LT. 0.) THEN
953 CALL PUSHCONTROL1B(0)
955 CALL PUSHCONTROL1B(1)
958 CALL PUSHCONTROL1B(0)
960 CALL PUSHCONTROL1B(1)
968 IF (specified .AND. u(i-1, k, j) .GT. 0.) THEN
970 CALL PUSHCONTROL1B(0)
972 CALL PUSHCONTROL1B(1)
975 CALL PUSHCONTROL1B(1)
977 CALL PUSHCONTROL1B(0)
979 ! x flux-divergence into tendency
984 CALL PUSHINTEGER4(i - 1)
985 CALL PUSHINTEGER4(ad_from10)
988 CALL PUSHINTEGER4(j - 1)
989 CALL PUSHINTEGER4(ad_from11)
993 IF (config_flags%open_xs .OR. specified) THEN
994 IF (ids + 1 .LT. its) THEN
1000 IF (config_flags%open_xe .OR. specified) THEN
1001 IF (ide - 1 .GT. ite) THEN
1007 IF (config_flags%periodic_x) i_start = its
1008 IF (config_flags%periodic_x) i_end = ite
1010 IF (jte .GT. jde - 1) THEN
1015 ! 3rd or 4th order flux has a 5 point stencil, so compute
1016 ! bounds so we can switch to second order flux close to the boundary
1019 !CJM these may not work with tiling because they define j_start and end in terms of domain dim
1020 IF (degrade_ys) THEN
1022 j_start_f = j_start + 1
1024 IF (degrade_ye) THEN
1028 IF (config_flags%polar) THEN
1029 IF (jte .GT. jde - 1) THEN
1035 ! j flux loop for v flux of u momentum
1039 DO j=ad_from18,j_end+1
1040 IF (j .LT. j_start_f .AND. degrade_ys) THEN
1043 CALL PUSHINTEGER4(i)
1045 CALL PUSHINTEGER4(i - 1)
1046 CALL PUSHINTEGER4(ad_from12)
1048 CALL PUSHCONTROL2B(0)
1049 ELSE IF (j .GT. j_end_f .AND. degrade_ye) THEN
1052 CALL PUSHINTEGER4(i)
1054 CALL PUSHINTEGER4(i - 1)
1055 CALL PUSHINTEGER4(ad_from13)
1057 CALL PUSHCONTROL2B(1)
1059 ! 3rd or 4th order flux
1062 CALL PUSHINTEGER4(i)
1064 CALL PUSHINTEGER4(i - 1)
1065 CALL PUSHINTEGER4(ad_from14)
1067 CALL PUSHCONTROL2B(2)
1069 ! y flux-divergence into tendency
1070 ! (j > j_start) will miss the u(,,jds) tendency
1071 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
1074 CALL PUSHINTEGER4(i)
1076 CALL PUSHINTEGER4(i - 1)
1077 CALL PUSHINTEGER4(ad_from15)
1079 CALL PUSHCONTROL2B(0)
1080 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
1081 ! This would be seen by (j > j_start) but we need to zero out the NP tendency
1084 CALL PUSHINTEGER4(i)
1086 CALL PUSHINTEGER4(i - 1)
1087 CALL PUSHINTEGER4(ad_from16)
1089 CALL PUSHCONTROL2B(1)
1090 ELSE IF (j .GT. j_start) THEN
1094 CALL PUSHINTEGER4(i)
1096 CALL PUSHINTEGER4(i - 1)
1097 CALL PUSHINTEGER4(ad_from17)
1099 CALL PUSHCONTROL2B(2)
1101 CALL PUSHCONTROL2B(3)
1104 CALL PUSHINTEGER4(jp1)
1106 CALL PUSHINTEGER4(jp0)
1109 CALL PUSHINTEGER4(j - 1)
1110 CALL PUSHINTEGER4(ad_from18)
1111 CALL PUSHCONTROL3B(2)
1112 ELSE IF (horz_order .EQ. 3) THEN
1113 ! As with the 5th and 6th order flux chioces, the 3rd and 4th order
1114 ! code is EXACTLY the same EXCEPT for the flux operator.
1115 ! determine boundary mods for flux operators
1116 ! We degrade the flux operators from 3rd/4th order
1117 ! to second order one gridpoint in from the boundaries for
1118 ! all boundary conditions except periodic and symmetry - these
1119 ! conditions have boundary zone data fill for correct application
1120 ! of the higher order flux stencils
1125 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
1126 & its .GT. ids + 2) degrade_xs = .false.
1127 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
1128 & ite .LT. ide - 1) degrade_xe = .false.
1129 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
1130 & jts .GT. jds + 2) degrade_ys = .false.
1131 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
1132 & jte .LT. jde - 3) degrade_ye = .false.
1133 !--------------- x - advection first
1137 IF (jte .GT. jde - 1) THEN
1142 ! 3rd or 4th order flux has a 5 point stencil, so compute
1143 ! bounds so we can switch to second order flux close to the boundary
1146 IF (degrade_xs) THEN
1148 i_start_f = i_start + 1
1150 IF (degrade_xe) THEN
1156 DO j=ad_from20,j_end
1158 CALL PUSHINTEGER4(i)
1160 ! second order flux close to boundaries (if not periodic or symmetric)
1161 ! specified uses upstream normal wind at boundaries
1162 IF (degrade_xs) THEN
1163 CALL PUSHINTEGER4(i)
1168 IF (specified .AND. u(i, k, j) .LT. 0.) THEN
1170 CALL PUSHCONTROL1B(0)
1172 CALL PUSHCONTROL1B(1)
1175 CALL PUSHCONTROL1B(0)
1177 CALL PUSHCONTROL1B(1)
1179 IF (degrade_xe) THEN
1180 CALL PUSHINTEGER4(i)
1185 IF (specified .AND. u(i-1, k, j) .GT. 0.) THEN
1187 CALL PUSHCONTROL1B(0)
1189 CALL PUSHCONTROL1B(1)
1192 CALL PUSHCONTROL1B(1)
1194 CALL PUSHCONTROL1B(0)
1196 ! x flux-divergence into tendency
1199 CALL PUSHINTEGER4(i)
1201 CALL PUSHINTEGER4(i - 1)
1202 CALL PUSHINTEGER4(ad_from19)
1205 CALL PUSHINTEGER4(j - 1)
1206 CALL PUSHINTEGER4(ad_from20)
1210 IF (config_flags%open_xs .OR. specified) THEN
1211 IF (ids + 1 .LT. its) THEN
1217 IF (config_flags%open_xe .OR. specified) THEN
1218 IF (ide - 1 .GT. ite) THEN
1224 IF (config_flags%periodic_x) i_start = its
1225 IF (config_flags%periodic_x) i_end = ite
1227 IF (jte .GT. jde - 1) THEN
1232 ! 3rd or 4th order flux has a 5 point stencil, so compute
1233 ! bounds so we can switch to second order flux close to the boundary
1236 !CJM these may not work with tiling because they define j_start and end in terms of domain dim
1237 IF (degrade_ys) THEN
1239 j_start_f = j_start + 1
1241 IF (degrade_ye) THEN
1245 IF (config_flags%polar) THEN
1246 IF (jte .GT. jde - 1) THEN
1252 ! j flux loop for v flux of u momentum
1256 DO j=ad_from27,j_end+1
1257 IF (j .LT. j_start_f .AND. degrade_ys) THEN
1260 CALL PUSHINTEGER4(i)
1262 CALL PUSHINTEGER4(i - 1)
1263 CALL PUSHINTEGER4(ad_from21)
1265 CALL PUSHCONTROL2B(0)
1266 ELSE IF (j .GT. j_end_f .AND. degrade_ye) THEN
1269 CALL PUSHINTEGER4(i)
1271 CALL PUSHINTEGER4(i - 1)
1272 CALL PUSHINTEGER4(ad_from22)
1274 CALL PUSHCONTROL2B(1)
1276 ! 3rd or 4th order flux
1279 CALL PUSHINTEGER4(i)
1281 CALL PUSHINTEGER4(i - 1)
1282 CALL PUSHINTEGER4(ad_from23)
1284 CALL PUSHCONTROL2B(2)
1286 ! y flux-divergence into tendency
1287 ! (j > j_start) will miss the u(,,jds) tendency
1288 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
1291 CALL PUSHINTEGER4(i)
1293 CALL PUSHINTEGER4(i - 1)
1294 CALL PUSHINTEGER4(ad_from24)
1296 CALL PUSHCONTROL2B(0)
1297 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
1298 ! This would be seen by (j > j_start) but we need to zero out the NP tendency
1301 CALL PUSHINTEGER4(i)
1303 CALL PUSHINTEGER4(i - 1)
1304 CALL PUSHINTEGER4(ad_from25)
1306 CALL PUSHCONTROL2B(1)
1307 ELSE IF (j .GT. j_start) THEN
1311 CALL PUSHINTEGER4(i)
1313 CALL PUSHINTEGER4(i - 1)
1314 CALL PUSHINTEGER4(ad_from26)
1316 CALL PUSHCONTROL2B(2)
1318 CALL PUSHCONTROL2B(3)
1321 CALL PUSHINTEGER4(jp1)
1323 CALL PUSHINTEGER4(jp0)
1326 CALL PUSHINTEGER4(j - 1)
1327 CALL PUSHINTEGER4(ad_from27)
1328 CALL PUSHCONTROL3B(3)
1329 ELSE IF (horz_order .EQ. 2) THEN
1333 IF (jte .GT. jde - 1) THEN
1338 IF (config_flags%open_xs) THEN
1339 IF (ids + 1 .LT. its) THEN
1345 IF (config_flags%open_xe) THEN
1346 IF (ide - 1 .GT. ite) THEN
1353 IF (ids + 2 .LT. its) THEN
1360 IF (ide - 2 .GT. ite) THEN
1366 IF (config_flags%periodic_x) i_start = its
1367 IF (config_flags%periodic_x) i_end = ite
1369 DO j=ad_from29,j_end
1373 CALL PUSHINTEGER4(i - 1)
1374 CALL PUSHINTEGER4(ad_from28)
1377 CALL PUSHINTEGER4(j - 1)
1378 CALL PUSHINTEGER4(ad_from29)
1379 IF (specified .AND. its .LE. ids + 1 .AND. (.NOT.config_flags%&
1382 DO j=ad_from30,j_end
1386 ! ADT eqn 44, 1st term on RHS
1388 IF (u(i, k, j) .LT. 0.) THEN
1390 CALL PUSHCONTROL1B(0)
1392 CALL PUSHCONTROL1B(1)
1396 CALL PUSHINTEGER4(j - 1)
1397 CALL PUSHINTEGER4(ad_from30)
1398 CALL PUSHCONTROL1B(0)
1400 CALL PUSHCONTROL1B(1)
1402 IF (specified .AND. ite .GE. ide - 1 .AND. (.NOT.config_flags%&
1405 DO j=ad_from31,j_end
1409 ! ADT eqn 44, 1st term on RHS
1411 IF (u(i, k, j) .GT. 0.) THEN
1413 CALL PUSHCONTROL1B(0)
1415 CALL PUSHCONTROL1B(1)
1419 CALL PUSHINTEGER4(j - 1)
1420 CALL PUSHINTEGER4(ad_from31)
1421 CALL PUSHCONTROL1B(0)
1423 CALL PUSHCONTROL1B(1)
1425 IF (config_flags%open_ys .OR. specified) THEN
1426 IF (jds + 1 .LT. jts) THEN
1432 IF (config_flags%open_ye .OR. specified) THEN
1433 IF (jde - 2 .GT. jte) THEN
1440 DO j=ad_from33,j_end
1443 CALL PUSHINTEGER4(i)
1444 DO i=ad_from32,i_end
1445 ! ADT eqn 44, 1st term on RHS
1446 ! Comments for polar boundary condition
1447 ! Flow is only from one side for points next to poles
1448 IF (config_flags%polar .AND. j .EQ. jds) THEN
1449 CALL PUSHCONTROL2B(2)
1450 ELSE IF (config_flags%polar .AND. j .EQ. jde - 1) THEN
1451 CALL PUSHCONTROL2B(1)
1453 CALL PUSHCONTROL2B(0)
1456 CALL PUSHINTEGER4(i - 1)
1457 CALL PUSHINTEGER4(ad_from32)
1460 CALL PUSHINTEGER4(j - 1)
1461 CALL PUSHINTEGER4(ad_from33)
1462 CALL PUSHCONTROL3B(4)
1464 CALL PUSHCONTROL3B(5)
1466 ! radiative lateral boundary condition in x for normal velocity (u)
1467 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
1468 CALL PUSHINTEGER4(j_start)
1470 IF (jte .GT. jde - 1) THEN
1476 DO j=ad_from45,j_end
1478 IF (ru(its, k, j) - cb*mut(its, j) .GT. 0.) THEN
1481 CALL PUSHCONTROL1B(0)
1484 ub = ru(its, k, j) - cb*mut(its, j)
1485 CALL PUSHCONTROL1B(1)
1489 CALL PUSHINTEGER4(j - 1)
1490 CALL PUSHINTEGER4(ad_from45)
1491 CALL PUSHCONTROL1B(0)
1493 CALL PUSHCONTROL1B(1)
1495 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
1496 CALL PUSHINTEGER4(j_start)
1498 IF (jte .GT. jde - 1) THEN
1504 DO j=ad_from46,j_end
1506 IF (ru(ite, k, j) + cb*mut(ite-1, j) .LT. 0.) THEN
1509 CALL PUSHCONTROL1B(0)
1512 ub = ru(ite, k, j) + cb*mut(ite-1, j)
1513 CALL PUSHCONTROL1B(1)
1517 CALL PUSHINTEGER4(j - 1)
1518 CALL PUSHINTEGER4(ad_from46)
1519 CALL PUSHCONTROL1B(1)
1521 CALL PUSHCONTROL1B(0)
1523 ! pick up the rest of the horizontal radiation boundary conditions.
1524 ! (these are the computations that don't require 'cb')
1525 ! first, set to index ranges
1527 IF (ite .GT. ide) THEN
1534 IF (config_flags%open_xs) THEN
1535 IF (ids + 1 .LT. its) THEN
1542 IF (config_flags%open_xe) THEN
1543 IF (ite .GT. ide - 1) THEN
1550 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
1552 CALL PUSHINTEGER4(i)
1553 DO i=ad_from47,i_end
1554 CALL PUSHREAL8(mrdy)
1555 ! ADT eqn 44, 2nd term on RHS
1556 mrdy = msfux(i, jts)*rdy
1557 IF (imax .GT. i) THEN
1558 CALL PUSHINTEGER4(ip)
1560 CALL PUSHCONTROL1B(0)
1562 CALL PUSHINTEGER4(ip)
1564 CALL PUSHCONTROL1B(1)
1566 IF (imin .LT. i - 1) THEN
1567 CALL PUSHINTEGER4(im)
1569 CALL PUSHCONTROL1B(0)
1571 CALL PUSHINTEGER4(im)
1573 CALL PUSHCONTROL1B(1)
1576 vw = 0.5*(rv(ip, k, jts)+rv(im, k, jts))
1577 IF (vw .GT. 0.) THEN
1580 CALL PUSHCONTROL1B(0)
1584 CALL PUSHCONTROL1B(1)
1588 CALL PUSHINTEGER4(i - 1)
1589 CALL PUSHINTEGER4(ad_from47)
1590 CALL PUSHCONTROL1B(0)
1592 CALL PUSHCONTROL1B(1)
1594 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
1596 CALL PUSHINTEGER4(i)
1597 DO i=ad_from48,i_end
1598 CALL PUSHREAL8(mrdy)
1599 ! ADT eqn 44, 2nd term on RHS
1600 mrdy = msfux(i, jte-1)*rdy
1601 IF (imax .GT. i) THEN
1602 CALL PUSHINTEGER4(ip)
1604 CALL PUSHCONTROL1B(0)
1606 CALL PUSHINTEGER4(ip)
1608 CALL PUSHCONTROL1B(1)
1610 IF (imin .LT. i - 1) THEN
1611 CALL PUSHINTEGER4(im)
1613 CALL PUSHCONTROL1B(0)
1615 CALL PUSHINTEGER4(im)
1617 CALL PUSHCONTROL1B(1)
1620 vw = 0.5*(rv(ip, k, jte)+rv(im, k, jte))
1621 IF (vw .LT. 0.) THEN
1624 CALL PUSHCONTROL1B(0)
1628 CALL PUSHCONTROL1B(1)
1632 CALL PUSHINTEGER4(i - 1)
1633 CALL PUSHINTEGER4(ad_from48)
1634 CALL PUSHCONTROL1B(1)
1636 CALL PUSHCONTROL1B(0)
1638 !-------------------- vertical advection
1639 ! ADT eqn 44 has 3rd term on RHS = -(1/my) partial d/dz (rho u w)
1640 ! Here we have: - partial d/dz (u*rom) = - partial d/dz (u rho w / my)
1641 ! Since 'my' (map scale factor in y-direction) isn't a function of z,
1642 ! this is what we need, so leave unchanged in advect_u
1645 CALL PUSHINTEGER4(j_start)
1647 IF (jte .GT. jde - 1) THEN
1652 ! IF ( config_flags%open_xs ) i_start = MAX(ids+1,its)
1653 ! IF ( config_flags%open_xe ) i_end = MIN(ide-1,ite)
1654 IF (config_flags%open_ys .OR. specified) THEN
1655 IF (ids + 1 .LT. its) THEN
1661 IF (config_flags%open_ye .OR. specified) THEN
1662 IF (ide - 1 .GT. ite) THEN
1668 IF (config_flags%periodic_x) i_start = its
1669 IF (config_flags%periodic_x) i_end = ite
1670 IF (vert_order .EQ. 6) THEN
1673 CALL PUSHINTEGER4(i)
1675 CALL PUSHINTEGER4(i)
1676 CALL PUSHINTEGER4(k)
1679 DO j=j_end,j_start,-1
1681 DO i=i_end,i_start,-1
1682 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
1683 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
1687 DO i=i_end,i_start,-1
1689 temp31b46 = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i&
1691 temp31b47 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
1692 romb(i, k, j) = romb(i, k, j) + temp31b46
1693 romb(i-1, k, j) = romb(i-1, k, j) + temp31b46
1694 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp31b47
1695 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp31b47
1698 vel = 0.5*(rom(i, k, j)+rom(i-1, k, j))
1699 temp31b48 = vel*vfluxb(i, k)/12.0
1700 velb = (7.*(u(i, k, j)+u(i, k-1, j))-u(i, k+1, j)-u(i, k-2, j))*&
1702 ub0(i, k, j) = ub0(i, k, j) + 7.*temp31b48
1703 ub0(i, k-1, j) = ub0(i, k-1, j) + 7.*temp31b48
1704 ub0(i, k+1, j) = ub0(i, k+1, j) - temp31b48
1705 ub0(i, k-2, j) = ub0(i, k-2, j) - temp31b48
1707 romb(i, k, j) = romb(i, k, j) + 0.5*velb
1708 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
1710 vel = 0.5*(rom(i, k, j)+rom(i-1, k, j))
1711 temp31b49 = vel*vfluxb(i, k)/12.0
1712 velb = (7.*(u(i, k, j)+u(i, k-1, j))-u(i, k+1, j)-u(i, k-2, j))*&
1714 ub0(i, k, j) = ub0(i, k, j) + 7.*temp31b49
1715 ub0(i, k-1, j) = ub0(i, k-1, j) + 7.*temp31b49
1716 ub0(i, k+1, j) = ub0(i, k+1, j) - temp31b49
1717 ub0(i, k-2, j) = ub0(i, k-2, j) - temp31b49
1719 romb(i, k, j) = romb(i, k, j) + 0.5*velb
1720 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
1722 temp31b50 = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i&
1724 temp31b51 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
1725 romb(i, k, j) = romb(i, k, j) + temp31b50
1726 romb(i-1, k, j) = romb(i-1, k, j) + temp31b50
1727 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp31b51
1728 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp31b51
1733 DO i=i_end,i_start,-1
1734 vel = 0.5*(rom(i-1, k, j)+rom(i, k, j))
1735 temp31b45 = vel*vfluxb(i, k)/60.0
1736 velb = (37.*(u(i, k, j)+u(i, k-1, j))-8.*(u(i, k+1, j)+u(i, k-&
1737 & 2, j))+u(i, k+2, j)+u(i, k-3, j))*vfluxb(i, k)/60.0
1738 ub0(i, k, j) = ub0(i, k, j) + 37.*temp31b45
1739 ub0(i, k-1, j) = ub0(i, k-1, j) + 37.*temp31b45
1740 ub0(i, k+1, j) = ub0(i, k+1, j) - 8.*temp31b45
1741 ub0(i, k-2, j) = ub0(i, k-2, j) - 8.*temp31b45
1742 ub0(i, k+2, j) = ub0(i, k+2, j) + temp31b45
1743 ub0(i, k-3, j) = ub0(i, k-3, j) + temp31b45
1745 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
1746 romb(i, k, j) = romb(i, k, j) + 0.5*velb
1751 ELSE IF (vert_order .EQ. 5) THEN
1754 CALL PUSHINTEGER4(i)
1756 CALL PUSHINTEGER4(i)
1757 CALL PUSHINTEGER4(k)
1760 DO j=j_end,j_start,-1
1762 DO i=i_end,i_start,-1
1763 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
1764 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
1768 DO i=i_end,i_start,-1
1770 temp43b = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i, &
1772 temp43b0 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
1773 romb(i, k, j) = romb(i, k, j) + temp43b
1774 romb(i-1, k, j) = romb(i-1, k, j) + temp43b
1775 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp43b0
1776 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp43b0
1779 vel = 0.5*(rom(i, k, j)+rom(i-1, k, j))
1780 temp39 = u(i, k+1, j) - u(i, k-2, j) - 3.*(u(i, k, j)-u(i, k-1, &
1782 temp42 = SIGN(1., -vel)
1783 temp41 = temp42/12.0
1784 temp40 = SIGN(1, time_step)
1785 temp39b = vel*vfluxb(i, k)
1786 temp39b0 = temp39b/12.0
1787 temp39b1 = temp40*temp41*temp39b
1788 velb = ((7.*(u(i, k, j)+u(i, k-1, j))-u(i, k+1, j)-u(i, k-2, j))&
1789 & /12.0+temp40*(temp41*temp39))*vfluxb(i, k)
1790 ub0(i, k, j) = ub0(i, k, j) + 7.*temp39b0 - 3.*temp39b1
1791 ub0(i, k-1, j) = ub0(i, k-1, j) + 3.*temp39b1 + 7.*temp39b0
1792 ub0(i, k+1, j) = ub0(i, k+1, j) + temp39b1 - temp39b0
1793 ub0(i, k-2, j) = ub0(i, k-2, j) - temp39b1 - temp39b0
1795 romb(i, k, j) = romb(i, k, j) + 0.5*velb
1796 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
1798 vel = 0.5*(rom(i, k, j)+rom(i-1, k, j))
1799 temp35 = u(i, k+1, j) - u(i, k-2, j) - 3.*(u(i, k, j)-u(i, k-1, &
1801 temp38 = SIGN(1., -vel)
1802 temp37 = temp38/12.0
1803 temp36 = SIGN(1, time_step)
1804 temp35b = vel*vfluxb(i, k)
1805 temp35b0 = temp35b/12.0
1806 temp35b1 = temp36*temp37*temp35b
1807 velb = ((7.*(u(i, k, j)+u(i, k-1, j))-u(i, k+1, j)-u(i, k-2, j))&
1808 & /12.0+temp36*(temp37*temp35))*vfluxb(i, k)
1809 ub0(i, k, j) = ub0(i, k, j) + 7.*temp35b0 - 3.*temp35b1
1810 ub0(i, k-1, j) = ub0(i, k-1, j) + 3.*temp35b1 + 7.*temp35b0
1811 ub0(i, k+1, j) = ub0(i, k+1, j) + temp35b1 - temp35b0
1812 ub0(i, k-2, j) = ub0(i, k-2, j) - temp35b1 - temp35b0
1814 romb(i, k, j) = romb(i, k, j) + 0.5*velb
1815 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
1817 temp35b2 = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i&
1819 temp35b3 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
1820 romb(i, k, j) = romb(i, k, j) + temp35b2
1821 romb(i-1, k, j) = romb(i-1, k, j) + temp35b2
1822 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp35b3
1823 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp35b3
1828 DO i=i_end,i_start,-1
1829 vel = 0.5*(rom(i-1, k, j)+rom(i, k, j))
1830 temp31 = u(i, k+2, j) - u(i, k-3, j) + 10.*(u(i, k, j)-u(i, k-&
1831 & 1, j)) - 5.*(u(i, k+1, j)-u(i, k-2, j))
1832 temp34 = SIGN(1., -vel)
1833 temp33 = temp34/60.0
1834 temp32 = SIGN(1, time_step)
1835 temp31b52 = vel*vfluxb(i, k)
1836 temp31b53 = temp31b52/60.0
1837 temp31b54 = -(temp32*temp33*temp31b52)
1838 velb = ((37.*(u(i, k, j)+u(i, k-1, j))-8.*(u(i, k+1, j)+u(i, k&
1839 & -2, j))+u(i, k+2, j)+u(i, k-3, j))/60.0-temp32*(temp33*&
1840 & temp31))*vfluxb(i, k)
1841 ub0(i, k, j) = ub0(i, k, j) + 10.*temp31b54 + 37.*temp31b53
1842 ub0(i, k-1, j) = ub0(i, k-1, j) + 37.*temp31b53 - 10.*&
1844 ub0(i, k+1, j) = ub0(i, k+1, j) - 5.*temp31b54 - 8.*temp31b53
1845 ub0(i, k-2, j) = ub0(i, k-2, j) + 5.*temp31b54 - 8.*temp31b53
1846 ub0(i, k+2, j) = ub0(i, k+2, j) + temp31b54 + temp31b53
1847 ub0(i, k-3, j) = ub0(i, k-3, j) + temp31b53 - temp31b54
1849 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
1850 romb(i, k, j) = romb(i, k, j) + 0.5*velb
1855 ELSE IF (vert_order .EQ. 4) THEN
1858 CALL PUSHINTEGER4(i)
1860 CALL PUSHINTEGER4(i)
1861 CALL PUSHINTEGER4(k)
1864 DO j=j_end,j_start,-1
1866 DO i=i_end,i_start,-1
1867 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
1868 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
1872 DO i=i_end,i_start,-1
1874 temp43b2 = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i&
1876 temp43b3 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
1877 romb(i, k, j) = romb(i, k, j) + temp43b2
1878 romb(i-1, k, j) = romb(i-1, k, j) + temp43b2
1879 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp43b3
1880 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp43b3
1883 temp43b4 = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i&
1885 temp43b5 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
1886 romb(i, k, j) = romb(i, k, j) + temp43b4
1887 romb(i-1, k, j) = romb(i-1, k, j) + temp43b4
1888 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp43b5
1889 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp43b5
1894 DO i=i_end,i_start,-1
1895 vel = 0.5*(rom(i-1, k, j)+rom(i, k, j))
1896 temp43b1 = vel*vfluxb(i, k)/12.0
1897 velb = (7.*(u(i, k, j)+u(i, k-1, j))-u(i, k+1, j)-u(i, k-2, j)&
1898 & )*vfluxb(i, k)/12.0
1899 ub0(i, k, j) = ub0(i, k, j) + 7.*temp43b1
1900 ub0(i, k-1, j) = ub0(i, k-1, j) + 7.*temp43b1
1901 ub0(i, k+1, j) = ub0(i, k+1, j) - temp43b1
1902 ub0(i, k-2, j) = ub0(i, k-2, j) - temp43b1
1904 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
1905 romb(i, k, j) = romb(i, k, j) + 0.5*velb
1910 ELSE IF (vert_order .EQ. 3) THEN
1913 CALL PUSHINTEGER4(i)
1915 CALL PUSHINTEGER4(i)
1916 CALL PUSHINTEGER4(k)
1919 DO j=j_end,j_start,-1
1921 DO i=i_end,i_start,-1
1922 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
1923 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
1927 DO i=i_end,i_start,-1
1929 temp47b = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i, &
1931 temp47b0 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
1932 romb(i, k, j) = romb(i, k, j) + temp47b
1933 romb(i-1, k, j) = romb(i-1, k, j) + temp47b
1934 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp47b0
1935 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp47b0
1938 temp47b1 = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i&
1940 temp47b2 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
1941 romb(i, k, j) = romb(i, k, j) + temp47b1
1942 romb(i-1, k, j) = romb(i-1, k, j) + temp47b1
1943 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp47b2
1944 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp47b2
1949 DO i=i_end,i_start,-1
1950 vel = 0.5*(rom(i-1, k, j)+rom(i, k, j))
1951 temp43 = u(i, k+1, j) - u(i, k-2, j) - 3.*(u(i, k, j)-u(i, k-1&
1953 temp46 = SIGN(1., -vel)
1954 temp45 = temp46/12.0
1955 temp44 = SIGN(1, time_step)
1956 temp43b6 = vel*vfluxb(i, k)
1957 temp43b7 = temp43b6/12.0
1958 temp43b8 = temp44*temp45*temp43b6
1959 velb = ((7.*(u(i, k, j)+u(i, k-1, j))-u(i, k+1, j)-u(i, k-2, j&
1960 & ))/12.0+temp44*(temp45*temp43))*vfluxb(i, k)
1961 ub0(i, k, j) = ub0(i, k, j) + 7.*temp43b7 - 3.*temp43b8
1962 ub0(i, k-1, j) = ub0(i, k-1, j) + 3.*temp43b8 + 7.*temp43b7
1963 ub0(i, k+1, j) = ub0(i, k+1, j) + temp43b8 - temp43b7
1964 ub0(i, k-2, j) = ub0(i, k-2, j) - temp43b8 - temp43b7
1966 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
1967 romb(i, k, j) = romb(i, k, j) + 0.5*velb
1972 ELSE IF (vert_order .EQ. 2) THEN
1975 CALL PUSHINTEGER4(i)
1978 CALL PUSHINTEGER4(i)
1982 DO j=j_end,j_start,-1
1984 DO i=i_end,i_start,-1
1985 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
1986 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
1991 DO i=i_end,i_start,-1
1992 temp47b3 = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(&
1994 temp47b4 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
1995 romb(i, k, j) = romb(i, k, j) + temp47b3
1996 romb(i-1, k, j) = romb(i-1, k, j) + temp47b3
1997 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp47b4
1998 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp47b4
2005 CALL POPINTEGER4(j_start)
2006 CALL POPCONTROL1B(branch)
2007 IF (branch .NE. 0) THEN
2008 CALL POPINTEGER4(ad_from48)
2009 CALL POPINTEGER4(ad_to48)
2010 DO i=ad_to48,ad_from48,-1
2012 dvm = rv(ip, k, jte) - rv(ip, k, jte-1)
2013 dvp = rv(im, k, jte) - rv(im, k, jte-1)
2014 temp31b43 = -(mrdy*tendencyb(i, k, jte-1))
2015 temp31b44 = 0.5*u(i, k, jte-1)*temp31b43
2016 vbb = (u_old(i, k, jte-1)-u_old(i, k, jte-2))*temp31b43
2017 u_oldb(i, k, jte-1) = u_oldb(i, k, jte-1) + vb*temp31b43
2018 u_oldb(i, k, jte-2) = u_oldb(i, k, jte-2) - vb*temp31b43
2019 ub0(i, k, jte-1) = ub0(i, k, jte-1) + 0.5*(dvm+dvp)*temp31b43
2022 rvb(im, k, jte) = rvb(im, k, jte) + dvpb
2023 rvb(im, k, jte-1) = rvb(im, k, jte-1) - dvpb
2024 rvb(ip, k, jte) = rvb(ip, k, jte) + dvmb
2025 rvb(ip, k, jte-1) = rvb(ip, k, jte-1) - dvmb
2026 CALL POPCONTROL1B(branch)
2027 IF (branch .EQ. 0) THEN
2034 rvb(ip, k, jte) = rvb(ip, k, jte) + 0.5*vwb
2035 rvb(im, k, jte) = rvb(im, k, jte) + 0.5*vwb
2037 CALL POPCONTROL1B(branch)
2038 IF (branch .EQ. 0) THEN
2039 CALL POPINTEGER4(im)
2041 CALL POPINTEGER4(im)
2043 CALL POPCONTROL1B(branch)
2044 IF (branch .EQ. 0) THEN
2045 CALL POPINTEGER4(ip)
2047 CALL POPINTEGER4(ip)
2053 CALL POPCONTROL1B(branch)
2054 IF (branch .EQ. 0) THEN
2055 CALL POPINTEGER4(ad_from47)
2056 CALL POPINTEGER4(ad_to47)
2057 DO i=ad_to47,ad_from47,-1
2059 dvm = rv(ip, k, jts+1) - rv(ip, k, jts)
2060 dvp = rv(im, k, jts+1) - rv(im, k, jts)
2061 temp31b41 = -(mrdy*tendencyb(i, k, jts))
2062 temp31b42 = 0.5*u(i, k, jts)*temp31b41
2063 vbb = (u_old(i, k, jts+1)-u_old(i, k, jts))*temp31b41
2064 u_oldb(i, k, jts+1) = u_oldb(i, k, jts+1) + vb*temp31b41
2065 u_oldb(i, k, jts) = u_oldb(i, k, jts) - vb*temp31b41
2066 ub0(i, k, jts) = ub0(i, k, jts) + 0.5*(dvm+dvp)*temp31b41
2069 rvb(im, k, jts+1) = rvb(im, k, jts+1) + dvpb
2070 rvb(im, k, jts) = rvb(im, k, jts) - dvpb
2071 rvb(ip, k, jts+1) = rvb(ip, k, jts+1) + dvmb
2072 rvb(ip, k, jts) = rvb(ip, k, jts) - dvmb
2073 CALL POPCONTROL1B(branch)
2074 IF (branch .EQ. 0) THEN
2081 rvb(ip, k, jts) = rvb(ip, k, jts) + 0.5*vwb
2082 rvb(im, k, jts) = rvb(im, k, jts) + 0.5*vwb
2084 CALL POPCONTROL1B(branch)
2085 IF (branch .EQ. 0) THEN
2086 CALL POPINTEGER4(im)
2088 CALL POPINTEGER4(im)
2090 CALL POPCONTROL1B(branch)
2091 IF (branch .EQ. 0) THEN
2092 CALL POPINTEGER4(ip)
2094 CALL POPINTEGER4(ip)
2100 CALL POPCONTROL1B(branch)
2101 IF (branch .NE. 0) THEN
2102 CALL POPINTEGER4(ad_from46)
2103 CALL POPINTEGER4(ad_to46)
2104 DO j=ad_to46,ad_from46,-1
2106 temp31b40 = -(rdx*tendencyb(ite, k, j))
2107 ubb = (u_old(ite, k, j)-u_old(ite-1, k, j))*temp31b40
2108 u_oldb(ite, k, j) = u_oldb(ite, k, j) + ub*temp31b40
2109 u_oldb(ite-1, k, j) = u_oldb(ite-1, k, j) - ub*temp31b40
2110 CALL POPCONTROL1B(branch)
2111 IF (branch .EQ. 0) THEN
2115 rub(ite, k, j) = rub(ite, k, j) + ubb
2116 mutb(ite-1, j) = mutb(ite-1, j) + cb*ubb
2120 CALL POPINTEGER4(j_start)
2122 CALL POPCONTROL1B(branch)
2123 IF (branch .EQ. 0) THEN
2124 CALL POPINTEGER4(ad_from45)
2125 CALL POPINTEGER4(ad_to45)
2126 DO j=ad_to45,ad_from45,-1
2128 temp31b39 = -(rdx*tendencyb(its, k, j))
2129 ubb = (u_old(its+1, k, j)-u_old(its, k, j))*temp31b39
2130 u_oldb(its+1, k, j) = u_oldb(its+1, k, j) + ub*temp31b39
2131 u_oldb(its, k, j) = u_oldb(its, k, j) - ub*temp31b39
2132 CALL POPCONTROL1B(branch)
2133 IF (branch .EQ. 0) THEN
2137 rub(its, k, j) = rub(its, k, j) + ubb
2138 mutb(its, j) = mutb(its, j) - cb*ubb
2142 CALL POPINTEGER4(j_start)
2144 CALL POPCONTROL3B(branch)
2145 IF (branch .LT. 3) THEN
2146 IF (branch .EQ. 0) THEN
2148 CALL POPINTEGER4(ad_from44)
2149 CALL POPINTEGER4(ad_to44)
2150 DO j=ad_to44,ad_from44,-1
2152 CALL POPINTEGER4(ad_from43)
2153 CALL POPINTEGER4(ad_to43)
2154 DO i=ad_to43,ad_from43,-1
2155 mrdx = msfux(i, j)*rdx
2156 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
2157 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
2161 CALL POPCONTROL1B(branch)
2162 IF (branch .NE. 0) THEN
2165 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
2166 temp31b38 = vel*fqxb(i, k)/12.0
2167 velb = (7.*(u(i, k, j)+u(i-1, k, j))-u(i+1, k, j)-u(i-2, k, &
2168 & j))*fqxb(i, k)/12.0
2169 ub0(i, k, j) = ub0(i, k, j) + 7.*temp31b38
2170 ub0(i-1, k, j) = ub0(i-1, k, j) + 7.*temp31b38
2171 ub0(i+1, k, j) = ub0(i+1, k, j) - temp31b38
2172 ub0(i-2, k, j) = ub0(i-2, k, j) - temp31b38
2174 rub(i, k, j) = rub(i, k, j) + 0.5*velb
2175 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
2178 CALL POPCONTROL1B(branch)
2179 IF (branch .NE. 0) THEN
2181 temp31b36 = 0.25*(u(i-1, k, j)+ub)*fqxb(i, k)
2182 temp31b37 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
2183 rub(i, k, j) = rub(i, k, j) + temp31b36
2184 rub(i-1, k, j) = rub(i-1, k, j) + temp31b36
2185 ub0(i-1, k, j) = ub0(i-1, k, j) + temp31b37
2188 CALL POPCONTROL1B(branch)
2189 IF (branch .EQ. 0) THEN
2190 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
2194 ub0(i, k, j) = ub0(i, k, j) + ubb
2199 CALL POPCONTROL1B(branch)
2200 IF (branch .EQ. 0) THEN
2202 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
2203 temp31b35 = vel*fqxb(i, k)/12.0
2204 velb = (7.*(u(i, k, j)+u(i-1, k, j))-u(i+1, k, j)-u(i-2, k, &
2205 & j))*fqxb(i, k)/12.0
2206 ub0(i, k, j) = ub0(i, k, j) + 7.*temp31b35
2207 ub0(i-1, k, j) = ub0(i-1, k, j) + 7.*temp31b35
2208 ub0(i+1, k, j) = ub0(i+1, k, j) - temp31b35
2209 ub0(i-2, k, j) = ub0(i-2, k, j) - temp31b35
2211 rub(i, k, j) = rub(i, k, j) + 0.5*velb
2212 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
2215 CALL POPCONTROL1B(branch)
2216 IF (branch .EQ. 0) THEN
2218 temp31b33 = 0.25*(u(i, k, j)+ub)*fqxb(i, k)
2219 temp31b34 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
2220 rub(i, k, j) = rub(i, k, j) + temp31b33
2221 rub(i-1, k, j) = rub(i-1, k, j) + temp31b33
2222 ub0(i, k, j) = ub0(i, k, j) + temp31b34
2225 CALL POPCONTROL1B(branch)
2226 IF (branch .EQ. 0) THEN
2227 ub0(i, k, j) = ub0(i, k, j) + ubb
2231 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
2237 DO i=i_end_f,i_start_f,-1
2238 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
2239 temp31b32 = vel*fqxb(i, k)/60.0
2240 velb = (37.*(u(i, k, j)+u(i-1, k, j))-8.*(u(i+1, k, j)+u(i-2&
2241 & , k, j))+u(i+2, k, j)+u(i-3, k, j))*fqxb(i, k)/60.0
2242 ub0(i, k, j) = ub0(i, k, j) + 37.*temp31b32
2243 ub0(i-1, k, j) = ub0(i-1, k, j) + 37.*temp31b32
2244 ub0(i+1, k, j) = ub0(i+1, k, j) - 8.*temp31b32
2245 ub0(i-2, k, j) = ub0(i-2, k, j) - 8.*temp31b32
2246 ub0(i+2, k, j) = ub0(i+2, k, j) + temp31b32
2247 ub0(i-3, k, j) = ub0(i-3, k, j) + temp31b32
2249 rub(i, k, j) = rub(i, k, j) + 0.5*velb
2250 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
2256 CALL POPINTEGER4(ad_from42)
2257 CALL POPINTEGER4(ad_to42)
2258 DO j=ad_to42,ad_from42,-1
2259 CALL POPINTEGER4(jp0)
2260 CALL POPINTEGER4(jp1)
2261 CALL POPCONTROL2B(branch)
2262 IF (branch .LT. 2) THEN
2263 IF (branch .EQ. 0) THEN
2265 CALL POPINTEGER4(ad_from39)
2266 CALL POPINTEGER4(ad_to39)
2267 DO i=ad_to39,ad_from39,-1
2268 mrdy = msfux(i, j-1)*rdy
2269 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k&
2275 CALL POPINTEGER4(ad_from40)
2276 CALL POPINTEGER4(ad_to40)
2277 DO i=ad_to40,ad_from40,-1
2278 mrdy = msfux(i, j-1)*rdy
2279 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k&
2284 ELSE IF (branch .EQ. 2) THEN
2286 CALL POPINTEGER4(ad_from41)
2287 CALL POPINTEGER4(ad_to41)
2288 DO i=ad_to41,ad_from41,-1
2289 mrdy = msfux(i, j-1)*rdy
2290 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
2292 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
2297 CALL POPCONTROL3B(branch)
2298 IF (branch .LT. 3) THEN
2299 IF (branch .EQ. 0) THEN
2301 CALL POPINTEGER4(ad_from34)
2302 CALL POPINTEGER4(ad_to34)
2303 DO i=ad_to34,ad_from34,-1
2304 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
2305 temp31b25 = vel*fqyb(i, k, jp1)/60.0
2306 velb = (37.*(u(i, k, j)+u(i, k, j-1))-8.*(u(i, k, j+1)+u&
2307 & (i, k, j-2))+u(i, k, j+2)+u(i, k, j-3))*fqyb(i, k, jp1&
2309 ub0(i, k, j) = ub0(i, k, j) + 37.*temp31b25
2310 ub0(i, k, j-1) = ub0(i, k, j-1) + 37.*temp31b25
2311 ub0(i, k, j+1) = ub0(i, k, j+1) - 8.*temp31b25
2312 ub0(i, k, j-2) = ub0(i, k, j-2) - 8.*temp31b25
2313 ub0(i, k, j+2) = ub0(i, k, j+2) + temp31b25
2314 ub0(i, k, j-3) = ub0(i, k, j-3) + temp31b25
2315 fqyb(i, k, jp1) = 0.0
2316 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
2317 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
2320 ELSE IF (branch .EQ. 1) THEN
2322 CALL POPINTEGER4(ad_from35)
2323 CALL POPINTEGER4(ad_to35)
2324 DO i=ad_to35,ad_from35,-1
2325 temp31b26 = 0.25*(u(i, k, j)+u(i, k, j-1))*fqyb(i, k, &
2327 temp31b27 = 0.25*(rv(i, k, j)+rv(i-1, k, j))*fqyb(i, k, &
2329 rvb(i, k, j) = rvb(i, k, j) + temp31b26
2330 rvb(i-1, k, j) = rvb(i-1, k, j) + temp31b26
2331 ub0(i, k, j) = ub0(i, k, j) + temp31b27
2332 ub0(i, k, j-1) = ub0(i, k, j-1) + temp31b27
2333 fqyb(i, k, jp1) = 0.0
2338 CALL POPINTEGER4(ad_from36)
2339 CALL POPINTEGER4(ad_to36)
2340 DO i=ad_to36,ad_from36,-1
2341 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
2342 temp31b28 = vel*fqyb(i, k, jp1)/12.0
2343 velb = (7.*(u(i, k, j)+u(i, k, j-1))-u(i, k, j+1)-u(i, k&
2344 & , j-2))*fqyb(i, k, jp1)/12.0
2345 ub0(i, k, j) = ub0(i, k, j) + 7.*temp31b28
2346 ub0(i, k, j-1) = ub0(i, k, j-1) + 7.*temp31b28
2347 ub0(i, k, j+1) = ub0(i, k, j+1) - temp31b28
2348 ub0(i, k, j-2) = ub0(i, k, j-2) - temp31b28
2349 fqyb(i, k, jp1) = 0.0
2350 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
2351 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
2355 ELSE IF (branch .EQ. 3) THEN
2357 CALL POPINTEGER4(ad_from37)
2358 CALL POPINTEGER4(ad_to37)
2359 DO i=ad_to37,ad_from37,-1
2360 temp31b29 = 0.25*(u(i, k, j)+u(i, k, j-1))*fqyb(i, k, jp1)
2361 temp31b30 = 0.25*(rv(i, k, j)+rv(i-1, k, j))*fqyb(i, k, &
2363 rvb(i, k, j) = rvb(i, k, j) + temp31b29
2364 rvb(i-1, k, j) = rvb(i-1, k, j) + temp31b29
2365 ub0(i, k, j) = ub0(i, k, j) + temp31b30
2366 ub0(i, k, j-1) = ub0(i, k, j-1) + temp31b30
2367 fqyb(i, k, jp1) = 0.0
2370 ELSE IF (branch .EQ. 4) THEN
2372 CALL POPINTEGER4(ad_from38)
2373 CALL POPINTEGER4(ad_to38)
2374 DO i=ad_to38,ad_from38,-1
2375 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
2376 temp31b31 = vel*fqyb(i, k, jp1)/12.0
2377 velb = (7.*(u(i, k, j)+u(i, k, j-1))-u(i, k, j+1)-u(i, k, &
2378 & j-2))*fqyb(i, k, jp1)/12.0
2379 ub0(i, k, j) = ub0(i, k, j) + 7.*temp31b31
2380 ub0(i, k, j-1) = ub0(i, k, j-1) + 7.*temp31b31
2381 ub0(i, k, j+1) = ub0(i, k, j+1) - temp31b31
2382 ub0(i, k, j-2) = ub0(i, k, j-2) - temp31b31
2383 fqyb(i, k, jp1) = 0.0
2384 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
2385 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
2390 ELSE IF (branch .EQ. 1) THEN
2392 CALL POPINTEGER4(ad_from9)
2393 CALL POPINTEGER4(ad_to9)
2394 DO j=ad_to9,ad_from9,-1
2396 CALL POPINTEGER4(ad_from8)
2397 CALL POPINTEGER4(ad_to8)
2398 DO i=ad_to8,ad_from8,-1
2399 mrdx = msfux(i, j)*rdx
2400 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
2401 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
2405 CALL POPCONTROL1B(branch)
2406 IF (branch .NE. 0) THEN
2409 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
2410 temp19 = u(i+1, k, j) - u(i-2, k, j) - 3.*(u(i, k, j)-u(i-1&
2412 temp22 = SIGN(1., vel)
2413 temp21 = temp22/12.0
2414 temp20 = SIGN(1, time_step)
2415 temp19b1 = vel*fqxb(i, k)
2416 temp19b2 = temp19b1/12.0
2417 temp19b3 = temp20*temp21*temp19b1
2418 velb = ((7.*(u(i, k, j)+u(i-1, k, j))-u(i+1, k, j)-u(i-2, k&
2419 & , j))/12.0+temp20*(temp21*temp19))*fqxb(i, k)
2420 ub0(i, k, j) = ub0(i, k, j) + 7.*temp19b2 - 3.*temp19b3
2421 ub0(i-1, k, j) = ub0(i-1, k, j) + 3.*temp19b3 + 7.*temp19b2
2422 ub0(i+1, k, j) = ub0(i+1, k, j) + temp19b3 - temp19b2
2423 ub0(i-2, k, j) = ub0(i-2, k, j) - temp19b3 - temp19b2
2425 rub(i, k, j) = rub(i, k, j) + 0.5*velb
2426 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
2429 CALL POPCONTROL1B(branch)
2430 IF (branch .NE. 0) THEN
2432 temp19b = 0.25*(u(i-1, k, j)+ub)*fqxb(i, k)
2433 temp19b0 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
2434 rub(i, k, j) = rub(i, k, j) + temp19b
2435 rub(i-1, k, j) = rub(i-1, k, j) + temp19b
2436 ub0(i-1, k, j) = ub0(i-1, k, j) + temp19b0
2439 CALL POPCONTROL1B(branch)
2440 IF (branch .EQ. 0) THEN
2441 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
2445 ub0(i, k, j) = ub0(i, k, j) + ubb
2450 CALL POPCONTROL1B(branch)
2451 IF (branch .EQ. 0) THEN
2453 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
2454 temp15 = u(i+1, k, j) - u(i-2, k, j) - 3.*(u(i, k, j)-u(i-1&
2456 temp18 = SIGN(1., vel)
2457 temp17 = temp18/12.0
2458 temp16 = SIGN(1, time_step)
2459 temp15b1 = vel*fqxb(i, k)
2460 temp15b2 = temp15b1/12.0
2461 temp15b3 = temp16*temp17*temp15b1
2462 velb = ((7.*(u(i, k, j)+u(i-1, k, j))-u(i+1, k, j)-u(i-2, k&
2463 & , j))/12.0+temp16*(temp17*temp15))*fqxb(i, k)
2464 ub0(i, k, j) = ub0(i, k, j) + 7.*temp15b2 - 3.*temp15b3
2465 ub0(i-1, k, j) = ub0(i-1, k, j) + 3.*temp15b3 + 7.*temp15b2
2466 ub0(i+1, k, j) = ub0(i+1, k, j) + temp15b3 - temp15b2
2467 ub0(i-2, k, j) = ub0(i-2, k, j) - temp15b3 - temp15b2
2469 rub(i, k, j) = rub(i, k, j) + 0.5*velb
2470 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
2473 CALL POPCONTROL1B(branch)
2474 IF (branch .EQ. 0) THEN
2476 temp15b = 0.25*(u(i, k, j)+ub)*fqxb(i, k)
2477 temp15b0 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
2478 rub(i, k, j) = rub(i, k, j) + temp15b
2479 rub(i-1, k, j) = rub(i-1, k, j) + temp15b
2480 ub0(i, k, j) = ub0(i, k, j) + temp15b0
2483 CALL POPCONTROL1B(branch)
2484 IF (branch .EQ. 0) THEN
2485 ub0(i, k, j) = ub0(i, k, j) + ubb
2489 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
2495 DO i=i_end_f,i_start_f,-1
2496 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
2497 temp11 = u(i+2, k, j) - u(i-3, k, j) + 10.*(u(i, k, j)-u(i-1&
2498 & , k, j)) - 5.*(u(i+1, k, j)-u(i-2, k, j))
2499 temp14 = SIGN(1., vel)
2500 temp13 = temp14/60.0
2501 temp12 = SIGN(1, time_step)
2502 temp11b = vel*fqxb(i, k)
2503 temp11b0 = temp11b/60.0
2504 temp11b1 = -(temp12*temp13*temp11b)
2505 velb = ((37.*(u(i, k, j)+u(i-1, k, j))-8.*(u(i+1, k, j)+u(i-&
2506 & 2, k, j))+u(i+2, k, j)+u(i-3, k, j))/60.0-temp12*(temp13*&
2507 & temp11))*fqxb(i, k)
2508 ub0(i, k, j) = ub0(i, k, j) + 10.*temp11b1 + 37.*temp11b0
2509 ub0(i-1, k, j) = ub0(i-1, k, j) + 37.*temp11b0 - 10.*&
2511 ub0(i+1, k, j) = ub0(i+1, k, j) - 5.*temp11b1 - 8.*temp11b0
2512 ub0(i-2, k, j) = ub0(i-2, k, j) + 5.*temp11b1 - 8.*temp11b0
2513 ub0(i+2, k, j) = ub0(i+2, k, j) + temp11b1 + temp11b0
2514 ub0(i-3, k, j) = ub0(i-3, k, j) + temp11b0 - temp11b1
2516 rub(i, k, j) = rub(i, k, j) + 0.5*velb
2517 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
2523 CALL POPINTEGER4(ad_from7)
2524 CALL POPINTEGER4(ad_to7)
2525 DO j=ad_to7,ad_from7,-1
2526 CALL POPINTEGER4(jp0)
2527 CALL POPINTEGER4(jp1)
2528 CALL POPCONTROL2B(branch)
2529 IF (branch .LT. 2) THEN
2530 IF (branch .EQ. 0) THEN
2532 CALL POPINTEGER4(ad_from4)
2533 CALL POPINTEGER4(ad_to4)
2534 DO i=ad_to4,ad_from4,-1
2535 mrdy = msfux(i, j-1)*rdy
2536 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k&
2542 CALL POPINTEGER4(ad_from5)
2543 CALL POPINTEGER4(ad_to5)
2544 DO i=ad_to5,ad_from5,-1
2545 mrdy = msfux(i, j-1)*rdy
2546 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k&
2551 ELSE IF (branch .EQ. 2) THEN
2553 CALL POPINTEGER4(ad_from6)
2554 CALL POPINTEGER4(ad_to6)
2555 DO i=ad_to6,ad_from6,-1
2556 mrdy = msfux(i, j-1)*rdy
2557 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
2559 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
2564 CALL POPCONTROL3B(branch)
2565 IF (branch .LT. 3) THEN
2566 IF (branch .EQ. 0) THEN
2568 CALL POPINTEGER4(ad_from)
2569 CALL POPINTEGER4(ad_to)
2570 DO i=ad_to,ad_from,-1
2571 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
2572 temp = u(i, k, j+2) - u(i, k, j-3) + 10.*(u(i, k, j)-u(i&
2573 & , k, j-1)) - 5.*(u(i, k, j+1)-u(i, k, j-2))
2574 temp2 = SIGN(1., vel)
2576 temp0 = SIGN(1, time_step)
2577 tempb = vel*fqyb(i, k, jp1)
2579 tempb1 = -(temp0*temp1*tempb)
2580 velb = ((37.*(u(i, k, j)+u(i, k, j-1))-8.*(u(i, k, j+1)+&
2581 & u(i, k, j-2))+u(i, k, j+2)+u(i, k, j-3))/60.0-temp0*(&
2582 & temp1*temp))*fqyb(i, k, jp1)
2583 ub0(i, k, j) = ub0(i, k, j) + 10.*tempb1 + 37.*tempb0
2584 ub0(i, k, j-1) = ub0(i, k, j-1) + 37.*tempb0 - 10.*&
2586 ub0(i, k, j+1) = ub0(i, k, j+1) - 5.*tempb1 - 8.*tempb0
2587 ub0(i, k, j-2) = ub0(i, k, j-2) + 5.*tempb1 - 8.*tempb0
2588 ub0(i, k, j+2) = ub0(i, k, j+2) + tempb1 + tempb0
2589 ub0(i, k, j-3) = ub0(i, k, j-3) + tempb0 - tempb1
2590 fqyb(i, k, jp1) = 0.0
2591 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
2592 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
2595 ELSE IF (branch .EQ. 1) THEN
2597 CALL POPINTEGER4(ad_from0)
2598 CALL POPINTEGER4(ad_to0)
2599 DO i=ad_to0,ad_from0,-1
2600 temp3b = 0.25*(u(i, k, j)+u(i, k, j-1))*fqyb(i, k, jp1)
2601 temp3b0 = 0.25*(rv(i, k, j)+rv(i-1, k, j))*fqyb(i, k, &
2603 rvb(i, k, j) = rvb(i, k, j) + temp3b
2604 rvb(i-1, k, j) = rvb(i-1, k, j) + temp3b
2605 ub0(i, k, j) = ub0(i, k, j) + temp3b0
2606 ub0(i, k, j-1) = ub0(i, k, j-1) + temp3b0
2607 fqyb(i, k, jp1) = 0.0
2612 CALL POPINTEGER4(ad_from1)
2613 CALL POPINTEGER4(ad_to1)
2614 DO i=ad_to1,ad_from1,-1
2615 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
2616 temp3 = u(i, k, j+1) - u(i, k, j-2) - 3.*(u(i, k, j)-u(i&
2618 temp6 = SIGN(1., vel)
2620 temp4 = SIGN(1, time_step)
2621 temp3b1 = vel*fqyb(i, k, jp1)
2622 temp3b2 = temp3b1/12.0
2623 temp3b3 = temp4*temp5*temp3b1
2624 velb = ((7.*(u(i, k, j)+u(i, k, j-1))-u(i, k, j+1)-u(i, &
2625 & k, j-2))/12.0+temp4*(temp5*temp3))*fqyb(i, k, jp1)
2626 ub0(i, k, j) = ub0(i, k, j) + 7.*temp3b2 - 3.*temp3b3
2627 ub0(i, k, j-1) = ub0(i, k, j-1) + 3.*temp3b3 + 7.*&
2629 ub0(i, k, j+1) = ub0(i, k, j+1) + temp3b3 - temp3b2
2630 ub0(i, k, j-2) = ub0(i, k, j-2) - temp3b3 - temp3b2
2631 fqyb(i, k, jp1) = 0.0
2632 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
2633 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
2637 ELSE IF (branch .EQ. 3) THEN
2639 CALL POPINTEGER4(ad_from2)
2640 CALL POPINTEGER4(ad_to2)
2641 DO i=ad_to2,ad_from2,-1
2642 temp7b = 0.25*(u(i, k, j)+u(i, k, j-1))*fqyb(i, k, jp1)
2643 temp7b0 = 0.25*(rv(i, k, j)+rv(i-1, k, j))*fqyb(i, k, jp1)
2644 rvb(i, k, j) = rvb(i, k, j) + temp7b
2645 rvb(i-1, k, j) = rvb(i-1, k, j) + temp7b
2646 ub0(i, k, j) = ub0(i, k, j) + temp7b0
2647 ub0(i, k, j-1) = ub0(i, k, j-1) + temp7b0
2648 fqyb(i, k, jp1) = 0.0
2651 ELSE IF (branch .EQ. 4) THEN
2653 CALL POPINTEGER4(ad_from3)
2654 CALL POPINTEGER4(ad_to3)
2655 DO i=ad_to3,ad_from3,-1
2656 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
2657 temp7 = u(i, k, j+1) - u(i, k, j-2) - 3.*(u(i, k, j)-u(i, &
2659 temp10 = SIGN(1., vel)
2661 temp8 = SIGN(1, time_step)
2662 temp7b1 = vel*fqyb(i, k, jp1)
2663 temp7b2 = temp7b1/12.0
2664 temp7b3 = temp8*temp9*temp7b1
2665 velb = ((7.*(u(i, k, j)+u(i, k, j-1))-u(i, k, j+1)-u(i, k&
2666 & , j-2))/12.0+temp8*(temp9*temp7))*fqyb(i, k, jp1)
2667 ub0(i, k, j) = ub0(i, k, j) + 7.*temp7b2 - 3.*temp7b3
2668 ub0(i, k, j-1) = ub0(i, k, j-1) + 3.*temp7b3 + 7.*temp7b2
2669 ub0(i, k, j+1) = ub0(i, k, j+1) + temp7b3 - temp7b2
2670 ub0(i, k, j-2) = ub0(i, k, j-2) - temp7b3 - temp7b2
2671 fqyb(i, k, jp1) = 0.0
2672 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
2673 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
2680 CALL POPINTEGER4(ad_from18)
2681 CALL POPINTEGER4(ad_to18)
2682 DO j=ad_to18,ad_from18,-1
2683 CALL POPINTEGER4(jp0)
2684 CALL POPINTEGER4(jp1)
2685 CALL POPCONTROL2B(branch)
2686 IF (branch .LT. 2) THEN
2687 IF (branch .EQ. 0) THEN
2689 CALL POPINTEGER4(ad_from15)
2690 CALL POPINTEGER4(ad_to15)
2691 DO i=ad_to15,ad_from15,-1
2692 mrdy = msfux(i, j-1)*rdy
2693 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k&
2700 CALL POPINTEGER4(ad_from16)
2701 CALL POPINTEGER4(ad_to16)
2702 DO i=ad_to16,ad_from16,-1
2703 mrdy = msfux(i, j-1)*rdy
2704 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k&
2710 ELSE IF (branch .EQ. 2) THEN
2712 CALL POPINTEGER4(ad_from17)
2713 CALL POPINTEGER4(ad_to17)
2714 DO i=ad_to17,ad_from17,-1
2715 mrdy = msfux(i, j-1)*rdy
2716 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
2718 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
2724 CALL POPCONTROL2B(branch)
2725 IF (branch .EQ. 0) THEN
2727 CALL POPINTEGER4(ad_from12)
2728 CALL POPINTEGER4(ad_to12)
2729 DO i=ad_to12,ad_from12,-1
2730 temp23b4 = 0.25*(u(i, k, j_start)+u(i, k, j_start-1))*fqyb&
2732 temp23b5 = 0.25*(rv(i, k, j_start)+rv(i-1, k, j_start))*&
2734 rvb(i, k, j_start) = rvb(i, k, j_start) + temp23b4
2735 rvb(i-1, k, j_start) = rvb(i-1, k, j_start) + temp23b4
2736 ub0(i, k, j_start) = ub0(i, k, j_start) + temp23b5
2737 ub0(i, k, j_start-1) = ub0(i, k, j_start-1) + temp23b5
2738 fqyb(i, k, jp1) = 0.0
2742 ELSE IF (branch .EQ. 1) THEN
2744 CALL POPINTEGER4(ad_from13)
2745 CALL POPINTEGER4(ad_to13)
2746 DO i=ad_to13,ad_from13,-1
2747 temp23b6 = 0.25*(u(i, k, j)+u(i, k, j-1))*fqyb(i, k, jp1)
2748 temp23b7 = 0.25*(rv(i, k, j)+rv(i-1, k, j))*fqyb(i, k, jp1&
2750 rvb(i, k, j) = rvb(i, k, j) + temp23b6
2751 rvb(i-1, k, j) = rvb(i-1, k, j) + temp23b6
2752 ub0(i, k, j) = ub0(i, k, j) + temp23b7
2753 ub0(i, k, j-1) = ub0(i, k, j-1) + temp23b7
2754 fqyb(i, k, jp1) = 0.0
2760 CALL POPINTEGER4(ad_from14)
2761 CALL POPINTEGER4(ad_to14)
2762 DO i=ad_to14,ad_from14,-1
2763 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
2764 temp23b8 = vel*fqyb(i, k, jp1)/12.0
2765 velb = (7.*(u(i, k, j)+u(i, k, j-1))-u(i, k, j+1)-u(i, k, &
2766 & j-2))*fqyb(i, k, jp1)/12.0
2767 ub0(i, k, j) = ub0(i, k, j) + 7.*temp23b8
2768 ub0(i, k, j-1) = ub0(i, k, j-1) + 7.*temp23b8
2769 ub0(i, k, j+1) = ub0(i, k, j+1) - temp23b8
2770 ub0(i, k, j-2) = ub0(i, k, j-2) - temp23b8
2771 fqyb(i, k, jp1) = 0.0
2772 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
2773 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
2780 CALL POPINTEGER4(ad_from11)
2781 CALL POPINTEGER4(ad_to11)
2782 DO j=ad_to11,ad_from11,-1
2784 CALL POPINTEGER4(ad_from10)
2785 CALL POPINTEGER4(ad_to10)
2786 DO i=ad_to10,ad_from10,-1
2787 mrdx = msfux(i, j)*rdx
2788 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
2789 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
2793 CALL POPCONTROL1B(branch)
2794 IF (branch .NE. 0) THEN
2796 temp23b2 = 0.25*(u(i-1, k, j)+ub)*fqxb(i, k)
2797 temp23b3 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
2798 rub(i, k, j) = rub(i, k, j) + temp23b2
2799 rub(i-1, k, j) = rub(i-1, k, j) + temp23b2
2800 ub0(i-1, k, j) = ub0(i-1, k, j) + temp23b3
2803 CALL POPCONTROL1B(branch)
2804 IF (branch .EQ. 0) THEN
2805 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
2809 ub0(i, k, j) = ub0(i, k, j) + ubb
2813 CALL POPCONTROL1B(branch)
2814 IF (branch .EQ. 0) THEN
2816 temp23b0 = 0.25*(u(i, k, j)+ub)*fqxb(i, k)
2817 temp23b1 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
2818 rub(i, k, j) = rub(i, k, j) + temp23b0
2819 rub(i-1, k, j) = rub(i-1, k, j) + temp23b0
2820 ub0(i, k, j) = ub0(i, k, j) + temp23b1
2823 CALL POPCONTROL1B(branch)
2824 IF (branch .EQ. 0) THEN
2825 ub0(i, k, j) = ub0(i, k, j) + ubb
2829 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
2834 DO i=i_end_f,i_start_f,-1
2835 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
2836 temp23b = vel*fqxb(i, k)/12.0
2837 velb = (7.*(u(i, k, j)+u(i-1, k, j))-u(i+1, k, j)-u(i-2, k, &
2838 & j))*fqxb(i, k)/12.0
2839 ub0(i, k, j) = ub0(i, k, j) + 7.*temp23b
2840 ub0(i-1, k, j) = ub0(i-1, k, j) + 7.*temp23b
2841 ub0(i+1, k, j) = ub0(i+1, k, j) - temp23b
2842 ub0(i-2, k, j) = ub0(i-2, k, j) - temp23b
2844 rub(i, k, j) = rub(i, k, j) + 0.5*velb
2845 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
2851 ELSE IF (branch .EQ. 3) THEN
2853 CALL POPINTEGER4(ad_from27)
2854 CALL POPINTEGER4(ad_to27)
2855 DO j=ad_to27,ad_from27,-1
2856 CALL POPINTEGER4(jp0)
2857 CALL POPINTEGER4(jp1)
2858 CALL POPCONTROL2B(branch)
2859 IF (branch .LT. 2) THEN
2860 IF (branch .EQ. 0) THEN
2862 CALL POPINTEGER4(ad_from24)
2863 CALL POPINTEGER4(ad_to24)
2864 DO i=ad_to24,ad_from24,-1
2865 mrdy = msfux(i, j-1)*rdy
2866 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
2873 CALL POPINTEGER4(ad_from25)
2874 CALL POPINTEGER4(ad_to25)
2875 DO i=ad_to25,ad_from25,-1
2876 mrdy = msfux(i, j-1)*rdy
2877 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
2883 ELSE IF (branch .EQ. 2) THEN
2885 CALL POPINTEGER4(ad_from26)
2886 CALL POPINTEGER4(ad_to26)
2887 DO i=ad_to26,ad_from26,-1
2888 mrdy = msfux(i, j-1)*rdy
2889 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1&
2891 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1&
2897 CALL POPCONTROL2B(branch)
2898 IF (branch .EQ. 0) THEN
2900 CALL POPINTEGER4(ad_from21)
2901 CALL POPINTEGER4(ad_to21)
2902 DO i=ad_to21,ad_from21,-1
2903 temp27b3 = 0.25*(u(i, k, j_start)+u(i, k, j_start-1))*fqyb(i&
2905 temp27b4 = 0.25*(rv(i, k, j_start)+rv(i-1, k, j_start))*fqyb&
2907 rvb(i, k, j_start) = rvb(i, k, j_start) + temp27b3
2908 rvb(i-1, k, j_start) = rvb(i-1, k, j_start) + temp27b3
2909 ub0(i, k, j_start) = ub0(i, k, j_start) + temp27b4
2910 ub0(i, k, j_start-1) = ub0(i, k, j_start-1) + temp27b4
2911 fqyb(i, k, jp1) = 0.0
2915 ELSE IF (branch .EQ. 1) THEN
2917 CALL POPINTEGER4(ad_from22)
2918 CALL POPINTEGER4(ad_to22)
2919 DO i=ad_to22,ad_from22,-1
2920 temp27b5 = 0.25*(u(i, k, j)+u(i, k, j-1))*fqyb(i, k, jp1)
2921 temp27b6 = 0.25*(rv(i, k, j)+rv(i-1, k, j))*fqyb(i, k, jp1)
2922 rvb(i, k, j) = rvb(i, k, j) + temp27b5
2923 rvb(i-1, k, j) = rvb(i-1, k, j) + temp27b5
2924 ub0(i, k, j) = ub0(i, k, j) + temp27b6
2925 ub0(i, k, j-1) = ub0(i, k, j-1) + temp27b6
2926 fqyb(i, k, jp1) = 0.0
2932 CALL POPINTEGER4(ad_from23)
2933 CALL POPINTEGER4(ad_to23)
2934 DO i=ad_to23,ad_from23,-1
2935 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
2936 temp27 = u(i, k, j+1) - u(i, k, j-2) - 3.*(u(i, k, j)-u(i, k&
2938 temp30 = SIGN(1., vel)
2939 temp29 = temp30/12.0
2940 temp28 = SIGN(1, time_step)
2941 temp27b7 = vel*fqyb(i, k, jp1)
2942 temp27b8 = temp27b7/12.0
2943 temp27b9 = temp28*temp29*temp27b7
2944 velb = ((7.*(u(i, k, j)+u(i, k, j-1))-u(i, k, j+1)-u(i, k, j&
2945 & -2))/12.0+temp28*(temp29*temp27))*fqyb(i, k, jp1)
2946 ub0(i, k, j) = ub0(i, k, j) + 7.*temp27b8 - 3.*temp27b9
2947 ub0(i, k, j-1) = ub0(i, k, j-1) + 3.*temp27b9 + 7.*temp27b8
2948 ub0(i, k, j+1) = ub0(i, k, j+1) + temp27b9 - temp27b8
2949 ub0(i, k, j-2) = ub0(i, k, j-2) - temp27b9 - temp27b8
2950 fqyb(i, k, jp1) = 0.0
2951 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
2952 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
2959 CALL POPINTEGER4(ad_from20)
2960 CALL POPINTEGER4(ad_to20)
2961 DO j=ad_to20,ad_from20,-1
2963 CALL POPINTEGER4(ad_from19)
2964 CALL POPINTEGER4(ad_to19)
2965 DO i=ad_to19,ad_from19,-1
2966 mrdx = msfux(i, j)*rdx
2967 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
2968 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
2972 CALL POPCONTROL1B(branch)
2973 IF (branch .NE. 0) THEN
2975 temp27b1 = 0.25*(u(i-1, k, j)+ub)*fqxb(i, k)
2976 temp27b2 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
2977 rub(i, k, j) = rub(i, k, j) + temp27b1
2978 rub(i-1, k, j) = rub(i-1, k, j) + temp27b1
2979 ub0(i-1, k, j) = ub0(i-1, k, j) + temp27b2
2982 CALL POPCONTROL1B(branch)
2983 IF (branch .EQ. 0) THEN
2984 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
2988 ub0(i, k, j) = ub0(i, k, j) + ubb
2992 CALL POPCONTROL1B(branch)
2993 IF (branch .EQ. 0) THEN
2995 temp27b = 0.25*(u(i, k, j)+ub)*fqxb(i, k)
2996 temp27b0 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
2997 rub(i, k, j) = rub(i, k, j) + temp27b
2998 rub(i-1, k, j) = rub(i-1, k, j) + temp27b
2999 ub0(i, k, j) = ub0(i, k, j) + temp27b0
3002 CALL POPCONTROL1B(branch)
3003 IF (branch .EQ. 0) THEN
3004 ub0(i, k, j) = ub0(i, k, j) + ubb
3008 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
3013 DO i=i_end_f,i_start_f,-1
3014 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
3015 temp23 = u(i+1, k, j) - u(i-2, k, j) - 3.*(u(i, k, j)-u(i-1, k&
3017 temp26 = SIGN(1., vel)
3018 temp25 = temp26/12.0
3019 temp24 = SIGN(1, time_step)
3020 temp23b9 = vel*fqxb(i, k)
3021 temp23b10 = temp23b9/12.0
3022 temp23b11 = temp24*temp25*temp23b9
3023 velb = ((7.*(u(i, k, j)+u(i-1, k, j))-u(i+1, k, j)-u(i-2, k, j&
3024 & ))/12.0+temp24*(temp25*temp23))*fqxb(i, k)
3025 ub0(i, k, j) = ub0(i, k, j) + 7.*temp23b10 - 3.*temp23b11
3026 ub0(i-1, k, j) = ub0(i-1, k, j) + 3.*temp23b11 + 7.*temp23b10
3027 ub0(i+1, k, j) = ub0(i+1, k, j) + temp23b11 - temp23b10
3028 ub0(i-2, k, j) = ub0(i-2, k, j) - temp23b11 - temp23b10
3030 rub(i, k, j) = rub(i, k, j) + 0.5*velb
3031 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
3036 ELSE IF (branch .EQ. 4) THEN
3037 CALL POPINTEGER4(ad_from33)
3038 CALL POPINTEGER4(ad_to33)
3039 DO j=ad_to33,ad_from33,-1
3041 CALL POPINTEGER4(ad_from32)
3042 CALL POPINTEGER4(ad_to32)
3043 DO i=ad_to32,ad_from32,-1
3044 CALL POPCONTROL2B(branch)
3045 IF (branch .EQ. 0) THEN
3046 mrdy = msfux(i, j)*rdy
3047 temp31b20 = -(mrdy*0.25*tendencyb(i, k, j))
3048 temp31b21 = (u(i, k, j+1)+u(i, k, j))*temp31b20
3049 temp31b22 = (rv(i, k, j+1)+rv(i-1, k, j+1))*temp31b20
3050 temp31b23 = -((u(i, k, j)+u(i, k, j-1))*temp31b20)
3051 temp31b24 = -((rv(i, k, j)+rv(i-1, k, j))*temp31b20)
3052 rvb(i, k, j+1) = rvb(i, k, j+1) + temp31b21
3053 rvb(i-1, k, j+1) = rvb(i-1, k, j+1) + temp31b21
3054 ub0(i, k, j+1) = ub0(i, k, j+1) + temp31b22
3055 ub0(i, k, j) = ub0(i, k, j) + temp31b24 + temp31b22
3056 rvb(i, k, j) = rvb(i, k, j) + temp31b23
3057 rvb(i-1, k, j) = rvb(i-1, k, j) + temp31b23
3058 ub0(i, k, j-1) = ub0(i, k, j-1) + temp31b24
3059 ELSE IF (branch .EQ. 1) THEN
3060 mrdy = msfux(i, j)*rdy
3061 temp31b17 = mrdy*0.25*tendencyb(i, k, j)
3062 temp31b18 = (u(i, k, j)+u(i, k, j-1))*temp31b17
3063 temp31b19 = (rv(i, k, j)+rv(i-1, k, j))*temp31b17
3064 rvb(i, k, j) = rvb(i, k, j) + temp31b18
3065 rvb(i-1, k, j) = rvb(i-1, k, j) + temp31b18
3066 ub0(i, k, j) = ub0(i, k, j) + temp31b19
3067 ub0(i, k, j-1) = ub0(i, k, j-1) + temp31b19
3069 mrdy = msfux(i, j)*rdy
3070 temp31b14 = -(mrdy*0.25*tendencyb(i, k, j))
3071 temp31b15 = (u(i, k, j+1)+u(i, k, j))*temp31b14
3072 temp31b16 = (rv(i, k, j+1)+rv(i-1, k, j+1))*temp31b14
3073 rvb(i, k, j+1) = rvb(i, k, j+1) + temp31b15
3074 rvb(i-1, k, j+1) = rvb(i-1, k, j+1) + temp31b15
3075 ub0(i, k, j+1) = ub0(i, k, j+1) + temp31b16
3076 ub0(i, k, j) = ub0(i, k, j) + temp31b16
3082 CALL POPCONTROL1B(branch)
3083 IF (branch .EQ. 0) THEN
3084 CALL POPINTEGER4(ad_from31)
3085 CALL POPINTEGER4(ad_to31)
3086 DO j=ad_to31,ad_from31,-1
3089 mrdx = msfux(i, j)*rdx
3090 temp31b9 = -(mrdx*0.25*tendencyb(i, k, j))
3091 temp31b10 = (ub+u(i, k, j))*temp31b9
3092 temp31b11 = (ru(i+1, k, j)+ru(i, k, j))*temp31b9
3093 temp31b12 = -((u(i, k, j)+u(i-1, k, j))*temp31b9)
3094 temp31b13 = -((ru(i, k, j)+ru(i-1, k, j))*temp31b9)
3095 rub(i+1, k, j) = rub(i+1, k, j) + temp31b10
3096 rub(i, k, j) = rub(i, k, j) + temp31b12 + temp31b10
3098 ub0(i, k, j) = ub0(i, k, j) + temp31b13 + temp31b11
3099 rub(i-1, k, j) = rub(i-1, k, j) + temp31b12
3100 ub0(i-1, k, j) = ub0(i-1, k, j) + temp31b13
3101 CALL POPCONTROL1B(branch)
3102 IF (branch .EQ. 0) THEN
3103 ub0(i, k, j) = ub0(i, k, j) + ubb
3107 ub0(i+1, k, j) = ub0(i+1, k, j) + ubb
3111 CALL POPCONTROL1B(branch)
3112 IF (branch .EQ. 0) THEN
3113 CALL POPINTEGER4(ad_from30)
3114 CALL POPINTEGER4(ad_to30)
3115 DO j=ad_to30,ad_from30,-1
3118 mrdx = msfux(i, j)*rdx
3119 temp31b4 = -(mrdx*0.25*tendencyb(i, k, j))
3120 temp31b5 = (u(i+1, k, j)+u(i, k, j))*temp31b4
3121 temp31b6 = (ru(i+1, k, j)+ru(i, k, j))*temp31b4
3122 temp31b7 = -((u(i, k, j)+ub)*temp31b4)
3123 temp31b8 = -((ru(i, k, j)+ru(i-1, k, j))*temp31b4)
3124 rub(i+1, k, j) = rub(i+1, k, j) + temp31b5
3125 rub(i, k, j) = rub(i, k, j) + temp31b7 + temp31b5
3126 ub0(i+1, k, j) = ub0(i+1, k, j) + temp31b6
3127 ub0(i, k, j) = ub0(i, k, j) + temp31b8 + temp31b6
3128 rub(i-1, k, j) = rub(i-1, k, j) + temp31b7
3130 CALL POPCONTROL1B(branch)
3131 IF (branch .EQ. 0) THEN
3132 ub0(i, k, j) = ub0(i, k, j) + ubb
3136 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
3140 CALL POPINTEGER4(ad_from29)
3141 CALL POPINTEGER4(ad_to29)
3142 DO j=ad_to29,ad_from29,-1
3144 CALL POPINTEGER4(ad_from28)
3145 CALL POPINTEGER4(ad_to28)
3146 DO i=ad_to28,ad_from28,-1
3147 mrdx = msfux(i, j)*rdx
3148 temp31b = -(mrdx*0.25*tendencyb(i, k, j))
3149 temp31b0 = (u(i+1, k, j)+u(i, k, j))*temp31b
3150 temp31b1 = (ru(i+1, k, j)+ru(i, k, j))*temp31b
3151 temp31b2 = -((u(i, k, j)+u(i-1, k, j))*temp31b)
3152 temp31b3 = -((ru(i, k, j)+ru(i-1, k, j))*temp31b)
3153 rub(i+1, k, j) = rub(i+1, k, j) + temp31b0
3154 rub(i, k, j) = rub(i, k, j) + temp31b2 + temp31b0
3155 ub0(i+1, k, j) = ub0(i+1, k, j) + temp31b1
3156 ub0(i, k, j) = ub0(i, k, j) + temp31b3 + temp31b1
3157 rub(i-1, k, j) = rub(i-1, k, j) + temp31b2
3158 ub0(i-1, k, j) = ub0(i-1, k, j) + temp31b3
3163 END SUBROUTINE A_ADVECT_U
3165 ! Generated by TAPENADE (INRIA, Tropics team)
3166 ! Tapenade 3.5 (r3785) - 22 Mar 2011 18:35
3168 ! Differentiation of advect_v in reverse (adjoint) mode:
3169 ! gradient of useful results: rom tendency v v_old ru rv
3171 ! with respect to varying inputs: rom tendency v v_old ru rv
3173 ! RW status of diff variables: rom:incr tendency:in-out v:incr
3174 ! v_old:incr ru:incr rv:incr mut:incr
3175 SUBROUTINE A_ADVECT_V(v, vb0, v_old, v_oldb, tendency, tendencyb, ru, &
3176 & rub, rv, rvb, rom, romb, mut, mutb, time_step, config_flags, msfux, &
3177 & msfuy, msfvx, msfvy, msftx, msfty, fzm, fzp, rdx, rdy, rdzw, ids, ide&
3178 & , jds, jde, kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, jte&
3182 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
3183 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
3184 & jme, kms, kme, its, ite, jts, jte, kts, kte
3185 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: v, v_old, ru&
3187 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: vb0, v_oldb, rub, rvb, &
3189 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut
3190 REAL, DIMENSION(ims:ime, jms:jme) :: mutb
3191 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
3192 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: tendencyb
3193 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
3194 & msfvy, msftx, msfty
3195 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzw
3196 REAL, INTENT(IN) :: rdx, rdy
3197 INTEGER, INTENT(IN) :: time_step
3199 INTEGER :: i, j, k, itf, jtf, ktf
3200 INTEGER :: i_start, i_end, j_start, j_end
3201 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
3202 INTEGER :: jmin, jmax, jp, jm, imin, imax
3203 REAL :: mrdx, mrdy, ub, vb, uw, vw, dup, dum
3204 REAL :: ubb, vbb, uwb, dupb, dumb
3205 REAL, DIMENSION(its:ite, kts:kte) :: vflux
3206 REAL, DIMENSION(its:ite, kts:kte) :: vfluxb
3207 REAL, DIMENSION(its:ite + 1, kts:kte) :: fqx
3208 REAL, DIMENSION(its:ite+1, kts:kte) :: fqxb
3209 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqy
3210 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqyb
3211 INTEGER :: horz_order
3212 INTEGER :: vert_order
3213 LOGICAL :: degrade_xs, degrade_ys
3214 LOGICAL :: degrade_xe, degrade_ye
3215 INTEGER :: jp1, jp0, jtmp
3216 ! definition of flux operators, 3rd, 4th, 5th or 6th order
3217 REAL :: flux3, flux4, flux5, flux6
3218 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel
3220 LOGICAL :: specified
3244 INTEGER :: ad_from10
3246 INTEGER :: ad_from11
3248 INTEGER :: ad_from12
3250 INTEGER :: ad_from13
3252 INTEGER :: ad_from14
3254 INTEGER :: ad_from15
3256 INTEGER :: ad_from16
3258 INTEGER :: ad_from17
3260 INTEGER :: ad_from18
3262 INTEGER :: ad_from19
3264 INTEGER :: ad_from20
3266 INTEGER :: ad_from21
3268 INTEGER :: ad_from22
3270 INTEGER :: ad_from23
3272 INTEGER :: ad_from24
3274 INTEGER :: ad_from25
3276 INTEGER :: ad_from26
3278 INTEGER :: ad_from27
3280 INTEGER :: ad_from28
3282 INTEGER :: ad_from29
3284 INTEGER :: ad_from30
3286 INTEGER :: ad_from31
3288 INTEGER :: ad_from32
3290 INTEGER :: ad_from33
3292 INTEGER :: ad_from34
3294 INTEGER :: ad_from35
3296 INTEGER :: ad_from36
3298 INTEGER :: ad_from37
3300 INTEGER :: ad_from38
3302 INTEGER :: ad_from39
3304 INTEGER :: ad_from40
3306 INTEGER :: ad_from41
3308 INTEGER :: ad_from42
3310 INTEGER :: ad_from43
3312 INTEGER :: ad_from44
3314 INTEGER :: ad_from45
3316 INTEGER :: ad_from46
3318 INTEGER :: ad_from47
3320 INTEGER :: ad_from48
3322 INTEGER :: ad_from49
3324 INTEGER :: ad_from50
3326 INTEGER :: ad_from51
3328 INTEGER :: ad_from52
3509 IF (config_flags%specified .OR. config_flags%nested) specified = &
3511 IF (kte .GT. kde - 1) THEN
3516 horz_order = config_flags%h_mom_adv_order
3517 vert_order = config_flags%v_mom_adv_order
3518 ! here is the choice of flux operators
3519 IF (horz_order .EQ. 6) THEN
3520 ! determine boundary mods for flux operators
3521 ! We degrade the flux operators from 3rd/4th order
3522 ! to second order one gridpoint in from the boundaries for
3523 ! all boundary conditions except periodic and symmetry - these
3524 ! conditions have boundary zone data fill for correct application
3525 ! of the higher order flux stencils
3530 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
3531 & its .GT. ids + 3) degrade_xs = .false.
3532 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
3533 & ite .LT. ide - 3) degrade_xe = .false.
3534 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
3535 & jts .GT. jds + 3) degrade_ys = .false.
3536 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
3537 & jte .LT. jde - 3) degrade_ye = .false.
3538 !--------------- y - advection first
3540 IF (ite .GT. ide - 1) THEN
3547 ! higher order flux has a 5 or 7 point stencil, so compute
3548 ! bounds so we can switch to second order flux close to the boundary
3551 IF (degrade_ys) THEN
3552 IF (jts .LT. jds + 1) THEN
3559 IF (degrade_ye) THEN
3560 IF (jte .GT. jde - 1) THEN
3567 ! compute fluxes, 5th or 6th order
3571 j_loop_y_flux_6:DO j=ad_from45,j_end+1
3572 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
3576 CALL PUSHINTEGER4(i - 1)
3577 CALL PUSHINTEGER4(ad_from37)
3579 CALL PUSHCONTROL3B(0)
3580 ELSE IF (j .EQ. jds + 1) THEN
3581 ! we must be close to some boundary where we need to reduce the order of the stencil
3582 ! specified uses upstream normal wind at boundaries
3583 ! 2nd order flux next to south boundary
3586 DO i=ad_from38,i_end
3589 IF (specified .AND. v(i, k, j) .LT. 0.) THEN
3591 CALL PUSHCONTROL1B(0)
3593 CALL PUSHCONTROL1B(1)
3596 CALL PUSHINTEGER4(i - 1)
3597 CALL PUSHINTEGER4(ad_from38)
3599 CALL PUSHCONTROL3B(1)
3600 ELSE IF (j .EQ. jds + 2) THEN
3601 ! third of 4th order flux 2 in from south boundary
3605 CALL PUSHINTEGER4(i - 1)
3606 CALL PUSHINTEGER4(ad_from39)
3608 CALL PUSHCONTROL3B(2)
3609 ELSE IF (j .EQ. jde) THEN
3610 ! 2nd order flux next to north boundary
3613 DO i=ad_from40,i_end
3616 IF (specified .AND. v(i, k, j-1) .GT. 0.) THEN
3618 CALL PUSHCONTROL1B(0)
3620 CALL PUSHCONTROL1B(1)
3623 CALL PUSHINTEGER4(i - 1)
3624 CALL PUSHINTEGER4(ad_from40)
3626 CALL PUSHCONTROL3B(3)
3627 ELSE IF (j .EQ. jde - 1) THEN
3628 ! 3rd or 4th order flux 2 in from north boundary
3632 CALL PUSHINTEGER4(i - 1)
3633 CALL PUSHINTEGER4(ad_from41)
3635 CALL PUSHCONTROL3B(4)
3637 CALL PUSHCONTROL3B(5)
3639 ! y flux-divergence into tendency
3640 ! Comments on polar boundary conditions
3641 ! No advection over the poles means tendencies (held from jds [S. pole]
3642 ! to jde [N pole], i.e., on v grid) must be zero at poles
3643 ! [tendency(jds) and tendency(jde)=0]
3644 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
3648 CALL PUSHINTEGER4(i - 1)
3649 CALL PUSHINTEGER4(ad_from42)
3651 CALL PUSHCONTROL2B(0)
3652 ELSE IF (config_flags%polar .AND. j .EQ. jde + 1) THEN
3653 ! If j_end were set to jde in a special if statement apart from
3654 ! degrade_ye, then we would hit the next conditional. But since
3655 ! we want the tendency to be zero anyway, not looping to jde+1
3656 ! will produce the same effect.
3660 CALL PUSHINTEGER4(i - 1)
3661 CALL PUSHINTEGER4(ad_from43)
3663 CALL PUSHCONTROL2B(1)
3664 ELSE IF (j .GT. j_start) THEN
3669 CALL PUSHINTEGER4(i - 1)
3670 CALL PUSHINTEGER4(ad_from44)
3672 CALL PUSHCONTROL2B(2)
3674 CALL PUSHCONTROL2B(3)
3677 CALL PUSHINTEGER4(jp1)
3679 CALL PUSHINTEGER4(jp0)
3681 END DO j_loop_y_flux_6
3682 CALL PUSHINTEGER4(j - 1)
3683 CALL PUSHINTEGER4(ad_from45)
3684 ! next, x - flux divergence
3686 IF (ite .GT. ide - 1) THEN
3693 ! Polar boundary conditions are like open or specified
3694 IF ((config_flags%open_ys .OR. specified) .OR. config_flags%polar) &
3696 IF (jds + 1 .LT. jts) THEN
3702 IF ((config_flags%open_ye .OR. specified) .OR. config_flags%polar) &
3704 IF (jde - 1 .GT. jte) THEN
3710 ! higher order flux has a 5 or 7 point stencil, so compute
3711 ! bounds so we can switch to second order flux close to the boundary
3714 IF (degrade_xs) THEN
3715 IF (ids + 1 .LT. its) THEN
3720 IF (i_start + 2 .GT. ids + 3) THEN
3723 i_start_f = i_start + 2
3726 IF (degrade_xe) THEN
3727 IF (ide - 2 .GT. ite) THEN
3736 DO j=ad_from48,j_end
3737 ! lower order fluxes close to boundaries (if not periodic or symmetric)
3738 IF (degrade_xs) THEN
3740 DO i=ad_from46,i_start_f-1
3741 IF (i .EQ. ids + 1) THEN
3742 CALL PUSHCONTROL1B(0)
3744 CALL PUSHCONTROL1B(1)
3746 IF (i .EQ. ids + 2) THEN
3747 CALL PUSHCONTROL1B(1)
3749 CALL PUSHCONTROL1B(0)
3752 CALL PUSHINTEGER4(ad_from46)
3753 CALL PUSHCONTROL1B(0)
3755 CALL PUSHCONTROL1B(1)
3757 IF (degrade_xe) THEN
3758 DO i=i_end_f+1,i_end+1
3759 IF (i .EQ. ide - 1) THEN
3760 CALL PUSHCONTROL1B(0)
3762 CALL PUSHCONTROL1B(1)
3764 IF (i .EQ. ide - 2) THEN
3765 CALL PUSHCONTROL1B(1)
3767 CALL PUSHCONTROL1B(0)
3770 CALL PUSHINTEGER4(i - 1)
3771 CALL PUSHCONTROL1B(1)
3773 CALL PUSHCONTROL1B(0)
3775 ! x flux-divergence into tendency
3779 CALL PUSHINTEGER4(i - 1)
3780 CALL PUSHINTEGER4(ad_from47)
3783 CALL PUSHINTEGER4(j - 1)
3784 CALL PUSHINTEGER4(ad_from48)
3785 CALL PUSHCONTROL3B(0)
3786 ELSE IF (horz_order .EQ. 5) THEN
3787 ! 5th order horizontal flux calculation
3788 ! This code is EXACTLY the same as the 6th order code
3789 ! EXCEPT the 5th order and 3rd operators are used in
3790 ! place of the 6th and 4th order operators
3791 ! determine boundary mods for flux operators
3792 ! We degrade the flux operators from 3rd/4th order
3793 ! to second order one gridpoint in from the boundaries for
3794 ! all boundary conditions except periodic and symmetry - these
3795 ! conditions have boundary zone data fill for correct application
3796 ! of the higher order flux stencils
3801 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
3802 & its .GT. ids + 3) degrade_xs = .false.
3803 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
3804 & ite .LT. ide - 3) degrade_xe = .false.
3805 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
3806 & jts .GT. jds + 3) degrade_ys = .false.
3807 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
3808 & jte .LT. jde - 3) degrade_ye = .false.
3809 !--------------- y - advection first
3811 IF (ite .GT. ide - 1) THEN
3818 ! higher order flux has a 5 or 7 point stencil, so compute
3819 ! bounds so we can switch to second order flux close to the boundary
3822 IF (degrade_ys) THEN
3823 IF (jts .LT. jds + 1) THEN
3830 IF (degrade_ye) THEN
3831 IF (jte .GT. jde - 1) THEN
3838 ! compute fluxes, 5th or 6th order
3842 j_loop_y_flux_5:DO j=ad_from7,j_end+1
3843 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
3847 CALL PUSHINTEGER4(i - 1)
3848 CALL PUSHINTEGER4(ad_from)
3850 CALL PUSHCONTROL3B(0)
3851 ELSE IF (j .EQ. jds + 1) THEN
3852 ! we must be close to some boundary where we need to reduce the order of the stencil
3853 ! specified uses upstream normal wind at boundaries
3854 ! 2nd order flux next to south boundary
3860 IF (specified .AND. v(i, k, j) .LT. 0.) THEN
3862 CALL PUSHCONTROL1B(0)
3864 CALL PUSHCONTROL1B(1)
3867 CALL PUSHINTEGER4(i - 1)
3868 CALL PUSHINTEGER4(ad_from0)
3870 CALL PUSHCONTROL3B(1)
3871 ELSE IF (j .EQ. jds + 2) THEN
3872 ! third of 4th order flux 2 in from south boundary
3876 CALL PUSHINTEGER4(i - 1)
3877 CALL PUSHINTEGER4(ad_from1)
3879 CALL PUSHCONTROL3B(2)
3880 ELSE IF (j .EQ. jde) THEN
3881 ! 2nd order flux next to north boundary
3887 IF (specified .AND. v(i, k, j-1) .GT. 0.) THEN
3889 CALL PUSHCONTROL1B(0)
3891 CALL PUSHCONTROL1B(1)
3894 CALL PUSHINTEGER4(i - 1)
3895 CALL PUSHINTEGER4(ad_from2)
3897 CALL PUSHCONTROL3B(3)
3898 ELSE IF (j .EQ. jde - 1) THEN
3899 ! 3rd or 4th order flux 2 in from north boundary
3903 CALL PUSHINTEGER4(i - 1)
3904 CALL PUSHINTEGER4(ad_from3)
3906 CALL PUSHCONTROL3B(4)
3908 CALL PUSHCONTROL3B(5)
3910 ! y flux-divergence into tendency
3911 ! Comments on polar boundary conditions
3912 ! No advection over the poles means tendencies (held from jds [S. pole]
3913 ! to jde [N pole], i.e., on v grid) must be zero at poles
3914 ! [tendency(jds) and tendency(jde)=0]
3915 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
3919 CALL PUSHINTEGER4(i - 1)
3920 CALL PUSHINTEGER4(ad_from4)
3922 CALL PUSHCONTROL2B(0)
3923 ELSE IF (config_flags%polar .AND. j .EQ. jde + 1) THEN
3924 ! If j_end were set to jde in a special if statement apart from
3925 ! degrade_ye, then we would hit the next conditional. But since
3926 ! we want the tendency to be zero anyway, not looping to jde+1
3927 ! will produce the same effect.
3931 CALL PUSHINTEGER4(i - 1)
3932 CALL PUSHINTEGER4(ad_from5)
3934 CALL PUSHCONTROL2B(1)
3935 ELSE IF (j .GT. j_start) THEN
3940 CALL PUSHINTEGER4(i - 1)
3941 CALL PUSHINTEGER4(ad_from6)
3943 CALL PUSHCONTROL2B(2)
3945 CALL PUSHCONTROL2B(3)
3948 CALL PUSHINTEGER4(jp1)
3950 CALL PUSHINTEGER4(jp0)
3952 END DO j_loop_y_flux_5
3953 CALL PUSHINTEGER4(j - 1)
3954 CALL PUSHINTEGER4(ad_from7)
3955 ! next, x - flux divergence
3957 IF (ite .GT. ide - 1) THEN
3964 ! Polar boundary conditions are like open or specified
3965 IF ((config_flags%open_ys .OR. specified) .OR. config_flags%polar) &
3967 IF (jds + 1 .LT. jts) THEN
3973 IF ((config_flags%open_ye .OR. specified) .OR. config_flags%polar) &
3975 IF (jde - 1 .GT. jte) THEN
3981 ! higher order flux has a 5 or 7 point stencil, so compute
3982 ! bounds so we can switch to second order flux close to the boundary
3985 IF (degrade_xs) THEN
3986 IF (ids + 1 .LT. its) THEN
3991 IF (i_start + 2 .GT. ids + 3) THEN
3994 i_start_f = i_start + 2
3997 IF (degrade_xe) THEN
3998 IF (ide - 2 .GT. ite) THEN
4007 DO j=ad_from10,j_end
4008 ! lower order fluxes close to boundaries (if not periodic or symmetric)
4009 IF (degrade_xs) THEN
4011 DO i=ad_from8,i_start_f-1
4012 IF (i .EQ. ids + 1) THEN
4013 CALL PUSHCONTROL1B(0)
4015 CALL PUSHCONTROL1B(1)
4017 IF (i .EQ. ids + 2) THEN
4018 CALL PUSHCONTROL1B(1)
4020 CALL PUSHCONTROL1B(0)
4023 CALL PUSHINTEGER4(ad_from8)
4024 CALL PUSHCONTROL1B(0)
4026 CALL PUSHCONTROL1B(1)
4028 IF (degrade_xe) THEN
4029 DO i=i_end_f+1,i_end+1
4030 IF (i .EQ. ide - 1) THEN
4031 CALL PUSHCONTROL1B(0)
4033 CALL PUSHCONTROL1B(1)
4035 IF (i .EQ. ide - 2) THEN
4036 CALL PUSHCONTROL1B(1)
4038 CALL PUSHCONTROL1B(0)
4041 CALL PUSHINTEGER4(i - 1)
4042 CALL PUSHCONTROL1B(1)
4044 CALL PUSHCONTROL1B(0)
4046 ! x flux-divergence into tendency
4050 CALL PUSHINTEGER4(i - 1)
4051 CALL PUSHINTEGER4(ad_from9)
4054 CALL PUSHINTEGER4(j - 1)
4055 CALL PUSHINTEGER4(ad_from10)
4056 CALL PUSHCONTROL3B(1)
4057 ELSE IF (horz_order .EQ. 4) THEN
4058 ! determine boundary mods for flux operators
4059 ! We degrade the flux operators from 3rd/4th order
4060 ! to second order one gridpoint in from the boundaries for
4061 ! all boundary conditions except periodic and symmetry - these
4062 ! conditions have boundary zone data fill for correct application
4063 ! of the higher order flux stencils
4068 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
4069 & its .GT. ids + 2) degrade_xs = .false.
4070 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
4071 & ite .LT. ide - 2) degrade_xe = .false.
4072 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
4073 & jts .GT. jds + 2) degrade_ys = .false.
4074 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
4075 & jte .LT. jde - 2) degrade_ye = .false.
4076 IF (kte .GT. kde - 1) THEN
4082 IF (ite .GT. ide - 1) THEN
4089 ! 3rd or 4th order flux has a 5 point stencil, so compute
4090 ! bounds so we can switch to second order flux close to the boundary
4091 !CJM May not work with tiling because defined in terms of domain dims
4092 IF (degrade_ys) j_start = jds + 1
4093 IF (degrade_ye) j_end = jde - 1
4095 ! specified uses upstream normal wind at boundaries
4099 DO j=ad_from17,j_end+1
4100 IF (j .EQ. j_start .AND. degrade_ys) THEN
4103 DO i=ad_from11,i_end
4106 IF (specified .AND. v(i, k, j) .LT. 0.) THEN
4108 CALL PUSHCONTROL1B(0)
4110 CALL PUSHCONTROL1B(1)
4113 CALL PUSHINTEGER4(i - 1)
4114 CALL PUSHINTEGER4(ad_from11)
4116 CALL PUSHCONTROL2B(0)
4117 ELSE IF (j .EQ. j_end + 1 .AND. degrade_ye) THEN
4120 DO i=ad_from12,i_end
4123 IF (specified .AND. v(i, k, j-1) .GT. 0.) THEN
4125 CALL PUSHCONTROL1B(0)
4127 CALL PUSHCONTROL1B(1)
4130 CALL PUSHINTEGER4(i - 1)
4131 CALL PUSHINTEGER4(ad_from12)
4133 CALL PUSHCONTROL2B(1)
4138 CALL PUSHINTEGER4(i - 1)
4139 CALL PUSHINTEGER4(ad_from13)
4141 CALL PUSHCONTROL2B(2)
4143 ! Comments on polar boundary conditions
4144 ! No advection over the poles means tendencies (held from jds [S. pole]
4145 ! to jde [N pole], i.e., on v grid) must be zero at poles
4146 ! [tendency(jds) and tendency(jde)=0]
4147 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
4151 CALL PUSHINTEGER4(i - 1)
4152 CALL PUSHINTEGER4(ad_from14)
4154 CALL PUSHCONTROL2B(0)
4155 ELSE IF (config_flags%polar .AND. j .EQ. jde + 1) THEN
4156 ! If j_end were set to jde in a special if statement apart from
4157 ! degrade_ye, then we would hit the next conditional. But since
4158 ! we want the tendency to be zero anyway, not looping to jde+1
4159 ! will produce the same effect.
4163 CALL PUSHINTEGER4(i - 1)
4164 CALL PUSHINTEGER4(ad_from15)
4166 CALL PUSHCONTROL2B(1)
4167 ELSE IF (j .GT. j_start) THEN
4172 CALL PUSHINTEGER4(i - 1)
4173 CALL PUSHINTEGER4(ad_from16)
4175 CALL PUSHCONTROL2B(2)
4177 CALL PUSHCONTROL2B(3)
4180 CALL PUSHINTEGER4(jp1)
4182 CALL PUSHINTEGER4(jp0)
4185 CALL PUSHINTEGER4(j - 1)
4186 CALL PUSHINTEGER4(ad_from17)
4187 ! next, x - flux divergence
4189 IF (ite .GT. ide - 1) THEN
4196 ! Polar boundary conditions are like open or specified
4197 IF ((config_flags%open_ys .OR. specified) .OR. config_flags%polar) &
4199 IF (jds + 1 .LT. jts) THEN
4205 IF ((config_flags%open_ye .OR. specified) .OR. config_flags%polar) &
4207 IF (jde - 1 .GT. jte) THEN
4213 ! 3rd or 4th order flux has a 5 point stencil, so compute
4214 ! bounds so we can switch to second order flux close to the boundary
4217 IF (degrade_xs) THEN
4219 i_start_f = i_start + 1
4221 IF (degrade_xe) THEN
4227 DO j=ad_from19,j_end
4228 ! second order flux close to boundaries (if not periodic or symmetric)
4229 IF (degrade_xs) THEN
4230 CALL PUSHCONTROL1B(0)
4232 CALL PUSHCONTROL1B(1)
4234 IF (degrade_xe) THEN
4235 CALL PUSHCONTROL1B(1)
4237 CALL PUSHCONTROL1B(0)
4239 ! x flux-divergence into tendency
4243 CALL PUSHINTEGER4(i - 1)
4244 CALL PUSHINTEGER4(ad_from18)
4247 CALL PUSHINTEGER4(j - 1)
4248 CALL PUSHINTEGER4(ad_from19)
4249 CALL PUSHCONTROL3B(2)
4250 ELSE IF (horz_order .EQ. 3) THEN
4251 ! determine boundary mods for flux operators
4252 ! We degrade the flux operators from 3rd/4th order
4253 ! to second order one gridpoint in from the boundaries for
4254 ! all boundary conditions except periodic and symmetry - these
4255 ! conditions have boundary zone data fill for correct application
4256 ! of the higher order flux stencils
4261 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
4262 & its .GT. ids + 2) degrade_xs = .false.
4263 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
4264 & ite .LT. ide - 2) degrade_xe = .false.
4265 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
4266 & jts .GT. jds + 2) degrade_ys = .false.
4267 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
4268 & jte .LT. jde - 2) degrade_ye = .false.
4269 IF (kte .GT. kde - 1) THEN
4275 IF (ite .GT. ide - 1) THEN
4282 ! 3rd or 4th order flux has a 5 point stencil, so compute
4283 ! bounds so we can switch to second order flux close to the boundary
4284 !CJM May not work with tiling because defined in terms of domain dims
4285 IF (degrade_ys) j_start = jds + 1
4286 IF (degrade_ye) j_end = jde - 1
4288 ! specified uses upstream normal wind at boundaries
4292 DO j=ad_from26,j_end+1
4293 IF (j .EQ. j_start .AND. degrade_ys) THEN
4296 DO i=ad_from20,i_end
4299 IF (specified .AND. v(i, k, j) .LT. 0.) THEN
4301 CALL PUSHCONTROL1B(0)
4303 CALL PUSHCONTROL1B(1)
4306 CALL PUSHINTEGER4(i - 1)
4307 CALL PUSHINTEGER4(ad_from20)
4309 CALL PUSHCONTROL2B(0)
4310 ELSE IF (j .EQ. j_end + 1 .AND. degrade_ye) THEN
4313 DO i=ad_from21,i_end
4316 IF (specified .AND. v(i, k, j-1) .GT. 0.) THEN
4318 CALL PUSHCONTROL1B(0)
4320 CALL PUSHCONTROL1B(1)
4323 CALL PUSHINTEGER4(i - 1)
4324 CALL PUSHINTEGER4(ad_from21)
4326 CALL PUSHCONTROL2B(1)
4331 CALL PUSHINTEGER4(i - 1)
4332 CALL PUSHINTEGER4(ad_from22)
4334 CALL PUSHCONTROL2B(2)
4336 ! Comments on polar boundary conditions
4337 ! No advection over the poles means tendencies (held from jds [S. pole]
4338 ! to jde [N pole], i.e., on v grid) must be zero at poles
4339 ! [tendency(jds) and tendency(jde)=0]
4340 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
4344 CALL PUSHINTEGER4(i - 1)
4345 CALL PUSHINTEGER4(ad_from23)
4347 CALL PUSHCONTROL2B(0)
4348 ELSE IF (config_flags%polar .AND. j .EQ. jde + 1) THEN
4349 ! If j_end were set to jde in a special if statement apart from
4350 ! degrade_ye, then we would hit the next conditional. But since
4351 ! we want the tendency to be zero anyway, not looping to jde+1
4352 ! will produce the same effect.
4356 CALL PUSHINTEGER4(i - 1)
4357 CALL PUSHINTEGER4(ad_from24)
4359 CALL PUSHCONTROL2B(1)
4360 ELSE IF (j .GT. j_start) THEN
4365 CALL PUSHINTEGER4(i - 1)
4366 CALL PUSHINTEGER4(ad_from25)
4368 CALL PUSHCONTROL2B(2)
4370 CALL PUSHCONTROL2B(3)
4373 CALL PUSHINTEGER4(jp1)
4375 CALL PUSHINTEGER4(jp0)
4378 CALL PUSHINTEGER4(j - 1)
4379 CALL PUSHINTEGER4(ad_from26)
4380 ! next, x - flux divergence
4382 IF (ite .GT. ide - 1) THEN
4389 ! Polar boundary conditions are like open or specified
4390 IF ((config_flags%open_ys .OR. specified) .OR. config_flags%polar) &
4392 IF (jds + 1 .LT. jts) THEN
4398 IF ((config_flags%open_ye .OR. specified) .OR. config_flags%polar) &
4400 IF (jde - 1 .GT. jte) THEN
4406 ! 3rd or 4th order flux has a 5 point stencil, so compute
4407 ! bounds so we can switch to second order flux close to the boundary
4410 IF (degrade_xs) THEN
4412 i_start_f = i_start + 1
4414 IF (degrade_xe) THEN
4420 DO j=ad_from28,j_end
4421 ! second order flux close to boundaries (if not periodic or symmetric)
4422 IF (degrade_xs) THEN
4423 CALL PUSHCONTROL1B(0)
4425 CALL PUSHCONTROL1B(1)
4427 IF (degrade_xe) THEN
4428 CALL PUSHCONTROL1B(1)
4430 CALL PUSHCONTROL1B(0)
4432 ! x flux-divergence into tendency
4436 CALL PUSHINTEGER4(i - 1)
4437 CALL PUSHINTEGER4(ad_from27)
4440 CALL PUSHINTEGER4(j - 1)
4441 CALL PUSHINTEGER4(ad_from28)
4442 CALL PUSHCONTROL3B(3)
4443 ELSE IF (horz_order .EQ. 2) THEN
4445 IF (ite .GT. ide - 1) THEN
4452 IF (config_flags%open_ys) THEN
4453 IF (jds + 1 .LT. jts) THEN
4459 IF (config_flags%open_ye) THEN
4460 IF (jde - 1 .GT. jte) THEN
4467 IF (jds + 2 .LT. jts) THEN
4474 IF (jde - 2 .GT. jte) THEN
4480 IF (config_flags%polar) THEN
4481 IF (jds + 1 .LT. jts) THEN
4487 IF (config_flags%polar) THEN
4488 IF (jde - 1 .GT. jte) THEN
4495 DO j=ad_from30,j_end
4499 CALL PUSHINTEGER4(i - 1)
4500 CALL PUSHINTEGER4(ad_from29)
4503 CALL PUSHINTEGER4(j - 1)
4504 CALL PUSHINTEGER4(ad_from30)
4505 ! Comments on polar boundary conditions
4506 ! tendencies = 0 at poles, and polar points do not contribute at points
4508 IF (config_flags%polar) THEN
4509 IF (jts .EQ. jds) THEN
4513 CALL PUSHINTEGER4(i - 1)
4514 CALL PUSHINTEGER4(ad_from31)
4516 CALL PUSHCONTROL1B(0)
4518 CALL PUSHCONTROL1B(1)
4520 IF (jte .EQ. jde) THEN
4524 CALL PUSHINTEGER4(i - 1)
4525 CALL PUSHINTEGER4(ad_from32)
4527 CALL PUSHCONTROL2B(0)
4529 CALL PUSHCONTROL2B(1)
4532 CALL PUSHCONTROL2B(2)
4534 ! specified uses upstream normal wind at boundaries
4535 IF (specified .AND. jts .LE. jds + 1) THEN
4539 DO i=ad_from33,i_end
4541 ! ADT eqn 45, 2nd term on RHS
4543 IF (v(i, k, j) .LT. 0.) THEN
4545 CALL PUSHCONTROL1B(0)
4547 CALL PUSHCONTROL1B(1)
4550 CALL PUSHINTEGER4(i - 1)
4551 CALL PUSHINTEGER4(ad_from33)
4553 CALL PUSHCONTROL1B(0)
4555 CALL PUSHCONTROL1B(1)
4557 IF (specified .AND. jte .GE. jde - 1) THEN
4558 CALL PUSHINTEGER4(j)
4562 DO i=ad_from34,i_end
4564 ! ADT eqn 45, 2nd term on RHS
4566 IF (v(i, k, j) .GT. 0.) THEN
4568 CALL PUSHCONTROL1B(0)
4570 CALL PUSHCONTROL1B(1)
4573 CALL PUSHINTEGER4(i - 1)
4574 CALL PUSHINTEGER4(ad_from34)
4576 CALL PUSHCONTROL1B(0)
4578 CALL PUSHCONTROL1B(1)
4580 IF (.NOT.config_flags%periodic_x) THEN
4581 IF (config_flags%open_xs .OR. specified) THEN
4582 IF (ids + 1 .LT. its) THEN
4588 IF (config_flags%open_xe .OR. specified) THEN
4589 IF (ide - 2 .GT. ite) THEN
4596 IF (config_flags%polar) THEN
4597 IF (jds + 1 .LT. jts) THEN
4603 IF (config_flags%polar) THEN
4604 IF (jde - 1 .GT. jte) THEN
4611 CALL PUSHINTEGER4(j)
4612 DO j=ad_from36,j_end
4616 CALL PUSHINTEGER4(i - 1)
4617 CALL PUSHINTEGER4(ad_from35)
4620 CALL PUSHINTEGER4(j - 1)
4621 CALL PUSHINTEGER4(ad_from36)
4622 CALL PUSHCONTROL3B(4)
4624 CALL PUSHCONTROL3B(5)
4626 ! Comments on polar boundary condition
4627 ! Force tendency=0 at NP and SP
4628 ! We keep setting this everywhere, but it can't hurt...
4629 IF (config_flags%polar .AND. jts .EQ. jds) THEN
4630 CALL PUSHCONTROL1B(0)
4632 CALL PUSHCONTROL1B(1)
4634 IF (config_flags%polar .AND. jte .EQ. jde) THEN
4635 CALL PUSHCONTROL1B(0)
4637 CALL PUSHCONTROL1B(1)
4639 ! radiative lateral boundary condition in y for normal velocity (v)
4640 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
4641 CALL PUSHINTEGER4(i_start)
4643 IF (ite .GT. ide - 1) THEN
4644 CALL PUSHINTEGER4(i_end)
4646 CALL PUSHCONTROL1B(0)
4648 CALL PUSHINTEGER4(i_end)
4650 CALL PUSHCONTROL1B(1)
4653 DO i=ad_from49,i_end
4655 IF (rv(i, k, jts) - cb*mut(i, jts) .GT. 0.) THEN
4658 CALL PUSHCONTROL1B(0)
4661 vb = rv(i, k, jts) - cb*mut(i, jts)
4662 CALL PUSHCONTROL1B(1)
4666 CALL PUSHINTEGER4(i - 1)
4667 CALL PUSHINTEGER4(ad_from49)
4668 CALL PUSHCONTROL1B(0)
4670 CALL PUSHCONTROL1B(1)
4672 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
4673 CALL PUSHINTEGER4(i_start)
4675 IF (ite .GT. ide - 1) THEN
4676 CALL PUSHINTEGER4(i_end)
4678 CALL PUSHCONTROL1B(0)
4680 CALL PUSHINTEGER4(i_end)
4682 CALL PUSHCONTROL1B(1)
4685 DO i=ad_from50,i_end
4687 IF (rv(i, k, jte) + cb*mut(i, jte-1) .LT. 0.) THEN
4690 CALL PUSHCONTROL1B(0)
4693 vb = rv(i, k, jte) + cb*mut(i, jte-1)
4694 CALL PUSHCONTROL1B(1)
4698 CALL PUSHINTEGER4(i - 1)
4699 CALL PUSHINTEGER4(ad_from50)
4700 CALL PUSHCONTROL1B(1)
4702 CALL PUSHCONTROL1B(0)
4704 ! pick up the rest of the horizontal radiation boundary conditions.
4705 ! (these are the computations that don't require 'cb'.
4706 ! first, set to index ranges
4708 IF (jte .GT. jde) THEN
4715 IF (config_flags%open_ys) THEN
4716 IF (jds + 1 .LT. jts) THEN
4723 IF (config_flags%open_ye) THEN
4724 IF (jte .GT. jde - 1) THEN
4731 ! compute x (u) conditions for v, w, or scalar
4732 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
4734 DO j=ad_from51,j_end
4735 CALL PUSHREAL8(mrdx)
4736 ! ADT eqn 45, 1st term on RHS
4737 mrdx = msfvy(its, j)*rdx
4738 IF (jmax .GT. j) THEN
4739 CALL PUSHINTEGER4(jp)
4741 CALL PUSHCONTROL1B(0)
4743 CALL PUSHINTEGER4(jp)
4745 CALL PUSHCONTROL1B(1)
4747 IF (jmin .LT. j - 1) THEN
4748 CALL PUSHINTEGER4(jm)
4750 CALL PUSHCONTROL1B(0)
4752 CALL PUSHINTEGER4(jm)
4754 CALL PUSHCONTROL1B(1)
4757 uw = 0.5*(ru(its, k, jp)+ru(its, k, jm))
4758 IF (uw .GT. 0.) THEN
4761 CALL PUSHCONTROL1B(0)
4765 CALL PUSHCONTROL1B(1)
4769 CALL PUSHINTEGER4(j - 1)
4770 CALL PUSHINTEGER4(ad_from51)
4771 CALL PUSHCONTROL1B(0)
4773 CALL PUSHCONTROL1B(1)
4775 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
4777 DO j=ad_from52,j_end
4778 CALL PUSHREAL8(mrdx)
4779 ! ADT eqn 45, 1st term on RHS
4780 mrdx = msfvy(ite-1, j)*rdx
4781 IF (jmax .GT. j) THEN
4782 CALL PUSHINTEGER4(jp)
4784 CALL PUSHCONTROL1B(0)
4786 CALL PUSHINTEGER4(jp)
4788 CALL PUSHCONTROL1B(1)
4790 IF (jmin .LT. j - 1) THEN
4791 CALL PUSHINTEGER4(jm)
4793 CALL PUSHCONTROL1B(0)
4795 CALL PUSHINTEGER4(jm)
4797 CALL PUSHCONTROL1B(1)
4800 uw = 0.5*(ru(ite, k, jp)+ru(ite, k, jm))
4801 IF (uw .LT. 0.) THEN
4804 CALL PUSHCONTROL1B(0)
4808 CALL PUSHCONTROL1B(1)
4812 CALL PUSHINTEGER4(j - 1)
4813 CALL PUSHINTEGER4(ad_from52)
4814 CALL PUSHCONTROL1B(1)
4816 CALL PUSHCONTROL1B(0)
4818 CALL PUSHINTEGER4(i_start)
4819 !-------------------- vertical advection
4820 ! ADT eqn 45 has 3rd term on RHS = -(1/mx) partial d/dz (rho v w)
4821 ! Here we have: - partial d/dz (v*rom) = - partial d/dz (v rho w / my)
4822 ! We therefore need to make a correction for advect_v
4823 ! since 'my' (map scale factor in y direction) isn't a function of z,
4824 ! we can do this using *(my/mx) (see eqn. 45 for example)
4826 IF (ite .GT. ide - 1) THEN
4827 CALL PUSHINTEGER4(i_end)
4829 CALL PUSHCONTROL1B(0)
4831 CALL PUSHINTEGER4(i_end)
4833 CALL PUSHCONTROL1B(1)
4837 ! Polar boundary conditions are like open or specified
4838 ! We don't want to calculate vertical v tendencies at the N or S pole
4839 IF ((config_flags%open_ys .OR. specified) .OR. config_flags%polar) &
4841 IF (jds + 1 .LT. jts) THEN
4847 IF ((config_flags%open_ye .OR. specified) .OR. config_flags%polar) &
4849 IF (jde - 1 .GT. jte) THEN
4855 IF (vert_order .EQ. 6) THEN
4857 CALL PUSHINTEGER4(k)
4860 DO j=j_end,j_start,-1
4862 DO i=i_end,i_start,-1
4863 temp31b50 = -(msfvy(i, j)*rdzw(k)*tendencyb(i, k, j)/msfvx(i, &
4865 vfluxb(i, k+1) = vfluxb(i, k+1) + temp31b50
4866 vfluxb(i, k) = vfluxb(i, k) - temp31b50
4870 DO i=i_end,i_start,-1
4872 temp31b44 = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i&
4874 temp31b45 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
4875 romb(i, k, j) = romb(i, k, j) + temp31b44
4876 romb(i, k, j-1) = romb(i, k, j-1) + temp31b44
4877 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp31b45
4878 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp31b45
4881 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
4882 temp31b46 = vel*vfluxb(i, k)/12.0
4883 velb = (7.*(v(i, k, j)+v(i, k-1, j))-v(i, k+1, j)-v(i, k-2, j))*&
4885 vb0(i, k, j) = vb0(i, k, j) + 7.*temp31b46
4886 vb0(i, k-1, j) = vb0(i, k-1, j) + 7.*temp31b46
4887 vb0(i, k+1, j) = vb0(i, k+1, j) - temp31b46
4888 vb0(i, k-2, j) = vb0(i, k-2, j) - temp31b46
4890 romb(i, k, j) = romb(i, k, j) + 0.5*velb
4891 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
4893 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
4894 temp31b47 = vel*vfluxb(i, k)/12.0
4895 velb = (7.*(v(i, k, j)+v(i, k-1, j))-v(i, k+1, j)-v(i, k-2, j))*&
4897 vb0(i, k, j) = vb0(i, k, j) + 7.*temp31b47
4898 vb0(i, k-1, j) = vb0(i, k-1, j) + 7.*temp31b47
4899 vb0(i, k+1, j) = vb0(i, k+1, j) - temp31b47
4900 vb0(i, k-2, j) = vb0(i, k-2, j) - temp31b47
4902 romb(i, k, j) = romb(i, k, j) + 0.5*velb
4903 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
4905 temp31b48 = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i&
4907 temp31b49 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
4908 romb(i, k, j) = romb(i, k, j) + temp31b48
4909 romb(i, k, j-1) = romb(i, k, j-1) + temp31b48
4910 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp31b49
4911 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp31b49
4915 DO i=i_end,i_start,-1
4916 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
4917 temp31b43 = vel*vfluxb(i, k)/60.0
4918 velb = (37.*(v(i, k, j)+v(i, k-1, j))-8.*(v(i, k+1, j)+v(i, k-&
4919 & 2, j))+v(i, k+2, j)+v(i, k-3, j))*vfluxb(i, k)/60.0
4920 vb0(i, k, j) = vb0(i, k, j) + 37.*temp31b43
4921 vb0(i, k-1, j) = vb0(i, k-1, j) + 37.*temp31b43
4922 vb0(i, k+1, j) = vb0(i, k+1, j) - 8.*temp31b43
4923 vb0(i, k-2, j) = vb0(i, k-2, j) - 8.*temp31b43
4924 vb0(i, k+2, j) = vb0(i, k+2, j) + temp31b43
4925 vb0(i, k-3, j) = vb0(i, k-3, j) + temp31b43
4927 romb(i, k, j) = romb(i, k, j) + 0.5*velb
4928 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
4932 ELSE IF (vert_order .EQ. 5) THEN
4934 CALL PUSHINTEGER4(k)
4937 DO j=j_end,j_start,-1
4939 DO i=i_end,i_start,-1
4940 temp43b1 = -(msfvy(i, j)*rdzw(k)*tendencyb(i, k, j)/msfvx(i, j&
4942 vfluxb(i, k+1) = vfluxb(i, k+1) + temp43b1
4943 vfluxb(i, k) = vfluxb(i, k) - temp43b1
4947 DO i=i_end,i_start,-1
4949 temp43b = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i, &
4951 temp43b0 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
4952 romb(i, k, j) = romb(i, k, j) + temp43b
4953 romb(i, k, j-1) = romb(i, k, j-1) + temp43b
4954 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp43b0
4955 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp43b0
4958 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
4959 temp39 = v(i, k+1, j) - v(i, k-2, j) - 3.*(v(i, k, j)-v(i, k-1, &
4961 temp42 = SIGN(1., -vel)
4962 temp41 = temp42/12.0
4963 temp40 = SIGN(1, time_step)
4964 temp39b = vel*vfluxb(i, k)
4965 temp39b0 = temp39b/12.0
4966 temp39b1 = temp40*temp41*temp39b
4967 velb = ((7.*(v(i, k, j)+v(i, k-1, j))-v(i, k+1, j)-v(i, k-2, j))&
4968 & /12.0+temp40*(temp41*temp39))*vfluxb(i, k)
4969 vb0(i, k, j) = vb0(i, k, j) + 7.*temp39b0 - 3.*temp39b1
4970 vb0(i, k-1, j) = vb0(i, k-1, j) + 3.*temp39b1 + 7.*temp39b0
4971 vb0(i, k+1, j) = vb0(i, k+1, j) + temp39b1 - temp39b0
4972 vb0(i, k-2, j) = vb0(i, k-2, j) - temp39b1 - temp39b0
4974 romb(i, k, j) = romb(i, k, j) + 0.5*velb
4975 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
4977 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
4978 temp35 = v(i, k+1, j) - v(i, k-2, j) - 3.*(v(i, k, j)-v(i, k-1, &
4980 temp38 = SIGN(1., -vel)
4981 temp37 = temp38/12.0
4982 temp36 = SIGN(1, time_step)
4983 temp35b = vel*vfluxb(i, k)
4984 temp35b0 = temp35b/12.0
4985 temp35b1 = temp36*temp37*temp35b
4986 velb = ((7.*(v(i, k, j)+v(i, k-1, j))-v(i, k+1, j)-v(i, k-2, j))&
4987 & /12.0+temp36*(temp37*temp35))*vfluxb(i, k)
4988 vb0(i, k, j) = vb0(i, k, j) + 7.*temp35b0 - 3.*temp35b1
4989 vb0(i, k-1, j) = vb0(i, k-1, j) + 3.*temp35b1 + 7.*temp35b0
4990 vb0(i, k+1, j) = vb0(i, k+1, j) + temp35b1 - temp35b0
4991 vb0(i, k-2, j) = vb0(i, k-2, j) - temp35b1 - temp35b0
4993 romb(i, k, j) = romb(i, k, j) + 0.5*velb
4994 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
4996 temp35b2 = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i&
4998 temp35b3 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
4999 romb(i, k, j) = romb(i, k, j) + temp35b2
5000 romb(i, k, j-1) = romb(i, k, j-1) + temp35b2
5001 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp35b3
5002 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp35b3
5006 DO i=i_end,i_start,-1
5007 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
5008 temp31 = v(i, k+2, j) - v(i, k-3, j) + 10.*(v(i, k, j)-v(i, k-&
5009 & 1, j)) - 5.*(v(i, k+1, j)-v(i, k-2, j))
5010 temp34 = SIGN(1., -vel)
5011 temp33 = temp34/60.0
5012 temp32 = SIGN(1, time_step)
5013 temp31b51 = vel*vfluxb(i, k)
5014 temp31b52 = temp31b51/60.0
5015 temp31b53 = -(temp32*temp33*temp31b51)
5016 velb = ((37.*(v(i, k, j)+v(i, k-1, j))-8.*(v(i, k+1, j)+v(i, k&
5017 & -2, j))+v(i, k+2, j)+v(i, k-3, j))/60.0-temp32*(temp33*&
5018 & temp31))*vfluxb(i, k)
5019 vb0(i, k, j) = vb0(i, k, j) + 10.*temp31b53 + 37.*temp31b52
5020 vb0(i, k-1, j) = vb0(i, k-1, j) + 37.*temp31b52 - 10.*&
5022 vb0(i, k+1, j) = vb0(i, k+1, j) - 5.*temp31b53 - 8.*temp31b52
5023 vb0(i, k-2, j) = vb0(i, k-2, j) + 5.*temp31b53 - 8.*temp31b52
5024 vb0(i, k+2, j) = vb0(i, k+2, j) + temp31b53 + temp31b52
5025 vb0(i, k-3, j) = vb0(i, k-3, j) + temp31b52 - temp31b53
5027 romb(i, k, j) = romb(i, k, j) + 0.5*velb
5028 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
5032 ELSE IF (vert_order .EQ. 4) THEN
5034 CALL PUSHINTEGER4(k)
5037 DO j=j_end,j_start,-1
5039 DO i=i_end,i_start,-1
5040 temp43b7 = -(msfvy(i, j)*rdzw(k)*tendencyb(i, k, j)/msfvx(i, j&
5042 vfluxb(i, k+1) = vfluxb(i, k+1) + temp43b7
5043 vfluxb(i, k) = vfluxb(i, k) - temp43b7
5047 DO i=i_end,i_start,-1
5049 temp43b3 = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i&
5051 temp43b4 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
5052 romb(i, k, j) = romb(i, k, j) + temp43b3
5053 romb(i, k, j-1) = romb(i, k, j-1) + temp43b3
5054 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp43b4
5055 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp43b4
5058 temp43b5 = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i&
5060 temp43b6 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
5061 romb(i, k, j) = romb(i, k, j) + temp43b5
5062 romb(i, k, j-1) = romb(i, k, j-1) + temp43b5
5063 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp43b6
5064 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp43b6
5068 DO i=i_end,i_start,-1
5069 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
5070 temp43b2 = vel*vfluxb(i, k)/12.0
5071 velb = (7.*(v(i, k, j)+v(i, k-1, j))-v(i, k+1, j)-v(i, k-2, j)&
5072 & )*vfluxb(i, k)/12.0
5073 vb0(i, k, j) = vb0(i, k, j) + 7.*temp43b2
5074 vb0(i, k-1, j) = vb0(i, k-1, j) + 7.*temp43b2
5075 vb0(i, k+1, j) = vb0(i, k+1, j) - temp43b2
5076 vb0(i, k-2, j) = vb0(i, k-2, j) - temp43b2
5078 romb(i, k, j) = romb(i, k, j) + 0.5*velb
5079 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
5083 ELSE IF (vert_order .EQ. 3) THEN
5085 CALL PUSHINTEGER4(k)
5088 DO j=j_end,j_start,-1
5090 DO i=i_end,i_start,-1
5091 temp47b3 = -(msfvy(i, j)*rdzw(k)*tendencyb(i, k, j)/msfvx(i, j&
5093 vfluxb(i, k+1) = vfluxb(i, k+1) + temp47b3
5094 vfluxb(i, k) = vfluxb(i, k) - temp47b3
5098 DO i=i_end,i_start,-1
5100 temp47b = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i, &
5102 temp47b0 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
5103 romb(i, k, j) = romb(i, k, j) + temp47b
5104 romb(i, k, j-1) = romb(i, k, j-1) + temp47b
5105 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp47b0
5106 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp47b0
5109 temp47b1 = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i&
5111 temp47b2 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
5112 romb(i, k, j) = romb(i, k, j) + temp47b1
5113 romb(i, k, j-1) = romb(i, k, j-1) + temp47b1
5114 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp47b2
5115 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp47b2
5119 DO i=i_end,i_start,-1
5120 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
5121 temp43 = v(i, k+1, j) - v(i, k-2, j) - 3.*(v(i, k, j)-v(i, k-1&
5123 temp46 = SIGN(1., -vel)
5124 temp45 = temp46/12.0
5125 temp44 = SIGN(1, time_step)
5126 temp43b8 = vel*vfluxb(i, k)
5127 temp43b9 = temp43b8/12.0
5128 temp43b10 = temp44*temp45*temp43b8
5129 velb = ((7.*(v(i, k, j)+v(i, k-1, j))-v(i, k+1, j)-v(i, k-2, j&
5130 & ))/12.0+temp44*(temp45*temp43))*vfluxb(i, k)
5131 vb0(i, k, j) = vb0(i, k, j) + 7.*temp43b9 - 3.*temp43b10
5132 vb0(i, k-1, j) = vb0(i, k-1, j) + 3.*temp43b10 + 7.*temp43b9
5133 vb0(i, k+1, j) = vb0(i, k+1, j) + temp43b10 - temp43b9
5134 vb0(i, k-2, j) = vb0(i, k-2, j) - temp43b10 - temp43b9
5136 romb(i, k, j) = romb(i, k, j) + 0.5*velb
5137 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
5141 ELSE IF (vert_order .EQ. 2) THEN
5143 DO j=j_end,j_start,-1
5145 DO i=i_end,i_start,-1
5146 temp47b6 = -(msfvy(i, j)*rdzw(k)*tendencyb(i, k, j)/msfvx(i, j&
5148 vfluxb(i, k+1) = vfluxb(i, k+1) + temp47b6
5149 vfluxb(i, k) = vfluxb(i, k) - temp47b6
5153 DO i=i_end,i_start,-1
5154 temp47b4 = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(&
5156 temp47b5 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
5157 romb(i, k, j) = romb(i, k, j) + temp47b4
5158 romb(i, k, j-1) = romb(i, k, j-1) + temp47b4
5159 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp47b5
5160 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp47b5
5166 CALL POPCONTROL1B(branch)
5167 IF (branch .EQ. 0) THEN
5168 CALL POPINTEGER4(i_end)
5170 CALL POPINTEGER4(i_end)
5172 CALL POPINTEGER4(i_start)
5173 CALL POPCONTROL1B(branch)
5174 IF (branch .NE. 0) THEN
5175 CALL POPINTEGER4(ad_from52)
5176 CALL POPINTEGER4(ad_to52)
5177 DO j=ad_to52,ad_from52,-1
5179 dum = ru(ite, k, jm) - ru(ite-1, k, jm)
5180 dup = ru(ite, k, jp) - ru(ite-1, k, jp)
5181 temp31b41 = -(mrdx*tendencyb(ite-1, k, j))
5182 temp31b42 = 0.5*v(ite-1, k, j)*temp31b41
5183 ubb = (v_old(ite-1, k, j)-v_old(ite-2, k, j))*temp31b41
5184 v_oldb(ite-1, k, j) = v_oldb(ite-1, k, j) + ub*temp31b41
5185 v_oldb(ite-2, k, j) = v_oldb(ite-2, k, j) - ub*temp31b41
5186 vb0(ite-1, k, j) = vb0(ite-1, k, j) + 0.5*(dup+dum)*temp31b41
5189 rub(ite, k, jm) = rub(ite, k, jm) + dumb
5190 rub(ite-1, k, jm) = rub(ite-1, k, jm) - dumb
5191 rub(ite, k, jp) = rub(ite, k, jp) + dupb
5192 rub(ite-1, k, jp) = rub(ite-1, k, jp) - dupb
5193 CALL POPCONTROL1B(branch)
5194 IF (branch .EQ. 0) THEN
5201 rub(ite, k, jp) = rub(ite, k, jp) + 0.5*uwb
5202 rub(ite, k, jm) = rub(ite, k, jm) + 0.5*uwb
5204 CALL POPCONTROL1B(branch)
5205 IF (branch .EQ. 0) THEN
5206 CALL POPINTEGER4(jm)
5208 CALL POPINTEGER4(jm)
5210 CALL POPCONTROL1B(branch)
5211 IF (branch .EQ. 0) THEN
5212 CALL POPINTEGER4(jp)
5214 CALL POPINTEGER4(jp)
5219 CALL POPCONTROL1B(branch)
5220 IF (branch .EQ. 0) THEN
5221 CALL POPINTEGER4(ad_from51)
5222 CALL POPINTEGER4(ad_to51)
5223 DO j=ad_to51,ad_from51,-1
5225 dum = ru(its+1, k, jm) - ru(its, k, jm)
5226 dup = ru(its+1, k, jp) - ru(its, k, jp)
5227 temp31b39 = -(mrdx*tendencyb(its, k, j))
5228 temp31b40 = 0.5*v(its, k, j)*temp31b39
5229 ubb = (v_old(its+1, k, j)-v_old(its, k, j))*temp31b39
5230 v_oldb(its+1, k, j) = v_oldb(its+1, k, j) + ub*temp31b39
5231 v_oldb(its, k, j) = v_oldb(its, k, j) - ub*temp31b39
5232 vb0(its, k, j) = vb0(its, k, j) + 0.5*(dup+dum)*temp31b39
5235 rub(its+1, k, jm) = rub(its+1, k, jm) + dumb
5236 rub(its, k, jm) = rub(its, k, jm) - dumb
5237 rub(its+1, k, jp) = rub(its+1, k, jp) + dupb
5238 rub(its, k, jp) = rub(its, k, jp) - dupb
5239 CALL POPCONTROL1B(branch)
5240 IF (branch .EQ. 0) THEN
5247 rub(its, k, jp) = rub(its, k, jp) + 0.5*uwb
5248 rub(its, k, jm) = rub(its, k, jm) + 0.5*uwb
5250 CALL POPCONTROL1B(branch)
5251 IF (branch .EQ. 0) THEN
5252 CALL POPINTEGER4(jm)
5254 CALL POPINTEGER4(jm)
5256 CALL POPCONTROL1B(branch)
5257 IF (branch .EQ. 0) THEN
5258 CALL POPINTEGER4(jp)
5260 CALL POPINTEGER4(jp)
5265 CALL POPCONTROL1B(branch)
5266 IF (branch .NE. 0) THEN
5267 CALL POPINTEGER4(ad_from50)
5268 CALL POPINTEGER4(ad_to50)
5269 DO i=ad_to50,ad_from50,-1
5271 temp31b38 = -(rdy*tendencyb(i, k, jte))
5272 vbb = (v_old(i, k, jte)-v_old(i, k, jte-1))*temp31b38
5273 v_oldb(i, k, jte) = v_oldb(i, k, jte) + vb*temp31b38
5274 v_oldb(i, k, jte-1) = v_oldb(i, k, jte-1) - vb*temp31b38
5275 CALL POPCONTROL1B(branch)
5276 IF (branch .EQ. 0) THEN
5280 rvb(i, k, jte) = rvb(i, k, jte) + vbb
5281 mutb(i, jte-1) = mutb(i, jte-1) + cb*vbb
5285 CALL POPCONTROL1B(branch)
5286 IF (branch .EQ. 0) THEN
5287 CALL POPINTEGER4(i_end)
5289 CALL POPINTEGER4(i_end)
5291 CALL POPINTEGER4(i_start)
5293 CALL POPCONTROL1B(branch)
5294 IF (branch .EQ. 0) THEN
5295 CALL POPINTEGER4(ad_from49)
5296 CALL POPINTEGER4(ad_to49)
5297 DO i=ad_to49,ad_from49,-1
5299 temp31b37 = -(rdy*tendencyb(i, k, jts))
5300 vbb = (v_old(i, k, jts+1)-v_old(i, k, jts))*temp31b37
5301 v_oldb(i, k, jts+1) = v_oldb(i, k, jts+1) + vb*temp31b37
5302 v_oldb(i, k, jts) = v_oldb(i, k, jts) - vb*temp31b37
5303 CALL POPCONTROL1B(branch)
5304 IF (branch .EQ. 0) THEN
5308 rvb(i, k, jts) = rvb(i, k, jts) + vbb
5309 mutb(i, jts) = mutb(i, jts) - cb*vbb
5313 CALL POPCONTROL1B(branch)
5314 IF (branch .EQ. 0) THEN
5315 CALL POPINTEGER4(i_end)
5317 CALL POPINTEGER4(i_end)
5319 CALL POPINTEGER4(i_start)
5321 CALL POPCONTROL1B(branch)
5322 IF (branch .EQ. 0) THEN
5325 tendencyb(i, k, jte) = 0.0
5329 CALL POPCONTROL1B(branch)
5330 IF (branch .EQ. 0) THEN
5333 tendencyb(i, k, jts) = 0.0
5337 CALL POPCONTROL3B(branch)
5338 IF (branch .LT. 3) THEN
5339 IF (branch .EQ. 0) THEN
5341 CALL POPINTEGER4(ad_from48)
5342 CALL POPINTEGER4(ad_to48)
5343 DO j=ad_to48,ad_from48,-1
5345 CALL POPINTEGER4(ad_from47)
5346 CALL POPINTEGER4(ad_to47)
5347 DO i=ad_to47,ad_from47,-1
5348 mrdx = msfvy(i, j)*rdx
5349 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
5350 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
5353 CALL POPCONTROL1B(branch)
5354 IF (branch .NE. 0) THEN
5355 CALL POPINTEGER4(ad_to46)
5356 DO i=ad_to46,i_end_f+1,-1
5357 CALL POPCONTROL1B(branch)
5358 IF (branch .NE. 0) THEN
5360 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
5361 temp31b36 = vel*fqxb(i, k)/12.0
5362 velb = (7.*(v(i, k, j)+v(i-1, k, j))-v(i+1, k, j)-v(i-2&
5363 & , k, j))*fqxb(i, k)/12.0
5364 vb0(i, k, j) = vb0(i, k, j) + 7.*temp31b36
5365 vb0(i-1, k, j) = vb0(i-1, k, j) + 7.*temp31b36
5366 vb0(i+1, k, j) = vb0(i+1, k, j) - temp31b36
5367 vb0(i-2, k, j) = vb0(i-2, k, j) - temp31b36
5369 rub(i, k, j) = rub(i, k, j) + 0.5*velb
5370 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
5373 CALL POPCONTROL1B(branch)
5374 IF (branch .EQ. 0) THEN
5376 temp31b34 = 0.25*(v(i_end+1, k, j)+v(i_end, k, j))*fqxb(&
5378 temp31b35 = 0.25*(ru(i_end+1, k, j)+ru(i_end+1, k, j-1))&
5380 rub(i_end+1, k, j) = rub(i_end+1, k, j) + temp31b34
5381 rub(i_end+1, k, j-1) = rub(i_end+1, k, j-1) + temp31b34
5382 vb0(i_end+1, k, j) = vb0(i_end+1, k, j) + temp31b35
5383 vb0(i_end, k, j) = vb0(i_end, k, j) + temp31b35
5389 CALL POPCONTROL1B(branch)
5390 IF (branch .EQ. 0) THEN
5391 CALL POPINTEGER4(ad_from46)
5392 DO i=i_start_f-1,ad_from46,-1
5393 CALL POPCONTROL1B(branch)
5394 IF (branch .NE. 0) THEN
5396 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
5397 temp31b33 = vel*fqxb(i, k)/12.0
5398 velb = (7.*(v(i, k, j)+v(i-1, k, j))-v(i+1, k, j)-v(i-2&
5399 & , k, j))*fqxb(i, k)/12.0
5400 vb0(i, k, j) = vb0(i, k, j) + 7.*temp31b33
5401 vb0(i-1, k, j) = vb0(i-1, k, j) + 7.*temp31b33
5402 vb0(i+1, k, j) = vb0(i+1, k, j) - temp31b33
5403 vb0(i-2, k, j) = vb0(i-2, k, j) - temp31b33
5405 rub(i, k, j) = rub(i, k, j) + 0.5*velb
5406 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
5409 CALL POPCONTROL1B(branch)
5410 IF (branch .EQ. 0) THEN
5412 temp31b31 = 0.25*(v(i, k, j)+v(i-1, k, j))*fqxb(i, k)
5413 temp31b32 = 0.25*(ru(i, k, j)+ru(i, k, j-1))*fqxb(i, k)
5414 rub(i, k, j) = rub(i, k, j) + temp31b31
5415 rub(i, k, j-1) = rub(i, k, j-1) + temp31b31
5416 vb0(i, k, j) = vb0(i, k, j) + temp31b32
5417 vb0(i-1, k, j) = vb0(i-1, k, j) + temp31b32
5424 DO i=i_end_f,i_start_f,-1
5425 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
5426 temp31b30 = vel*fqxb(i, k)/60.0
5427 velb = (37.*(v(i, k, j)+v(i-1, k, j))-8.*(v(i+1, k, j)+v(i-2&
5428 & , k, j))+v(i+2, k, j)+v(i-3, k, j))*fqxb(i, k)/60.0
5429 vb0(i, k, j) = vb0(i, k, j) + 37.*temp31b30
5430 vb0(i-1, k, j) = vb0(i-1, k, j) + 37.*temp31b30
5431 vb0(i+1, k, j) = vb0(i+1, k, j) - 8.*temp31b30
5432 vb0(i-2, k, j) = vb0(i-2, k, j) - 8.*temp31b30
5433 vb0(i+2, k, j) = vb0(i+2, k, j) + temp31b30
5434 vb0(i-3, k, j) = vb0(i-3, k, j) + temp31b30
5436 rub(i, k, j) = rub(i, k, j) + 0.5*velb
5437 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
5442 CALL POPINTEGER4(ad_from45)
5443 CALL POPINTEGER4(ad_to45)
5444 DO j=ad_to45,ad_from45,-1
5445 CALL POPINTEGER4(jp0)
5446 CALL POPINTEGER4(jp1)
5447 CALL POPCONTROL2B(branch)
5448 IF (branch .LT. 2) THEN
5449 IF (branch .EQ. 0) THEN
5451 CALL POPINTEGER4(ad_from42)
5452 CALL POPINTEGER4(ad_to42)
5453 DO i=ad_to42,ad_from42,-1
5454 tendencyb(i, k, j-1) = 0.0
5459 CALL POPINTEGER4(ad_from43)
5460 CALL POPINTEGER4(ad_to43)
5461 DO i=ad_to43,ad_from43,-1
5462 tendencyb(i, k, j-1) = 0.0
5466 ELSE IF (branch .EQ. 2) THEN
5468 CALL POPINTEGER4(ad_from44)
5469 CALL POPINTEGER4(ad_to44)
5470 DO i=ad_to44,ad_from44,-1
5471 mrdy = msfvy(i, j-1)*rdy
5472 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
5474 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
5479 CALL POPCONTROL3B(branch)
5480 IF (branch .LT. 3) THEN
5481 IF (branch .EQ. 0) THEN
5483 CALL POPINTEGER4(ad_from37)
5484 CALL POPINTEGER4(ad_to37)
5485 DO i=ad_to37,ad_from37,-1
5486 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
5487 temp31b23 = vel*fqyb(i, k, jp1)/60.0
5488 velb = (37.*(v(i, k, j)+v(i, k, j-1))-8.*(v(i, k, j+1)+v&
5489 & (i, k, j-2))+v(i, k, j+2)+v(i, k, j-3))*fqyb(i, k, jp1&
5491 vb0(i, k, j) = vb0(i, k, j) + 37.*temp31b23
5492 vb0(i, k, j-1) = vb0(i, k, j-1) + 37.*temp31b23
5493 vb0(i, k, j+1) = vb0(i, k, j+1) - 8.*temp31b23
5494 vb0(i, k, j-2) = vb0(i, k, j-2) - 8.*temp31b23
5495 vb0(i, k, j+2) = vb0(i, k, j+2) + temp31b23
5496 vb0(i, k, j-3) = vb0(i, k, j-3) + temp31b23
5497 fqyb(i, k, jp1) = 0.0
5498 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
5499 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
5502 ELSE IF (branch .EQ. 1) THEN
5504 CALL POPINTEGER4(ad_from38)
5505 CALL POPINTEGER4(ad_to38)
5506 DO i=ad_to38,ad_from38,-1
5507 temp31b24 = 0.25*(v(i, k, j)+vb)*fqyb(i, k, jp1)
5508 temp31b25 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, &
5510 rvb(i, k, j) = rvb(i, k, j) + temp31b24
5511 rvb(i, k, j-1) = rvb(i, k, j-1) + temp31b24
5512 vb0(i, k, j) = vb0(i, k, j) + temp31b25
5514 fqyb(i, k, jp1) = 0.0
5515 CALL POPCONTROL1B(branch)
5516 IF (branch .EQ. 0) THEN
5517 vb0(i, k, j) = vb0(i, k, j) + vbb
5521 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
5526 CALL POPINTEGER4(ad_from39)
5527 CALL POPINTEGER4(ad_to39)
5528 DO i=ad_to39,ad_from39,-1
5529 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
5530 temp31b26 = vel*fqyb(i, k, jp1)/12.0
5531 velb = (7.*(v(i, k, j)+v(i, k, j-1))-v(i, k, j+1)-v(i, k&
5532 & , j-2))*fqyb(i, k, jp1)/12.0
5533 vb0(i, k, j) = vb0(i, k, j) + 7.*temp31b26
5534 vb0(i, k, j-1) = vb0(i, k, j-1) + 7.*temp31b26
5535 vb0(i, k, j+1) = vb0(i, k, j+1) - temp31b26
5536 vb0(i, k, j-2) = vb0(i, k, j-2) - temp31b26
5537 fqyb(i, k, jp1) = 0.0
5538 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
5539 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
5543 ELSE IF (branch .EQ. 3) THEN
5545 CALL POPINTEGER4(ad_from40)
5546 CALL POPINTEGER4(ad_to40)
5547 DO i=ad_to40,ad_from40,-1
5548 temp31b27 = 0.25*(vb+v(i, k, j-1))*fqyb(i, k, jp1)
5549 temp31b28 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, &
5551 rvb(i, k, j) = rvb(i, k, j) + temp31b27
5552 rvb(i, k, j-1) = rvb(i, k, j-1) + temp31b27
5554 vb0(i, k, j-1) = vb0(i, k, j-1) + temp31b28
5555 fqyb(i, k, jp1) = 0.0
5556 CALL POPCONTROL1B(branch)
5557 IF (branch .EQ. 0) THEN
5558 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
5562 vb0(i, k, j) = vb0(i, k, j) + vbb
5565 ELSE IF (branch .EQ. 4) THEN
5567 CALL POPINTEGER4(ad_from41)
5568 CALL POPINTEGER4(ad_to41)
5569 DO i=ad_to41,ad_from41,-1
5570 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
5571 temp31b29 = vel*fqyb(i, k, jp1)/12.0
5572 velb = (7.*(v(i, k, j)+v(i, k, j-1))-v(i, k, j+1)-v(i, k, &
5573 & j-2))*fqyb(i, k, jp1)/12.0
5574 vb0(i, k, j) = vb0(i, k, j) + 7.*temp31b29
5575 vb0(i, k, j-1) = vb0(i, k, j-1) + 7.*temp31b29
5576 vb0(i, k, j+1) = vb0(i, k, j+1) - temp31b29
5577 vb0(i, k, j-2) = vb0(i, k, j-2) - temp31b29
5578 fqyb(i, k, jp1) = 0.0
5579 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
5580 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
5585 ELSE IF (branch .EQ. 1) THEN
5587 CALL POPINTEGER4(ad_from10)
5588 CALL POPINTEGER4(ad_to10)
5589 DO j=ad_to10,ad_from10,-1
5591 CALL POPINTEGER4(ad_from9)
5592 CALL POPINTEGER4(ad_to9)
5593 DO i=ad_to9,ad_from9,-1
5594 mrdx = msfvy(i, j)*rdx
5595 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
5596 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
5599 CALL POPCONTROL1B(branch)
5600 IF (branch .NE. 0) THEN
5601 CALL POPINTEGER4(ad_to8)
5602 DO i=ad_to8,i_end_f+1,-1
5603 CALL POPCONTROL1B(branch)
5604 IF (branch .NE. 0) THEN
5606 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
5607 temp19 = v(i+1, k, j) - v(i-2, k, j) - 3.*(v(i, k, j)-v(&
5609 temp22 = SIGN(1., vel)
5610 temp21 = temp22/12.0
5611 temp20 = SIGN(1, time_step)
5612 temp19b1 = vel*fqxb(i, k)
5613 temp19b2 = temp19b1/12.0
5614 temp19b3 = temp20*temp21*temp19b1
5615 velb = ((7.*(v(i, k, j)+v(i-1, k, j))-v(i+1, k, j)-v(i-2&
5616 & , k, j))/12.0+temp20*(temp21*temp19))*fqxb(i, k)
5617 vb0(i, k, j) = vb0(i, k, j) + 7.*temp19b2 - 3.*temp19b3
5618 vb0(i-1, k, j) = vb0(i-1, k, j) + 3.*temp19b3 + 7.*&
5620 vb0(i+1, k, j) = vb0(i+1, k, j) + temp19b3 - temp19b2
5621 vb0(i-2, k, j) = vb0(i-2, k, j) - temp19b3 - temp19b2
5623 rub(i, k, j) = rub(i, k, j) + 0.5*velb
5624 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
5627 CALL POPCONTROL1B(branch)
5628 IF (branch .EQ. 0) THEN
5630 temp19b = 0.25*(v(i_end+1, k, j)+v(i_end, k, j))*fqxb(i&
5632 temp19b0 = 0.25*(ru(i_end+1, k, j)+ru(i_end+1, k, j-1))*&
5634 rub(i_end+1, k, j) = rub(i_end+1, k, j) + temp19b
5635 rub(i_end+1, k, j-1) = rub(i_end+1, k, j-1) + temp19b
5636 vb0(i_end+1, k, j) = vb0(i_end+1, k, j) + temp19b0
5637 vb0(i_end, k, j) = vb0(i_end, k, j) + temp19b0
5643 CALL POPCONTROL1B(branch)
5644 IF (branch .EQ. 0) THEN
5645 CALL POPINTEGER4(ad_from8)
5646 DO i=i_start_f-1,ad_from8,-1
5647 CALL POPCONTROL1B(branch)
5648 IF (branch .NE. 0) THEN
5650 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
5651 temp15 = v(i+1, k, j) - v(i-2, k, j) - 3.*(v(i, k, j)-v(&
5653 temp18 = SIGN(1., vel)
5654 temp17 = temp18/12.0
5655 temp16 = SIGN(1, time_step)
5656 temp15b1 = vel*fqxb(i, k)
5657 temp15b2 = temp15b1/12.0
5658 temp15b3 = temp16*temp17*temp15b1
5659 velb = ((7.*(v(i, k, j)+v(i-1, k, j))-v(i+1, k, j)-v(i-2&
5660 & , k, j))/12.0+temp16*(temp17*temp15))*fqxb(i, k)
5661 vb0(i, k, j) = vb0(i, k, j) + 7.*temp15b2 - 3.*temp15b3
5662 vb0(i-1, k, j) = vb0(i-1, k, j) + 3.*temp15b3 + 7.*&
5664 vb0(i+1, k, j) = vb0(i+1, k, j) + temp15b3 - temp15b2
5665 vb0(i-2, k, j) = vb0(i-2, k, j) - temp15b3 - temp15b2
5667 rub(i, k, j) = rub(i, k, j) + 0.5*velb
5668 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
5671 CALL POPCONTROL1B(branch)
5672 IF (branch .EQ. 0) THEN
5674 temp15b = 0.25*(v(i, k, j)+v(i-1, k, j))*fqxb(i, k)
5675 temp15b0 = 0.25*(ru(i, k, j)+ru(i, k, j-1))*fqxb(i, k)
5676 rub(i, k, j) = rub(i, k, j) + temp15b
5677 rub(i, k, j-1) = rub(i, k, j-1) + temp15b
5678 vb0(i, k, j) = vb0(i, k, j) + temp15b0
5679 vb0(i-1, k, j) = vb0(i-1, k, j) + temp15b0
5686 DO i=i_end_f,i_start_f,-1
5687 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
5688 temp11 = v(i+2, k, j) - v(i-3, k, j) + 10.*(v(i, k, j)-v(i-1&
5689 & , k, j)) - 5.*(v(i+1, k, j)-v(i-2, k, j))
5690 temp14 = SIGN(1., vel)
5691 temp13 = temp14/60.0
5692 temp12 = SIGN(1, time_step)
5693 temp11b = vel*fqxb(i, k)
5694 temp11b0 = temp11b/60.0
5695 temp11b1 = -(temp12*temp13*temp11b)
5696 velb = ((37.*(v(i, k, j)+v(i-1, k, j))-8.*(v(i+1, k, j)+v(i-&
5697 & 2, k, j))+v(i+2, k, j)+v(i-3, k, j))/60.0-temp12*(temp13*&
5698 & temp11))*fqxb(i, k)
5699 vb0(i, k, j) = vb0(i, k, j) + 10.*temp11b1 + 37.*temp11b0
5700 vb0(i-1, k, j) = vb0(i-1, k, j) + 37.*temp11b0 - 10.*&
5702 vb0(i+1, k, j) = vb0(i+1, k, j) - 5.*temp11b1 - 8.*temp11b0
5703 vb0(i-2, k, j) = vb0(i-2, k, j) + 5.*temp11b1 - 8.*temp11b0
5704 vb0(i+2, k, j) = vb0(i+2, k, j) + temp11b1 + temp11b0
5705 vb0(i-3, k, j) = vb0(i-3, k, j) + temp11b0 - temp11b1
5707 rub(i, k, j) = rub(i, k, j) + 0.5*velb
5708 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
5713 CALL POPINTEGER4(ad_from7)
5714 CALL POPINTEGER4(ad_to7)
5715 DO j=ad_to7,ad_from7,-1
5716 CALL POPINTEGER4(jp0)
5717 CALL POPINTEGER4(jp1)
5718 CALL POPCONTROL2B(branch)
5719 IF (branch .LT. 2) THEN
5720 IF (branch .EQ. 0) THEN
5722 CALL POPINTEGER4(ad_from4)
5723 CALL POPINTEGER4(ad_to4)
5724 DO i=ad_to4,ad_from4,-1
5725 tendencyb(i, k, j-1) = 0.0
5730 CALL POPINTEGER4(ad_from5)
5731 CALL POPINTEGER4(ad_to5)
5732 DO i=ad_to5,ad_from5,-1
5733 tendencyb(i, k, j-1) = 0.0
5737 ELSE IF (branch .EQ. 2) THEN
5739 CALL POPINTEGER4(ad_from6)
5740 CALL POPINTEGER4(ad_to6)
5741 DO i=ad_to6,ad_from6,-1
5742 mrdy = msfvy(i, j-1)*rdy
5743 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
5745 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
5750 CALL POPCONTROL3B(branch)
5751 IF (branch .LT. 3) THEN
5752 IF (branch .EQ. 0) THEN
5754 CALL POPINTEGER4(ad_from)
5755 CALL POPINTEGER4(ad_to)
5756 DO i=ad_to,ad_from,-1
5757 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
5758 temp = v(i, k, j+2) - v(i, k, j-3) + 10.*(v(i, k, j)-v(i&
5759 & , k, j-1)) - 5.*(v(i, k, j+1)-v(i, k, j-2))
5760 temp2 = SIGN(1., vel)
5762 temp0 = SIGN(1, time_step)
5763 tempb = vel*fqyb(i, k, jp1)
5765 tempb1 = -(temp0*temp1*tempb)
5766 velb = ((37.*(v(i, k, j)+v(i, k, j-1))-8.*(v(i, k, j+1)+&
5767 & v(i, k, j-2))+v(i, k, j+2)+v(i, k, j-3))/60.0-temp0*(&
5768 & temp1*temp))*fqyb(i, k, jp1)
5769 vb0(i, k, j) = vb0(i, k, j) + 10.*tempb1 + 37.*tempb0
5770 vb0(i, k, j-1) = vb0(i, k, j-1) + 37.*tempb0 - 10.*&
5772 vb0(i, k, j+1) = vb0(i, k, j+1) - 5.*tempb1 - 8.*tempb0
5773 vb0(i, k, j-2) = vb0(i, k, j-2) + 5.*tempb1 - 8.*tempb0
5774 vb0(i, k, j+2) = vb0(i, k, j+2) + tempb1 + tempb0
5775 vb0(i, k, j-3) = vb0(i, k, j-3) + tempb0 - tempb1
5776 fqyb(i, k, jp1) = 0.0
5777 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
5778 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
5781 ELSE IF (branch .EQ. 1) THEN
5783 CALL POPINTEGER4(ad_from0)
5784 CALL POPINTEGER4(ad_to0)
5785 DO i=ad_to0,ad_from0,-1
5786 temp3b = 0.25*(v(i, k, j)+vb)*fqyb(i, k, jp1)
5787 temp3b0 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, &
5789 rvb(i, k, j) = rvb(i, k, j) + temp3b
5790 rvb(i, k, j-1) = rvb(i, k, j-1) + temp3b
5791 vb0(i, k, j) = vb0(i, k, j) + temp3b0
5793 fqyb(i, k, jp1) = 0.0
5794 CALL POPCONTROL1B(branch)
5795 IF (branch .EQ. 0) THEN
5796 vb0(i, k, j) = vb0(i, k, j) + vbb
5800 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
5805 CALL POPINTEGER4(ad_from1)
5806 CALL POPINTEGER4(ad_to1)
5807 DO i=ad_to1,ad_from1,-1
5808 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
5809 temp3 = v(i, k, j+1) - v(i, k, j-2) - 3.*(v(i, k, j)-v(i&
5811 temp6 = SIGN(1., vel)
5813 temp4 = SIGN(1, time_step)
5814 temp3b1 = vel*fqyb(i, k, jp1)
5815 temp3b2 = temp3b1/12.0
5816 temp3b3 = temp4*temp5*temp3b1
5817 velb = ((7.*(v(i, k, j)+v(i, k, j-1))-v(i, k, j+1)-v(i, &
5818 & k, j-2))/12.0+temp4*(temp5*temp3))*fqyb(i, k, jp1)
5819 vb0(i, k, j) = vb0(i, k, j) + 7.*temp3b2 - 3.*temp3b3
5820 vb0(i, k, j-1) = vb0(i, k, j-1) + 3.*temp3b3 + 7.*&
5822 vb0(i, k, j+1) = vb0(i, k, j+1) + temp3b3 - temp3b2
5823 vb0(i, k, j-2) = vb0(i, k, j-2) - temp3b3 - temp3b2
5824 fqyb(i, k, jp1) = 0.0
5825 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
5826 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
5830 ELSE IF (branch .EQ. 3) THEN
5832 CALL POPINTEGER4(ad_from2)
5833 CALL POPINTEGER4(ad_to2)
5834 DO i=ad_to2,ad_from2,-1
5835 temp7b = 0.25*(vb+v(i, k, j-1))*fqyb(i, k, jp1)
5836 temp7b0 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, jp1)
5837 rvb(i, k, j) = rvb(i, k, j) + temp7b
5838 rvb(i, k, j-1) = rvb(i, k, j-1) + temp7b
5840 vb0(i, k, j-1) = vb0(i, k, j-1) + temp7b0
5841 fqyb(i, k, jp1) = 0.0
5842 CALL POPCONTROL1B(branch)
5843 IF (branch .EQ. 0) THEN
5844 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
5848 vb0(i, k, j) = vb0(i, k, j) + vbb
5851 ELSE IF (branch .EQ. 4) THEN
5853 CALL POPINTEGER4(ad_from3)
5854 CALL POPINTEGER4(ad_to3)
5855 DO i=ad_to3,ad_from3,-1
5856 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
5857 temp7 = v(i, k, j+1) - v(i, k, j-2) - 3.*(v(i, k, j)-v(i, &
5859 temp10 = SIGN(1., vel)
5861 temp8 = SIGN(1, time_step)
5862 temp7b1 = vel*fqyb(i, k, jp1)
5863 temp7b2 = temp7b1/12.0
5864 temp7b3 = temp8*temp9*temp7b1
5865 velb = ((7.*(v(i, k, j)+v(i, k, j-1))-v(i, k, j+1)-v(i, k&
5866 & , j-2))/12.0+temp8*(temp9*temp7))*fqyb(i, k, jp1)
5867 vb0(i, k, j) = vb0(i, k, j) + 7.*temp7b2 - 3.*temp7b3
5868 vb0(i, k, j-1) = vb0(i, k, j-1) + 3.*temp7b3 + 7.*temp7b2
5869 vb0(i, k, j+1) = vb0(i, k, j+1) + temp7b3 - temp7b2
5870 vb0(i, k, j-2) = vb0(i, k, j-2) - temp7b3 - temp7b2
5871 fqyb(i, k, jp1) = 0.0
5872 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
5873 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
5880 CALL POPINTEGER4(ad_from19)
5881 CALL POPINTEGER4(ad_to19)
5882 DO j=ad_to19,ad_from19,-1
5884 CALL POPINTEGER4(ad_from18)
5885 CALL POPINTEGER4(ad_to18)
5886 DO i=ad_to18,ad_from18,-1
5887 mrdx = msfvy(i, j)*rdx
5888 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
5889 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
5892 CALL POPCONTROL1B(branch)
5893 IF (branch .NE. 0) THEN
5895 temp23b7 = 0.25*(v(i_end+1, k, j)+v(i_end, k, j))*fqxb(i_end&
5897 temp23b8 = 0.25*(ru(i_end+1, k, j)+ru(i_end+1, k, j-1))*fqxb&
5899 rub(i_end+1, k, j) = rub(i_end+1, k, j) + temp23b7
5900 rub(i_end+1, k, j-1) = rub(i_end+1, k, j-1) + temp23b7
5901 vb0(i_end+1, k, j) = vb0(i_end+1, k, j) + temp23b8
5902 vb0(i_end, k, j) = vb0(i_end, k, j) + temp23b8
5903 fqxb(i_end+1, k) = 0.0
5906 CALL POPCONTROL1B(branch)
5907 IF (branch .EQ. 0) THEN
5909 temp23b5 = 0.25*(v(i_start, k, j)+v(i_start-1, k, j))*fqxb(&
5911 temp23b6 = 0.25*(ru(i_start, k, j)+ru(i_start, k, j-1))*fqxb&
5913 rub(i_start, k, j) = rub(i_start, k, j) + temp23b5
5914 rub(i_start, k, j-1) = rub(i_start, k, j-1) + temp23b5
5915 vb0(i_start, k, j) = vb0(i_start, k, j) + temp23b6
5916 vb0(i_start-1, k, j) = vb0(i_start-1, k, j) + temp23b6
5917 fqxb(i_start, k) = 0.0
5921 DO i=i_end_f,i_start_f,-1
5922 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
5923 temp23b4 = vel*fqxb(i, k)/12.0
5924 velb = (7.*(v(i, k, j)+v(i-1, k, j))-v(i+1, k, j)-v(i-2, k, &
5925 & j))*fqxb(i, k)/12.0
5926 vb0(i, k, j) = vb0(i, k, j) + 7.*temp23b4
5927 vb0(i-1, k, j) = vb0(i-1, k, j) + 7.*temp23b4
5928 vb0(i+1, k, j) = vb0(i+1, k, j) - temp23b4
5929 vb0(i-2, k, j) = vb0(i-2, k, j) - temp23b4
5931 rub(i, k, j) = rub(i, k, j) + 0.5*velb
5932 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
5937 CALL POPINTEGER4(ad_from17)
5938 CALL POPINTEGER4(ad_to17)
5939 DO j=ad_to17,ad_from17,-1
5940 CALL POPINTEGER4(jp0)
5941 CALL POPINTEGER4(jp1)
5942 CALL POPCONTROL2B(branch)
5943 IF (branch .LT. 2) THEN
5944 IF (branch .EQ. 0) THEN
5946 CALL POPINTEGER4(ad_from14)
5947 CALL POPINTEGER4(ad_to14)
5948 DO i=ad_to14,ad_from14,-1
5949 tendencyb(i, k, j-1) = 0.0
5954 CALL POPINTEGER4(ad_from15)
5955 CALL POPINTEGER4(ad_to15)
5956 DO i=ad_to15,ad_from15,-1
5957 tendencyb(i, k, j-1) = 0.0
5961 ELSE IF (branch .EQ. 2) THEN
5963 CALL POPINTEGER4(ad_from16)
5964 CALL POPINTEGER4(ad_to16)
5965 DO i=ad_to16,ad_from16,-1
5966 mrdy = msfvy(i, j-1)*rdy
5967 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
5969 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
5974 CALL POPCONTROL2B(branch)
5975 IF (branch .EQ. 0) THEN
5977 CALL POPINTEGER4(ad_from11)
5978 CALL POPINTEGER4(ad_to11)
5979 DO i=ad_to11,ad_from11,-1
5980 temp23b = 0.25*(v(i, k, j)+vb)*fqyb(i, k, jp1)
5981 temp23b0 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, jp1&
5983 rvb(i, k, j) = rvb(i, k, j) + temp23b
5984 rvb(i, k, j-1) = rvb(i, k, j-1) + temp23b
5985 vb0(i, k, j) = vb0(i, k, j) + temp23b0
5987 fqyb(i, k, jp1) = 0.0
5988 CALL POPCONTROL1B(branch)
5989 IF (branch .EQ. 0) THEN
5990 vb0(i, k, j) = vb0(i, k, j) + vbb
5994 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
5997 ELSE IF (branch .EQ. 1) THEN
5999 CALL POPINTEGER4(ad_from12)
6000 CALL POPINTEGER4(ad_to12)
6001 DO i=ad_to12,ad_from12,-1
6002 temp23b1 = 0.25*(vb+v(i, k, j-1))*fqyb(i, k, jp1)
6003 temp23b2 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, jp1&
6005 rvb(i, k, j) = rvb(i, k, j) + temp23b1
6006 rvb(i, k, j-1) = rvb(i, k, j-1) + temp23b1
6008 vb0(i, k, j-1) = vb0(i, k, j-1) + temp23b2
6009 fqyb(i, k, jp1) = 0.0
6010 CALL POPCONTROL1B(branch)
6011 IF (branch .EQ. 0) THEN
6012 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
6016 vb0(i, k, j) = vb0(i, k, j) + vbb
6021 CALL POPINTEGER4(ad_from13)
6022 CALL POPINTEGER4(ad_to13)
6023 DO i=ad_to13,ad_from13,-1
6024 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
6025 temp23b3 = vel*fqyb(i, k, jp1)/12.0
6026 velb = (7.*(v(i, k, j)+v(i, k, j-1))-v(i, k, j+1)-v(i, k, &
6027 & j-2))*fqyb(i, k, jp1)/12.0
6028 vb0(i, k, j) = vb0(i, k, j) + 7.*temp23b3
6029 vb0(i, k, j-1) = vb0(i, k, j-1) + 7.*temp23b3
6030 vb0(i, k, j+1) = vb0(i, k, j+1) - temp23b3
6031 vb0(i, k, j-2) = vb0(i, k, j-2) - temp23b3
6032 fqyb(i, k, jp1) = 0.0
6033 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
6034 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
6040 ELSE IF (branch .EQ. 3) THEN
6042 CALL POPINTEGER4(ad_from28)
6043 CALL POPINTEGER4(ad_to28)
6044 DO j=ad_to28,ad_from28,-1
6046 CALL POPINTEGER4(ad_from27)
6047 CALL POPINTEGER4(ad_to27)
6048 DO i=ad_to27,ad_from27,-1
6049 mrdx = msfvy(i, j)*rdx
6050 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
6051 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
6054 CALL POPCONTROL1B(branch)
6055 IF (branch .NE. 0) THEN
6057 temp31b1 = 0.25*(v(i_end+1, k, j)+v(i_end, k, j))*fqxb(i_end+1&
6059 temp31b2 = 0.25*(ru(i_end+1, k, j)+ru(i_end+1, k, j-1))*fqxb(&
6061 rub(i_end+1, k, j) = rub(i_end+1, k, j) + temp31b1
6062 rub(i_end+1, k, j-1) = rub(i_end+1, k, j-1) + temp31b1
6063 vb0(i_end+1, k, j) = vb0(i_end+1, k, j) + temp31b2
6064 vb0(i_end, k, j) = vb0(i_end, k, j) + temp31b2
6065 fqxb(i_end+1, k) = 0.0
6068 CALL POPCONTROL1B(branch)
6069 IF (branch .EQ. 0) THEN
6071 temp31b = 0.25*(v(i_start, k, j)+v(i_start-1, k, j))*fqxb(&
6073 temp31b0 = 0.25*(ru(i_start, k, j)+ru(i_start, k, j-1))*fqxb(&
6075 rub(i_start, k, j) = rub(i_start, k, j) + temp31b
6076 rub(i_start, k, j-1) = rub(i_start, k, j-1) + temp31b
6077 vb0(i_start, k, j) = vb0(i_start, k, j) + temp31b0
6078 vb0(i_start-1, k, j) = vb0(i_start-1, k, j) + temp31b0
6079 fqxb(i_start, k) = 0.0
6083 DO i=i_end_f,i_start_f,-1
6084 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
6085 temp27 = v(i+1, k, j) - v(i-2, k, j) - 3.*(v(i, k, j)-v(i-1, k&
6087 temp30 = SIGN(1., vel)
6088 temp29 = temp30/12.0
6089 temp28 = SIGN(1, time_step)
6090 temp27b = vel*fqxb(i, k)
6091 temp27b0 = temp27b/12.0
6092 temp27b1 = temp28*temp29*temp27b
6093 velb = ((7.*(v(i, k, j)+v(i-1, k, j))-v(i+1, k, j)-v(i-2, k, j&
6094 & ))/12.0+temp28*(temp29*temp27))*fqxb(i, k)
6095 vb0(i, k, j) = vb0(i, k, j) + 7.*temp27b0 - 3.*temp27b1
6096 vb0(i-1, k, j) = vb0(i-1, k, j) + 3.*temp27b1 + 7.*temp27b0
6097 vb0(i+1, k, j) = vb0(i+1, k, j) + temp27b1 - temp27b0
6098 vb0(i-2, k, j) = vb0(i-2, k, j) - temp27b1 - temp27b0
6100 rub(i, k, j) = rub(i, k, j) + 0.5*velb
6101 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
6106 CALL POPINTEGER4(ad_from26)
6107 CALL POPINTEGER4(ad_to26)
6108 DO j=ad_to26,ad_from26,-1
6109 CALL POPINTEGER4(jp0)
6110 CALL POPINTEGER4(jp1)
6111 CALL POPCONTROL2B(branch)
6112 IF (branch .LT. 2) THEN
6113 IF (branch .EQ. 0) THEN
6115 CALL POPINTEGER4(ad_from23)
6116 CALL POPINTEGER4(ad_to23)
6117 DO i=ad_to23,ad_from23,-1
6118 tendencyb(i, k, j-1) = 0.0
6123 CALL POPINTEGER4(ad_from24)
6124 CALL POPINTEGER4(ad_to24)
6125 DO i=ad_to24,ad_from24,-1
6126 tendencyb(i, k, j-1) = 0.0
6130 ELSE IF (branch .EQ. 2) THEN
6132 CALL POPINTEGER4(ad_from25)
6133 CALL POPINTEGER4(ad_to25)
6134 DO i=ad_to25,ad_from25,-1
6135 mrdy = msfvy(i, j-1)*rdy
6136 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1&
6138 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1&
6143 CALL POPCONTROL2B(branch)
6144 IF (branch .EQ. 0) THEN
6146 CALL POPINTEGER4(ad_from20)
6147 CALL POPINTEGER4(ad_to20)
6148 DO i=ad_to20,ad_from20,-1
6149 temp23b9 = 0.25*(v(i, k, j)+vb)*fqyb(i, k, jp1)
6150 temp23b10 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, jp1)
6151 rvb(i, k, j) = rvb(i, k, j) + temp23b9
6152 rvb(i, k, j-1) = rvb(i, k, j-1) + temp23b9
6153 vb0(i, k, j) = vb0(i, k, j) + temp23b10
6155 fqyb(i, k, jp1) = 0.0
6156 CALL POPCONTROL1B(branch)
6157 IF (branch .EQ. 0) THEN
6158 vb0(i, k, j) = vb0(i, k, j) + vbb
6162 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
6165 ELSE IF (branch .EQ. 1) THEN
6167 CALL POPINTEGER4(ad_from21)
6168 CALL POPINTEGER4(ad_to21)
6169 DO i=ad_to21,ad_from21,-1
6170 temp23b11 = 0.25*(vb+v(i, k, j-1))*fqyb(i, k, jp1)
6171 temp23b12 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, jp1)
6172 rvb(i, k, j) = rvb(i, k, j) + temp23b11
6173 rvb(i, k, j-1) = rvb(i, k, j-1) + temp23b11
6175 vb0(i, k, j-1) = vb0(i, k, j-1) + temp23b12
6176 fqyb(i, k, jp1) = 0.0
6177 CALL POPCONTROL1B(branch)
6178 IF (branch .EQ. 0) THEN
6179 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
6183 vb0(i, k, j) = vb0(i, k, j) + vbb
6188 CALL POPINTEGER4(ad_from22)
6189 CALL POPINTEGER4(ad_to22)
6190 DO i=ad_to22,ad_from22,-1
6191 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
6192 temp23 = v(i, k, j+1) - v(i, k, j-2) - 3.*(v(i, k, j)-v(i, k&
6194 temp26 = SIGN(1., vel)
6195 temp25 = temp26/12.0
6196 temp24 = SIGN(1, time_step)
6197 temp23b13 = vel*fqyb(i, k, jp1)
6198 temp23b14 = temp23b13/12.0
6199 temp23b15 = temp24*temp25*temp23b13
6200 velb = ((7.*(v(i, k, j)+v(i, k, j-1))-v(i, k, j+1)-v(i, k, j&
6201 & -2))/12.0+temp24*(temp25*temp23))*fqyb(i, k, jp1)
6202 vb0(i, k, j) = vb0(i, k, j) + 7.*temp23b14 - 3.*temp23b15
6203 vb0(i, k, j-1) = vb0(i, k, j-1) + 3.*temp23b15 + 7.*&
6205 vb0(i, k, j+1) = vb0(i, k, j+1) + temp23b15 - temp23b14
6206 vb0(i, k, j-2) = vb0(i, k, j-2) - temp23b15 - temp23b14
6207 fqyb(i, k, jp1) = 0.0
6208 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
6209 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
6214 ELSE IF (branch .EQ. 4) THEN
6215 CALL POPINTEGER4(ad_from36)
6216 CALL POPINTEGER4(ad_to36)
6217 DO j=ad_to36,ad_from36,-1
6219 CALL POPINTEGER4(ad_from35)
6220 CALL POPINTEGER4(ad_to35)
6221 DO i=ad_to35,ad_from35,-1
6222 mrdx = msfvy(i, j)*rdx
6223 temp31b18 = -(mrdx*0.25*tendencyb(i, k, j))
6224 temp31b19 = (v(i+1, k, j)+v(i, k, j))*temp31b18
6225 temp31b20 = (ru(i+1, k, j)+ru(i+1, k, j-1))*temp31b18
6226 temp31b21 = -((v(i, k, j)+v(i-1, k, j))*temp31b18)
6227 temp31b22 = -((ru(i, k, j)+ru(i, k, j-1))*temp31b18)
6228 rub(i+1, k, j) = rub(i+1, k, j) + temp31b19
6229 rub(i+1, k, j-1) = rub(i+1, k, j-1) + temp31b19
6230 vb0(i+1, k, j) = vb0(i+1, k, j) + temp31b20
6231 vb0(i, k, j) = vb0(i, k, j) + temp31b22 + temp31b20
6232 rub(i, k, j) = rub(i, k, j) + temp31b21
6233 rub(i, k, j-1) = rub(i, k, j-1) + temp31b21
6234 vb0(i-1, k, j) = vb0(i-1, k, j) + temp31b22
6239 CALL POPCONTROL1B(branch)
6240 IF (branch .EQ. 0) THEN
6242 CALL POPINTEGER4(ad_from34)
6243 CALL POPINTEGER4(ad_to34)
6244 DO i=ad_to34,ad_from34,-1
6245 mrdy = msfvy(i, j)*rdy
6246 temp31b13 = -(mrdy*0.25*tendencyb(i, k, j))
6247 temp31b14 = (vb+v(i, k, j))*temp31b13
6248 temp31b15 = (rv(i, k, j+1)+rv(i, k, j))*temp31b13
6249 temp31b16 = -((v(i, k, j)+v(i, k, j-1))*temp31b13)
6250 temp31b17 = -((rv(i, k, j)+rv(i, k, j-1))*temp31b13)
6251 rvb(i, k, j+1) = rvb(i, k, j+1) + temp31b14
6252 rvb(i, k, j) = rvb(i, k, j) + temp31b16 + temp31b14
6254 vb0(i, k, j) = vb0(i, k, j) + temp31b17 + temp31b15
6255 rvb(i, k, j-1) = rvb(i, k, j-1) + temp31b16
6256 vb0(i, k, j-1) = vb0(i, k, j-1) + temp31b17
6257 CALL POPCONTROL1B(branch)
6258 IF (branch .EQ. 0) THEN
6259 vb0(i, k, j) = vb0(i, k, j) + vbb
6263 vb0(i, k, j+1) = vb0(i, k, j+1) + vbb
6268 CALL POPCONTROL1B(branch)
6269 IF (branch .EQ. 0) THEN
6271 CALL POPINTEGER4(ad_from33)
6272 CALL POPINTEGER4(ad_to33)
6273 DO i=ad_to33,ad_from33,-1
6274 mrdy = msfvy(i, j)*rdy
6275 temp31b8 = -(mrdy*0.25*tendencyb(i, k, j))
6276 temp31b9 = (v(i, k, j+1)+v(i, k, j))*temp31b8
6277 temp31b10 = (rv(i, k, j+1)+rv(i, k, j))*temp31b8
6278 temp31b11 = -((v(i, k, j)+vb)*temp31b8)
6279 temp31b12 = -((rv(i, k, j)+rv(i, k, j-1))*temp31b8)
6280 rvb(i, k, j+1) = rvb(i, k, j+1) + temp31b9
6281 rvb(i, k, j) = rvb(i, k, j) + temp31b11 + temp31b9
6282 vb0(i, k, j+1) = vb0(i, k, j+1) + temp31b10
6283 vb0(i, k, j) = vb0(i, k, j) + temp31b12 + temp31b10
6284 rvb(i, k, j-1) = rvb(i, k, j-1) + temp31b11
6286 CALL POPCONTROL1B(branch)
6287 IF (branch .EQ. 0) THEN
6288 vb0(i, k, j) = vb0(i, k, j) + vbb
6292 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
6296 CALL POPCONTROL2B(branch)
6297 IF (branch .EQ. 0) THEN
6299 CALL POPINTEGER4(ad_from32)
6300 CALL POPINTEGER4(ad_to32)
6301 DO i=ad_to32,ad_from32,-1
6302 tendencyb(i, k, jde) = 0.0
6305 ELSE IF (branch .NE. 1) THEN
6308 CALL POPCONTROL1B(branch)
6309 IF (branch .EQ. 0) THEN
6311 CALL POPINTEGER4(ad_from31)
6312 CALL POPINTEGER4(ad_to31)
6313 DO i=ad_to31,ad_from31,-1
6314 tendencyb(i, k, jds) = 0.0
6318 100 CALL POPINTEGER4(ad_from30)
6319 CALL POPINTEGER4(ad_to30)
6320 DO j=ad_to30,ad_from30,-1
6322 CALL POPINTEGER4(ad_from29)
6323 CALL POPINTEGER4(ad_to29)
6324 DO i=ad_to29,ad_from29,-1
6325 mrdy = msfvy(i, j)*rdy
6326 temp31b3 = -(mrdy*0.25*tendencyb(i, k, j))
6327 temp31b4 = (v(i, k, j+1)+v(i, k, j))*temp31b3
6328 temp31b5 = (rv(i, k, j+1)+rv(i, k, j))*temp31b3
6329 temp31b6 = -((v(i, k, j)+v(i, k, j-1))*temp31b3)
6330 temp31b7 = -((rv(i, k, j)+rv(i, k, j-1))*temp31b3)
6331 rvb(i, k, j+1) = rvb(i, k, j+1) + temp31b4
6332 rvb(i, k, j) = rvb(i, k, j) + temp31b6 + temp31b4
6333 vb0(i, k, j+1) = vb0(i, k, j+1) + temp31b5
6334 vb0(i, k, j) = vb0(i, k, j) + temp31b7 + temp31b5
6335 rvb(i, k, j-1) = rvb(i, k, j-1) + temp31b6
6336 vb0(i, k, j-1) = vb0(i, k, j-1) + temp31b7
6341 END SUBROUTINE A_ADVECT_V
6343 ! Generated by TAPENADE (INRIA, Tropics team)
6344 ! Tapenade 3.5 (r3785) - 22 Mar 2011 18:35
6346 ! Differentiation of advect_scalar in reverse (adjoint) mode:
6347 ! gradient of useful results: rom field tendency ru rv field_old
6348 ! with respect to varying inputs: rom field tendency ru rv field_old
6349 ! RW status of diff variables: rom:incr field:incr tendency:in-out
6350 ! ru:incr rv:incr field_old:incr
6351 SUBROUTINE A_ADVECT_SCALAR(field, fieldb, field_old, field_oldb, &
6352 & tendency, tendencyb, ru, rub, rv, rvb, rom, romb, mut, time_step, &
6353 & config_flags, msfux, msfuy, msfvx, msfvy, msftx, msfty, fzm, fzp, rdx&
6354 & , rdy, rdzw, ids, ide, jds, jde, kds, kde, ims, ime, jms, jme, kms, &
6355 & kme, its, ite, jts, jte, kts, kte)
6358 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
6359 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
6360 & jme, kms, kme, its, ite, jts, jte, kts, kte
6361 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: field, &
6362 & field_old, ru, rv, rom
6363 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: fieldb, field_oldb, rub&
6365 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut
6366 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
6367 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: tendencyb
6368 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
6369 & msfvy, msftx, msfty
6370 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzw
6371 REAL, INTENT(IN) :: rdx, rdy
6372 INTEGER, INTENT(IN) :: time_step
6374 INTEGER :: i, j, k, itf, jtf, ktf
6375 INTEGER :: i_start, i_end, j_start, j_end
6376 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
6377 INTEGER :: jmin, jmax, jp, jm, imin, imax
6378 REAL :: mrdx, mrdy, ub, vb, uw, vw
6380 REAL, DIMENSION(its:ite, kts:kte) :: vflux
6381 REAL, DIMENSION(its:ite, kts:kte) :: vfluxb
6382 REAL, DIMENSION(its:ite + 1, kts:kte) :: fqx
6383 REAL, DIMENSION(its:ite+1, kts:kte) :: fqxb
6384 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqy
6385 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqyb
6386 INTEGER :: horz_order, vert_order
6387 LOGICAL :: degrade_xs, degrade_ys
6388 LOGICAL :: degrade_xe, degrade_ye
6389 INTEGER :: jp1, jp0, jtmp
6390 ! definition of flux operators, 3rd, 4th, 5th or 6th order
6391 REAL :: flux3, flux4, flux5, flux6
6392 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel
6394 LOGICAL :: specified
6418 INTEGER :: ad_from10
6420 INTEGER :: ad_from11
6422 INTEGER :: ad_from12
6424 INTEGER :: ad_from13
6426 INTEGER :: ad_from14
6428 INTEGER :: ad_from15
6430 INTEGER :: ad_from16
6432 INTEGER :: ad_from17
6434 INTEGER :: ad_from18
6436 INTEGER :: ad_from19
6438 INTEGER :: ad_from20
6440 INTEGER :: ad_from21
6442 INTEGER :: ad_from22
6444 INTEGER :: ad_from23
6446 INTEGER :: ad_from24
6448 INTEGER :: ad_from25
6450 INTEGER :: ad_from26
6452 INTEGER :: ad_from27
6454 INTEGER :: ad_from28
6456 INTEGER :: ad_from29
6458 INTEGER :: ad_from30
6460 INTEGER :: ad_from31
6462 INTEGER :: ad_from32
6464 INTEGER :: ad_from33
6466 INTEGER :: ad_from34
6468 INTEGER :: ad_from35
6470 INTEGER :: ad_from36
6472 INTEGER :: ad_from37
6474 INTEGER :: ad_from38
6476 INTEGER :: ad_from39
6478 INTEGER :: ad_from40
6480 INTEGER :: ad_from41
6482 INTEGER :: ad_from42
6484 INTEGER :: ad_from43
6486 INTEGER :: ad_from44
6488 INTEGER :: ad_from45
6490 INTEGER :: ad_from46
6492 INTEGER :: ad_from47
6494 INTEGER :: ad_from48
6496 INTEGER :: ad_from49
6498 INTEGER :: ad_from50
6641 IF (config_flags%specified .OR. config_flags%nested) specified = &
6643 IF (kte .GT. kde - 1) THEN
6648 horz_order = config_flags%h_sca_adv_order
6649 vert_order = config_flags%v_sca_adv_order
6650 ! begin with horizontal flux divergence
6651 ! here is the choice of flux operators
6652 IF (horz_order .EQ. 6) THEN
6653 ! determine boundary mods for flux operators
6654 ! We degrade the flux operators from 3rd/4th order
6655 ! to second order one gridpoint in from the boundaries for
6656 ! all boundary conditions except periodic and symmetry - these
6657 ! conditions have boundary zone data fill for correct application
6658 ! of the higher order flux stencils
6663 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
6664 & its .GT. ids + 3) degrade_xs = .false.
6665 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
6666 & ite .LT. ide - 3) degrade_xe = .false.
6667 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
6668 & jts .GT. jds + 3) degrade_ys = .false.
6669 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
6670 & jte .LT. jde - 4) degrade_ye = .false.
6671 IF (kte .GT. kde - 1) THEN
6677 IF (ite .GT. ide - 1) THEN
6683 IF (jte .GT. jde - 1) THEN
6688 ! higher order flux has a 5 or 7 point stencil, so compute
6689 ! bounds so we can switch to second order flux close to the boundary
6692 IF (degrade_ys) THEN
6693 IF (jts .LT. jds + 1) THEN
6700 IF (degrade_ye) THEN
6701 IF (jte .GT. jde - 2) THEN
6708 IF (config_flags%polar) THEN
6709 IF (jte .GT. jde - 1) THEN
6715 ! compute fluxes, 5th or 6th order
6719 j_loop_y_flux_6:DO j=ad_from43,j_end+1
6720 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
6725 CALL PUSHINTEGER4(i - 1)
6726 CALL PUSHINTEGER4(ad_from35)
6728 CALL PUSHCONTROL3B(0)
6729 ELSE IF (j .EQ. jds + 1) THEN
6730 ! 2nd order flux next to south boundary
6734 CALL PUSHINTEGER4(i - 1)
6735 CALL PUSHINTEGER4(ad_from36)
6737 CALL PUSHCONTROL3B(1)
6738 ELSE IF (j .EQ. jds + 2) THEN
6739 ! 4th order flux 2 in from south boundary
6743 CALL PUSHINTEGER4(i - 1)
6744 CALL PUSHINTEGER4(ad_from37)
6746 CALL PUSHCONTROL3B(2)
6747 ELSE IF (j .EQ. jde - 1) THEN
6748 ! 2nd order flux next to north boundary
6752 CALL PUSHINTEGER4(i - 1)
6753 CALL PUSHINTEGER4(ad_from38)
6755 CALL PUSHCONTROL3B(3)
6756 ELSE IF (j .EQ. jde - 2) THEN
6757 ! 3rd or 4th order flux 2 in from north boundary
6761 CALL PUSHINTEGER4(i - 1)
6762 CALL PUSHINTEGER4(ad_from39)
6764 CALL PUSHCONTROL3B(4)
6766 CALL PUSHCONTROL3B(5)
6768 ! y flux-divergence into tendency
6769 ! Comments on polar boundary conditions
6770 ! Same process as for advect_u - tendencies run from jds to jde-1
6771 ! (latitudes are as for u grid, longitudes are displaced)
6772 ! Therefore: flow is only from one side for points next to poles
6773 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
6777 CALL PUSHINTEGER4(i - 1)
6778 CALL PUSHINTEGER4(ad_from40)
6780 CALL PUSHCONTROL2B(0)
6781 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
6785 CALL PUSHINTEGER4(i - 1)
6786 CALL PUSHINTEGER4(ad_from41)
6788 CALL PUSHCONTROL2B(1)
6789 ELSE IF (j .GT. j_start) THEN
6794 CALL PUSHINTEGER4(i - 1)
6795 CALL PUSHINTEGER4(ad_from42)
6797 CALL PUSHCONTROL2B(2)
6799 CALL PUSHCONTROL2B(3)
6802 CALL PUSHINTEGER4(jp1)
6804 CALL PUSHINTEGER4(jp0)
6806 END DO j_loop_y_flux_6
6807 CALL PUSHINTEGER4(j - 1)
6808 CALL PUSHINTEGER4(ad_from43)
6809 ! next, x - flux divergence
6811 IF (ite .GT. ide - 1) THEN
6817 IF (jte .GT. jde - 1) THEN
6822 ! higher order flux has a 5 or 7 point stencil, so compute
6823 ! bounds so we can switch to second order flux close to the boundary
6826 IF (degrade_xs) THEN
6827 IF (ids + 1 .LT. its) THEN
6832 IF (i_start + 2 .GT. ids + 3) THEN
6835 i_start_f = i_start + 2
6838 IF (degrade_xe) THEN
6839 IF (ide - 2 .GT. ite) THEN
6848 DO j=ad_from46,j_end
6849 ! lower order fluxes close to boundaries (if not periodic or symmetric)
6850 IF (degrade_xs) THEN
6852 DO i=ad_from44,i_start_f-1
6853 IF (i .EQ. ids + 1) THEN
6854 CALL PUSHCONTROL1B(0)
6856 CALL PUSHCONTROL1B(1)
6858 IF (i .EQ. ids + 2) THEN
6859 CALL PUSHCONTROL1B(1)
6861 CALL PUSHCONTROL1B(0)
6864 CALL PUSHINTEGER4(ad_from44)
6865 CALL PUSHCONTROL1B(0)
6867 CALL PUSHCONTROL1B(1)
6869 IF (degrade_xe) THEN
6870 DO i=i_end_f+1,i_end+1
6871 IF (i .EQ. ide - 1) THEN
6872 CALL PUSHCONTROL1B(0)
6874 CALL PUSHCONTROL1B(1)
6876 IF (i .EQ. ide - 2) THEN
6877 CALL PUSHCONTROL1B(1)
6879 CALL PUSHCONTROL1B(0)
6882 CALL PUSHINTEGER4(i - 1)
6883 CALL PUSHCONTROL1B(1)
6885 CALL PUSHCONTROL1B(0)
6887 ! x flux-divergence into tendency
6891 CALL PUSHINTEGER4(i - 1)
6892 CALL PUSHINTEGER4(ad_from45)
6895 CALL PUSHINTEGER4(j - 1)
6896 CALL PUSHINTEGER4(ad_from46)
6897 CALL PUSHCONTROL3B(7)
6898 ELSE IF (horz_order .EQ. 5) THEN
6899 ! determine boundary mods for flux operators
6900 ! We degrade the flux operators from 3rd/4th order
6901 ! to second order one gridpoint in from the boundaries for
6902 ! all boundary conditions except periodic and symmetry - these
6903 ! conditions have boundary zone data fill for correct application
6904 ! of the higher order flux stencils
6909 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
6910 & its .GT. ids + 3) degrade_xs = .false.
6911 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
6912 & ite .LT. ide - 3) degrade_xe = .false.
6913 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
6914 & jts .GT. jds + 3) degrade_ys = .false.
6915 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
6916 & jte .LT. jde - 4) degrade_ye = .false.
6917 IF (kte .GT. kde - 1) THEN
6923 IF (ite .GT. ide - 1) THEN
6929 IF (jte .GT. jde - 1) THEN
6934 ! higher order flux has a 5 or 7 point stencil, so compute
6935 ! bounds so we can switch to second order flux close to the boundary
6938 IF (degrade_ys) THEN
6939 IF (jts .LT. jds + 1) THEN
6946 IF (degrade_ye) THEN
6947 IF (jte .GT. jde - 2) THEN
6954 IF (config_flags%polar) THEN
6955 IF (jte .GT. jde - 1) THEN
6961 ! compute fluxes, 5th or 6th order
6965 j_loop_y_flux_5:DO j=ad_from7,j_end+1
6966 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
6971 CALL PUSHINTEGER4(i - 1)
6972 CALL PUSHINTEGER4(ad_from)
6974 CALL PUSHCONTROL3B(0)
6975 ELSE IF (j .EQ. jds + 1) THEN
6976 ! 2nd order flux next to south boundary
6980 CALL PUSHINTEGER4(i - 1)
6981 CALL PUSHINTEGER4(ad_from0)
6983 CALL PUSHCONTROL3B(1)
6984 ELSE IF (j .EQ. jds + 2) THEN
6985 ! third of 4th order flux 2 in from south boundary
6989 CALL PUSHINTEGER4(i - 1)
6990 CALL PUSHINTEGER4(ad_from1)
6992 CALL PUSHCONTROL3B(2)
6993 ELSE IF (j .EQ. jde - 1) THEN
6994 ! 2nd order flux next to north boundary
6998 CALL PUSHINTEGER4(i - 1)
6999 CALL PUSHINTEGER4(ad_from2)
7001 CALL PUSHCONTROL3B(3)
7002 ELSE IF (j .EQ. jde - 2) THEN
7003 ! 3rd or 4th order flux 2 in from north boundary
7007 CALL PUSHINTEGER4(i - 1)
7008 CALL PUSHINTEGER4(ad_from3)
7010 CALL PUSHCONTROL3B(4)
7012 CALL PUSHCONTROL3B(5)
7014 ! y flux-divergence into tendency
7015 ! Comments on polar boundary conditions
7016 ! Same process as for advect_u - tendencies run from jds to jde-1
7017 ! (latitudes are as for u grid, longitudes are displaced)
7018 ! Therefore: flow is only from one side for points next to poles
7019 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
7023 CALL PUSHINTEGER4(i - 1)
7024 CALL PUSHINTEGER4(ad_from4)
7026 CALL PUSHCONTROL2B(0)
7027 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
7031 CALL PUSHINTEGER4(i - 1)
7032 CALL PUSHINTEGER4(ad_from5)
7034 CALL PUSHCONTROL2B(1)
7035 ELSE IF (j .GT. j_start) THEN
7040 CALL PUSHINTEGER4(i - 1)
7041 CALL PUSHINTEGER4(ad_from6)
7043 CALL PUSHCONTROL2B(2)
7045 CALL PUSHCONTROL2B(3)
7048 CALL PUSHINTEGER4(jp1)
7050 CALL PUSHINTEGER4(jp0)
7052 END DO j_loop_y_flux_5
7053 CALL PUSHINTEGER4(j - 1)
7054 CALL PUSHINTEGER4(ad_from7)
7055 ! next, x - flux divergence
7057 IF (ite .GT. ide - 1) THEN
7063 IF (jte .GT. jde - 1) THEN
7068 ! higher order flux has a 5 or 7 point stencil, so compute
7069 ! bounds so we can switch to second order flux close to the boundary
7072 IF (degrade_xs) THEN
7073 IF (ids + 1 .LT. its) THEN
7078 IF (i_start + 2 .GT. ids + 3) THEN
7081 i_start_f = i_start + 2
7084 IF (degrade_xe) THEN
7085 IF (ide - 2 .GT. ite) THEN
7094 DO j=ad_from10,j_end
7095 ! lower order fluxes close to boundaries (if not periodic or symmetric)
7096 IF (degrade_xs) THEN
7098 DO i=ad_from8,i_start_f-1
7099 IF (i .EQ. ids + 1) THEN
7100 CALL PUSHCONTROL1B(0)
7102 CALL PUSHCONTROL1B(1)
7104 IF (i .EQ. ids + 2) THEN
7105 CALL PUSHCONTROL1B(1)
7107 CALL PUSHCONTROL1B(0)
7110 CALL PUSHINTEGER4(ad_from8)
7111 CALL PUSHCONTROL1B(0)
7113 CALL PUSHCONTROL1B(1)
7115 IF (degrade_xe) THEN
7116 DO i=i_end_f+1,i_end+1
7117 IF (i .EQ. ide - 1) THEN
7118 CALL PUSHCONTROL1B(0)
7120 CALL PUSHCONTROL1B(1)
7122 IF (i .EQ. ide - 2) THEN
7123 CALL PUSHCONTROL1B(1)
7125 CALL PUSHCONTROL1B(0)
7128 CALL PUSHINTEGER4(i - 1)
7129 CALL PUSHCONTROL1B(1)
7131 CALL PUSHCONTROL1B(0)
7133 ! x flux-divergence into tendency
7137 CALL PUSHINTEGER4(i - 1)
7138 CALL PUSHINTEGER4(ad_from9)
7141 CALL PUSHINTEGER4(j - 1)
7142 CALL PUSHINTEGER4(ad_from10)
7143 CALL PUSHCONTROL3B(6)
7144 ELSE IF (horz_order .EQ. 4) THEN
7149 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
7150 & its .GT. ids + 2) degrade_xs = .false.
7151 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
7152 & ite .LT. ide - 2) degrade_xe = .false.
7153 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
7154 & jts .GT. jds + 2) degrade_ys = .false.
7155 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
7156 & jte .LT. jde - 3) degrade_ye = .false.
7157 IF (kte .GT. kde - 1) THEN
7163 IF (ite .GT. ide - 1) THEN
7169 IF (jte .GT. jde - 1) THEN
7174 ! 3rd or 4th order flux has a 5 point stencil, so compute
7175 ! bounds so we can switch to second order flux close to the boundary
7178 IF (degrade_xs) THEN
7180 i_start_f = i_start + 1
7182 IF (degrade_xe) THEN
7188 DO j=ad_from12,j_end
7189 ! second order flux close to boundaries (if not periodic or symmetric)
7190 IF (degrade_xs) THEN
7191 CALL PUSHCONTROL1B(0)
7193 CALL PUSHCONTROL1B(1)
7195 IF (degrade_xe) THEN
7196 CALL PUSHCONTROL1B(1)
7198 CALL PUSHCONTROL1B(0)
7200 ! x flux-divergence into tendency
7204 CALL PUSHINTEGER4(i - 1)
7205 CALL PUSHINTEGER4(ad_from11)
7208 CALL PUSHINTEGER4(j - 1)
7209 CALL PUSHINTEGER4(ad_from12)
7210 CALL PUSHINTEGER4(i_start)
7211 ! next -> y flux divergence calculation
7213 IF (ite .GT. ide - 1) THEN
7214 CALL PUSHINTEGER4(i_end)
7216 CALL PUSHCONTROL1B(0)
7218 CALL PUSHINTEGER4(i_end)
7220 CALL PUSHCONTROL1B(1)
7223 IF (jte .GT. jde - 1) THEN
7228 ! 3rd or 4th order flux has a 5 point stencil, so compute
7229 ! bounds so we can switch to second order flux close to the boundary
7232 IF (degrade_ys) THEN
7234 j_start_f = j_start + 1
7236 IF (degrade_ye) THEN
7240 IF (config_flags%polar) THEN
7241 IF (jte .GT. jde - 1) THEN
7250 DO j=ad_from19,j_end+1
7251 IF (j .LT. j_start_f .AND. degrade_ys) THEN
7255 CALL PUSHINTEGER4(i - 1)
7256 CALL PUSHINTEGER4(ad_from13)
7258 CALL PUSHCONTROL2B(0)
7259 ELSE IF (j .GT. j_end_f .AND. degrade_ye) THEN
7263 CALL PUSHINTEGER4(i - 1)
7264 CALL PUSHINTEGER4(ad_from14)
7266 CALL PUSHCONTROL2B(1)
7268 ! 3rd or 4th order flux
7272 CALL PUSHINTEGER4(i - 1)
7273 CALL PUSHINTEGER4(ad_from15)
7275 CALL PUSHCONTROL2B(2)
7277 ! y flux-divergence into tendency
7278 ! Comments on polar boundary conditions
7279 ! Same process as for advect_u - tendencies run from jds to jde-1
7280 ! (latitudes are as for u grid, longitudes are displaced)
7281 ! Therefore: flow is only from one side for points next to poles
7282 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
7286 CALL PUSHINTEGER4(i - 1)
7287 CALL PUSHINTEGER4(ad_from16)
7289 CALL PUSHCONTROL2B(0)
7290 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
7294 CALL PUSHINTEGER4(i - 1)
7295 CALL PUSHINTEGER4(ad_from17)
7297 CALL PUSHCONTROL2B(1)
7298 ELSE IF (j .GT. j_start) THEN
7303 CALL PUSHINTEGER4(i - 1)
7304 CALL PUSHINTEGER4(ad_from18)
7306 CALL PUSHCONTROL2B(2)
7308 CALL PUSHCONTROL2B(3)
7311 CALL PUSHINTEGER4(jp1)
7313 CALL PUSHINTEGER4(jp0)
7316 CALL PUSHINTEGER4(j - 1)
7317 CALL PUSHINTEGER4(ad_from19)
7318 CALL PUSHCONTROL3B(5)
7319 ELSE IF (horz_order .EQ. 3) THEN
7324 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
7325 & its .GT. ids + 2) degrade_xs = .false.
7326 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
7327 & ite .LT. ide - 2) degrade_xe = .false.
7328 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
7329 & jts .GT. jds + 2) degrade_ys = .false.
7330 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
7331 & jte .LT. jde - 3) degrade_ye = .false.
7332 IF (kte .GT. kde - 1) THEN
7338 IF (ite .GT. ide - 1) THEN
7344 IF (jte .GT. jde - 1) THEN
7349 ! 3rd or 4th order flux has a 5 point stencil, so compute
7350 ! bounds so we can switch to second order flux close to the boundary
7353 IF (degrade_xs) THEN
7355 i_start_f = i_start + 1
7357 IF (degrade_xe) THEN
7363 DO j=ad_from21,j_end
7364 ! second order flux close to boundaries (if not periodic or symmetric)
7365 IF (degrade_xs) THEN
7366 CALL PUSHCONTROL1B(0)
7368 CALL PUSHCONTROL1B(1)
7370 IF (degrade_xe) THEN
7371 CALL PUSHCONTROL1B(1)
7373 CALL PUSHCONTROL1B(0)
7375 ! x flux-divergence into tendency
7379 CALL PUSHINTEGER4(i - 1)
7380 CALL PUSHINTEGER4(ad_from20)
7383 CALL PUSHINTEGER4(j - 1)
7384 CALL PUSHINTEGER4(ad_from21)
7385 CALL PUSHINTEGER4(i_start)
7386 ! next -> y flux divergence calculation
7388 IF (ite .GT. ide - 1) THEN
7389 CALL PUSHINTEGER4(i_end)
7391 CALL PUSHCONTROL1B(0)
7393 CALL PUSHINTEGER4(i_end)
7395 CALL PUSHCONTROL1B(1)
7398 IF (jte .GT. jde - 1) THEN
7403 ! 3rd or 4th order flux has a 5 point stencil, so compute
7404 ! bounds so we can switch to second order flux close to the boundary
7407 IF (degrade_ys) THEN
7409 j_start_f = j_start + 1
7411 IF (degrade_ye) THEN
7415 IF (config_flags%polar) THEN
7416 IF (jte .GT. jde - 1) THEN
7425 DO j=ad_from28,j_end+1
7426 IF (j .LT. j_start_f .AND. degrade_ys) THEN
7430 CALL PUSHINTEGER4(i - 1)
7431 CALL PUSHINTEGER4(ad_from22)
7433 CALL PUSHCONTROL2B(0)
7434 ELSE IF (j .GT. j_end_f .AND. degrade_ye) THEN
7438 CALL PUSHINTEGER4(i - 1)
7439 CALL PUSHINTEGER4(ad_from23)
7441 CALL PUSHCONTROL2B(1)
7443 ! 3rd or 4th order flux
7447 CALL PUSHINTEGER4(i - 1)
7448 CALL PUSHINTEGER4(ad_from24)
7450 CALL PUSHCONTROL2B(2)
7452 ! y flux-divergence into tendency
7453 ! Comments on polar boundary conditions
7454 ! Same process as for advect_u - tendencies run from jds to jde-1
7455 ! (latitudes are as for u grid, longitudes are displaced)
7456 ! Therefore: flow is only from one side for points next to poles
7457 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
7461 CALL PUSHINTEGER4(i - 1)
7462 CALL PUSHINTEGER4(ad_from25)
7464 CALL PUSHCONTROL2B(0)
7465 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
7469 CALL PUSHINTEGER4(i - 1)
7470 CALL PUSHINTEGER4(ad_from26)
7472 CALL PUSHCONTROL2B(1)
7473 ELSE IF (j .GT. j_start) THEN
7478 CALL PUSHINTEGER4(i - 1)
7479 CALL PUSHINTEGER4(ad_from27)
7481 CALL PUSHCONTROL2B(2)
7483 CALL PUSHCONTROL2B(3)
7486 CALL PUSHINTEGER4(jp1)
7488 CALL PUSHINTEGER4(jp0)
7491 CALL PUSHINTEGER4(j - 1)
7492 CALL PUSHINTEGER4(ad_from28)
7493 CALL PUSHCONTROL3B(4)
7494 ELSE IF (horz_order .EQ. 2) THEN
7496 IF (ite .GT. ide - 1) THEN
7502 IF (jte .GT. jde - 1) THEN
7507 IF (.NOT.config_flags%periodic_x) THEN
7508 IF (config_flags%open_xs .OR. specified) THEN
7509 IF (ids + 1 .LT. its) THEN
7515 IF (config_flags%open_xe .OR. specified) THEN
7516 IF (ide - 2 .GT. ite) THEN
7524 DO j=ad_from30,j_end
7528 CALL PUSHINTEGER4(i - 1)
7529 CALL PUSHINTEGER4(ad_from29)
7532 CALL PUSHINTEGER4(j - 1)
7533 CALL PUSHINTEGER4(ad_from30)
7535 IF (ite .GT. ide - 1) THEN
7540 ! Polar boundary conditions are like open or specified
7541 IF ((config_flags%open_ys .OR. specified) .OR. config_flags%polar) &
7543 IF (jds + 1 .LT. jts) THEN
7549 IF ((config_flags%open_ye .OR. specified) .OR. config_flags%polar) &
7551 IF (jde - 2 .GT. jte) THEN
7558 DO j=ad_from32,j_end
7562 CALL PUSHINTEGER4(i - 1)
7563 CALL PUSHINTEGER4(ad_from31)
7566 CALL PUSHINTEGER4(j - 1)
7567 CALL PUSHINTEGER4(ad_from32)
7568 ! Polar boundary condtions
7569 ! These won't be covered in the loop above...
7570 IF (config_flags%polar) THEN
7571 IF (jts .EQ. jds) THEN
7575 CALL PUSHINTEGER4(i - 1)
7576 CALL PUSHINTEGER4(ad_from33)
7578 CALL PUSHCONTROL1B(0)
7580 CALL PUSHCONTROL1B(1)
7582 IF (jte .EQ. jde) THEN
7586 CALL PUSHINTEGER4(i - 1)
7587 CALL PUSHINTEGER4(ad_from34)
7589 CALL PUSHCONTROL3B(3)
7591 CALL PUSHCONTROL3B(2)
7594 CALL PUSHCONTROL3B(1)
7597 CALL PUSHCONTROL3B(0)
7599 ! pick up the rest of the horizontal radiation boundary conditions.
7600 ! (these are the computations that don't require 'cb'.
7601 ! first, set to index ranges
7603 IF (ite .GT. ide - 1) THEN
7608 CALL PUSHINTEGER4(j_start)
7610 IF (jte .GT. jde - 1) THEN
7615 ! compute x (u) conditions for v, w, or scalar
7616 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
7618 DO j=ad_from47,j_end
7620 IF (0.5*(ru(its, k, j)+ru(its+1, k, j)) .GT. 0.) THEN
7623 CALL PUSHCONTROL1B(0)
7626 ub = 0.5*(ru(its, k, j)+ru(its+1, k, j))
7627 CALL PUSHCONTROL1B(1)
7631 CALL PUSHINTEGER4(j - 1)
7632 CALL PUSHINTEGER4(ad_from47)
7633 CALL PUSHCONTROL1B(0)
7635 CALL PUSHCONTROL1B(1)
7637 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
7639 DO j=ad_from48,j_end
7641 IF (0.5*(ru(ite-1, k, j)+ru(ite, k, j)) .LT. 0.) THEN
7644 CALL PUSHCONTROL1B(0)
7647 ub = 0.5*(ru(ite-1, k, j)+ru(ite, k, j))
7648 CALL PUSHCONTROL1B(1)
7652 CALL PUSHINTEGER4(j - 1)
7653 CALL PUSHINTEGER4(ad_from48)
7654 CALL PUSHCONTROL1B(0)
7656 CALL PUSHCONTROL1B(1)
7658 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
7660 DO i=ad_from49,i_end
7662 IF (0.5*(rv(i, k, jts)+rv(i, k, jts+1)) .GT. 0.) THEN
7665 CALL PUSHCONTROL1B(0)
7668 vb = 0.5*(rv(i, k, jts)+rv(i, k, jts+1))
7669 CALL PUSHCONTROL1B(1)
7673 CALL PUSHINTEGER4(i - 1)
7674 CALL PUSHINTEGER4(ad_from49)
7675 CALL PUSHCONTROL1B(0)
7677 CALL PUSHCONTROL1B(1)
7679 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
7681 DO i=ad_from50,i_end
7683 IF (0.5*(rv(i, k, jte-1)+rv(i, k, jte)) .LT. 0.) THEN
7686 CALL PUSHCONTROL1B(0)
7689 vb = 0.5*(rv(i, k, jte-1)+rv(i, k, jte))
7690 CALL PUSHCONTROL1B(1)
7694 CALL PUSHINTEGER4(i - 1)
7695 CALL PUSHINTEGER4(ad_from50)
7696 CALL PUSHCONTROL1B(1)
7698 CALL PUSHCONTROL1B(0)
7700 !-------------------- vertical advection
7701 ! Scalar equation has 3rd term on RHS = - partial d/dz (q rho w /my)
7702 ! Here we have: - partial d/dz (q*rom) = - partial d/dz (q rho w / my)
7703 ! So we don't need to make a correction for advect_scalar
7705 IF (ite .GT. ide - 1) THEN
7706 CALL PUSHINTEGER4(i_end)
7708 CALL PUSHCONTROL1B(0)
7710 CALL PUSHINTEGER4(i_end)
7712 CALL PUSHCONTROL1B(1)
7715 IF (jte .GT. jde - 1) THEN
7716 CALL PUSHINTEGER4(j_end)
7718 CALL PUSHCONTROL1B(0)
7720 CALL PUSHINTEGER4(j_end)
7722 CALL PUSHCONTROL1B(1)
7724 IF (vert_order .EQ. 6) THEN
7726 CALL PUSHINTEGER4(k)
7729 DO j=j_end,j_start,-1
7731 DO i=i_end,i_start,-1
7732 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
7733 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
7737 DO i=i_end,i_start,-1
7739 temp31b28 = rom(i, k, j)*vfluxb(i, k)
7740 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
7741 & field(i, k-1, j))*vfluxb(i, k)
7742 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp31b28
7743 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp31b28
7747 temp31b29 = vel*vfluxb(i, k)/12.0
7748 velb = (7.*(field(i, k, j)+field(i, k-1, j))-field(i, k+1, j)-&
7749 & field(i, k-2, j))*vfluxb(i, k)/12.0
7750 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp31b29
7751 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 7.*temp31b29
7752 fieldb(i, k+1, j) = fieldb(i, k+1, j) - temp31b29
7753 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp31b29
7755 romb(i, k, j) = romb(i, k, j) + velb
7758 temp31b30 = vel*vfluxb(i, k)/12.0
7759 velb = (7.*(field(i, k, j)+field(i, k-1, j))-field(i, k+1, j)-&
7760 & field(i, k-2, j))*vfluxb(i, k)/12.0
7761 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp31b30
7762 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 7.*temp31b30
7763 fieldb(i, k+1, j) = fieldb(i, k+1, j) - temp31b30
7764 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp31b30
7766 romb(i, k, j) = romb(i, k, j) + velb
7768 temp31b31 = rom(i, k, j)*vfluxb(i, k)
7769 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
7770 & field(i, k-1, j))*vfluxb(i, k)
7771 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp31b31
7772 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp31b31
7776 DO i=i_end,i_start,-1
7778 temp31b27 = vel*vfluxb(i, k)/60.0
7779 velb = (37.*(field(i, k, j)+field(i, k-1, j))-8.*(field(i, k+1&
7780 & , j)+field(i, k-2, j))+field(i, k+2, j)+field(i, k-3, j))*&
7782 fieldb(i, k, j) = fieldb(i, k, j) + 37.*temp31b27
7783 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 37.*temp31b27
7784 fieldb(i, k+1, j) = fieldb(i, k+1, j) - 8.*temp31b27
7785 fieldb(i, k-2, j) = fieldb(i, k-2, j) - 8.*temp31b27
7786 fieldb(i, k+2, j) = fieldb(i, k+2, j) + temp31b27
7787 fieldb(i, k-3, j) = fieldb(i, k-3, j) + temp31b27
7789 romb(i, k, j) = romb(i, k, j) + velb
7793 ELSE IF (vert_order .EQ. 5) THEN
7795 CALL PUSHINTEGER4(k)
7798 DO j=j_end,j_start,-1
7800 DO i=i_end,i_start,-1
7801 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
7802 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
7806 DO i=i_end,i_start,-1
7808 temp43b = rom(i, k, j)*vfluxb(i, k)
7809 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
7810 & field(i, k-1, j))*vfluxb(i, k)
7811 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp43b
7812 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp43b
7816 temp39 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k, j&
7817 & )-field(i, k-1, j))
7818 temp42 = SIGN(1., -vel)
7819 temp41 = temp42/12.0
7820 temp40 = SIGN(1, time_step)
7821 temp39b = vel*vfluxb(i, k)
7822 temp39b0 = temp39b/12.0
7823 temp39b1 = temp40*temp41*temp39b
7824 velb = ((7.*(field(i, k, j)+field(i, k-1, j))-field(i, k+1, j)-&
7825 & field(i, k-2, j))/12.0+temp40*(temp41*temp39))*vfluxb(i, k)
7826 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp39b0 - 3.*temp39b1
7827 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*temp39b1 + 7.*&
7829 fieldb(i, k+1, j) = fieldb(i, k+1, j) + temp39b1 - temp39b0
7830 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp39b1 - temp39b0
7832 romb(i, k, j) = romb(i, k, j) + velb
7835 temp35 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k, j&
7836 & )-field(i, k-1, j))
7837 temp38 = SIGN(1., -vel)
7838 temp37 = temp38/12.0
7839 temp36 = SIGN(1, time_step)
7840 temp35b = vel*vfluxb(i, k)
7841 temp35b0 = temp35b/12.0
7842 temp35b1 = temp36*temp37*temp35b
7843 velb = ((7.*(field(i, k, j)+field(i, k-1, j))-field(i, k+1, j)-&
7844 & field(i, k-2, j))/12.0+temp36*(temp37*temp35))*vfluxb(i, k)
7845 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp35b0 - 3.*temp35b1
7846 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*temp35b1 + 7.*&
7848 fieldb(i, k+1, j) = fieldb(i, k+1, j) + temp35b1 - temp35b0
7849 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp35b1 - temp35b0
7851 romb(i, k, j) = romb(i, k, j) + velb
7853 temp35b2 = rom(i, k, j)*vfluxb(i, k)
7854 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
7855 & field(i, k-1, j))*vfluxb(i, k)
7856 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp35b2
7857 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp35b2
7861 DO i=i_end,i_start,-1
7863 temp31 = field(i, k+2, j) - field(i, k-3, j) + 10.*(field(i, k&
7864 & , j)-field(i, k-1, j)) - 5.*(field(i, k+1, j)-field(i, k-2, &
7866 temp34 = SIGN(1., -vel)
7867 temp33 = temp34/60.0
7868 temp32 = SIGN(1, time_step)
7869 temp31b32 = vel*vfluxb(i, k)
7870 temp31b33 = temp31b32/60.0
7871 temp31b34 = -(temp32*temp33*temp31b32)
7872 velb = ((37.*(field(i, k, j)+field(i, k-1, j))-8.*(field(i, k+&
7873 & 1, j)+field(i, k-2, j))+field(i, k+2, j)+field(i, k-3, j))/&
7874 & 60.0-temp32*(temp33*temp31))*vfluxb(i, k)
7875 fieldb(i, k, j) = fieldb(i, k, j) + 10.*temp31b34 + 37.*&
7877 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 37.*temp31b33 - 10.*&
7879 fieldb(i, k+1, j) = fieldb(i, k+1, j) - 5.*temp31b34 - 8.*&
7881 fieldb(i, k-2, j) = fieldb(i, k-2, j) + 5.*temp31b34 - 8.*&
7883 fieldb(i, k+2, j) = fieldb(i, k+2, j) + temp31b34 + temp31b33
7884 fieldb(i, k-3, j) = fieldb(i, k-3, j) + temp31b33 - temp31b34
7886 romb(i, k, j) = romb(i, k, j) + velb
7890 ELSE IF (vert_order .EQ. 4) THEN
7892 CALL PUSHINTEGER4(k)
7895 DO j=j_end,j_start,-1
7897 DO i=i_end,i_start,-1
7898 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
7899 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
7903 DO i=i_end,i_start,-1
7905 temp43b1 = rom(i, k, j)*vfluxb(i, k)
7906 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
7907 & field(i, k-1, j))*vfluxb(i, k)
7908 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp43b1
7909 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp43b1
7912 temp43b2 = rom(i, k, j)*vfluxb(i, k)
7913 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
7914 & field(i, k-1, j))*vfluxb(i, k)
7915 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp43b2
7916 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp43b2
7920 DO i=i_end,i_start,-1
7922 temp43b0 = vel*vfluxb(i, k)/12.0
7923 velb = (7.*(field(i, k, j)+field(i, k-1, j))-field(i, k+1, j)-&
7924 & field(i, k-2, j))*vfluxb(i, k)/12.0
7925 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp43b0
7926 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 7.*temp43b0
7927 fieldb(i, k+1, j) = fieldb(i, k+1, j) - temp43b0
7928 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp43b0
7930 romb(i, k, j) = romb(i, k, j) + velb
7934 ELSE IF (vert_order .EQ. 3) THEN
7936 CALL PUSHINTEGER4(k)
7939 DO j=j_end,j_start,-1
7941 DO i=i_end,i_start,-1
7942 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
7943 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
7947 DO i=i_end,i_start,-1
7949 temp47b = rom(i, k, j)*vfluxb(i, k)
7950 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
7951 & field(i, k-1, j))*vfluxb(i, k)
7952 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp47b
7953 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp47b
7956 temp47b0 = rom(i, k, j)*vfluxb(i, k)
7957 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
7958 & field(i, k-1, j))*vfluxb(i, k)
7959 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp47b0
7960 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp47b0
7964 DO i=i_end,i_start,-1
7966 temp43 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k&
7967 & , j)-field(i, k-1, j))
7968 temp46 = SIGN(1., -vel)
7969 temp45 = temp46/12.0
7970 temp44 = SIGN(1, time_step)
7971 temp43b3 = vel*vfluxb(i, k)
7972 temp43b4 = temp43b3/12.0
7973 temp43b5 = temp44*temp45*temp43b3
7974 velb = ((7.*(field(i, k, j)+field(i, k-1, j))-field(i, k+1, j)&
7975 & -field(i, k-2, j))/12.0+temp44*(temp45*temp43))*vfluxb(i, k)
7976 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp43b4 - 3.*temp43b5
7977 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*temp43b5 + 7.*&
7979 fieldb(i, k+1, j) = fieldb(i, k+1, j) + temp43b5 - temp43b4
7980 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp43b5 - temp43b4
7982 romb(i, k, j) = romb(i, k, j) + velb
7986 ELSE IF (vert_order .EQ. 2) THEN
7988 DO j=j_end,j_start,-1
7990 DO i=i_end,i_start,-1
7991 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
7992 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
7996 DO i=i_end,i_start,-1
7997 temp47b1 = rom(i, k, j)*vfluxb(i, k)
7998 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
7999 & field(i, k-1, j))*vfluxb(i, k)
8000 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp47b1
8001 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp47b1
8007 CALL POPCONTROL1B(branch)
8008 IF (branch .EQ. 0) THEN
8009 CALL POPINTEGER4(j_end)
8011 CALL POPINTEGER4(j_end)
8013 CALL POPCONTROL1B(branch)
8014 IF (branch .EQ. 0) THEN
8015 CALL POPINTEGER4(i_end)
8017 CALL POPINTEGER4(i_end)
8019 CALL POPCONTROL1B(branch)
8020 IF (branch .NE. 0) THEN
8021 CALL POPINTEGER4(ad_from50)
8022 CALL POPINTEGER4(ad_to50)
8023 DO i=ad_to50,ad_from50,-1
8025 temp31b25 = -(rdy*tendencyb(i, k, j_end))
8026 temp31b26 = field(i, k, j_end)*temp31b25
8027 vbb = (field_old(i, k, j_end)-field_old(i, k, j_end-1))*&
8029 field_oldb(i, k, j_end) = field_oldb(i, k, j_end) + vb*temp31b25
8030 field_oldb(i, k, j_end-1) = field_oldb(i, k, j_end-1) - vb*&
8032 fieldb(i, k, j_end) = fieldb(i, k, j_end) + (rv(i, k, jte)-rv(i&
8033 & , k, jte-1))*temp31b25
8034 rvb(i, k, jte) = rvb(i, k, jte) + temp31b26
8035 rvb(i, k, jte-1) = rvb(i, k, jte-1) - temp31b26
8036 CALL POPCONTROL1B(branch)
8037 IF (branch .EQ. 0) THEN
8041 rvb(i, k, jte-1) = rvb(i, k, jte-1) + 0.5*vbb
8042 rvb(i, k, jte) = rvb(i, k, jte) + 0.5*vbb
8047 CALL POPCONTROL1B(branch)
8048 IF (branch .EQ. 0) THEN
8049 CALL POPINTEGER4(ad_from49)
8050 CALL POPINTEGER4(ad_to49)
8051 DO i=ad_to49,ad_from49,-1
8053 temp31b23 = -(rdy*tendencyb(i, k, jts))
8054 temp31b24 = field(i, k, jts)*temp31b23
8055 vbb = (field_old(i, k, jts+1)-field_old(i, k, jts))*temp31b23
8056 field_oldb(i, k, jts+1) = field_oldb(i, k, jts+1) + vb*temp31b23
8057 field_oldb(i, k, jts) = field_oldb(i, k, jts) - vb*temp31b23
8058 fieldb(i, k, jts) = fieldb(i, k, jts) + (rv(i, k, jts+1)-rv(i, k&
8060 rvb(i, k, jts+1) = rvb(i, k, jts+1) + temp31b24
8061 rvb(i, k, jts) = rvb(i, k, jts) - temp31b24
8062 CALL POPCONTROL1B(branch)
8063 IF (branch .EQ. 0) THEN
8067 rvb(i, k, jts) = rvb(i, k, jts) + 0.5*vbb
8068 rvb(i, k, jts+1) = rvb(i, k, jts+1) + 0.5*vbb
8073 CALL POPCONTROL1B(branch)
8074 IF (branch .EQ. 0) THEN
8075 CALL POPINTEGER4(ad_from48)
8076 CALL POPINTEGER4(ad_to48)
8077 DO j=ad_to48,ad_from48,-1
8079 temp31b21 = -(rdx*tendencyb(i_end, k, j))
8080 temp31b22 = field(i_end, k, j)*temp31b21
8081 ubb = (field_old(i_end, k, j)-field_old(i_end-1, k, j))*&
8083 field_oldb(i_end, k, j) = field_oldb(i_end, k, j) + ub*temp31b21
8084 field_oldb(i_end-1, k, j) = field_oldb(i_end-1, k, j) - ub*&
8086 fieldb(i_end, k, j) = fieldb(i_end, k, j) + (ru(ite, k, j)-ru(&
8087 & ite-1, k, j))*temp31b21
8088 rub(ite, k, j) = rub(ite, k, j) + temp31b22
8089 rub(ite-1, k, j) = rub(ite-1, k, j) - temp31b22
8090 CALL POPCONTROL1B(branch)
8091 IF (branch .EQ. 0) THEN
8095 rub(ite-1, k, j) = rub(ite-1, k, j) + 0.5*ubb
8096 rub(ite, k, j) = rub(ite, k, j) + 0.5*ubb
8101 CALL POPCONTROL1B(branch)
8102 IF (branch .EQ. 0) THEN
8103 CALL POPINTEGER4(ad_from47)
8104 CALL POPINTEGER4(ad_to47)
8105 DO j=ad_to47,ad_from47,-1
8107 temp31b19 = -(rdx*tendencyb(its, k, j))
8108 temp31b20 = field(its, k, j)*temp31b19
8109 ubb = (field_old(its+1, k, j)-field_old(its, k, j))*temp31b19
8110 field_oldb(its+1, k, j) = field_oldb(its+1, k, j) + ub*temp31b19
8111 field_oldb(its, k, j) = field_oldb(its, k, j) - ub*temp31b19
8112 fieldb(its, k, j) = fieldb(its, k, j) + (ru(its+1, k, j)-ru(its&
8113 & , k, j))*temp31b19
8114 rub(its+1, k, j) = rub(its+1, k, j) + temp31b20
8115 rub(its, k, j) = rub(its, k, j) - temp31b20
8116 CALL POPCONTROL1B(branch)
8117 IF (branch .EQ. 0) THEN
8121 rub(its, k, j) = rub(its, k, j) + 0.5*ubb
8122 rub(its+1, k, j) = rub(its+1, k, j) + 0.5*ubb
8127 CALL POPINTEGER4(j_start)
8128 CALL POPCONTROL3B(branch)
8129 IF (branch .LT. 4) THEN
8130 IF (branch .LT. 2) THEN
8131 IF (branch .EQ. 0) GOTO 100
8133 IF (branch .NE. 2) THEN
8135 CALL POPINTEGER4(ad_from34)
8136 CALL POPINTEGER4(ad_to34)
8137 DO i=ad_to34,ad_from34,-1
8138 mrdy = msftx(i, jde-1)*rdy
8139 temp31b7 = mrdy*0.5*tendencyb(i, k, jde-1)
8140 temp31b8 = rv(i, k, jde-1)*temp31b7
8141 rvb(i, k, jde-1) = rvb(i, k, jde-1) + (field(i, k, jde-1)+&
8142 & field(i, k, jde-2))*temp31b7
8143 fieldb(i, k, jde-1) = fieldb(i, k, jde-1) + temp31b8
8144 fieldb(i, k, jde-2) = fieldb(i, k, jde-2) + temp31b8
8148 CALL POPCONTROL1B(branch)
8149 IF (branch .EQ. 0) THEN
8151 CALL POPINTEGER4(ad_from33)
8152 CALL POPINTEGER4(ad_to33)
8153 DO i=ad_to33,ad_from33,-1
8154 mrdy = msftx(i, jds)*rdy
8155 temp31b5 = -(mrdy*0.5*tendencyb(i, k, jds))
8156 temp31b6 = rv(i, k, jds+1)*temp31b5
8157 rvb(i, k, jds+1) = rvb(i, k, jds+1) + (field(i, k, jds+1)+&
8158 & field(i, k, jds))*temp31b5
8159 fieldb(i, k, jds+1) = fieldb(i, k, jds+1) + temp31b6
8160 fieldb(i, k, jds) = fieldb(i, k, jds) + temp31b6
8165 CALL POPINTEGER4(ad_from32)
8166 CALL POPINTEGER4(ad_to32)
8167 DO j=ad_to32,ad_from32,-1
8169 CALL POPINTEGER4(ad_from31)
8170 CALL POPINTEGER4(ad_to31)
8171 DO i=ad_to31,ad_from31,-1
8172 mrdy = msftx(i, j)*rdy
8173 temp31b2 = -(mrdy*0.5*tendencyb(i, k, j))
8174 temp31b3 = rv(i, k, j+1)*temp31b2
8175 temp31b4 = -(rv(i, k, j)*temp31b2)
8176 rvb(i, k, j+1) = rvb(i, k, j+1) + (field(i, k, j+1)+field(i, k&
8178 fieldb(i, k, j+1) = fieldb(i, k, j+1) + temp31b3
8179 fieldb(i, k, j) = fieldb(i, k, j) + temp31b4 + temp31b3
8180 rvb(i, k, j) = rvb(i, k, j) - (field(i, k, j)+field(i, k, j-1)&
8182 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp31b4
8186 CALL POPINTEGER4(ad_from30)
8187 CALL POPINTEGER4(ad_to30)
8188 DO j=ad_to30,ad_from30,-1
8190 CALL POPINTEGER4(ad_from29)
8191 CALL POPINTEGER4(ad_to29)
8192 DO i=ad_to29,ad_from29,-1
8193 mrdx = msftx(i, j)*rdx
8194 temp31b = -(mrdx*0.5*tendencyb(i, k, j))
8195 temp31b0 = ru(i+1, k, j)*temp31b
8196 temp31b1 = -(ru(i, k, j)*temp31b)
8197 rub(i+1, k, j) = rub(i+1, k, j) + (field(i+1, k, j)+field(i, k&
8199 fieldb(i+1, k, j) = fieldb(i+1, k, j) + temp31b0
8200 fieldb(i, k, j) = fieldb(i, k, j) + temp31b1 + temp31b0
8201 rub(i, k, j) = rub(i, k, j) - (field(i, k, j)+field(i-1, k, j)&
8203 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b1
8207 ELSE IF (branch .LT. 6) THEN
8208 IF (branch .EQ. 4) THEN
8210 CALL POPINTEGER4(ad_from28)
8211 CALL POPINTEGER4(ad_to28)
8212 DO j=ad_to28,ad_from28,-1
8213 CALL POPINTEGER4(jp0)
8214 CALL POPINTEGER4(jp1)
8215 CALL POPCONTROL2B(branch)
8216 IF (branch .LT. 2) THEN
8217 IF (branch .EQ. 0) THEN
8219 CALL POPINTEGER4(ad_from25)
8220 CALL POPINTEGER4(ad_to25)
8221 DO i=ad_to25,ad_from25,-1
8222 mrdy = msftx(i, j-1)*rdy
8223 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k&
8229 CALL POPINTEGER4(ad_from26)
8230 CALL POPINTEGER4(ad_to26)
8231 DO i=ad_to26,ad_from26,-1
8232 mrdy = msftx(i, j-1)*rdy
8233 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k&
8238 ELSE IF (branch .EQ. 2) THEN
8240 CALL POPINTEGER4(ad_from27)
8241 CALL POPINTEGER4(ad_to27)
8242 DO i=ad_to27,ad_from27,-1
8243 mrdy = msftx(i, j-1)*rdy
8244 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
8246 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
8251 CALL POPCONTROL2B(branch)
8252 IF (branch .EQ. 0) THEN
8254 CALL POPINTEGER4(ad_from22)
8255 CALL POPINTEGER4(ad_to22)
8256 DO i=ad_to22,ad_from22,-1
8257 temp27b1 = 0.5*rv(i, k, j_start)*fqyb(i, k, jp1)
8258 rvb(i, k, j_start) = rvb(i, k, j_start) + 0.5*(field(i, k&
8259 & , j_start)+field(i, k, j_start-1))*fqyb(i, k, jp1)
8260 fieldb(i, k, j_start) = fieldb(i, k, j_start) + temp27b1
8261 fieldb(i, k, j_start-1) = fieldb(i, k, j_start-1) + &
8263 fqyb(i, k, jp1) = 0.0
8266 ELSE IF (branch .EQ. 1) THEN
8268 CALL POPINTEGER4(ad_from23)
8269 CALL POPINTEGER4(ad_to23)
8270 DO i=ad_to23,ad_from23,-1
8271 temp27b2 = 0.5*rv(i, k, j)*fqyb(i, k, jp1)
8272 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i&
8273 & , k, j-1))*fqyb(i, k, jp1)
8274 fieldb(i, k, j) = fieldb(i, k, j) + temp27b2
8275 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp27b2
8276 fqyb(i, k, jp1) = 0.0
8281 CALL POPINTEGER4(ad_from24)
8282 CALL POPINTEGER4(ad_to24)
8283 DO i=ad_to24,ad_from24,-1
8284 temp27 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field(i&
8285 & , k, j)-field(i, k, j-1))
8286 temp30 = SIGN(1., rv(i, k, j))
8287 temp29 = temp30/12.0
8288 temp28 = SIGN(1, time_step)
8289 temp27b3 = rv(i, k, j)*fqyb(i, k, jp1)
8290 temp27b4 = temp27b3/12.0
8291 temp27b5 = temp28*temp29*temp27b3
8292 rvb(i, k, j) = rvb(i, k, j) + ((7.*(field(i, k, j)+field(i&
8293 & , k, j-1))-field(i, k, j+1)-field(i, k, j-2))/12.0+&
8294 & temp28*(temp29*temp27))*fqyb(i, k, jp1)
8295 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp27b4 - 3.*&
8297 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*temp27b5 + 7.*&
8299 fieldb(i, k, j+1) = fieldb(i, k, j+1) + temp27b5 - &
8301 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp27b5 - &
8303 fqyb(i, k, jp1) = 0.0
8308 CALL POPCONTROL1B(branch)
8309 IF (branch .EQ. 0) THEN
8310 CALL POPINTEGER4(i_end)
8312 CALL POPINTEGER4(i_end)
8314 CALL POPINTEGER4(i_start)
8316 CALL POPINTEGER4(ad_from21)
8317 CALL POPINTEGER4(ad_to21)
8318 DO j=ad_to21,ad_from21,-1
8320 CALL POPINTEGER4(ad_from20)
8321 CALL POPINTEGER4(ad_to20)
8322 DO i=ad_to20,ad_from20,-1
8323 mrdx = msftx(i, j)*rdx
8324 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
8325 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
8328 CALL POPCONTROL1B(branch)
8329 IF (branch .NE. 0) THEN
8331 temp27b0 = 0.5*ru(i_end+1, k, j)*fqxb(i_end+1, k)
8332 rub(i_end+1, k, j) = rub(i_end+1, k, j) + 0.5*(field(i_end+1&
8333 & , k, j)+field(i_end, k, j))*fqxb(i_end+1, k)
8334 fieldb(i_end+1, k, j) = fieldb(i_end+1, k, j) + temp27b0
8335 fieldb(i_end, k, j) = fieldb(i_end, k, j) + temp27b0
8336 fqxb(i_end+1, k) = 0.0
8339 CALL POPCONTROL1B(branch)
8340 IF (branch .EQ. 0) THEN
8342 temp27b = 0.5*ru(i_start, k, j)*fqxb(i_start, k)
8343 rub(i_start, k, j) = rub(i_start, k, j) + 0.5*(field(i_start&
8344 & , k, j)+field(i_start-1, k, j))*fqxb(i_start, k)
8345 fieldb(i_start, k, j) = fieldb(i_start, k, j) + temp27b
8346 fieldb(i_start-1, k, j) = fieldb(i_start-1, k, j) + temp27b
8347 fqxb(i_start, k) = 0.0
8351 DO i=i_end_f,i_start_f,-1
8352 temp23 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i, &
8353 & k, j)-field(i-1, k, j))
8354 temp26 = SIGN(1., ru(i, k, j))
8355 temp25 = temp26/12.0
8356 temp24 = SIGN(1, time_step)
8357 temp23b5 = ru(i, k, j)*fqxb(i, k)
8358 temp23b6 = temp23b5/12.0
8359 temp23b7 = temp24*temp25*temp23b5
8360 rub(i, k, j) = rub(i, k, j) + ((7.*(field(i, k, j)+field(i-1&
8361 & , k, j))-field(i+1, k, j)-field(i-2, k, j))/12.0+temp24*(&
8362 & temp25*temp23))*fqxb(i, k)
8363 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp23b6 - 3.*&
8365 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*temp23b7 + 7.*&
8367 fieldb(i+1, k, j) = fieldb(i+1, k, j) + temp23b7 - temp23b6
8368 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp23b7 - temp23b6
8375 CALL POPINTEGER4(ad_from19)
8376 CALL POPINTEGER4(ad_to19)
8377 DO j=ad_to19,ad_from19,-1
8378 CALL POPINTEGER4(jp0)
8379 CALL POPINTEGER4(jp1)
8380 CALL POPCONTROL2B(branch)
8381 IF (branch .LT. 2) THEN
8382 IF (branch .EQ. 0) THEN
8384 CALL POPINTEGER4(ad_from16)
8385 CALL POPINTEGER4(ad_to16)
8386 DO i=ad_to16,ad_from16,-1
8387 mrdy = msftx(i, j-1)*rdy
8388 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k&
8394 CALL POPINTEGER4(ad_from17)
8395 CALL POPINTEGER4(ad_to17)
8396 DO i=ad_to17,ad_from17,-1
8397 mrdy = msftx(i, j-1)*rdy
8398 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k&
8403 ELSE IF (branch .EQ. 2) THEN
8405 CALL POPINTEGER4(ad_from18)
8406 CALL POPINTEGER4(ad_to18)
8407 DO i=ad_to18,ad_from18,-1
8408 mrdy = msftx(i, j-1)*rdy
8409 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
8411 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
8416 CALL POPCONTROL2B(branch)
8417 IF (branch .EQ. 0) THEN
8419 CALL POPINTEGER4(ad_from13)
8420 CALL POPINTEGER4(ad_to13)
8421 DO i=ad_to13,ad_from13,-1
8422 temp23b2 = 0.5*rv(i, k, j_start)*fqyb(i, k, jp1)
8423 rvb(i, k, j_start) = rvb(i, k, j_start) + 0.5*(field(i, k&
8424 & , j_start)+field(i, k, j_start-1))*fqyb(i, k, jp1)
8425 fieldb(i, k, j_start) = fieldb(i, k, j_start) + temp23b2
8426 fieldb(i, k, j_start-1) = fieldb(i, k, j_start-1) + &
8428 fqyb(i, k, jp1) = 0.0
8431 ELSE IF (branch .EQ. 1) THEN
8433 CALL POPINTEGER4(ad_from14)
8434 CALL POPINTEGER4(ad_to14)
8435 DO i=ad_to14,ad_from14,-1
8436 temp23b3 = 0.5*rv(i, k, j)*fqyb(i, k, jp1)
8437 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i&
8438 & , k, j-1))*fqyb(i, k, jp1)
8439 fieldb(i, k, j) = fieldb(i, k, j) + temp23b3
8440 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp23b3
8441 fqyb(i, k, jp1) = 0.0
8446 CALL POPINTEGER4(ad_from15)
8447 CALL POPINTEGER4(ad_to15)
8448 DO i=ad_to15,ad_from15,-1
8449 temp23b4 = rv(i, k, j)*fqyb(i, k, jp1)/12.0
8450 rvb(i, k, j) = rvb(i, k, j) + (7.*(field(i, k, j)+field(i&
8451 & , k, j-1))-field(i, k, j+1)-field(i, k, j-2))*fqyb(i, k&
8453 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp23b4
8454 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 7.*temp23b4
8455 fieldb(i, k, j+1) = fieldb(i, k, j+1) - temp23b4
8456 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp23b4
8457 fqyb(i, k, jp1) = 0.0
8462 CALL POPCONTROL1B(branch)
8463 IF (branch .EQ. 0) THEN
8464 CALL POPINTEGER4(i_end)
8466 CALL POPINTEGER4(i_end)
8468 CALL POPINTEGER4(i_start)
8470 CALL POPINTEGER4(ad_from12)
8471 CALL POPINTEGER4(ad_to12)
8472 DO j=ad_to12,ad_from12,-1
8474 CALL POPINTEGER4(ad_from11)
8475 CALL POPINTEGER4(ad_to11)
8476 DO i=ad_to11,ad_from11,-1
8477 mrdx = msftx(i, j)*rdx
8478 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
8479 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
8482 CALL POPCONTROL1B(branch)
8483 IF (branch .NE. 0) THEN
8485 temp23b1 = 0.5*ru(i_end+1, k, j)*fqxb(i_end+1, k)
8486 rub(i_end+1, k, j) = rub(i_end+1, k, j) + 0.5*(field(i_end+1&
8487 & , k, j)+field(i_end, k, j))*fqxb(i_end+1, k)
8488 fieldb(i_end+1, k, j) = fieldb(i_end+1, k, j) + temp23b1
8489 fieldb(i_end, k, j) = fieldb(i_end, k, j) + temp23b1
8490 fqxb(i_end+1, k) = 0.0
8493 CALL POPCONTROL1B(branch)
8494 IF (branch .EQ. 0) THEN
8496 temp23b0 = 0.5*ru(i_start, k, j)*fqxb(i_start, k)
8497 rub(i_start, k, j) = rub(i_start, k, j) + 0.5*(field(i_start&
8498 & , k, j)+field(i_start-1, k, j))*fqxb(i_start, k)
8499 fieldb(i_start, k, j) = fieldb(i_start, k, j) + temp23b0
8500 fieldb(i_start-1, k, j) = fieldb(i_start-1, k, j) + temp23b0
8501 fqxb(i_start, k) = 0.0
8505 DO i=i_end_f,i_start_f,-1
8506 temp23b = ru(i, k, j)*fqxb(i, k)/12.0
8507 rub(i, k, j) = rub(i, k, j) + (7.*(field(i, k, j)+field(i-1&
8508 & , k, j))-field(i+1, k, j)-field(i-2, k, j))*fqxb(i, k)/&
8510 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp23b
8511 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 7.*temp23b
8512 fieldb(i+1, k, j) = fieldb(i+1, k, j) - temp23b
8513 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp23b
8519 ELSE IF (branch .EQ. 6) THEN
8521 CALL POPINTEGER4(ad_from10)
8522 CALL POPINTEGER4(ad_to10)
8523 DO j=ad_to10,ad_from10,-1
8525 CALL POPINTEGER4(ad_from9)
8526 CALL POPINTEGER4(ad_to9)
8527 DO i=ad_to9,ad_from9,-1
8528 mrdx = msftx(i, j)*rdx
8529 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
8530 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
8533 CALL POPCONTROL1B(branch)
8534 IF (branch .NE. 0) THEN
8535 CALL POPINTEGER4(ad_to8)
8536 DO i=ad_to8,i_end_f+1,-1
8537 CALL POPCONTROL1B(branch)
8538 IF (branch .NE. 0) THEN
8541 temp19 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i&
8542 & , k, j)-field(i-1, k, j))
8543 temp22 = SIGN(1., vel)
8544 temp21 = temp22/12.0
8545 temp20 = SIGN(1, time_step)
8546 temp19b0 = vel*fqxb(i, k)
8547 temp19b1 = temp19b0/12.0
8548 temp19b2 = temp20*temp21*temp19b0
8549 velb = ((7.*(field(i, k, j)+field(i-1, k, j))-field(i+1, k&
8550 & , j)-field(i-2, k, j))/12.0+temp20*(temp21*temp19))*fqxb&
8552 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp19b1 - 3.*&
8554 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*temp19b2 + 7.*&
8556 fieldb(i+1, k, j) = fieldb(i+1, k, j) + temp19b2 - &
8558 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp19b2 - &
8561 rub(i, k, j) = rub(i, k, j) + velb
8564 CALL POPCONTROL1B(branch)
8565 IF (branch .EQ. 0) THEN
8567 temp19b = 0.5*ru(i, k, j)*fqxb(i, k)
8568 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
8569 & 1, k, j))*fqxb(i, k)
8570 fieldb(i, k, j) = fieldb(i, k, j) + temp19b
8571 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp19b
8577 CALL POPCONTROL1B(branch)
8578 IF (branch .EQ. 0) THEN
8579 CALL POPINTEGER4(ad_from8)
8580 DO i=i_start_f-1,ad_from8,-1
8581 CALL POPCONTROL1B(branch)
8582 IF (branch .NE. 0) THEN
8585 temp15 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i&
8586 & , k, j)-field(i-1, k, j))
8587 temp18 = SIGN(1., vel)
8588 temp17 = temp18/12.0
8589 temp16 = SIGN(1, time_step)
8590 temp15b0 = vel*fqxb(i, k)
8591 temp15b1 = temp15b0/12.0
8592 temp15b2 = temp16*temp17*temp15b0
8593 velb = ((7.*(field(i, k, j)+field(i-1, k, j))-field(i+1, k&
8594 & , j)-field(i-2, k, j))/12.0+temp16*(temp17*temp15))*fqxb&
8596 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp15b1 - 3.*&
8598 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*temp15b2 + 7.*&
8600 fieldb(i+1, k, j) = fieldb(i+1, k, j) + temp15b2 - &
8602 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp15b2 - &
8605 rub(i, k, j) = rub(i, k, j) + velb
8608 CALL POPCONTROL1B(branch)
8609 IF (branch .EQ. 0) THEN
8611 temp15b = 0.5*ru(i, k, j)*fqxb(i, k)
8612 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
8613 & 1, k, j))*fqxb(i, k)
8614 fieldb(i, k, j) = fieldb(i, k, j) + temp15b
8615 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp15b
8622 DO i=i_end_f,i_start_f,-1
8624 temp11 = field(i+2, k, j) - field(i-3, k, j) + 10.*(field(i, k&
8625 & , j)-field(i-1, k, j)) - 5.*(field(i+1, k, j)-field(i-2, k, &
8627 temp14 = SIGN(1., vel)
8628 temp13 = temp14/60.0
8629 temp12 = SIGN(1, time_step)
8630 temp11b = vel*fqxb(i, k)
8631 temp11b0 = temp11b/60.0
8632 temp11b1 = -(temp12*temp13*temp11b)
8633 velb = ((37.*(field(i, k, j)+field(i-1, k, j))-8.*(field(i+1, &
8634 & k, j)+field(i-2, k, j))+field(i+2, k, j)+field(i-3, k, j))/&
8635 & 60.0-temp12*(temp13*temp11))*fqxb(i, k)
8636 fieldb(i, k, j) = fieldb(i, k, j) + 10.*temp11b1 + 37.*&
8638 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 37.*temp11b0 - 10.*&
8640 fieldb(i+1, k, j) = fieldb(i+1, k, j) - 5.*temp11b1 - 8.*&
8642 fieldb(i-2, k, j) = fieldb(i-2, k, j) + 5.*temp11b1 - 8.*&
8644 fieldb(i+2, k, j) = fieldb(i+2, k, j) + temp11b1 + temp11b0
8645 fieldb(i-3, k, j) = fieldb(i-3, k, j) + temp11b0 - temp11b1
8647 rub(i, k, j) = rub(i, k, j) + velb
8652 CALL POPINTEGER4(ad_from7)
8653 CALL POPINTEGER4(ad_to7)
8654 DO j=ad_to7,ad_from7,-1
8655 CALL POPINTEGER4(jp0)
8656 CALL POPINTEGER4(jp1)
8657 CALL POPCONTROL2B(branch)
8658 IF (branch .LT. 2) THEN
8659 IF (branch .EQ. 0) THEN
8661 CALL POPINTEGER4(ad_from4)
8662 CALL POPINTEGER4(ad_to4)
8663 DO i=ad_to4,ad_from4,-1
8664 mrdy = msftx(i, j-1)*rdy
8665 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
8671 CALL POPINTEGER4(ad_from5)
8672 CALL POPINTEGER4(ad_to5)
8673 DO i=ad_to5,ad_from5,-1
8674 mrdy = msftx(i, j-1)*rdy
8675 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
8680 ELSE IF (branch .EQ. 2) THEN
8682 CALL POPINTEGER4(ad_from6)
8683 CALL POPINTEGER4(ad_to6)
8684 DO i=ad_to6,ad_from6,-1
8685 mrdy = msftx(i, j-1)*rdy
8686 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1&
8688 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1&
8693 CALL POPCONTROL3B(branch)
8694 IF (branch .LT. 3) THEN
8695 IF (branch .EQ. 0) THEN
8697 CALL POPINTEGER4(ad_from)
8698 CALL POPINTEGER4(ad_to)
8699 DO i=ad_to,ad_from,-1
8701 temp = field(i, k, j+2) - field(i, k, j-3) + 10.*(field(i&
8702 & , k, j)-field(i, k, j-1)) - 5.*(field(i, k, j+1)-field(i&
8704 temp2 = SIGN(1., vel)
8706 temp0 = SIGN(1, time_step)
8707 tempb = vel*fqyb(i, k, jp1)
8709 tempb1 = -(temp0*temp1*tempb)
8710 velb = ((37.*(field(i, k, j)+field(i, k, j-1))-8.*(field(i&
8711 & , k, j+1)+field(i, k, j-2))+field(i, k, j+2)+field(i, k&
8712 & , j-3))/60.0-temp0*(temp1*temp))*fqyb(i, k, jp1)
8713 fieldb(i, k, j) = fieldb(i, k, j) + 10.*tempb1 + 37.*&
8715 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 37.*tempb0 - 10.*&
8717 fieldb(i, k, j+1) = fieldb(i, k, j+1) - 5.*tempb1 - 8.*&
8719 fieldb(i, k, j-2) = fieldb(i, k, j-2) + 5.*tempb1 - 8.*&
8721 fieldb(i, k, j+2) = fieldb(i, k, j+2) + tempb1 + tempb0
8722 fieldb(i, k, j-3) = fieldb(i, k, j-3) + tempb0 - tempb1
8723 fqyb(i, k, jp1) = 0.0
8724 rvb(i, k, j) = rvb(i, k, j) + velb
8727 ELSE IF (branch .EQ. 1) THEN
8729 CALL POPINTEGER4(ad_from0)
8730 CALL POPINTEGER4(ad_to0)
8731 DO i=ad_to0,ad_from0,-1
8732 temp3b = 0.5*rv(i, k, j)*fqyb(i, k, jp1)
8733 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i&
8734 & , k, j-1))*fqyb(i, k, jp1)
8735 fieldb(i, k, j) = fieldb(i, k, j) + temp3b
8736 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp3b
8737 fqyb(i, k, jp1) = 0.0
8742 CALL POPINTEGER4(ad_from1)
8743 CALL POPINTEGER4(ad_to1)
8744 DO i=ad_to1,ad_from1,-1
8746 temp3 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field(i&
8747 & , k, j)-field(i, k, j-1))
8748 temp6 = SIGN(1., vel)
8750 temp4 = SIGN(1, time_step)
8751 temp3b0 = vel*fqyb(i, k, jp1)
8752 temp3b1 = temp3b0/12.0
8753 temp3b2 = temp4*temp5*temp3b0
8754 velb = ((7.*(field(i, k, j)+field(i, k, j-1))-field(i, k, &
8755 & j+1)-field(i, k, j-2))/12.0+temp4*(temp5*temp3))*fqyb(i&
8757 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp3b1 - 3.*&
8759 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*temp3b2 + 7.*&
8761 fieldb(i, k, j+1) = fieldb(i, k, j+1) + temp3b2 - temp3b1
8762 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp3b2 - temp3b1
8763 fqyb(i, k, jp1) = 0.0
8764 rvb(i, k, j) = rvb(i, k, j) + velb
8768 ELSE IF (branch .EQ. 3) THEN
8770 CALL POPINTEGER4(ad_from2)
8771 CALL POPINTEGER4(ad_to2)
8772 DO i=ad_to2,ad_from2,-1
8773 temp7b = 0.5*rv(i, k, j)*fqyb(i, k, jp1)
8774 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i, k&
8775 & , j-1))*fqyb(i, k, jp1)
8776 fieldb(i, k, j) = fieldb(i, k, j) + temp7b
8777 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp7b
8778 fqyb(i, k, jp1) = 0.0
8781 ELSE IF (branch .EQ. 4) THEN
8783 CALL POPINTEGER4(ad_from3)
8784 CALL POPINTEGER4(ad_to3)
8785 DO i=ad_to3,ad_from3,-1
8787 temp7 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field(i, k&
8788 & , j)-field(i, k, j-1))
8789 temp10 = SIGN(1., vel)
8791 temp8 = SIGN(1, time_step)
8792 temp7b0 = vel*fqyb(i, k, jp1)
8793 temp7b1 = temp7b0/12.0
8794 temp7b2 = temp8*temp9*temp7b0
8795 velb = ((7.*(field(i, k, j)+field(i, k, j-1))-field(i, k, j+&
8796 & 1)-field(i, k, j-2))/12.0+temp8*(temp9*temp7))*fqyb(i, k, &
8798 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp7b1 - 3.*temp7b2
8799 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*temp7b2 + 7.*&
8801 fieldb(i, k, j+1) = fieldb(i, k, j+1) + temp7b2 - temp7b1
8802 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp7b2 - temp7b1
8803 fqyb(i, k, jp1) = 0.0
8804 rvb(i, k, j) = rvb(i, k, j) + velb
8811 CALL POPINTEGER4(ad_from46)
8812 CALL POPINTEGER4(ad_to46)
8813 DO j=ad_to46,ad_from46,-1
8815 CALL POPINTEGER4(ad_from45)
8816 CALL POPINTEGER4(ad_to45)
8817 DO i=ad_to45,ad_from45,-1
8818 mrdx = msftx(i, j)*rdx
8819 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
8820 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
8823 CALL POPCONTROL1B(branch)
8824 IF (branch .NE. 0) THEN
8825 CALL POPINTEGER4(ad_to44)
8826 DO i=ad_to44,i_end_f+1,-1
8827 CALL POPCONTROL1B(branch)
8828 IF (branch .NE. 0) THEN
8831 temp31b18 = vel*fqxb(i, k)/12.0
8832 velb = (7.*(field(i, k, j)+field(i-1, k, j))-field(i+1, k&
8833 & , j)-field(i-2, k, j))*fqxb(i, k)/12.0
8834 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp31b18
8835 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 7.*temp31b18
8836 fieldb(i+1, k, j) = fieldb(i+1, k, j) - temp31b18
8837 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp31b18
8839 rub(i, k, j) = rub(i, k, j) + velb
8842 CALL POPCONTROL1B(branch)
8843 IF (branch .EQ. 0) THEN
8845 temp31b17 = 0.5*ru(i, k, j)*fqxb(i, k)
8846 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
8847 & 1, k, j))*fqxb(i, k)
8848 fieldb(i, k, j) = fieldb(i, k, j) + temp31b17
8849 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b17
8855 CALL POPCONTROL1B(branch)
8856 IF (branch .EQ. 0) THEN
8857 CALL POPINTEGER4(ad_from44)
8858 DO i=i_start_f-1,ad_from44,-1
8859 CALL POPCONTROL1B(branch)
8860 IF (branch .NE. 0) THEN
8863 temp31b16 = vel*fqxb(i, k)/12.0
8864 velb = (7.*(field(i, k, j)+field(i-1, k, j))-field(i+1, k&
8865 & , j)-field(i-2, k, j))*fqxb(i, k)/12.0
8866 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp31b16
8867 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 7.*temp31b16
8868 fieldb(i+1, k, j) = fieldb(i+1, k, j) - temp31b16
8869 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp31b16
8871 rub(i, k, j) = rub(i, k, j) + velb
8874 CALL POPCONTROL1B(branch)
8875 IF (branch .EQ. 0) THEN
8877 temp31b15 = 0.5*ru(i, k, j)*fqxb(i, k)
8878 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
8879 & 1, k, j))*fqxb(i, k)
8880 fieldb(i, k, j) = fieldb(i, k, j) + temp31b15
8881 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b15
8888 DO i=i_end_f,i_start_f,-1
8890 temp31b14 = vel*fqxb(i, k)/60.0
8891 velb = (37.*(field(i, k, j)+field(i-1, k, j))-8.*(field(i+1, k&
8892 & , j)+field(i-2, k, j))+field(i+2, k, j)+field(i-3, k, j))*&
8894 fieldb(i, k, j) = fieldb(i, k, j) + 37.*temp31b14
8895 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 37.*temp31b14
8896 fieldb(i+1, k, j) = fieldb(i+1, k, j) - 8.*temp31b14
8897 fieldb(i-2, k, j) = fieldb(i-2, k, j) - 8.*temp31b14
8898 fieldb(i+2, k, j) = fieldb(i+2, k, j) + temp31b14
8899 fieldb(i-3, k, j) = fieldb(i-3, k, j) + temp31b14
8901 rub(i, k, j) = rub(i, k, j) + velb
8906 CALL POPINTEGER4(ad_from43)
8907 CALL POPINTEGER4(ad_to43)
8908 DO j=ad_to43,ad_from43,-1
8909 CALL POPINTEGER4(jp0)
8910 CALL POPINTEGER4(jp1)
8911 CALL POPCONTROL2B(branch)
8912 IF (branch .LT. 2) THEN
8913 IF (branch .EQ. 0) THEN
8915 CALL POPINTEGER4(ad_from40)
8916 CALL POPINTEGER4(ad_to40)
8917 DO i=ad_to40,ad_from40,-1
8918 mrdy = msftx(i, j-1)*rdy
8919 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
8925 CALL POPINTEGER4(ad_from41)
8926 CALL POPINTEGER4(ad_to41)
8927 DO i=ad_to41,ad_from41,-1
8928 mrdy = msftx(i, j-1)*rdy
8929 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
8934 ELSE IF (branch .EQ. 2) THEN
8936 CALL POPINTEGER4(ad_from42)
8937 CALL POPINTEGER4(ad_to42)
8938 DO i=ad_to42,ad_from42,-1
8939 mrdy = msftx(i, j-1)*rdy
8940 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1&
8942 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1&
8947 CALL POPCONTROL3B(branch)
8948 IF (branch .LT. 3) THEN
8949 IF (branch .EQ. 0) THEN
8951 CALL POPINTEGER4(ad_from35)
8952 CALL POPINTEGER4(ad_to35)
8953 DO i=ad_to35,ad_from35,-1
8955 temp31b9 = vel*fqyb(i, k, jp1)/60.0
8956 velb = (37.*(field(i, k, j)+field(i, k, j-1))-8.*(field(i&
8957 & , k, j+1)+field(i, k, j-2))+field(i, k, j+2)+field(i, k&
8958 & , j-3))*fqyb(i, k, jp1)/60.0
8959 fieldb(i, k, j) = fieldb(i, k, j) + 37.*temp31b9
8960 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 37.*temp31b9
8961 fieldb(i, k, j+1) = fieldb(i, k, j+1) - 8.*temp31b9
8962 fieldb(i, k, j-2) = fieldb(i, k, j-2) - 8.*temp31b9
8963 fieldb(i, k, j+2) = fieldb(i, k, j+2) + temp31b9
8964 fieldb(i, k, j-3) = fieldb(i, k, j-3) + temp31b9
8965 fqyb(i, k, jp1) = 0.0
8966 rvb(i, k, j) = rvb(i, k, j) + velb
8969 ELSE IF (branch .EQ. 1) THEN
8971 CALL POPINTEGER4(ad_from36)
8972 CALL POPINTEGER4(ad_to36)
8973 DO i=ad_to36,ad_from36,-1
8974 temp31b10 = 0.5*rv(i, k, j)*fqyb(i, k, jp1)
8975 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i&
8976 & , k, j-1))*fqyb(i, k, jp1)
8977 fieldb(i, k, j) = fieldb(i, k, j) + temp31b10
8978 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp31b10
8979 fqyb(i, k, jp1) = 0.0
8984 CALL POPINTEGER4(ad_from37)
8985 CALL POPINTEGER4(ad_to37)
8986 DO i=ad_to37,ad_from37,-1
8988 temp31b11 = vel*fqyb(i, k, jp1)/12.0
8989 velb = (7.*(field(i, k, j)+field(i, k, j-1))-field(i, k, j&
8990 & +1)-field(i, k, j-2))*fqyb(i, k, jp1)/12.0
8991 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp31b11
8992 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 7.*temp31b11
8993 fieldb(i, k, j+1) = fieldb(i, k, j+1) - temp31b11
8994 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp31b11
8995 fqyb(i, k, jp1) = 0.0
8996 rvb(i, k, j) = rvb(i, k, j) + velb
9000 ELSE IF (branch .EQ. 3) THEN
9002 CALL POPINTEGER4(ad_from38)
9003 CALL POPINTEGER4(ad_to38)
9004 DO i=ad_to38,ad_from38,-1
9005 temp31b12 = 0.5*rv(i, k, j)*fqyb(i, k, jp1)
9006 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i, k&
9007 & , j-1))*fqyb(i, k, jp1)
9008 fieldb(i, k, j) = fieldb(i, k, j) + temp31b12
9009 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp31b12
9010 fqyb(i, k, jp1) = 0.0
9013 ELSE IF (branch .EQ. 4) THEN
9015 CALL POPINTEGER4(ad_from39)
9016 CALL POPINTEGER4(ad_to39)
9017 DO i=ad_to39,ad_from39,-1
9019 temp31b13 = vel*fqyb(i, k, jp1)/12.0
9020 velb = (7.*(field(i, k, j)+field(i, k, j-1))-field(i, k, j+1&
9021 & )-field(i, k, j-2))*fqyb(i, k, jp1)/12.0
9022 fieldb(i, k, j) = fieldb(i, k, j) + 7.*temp31b13
9023 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 7.*temp31b13
9024 fieldb(i, k, j+1) = fieldb(i, k, j+1) - temp31b13
9025 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp31b13
9026 fqyb(i, k, jp1) = 0.0
9027 rvb(i, k, j) = rvb(i, k, j) + velb
9034 END SUBROUTINE A_ADVECT_SCALAR
9036 ! Generated by TAPENADE (INRIA, Tropics team)
9037 ! Tapenade 3.5 (r3785) - 22 Mar 2011 18:35
9039 ! Differentiation of advect_w in reverse (adjoint) mode:
9040 ! gradient of useful results: rom tendency w ru rv w_old
9041 ! with respect to varying inputs: rom tendency w ru rv w_old
9042 ! RW status of diff variables: rom:incr tendency:in-out w:incr
9043 ! ru:incr rv:incr w_old:incr
9044 SUBROUTINE A_ADVECT_W(w, wb, w_old, w_oldb, tendency, tendencyb, ru, rub&
9045 & , rv, rvb, rom, romb, mut, time_step, config_flags, msfux, msfuy, &
9046 & msfvx, msfvy, msftx, msfty, fzm, fzp, rdx, rdy, rdzu, ids, ide, jds, &
9047 & jde, kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, jte, kts, &
9051 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
9052 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
9053 & jme, kms, kme, its, ite, jts, jte, kts, kte
9054 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: w, w_old, ru&
9056 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: wb, w_oldb, rub, rvb, &
9058 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut
9059 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
9060 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: tendencyb
9061 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
9062 & msfvy, msftx, msfty
9063 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzu
9064 REAL, INTENT(IN) :: rdx, rdy
9065 INTEGER, INTENT(IN) :: time_step
9067 INTEGER :: i, j, k, itf, jtf, ktf
9068 INTEGER :: i_start, i_end, j_start, j_end
9069 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
9070 INTEGER :: jmin, jmax, jp, jm, imin, imax
9071 REAL :: mrdx, mrdy, ub, vb, uw, vw
9072 REAL :: ubb, vbb, uwb, vwb
9073 REAL, DIMENSION(its:ite, kts:kte) :: vflux
9074 REAL, DIMENSION(its:ite, kts:kte) :: vfluxb
9075 INTEGER :: horz_order, vert_order
9076 REAL, DIMENSION(its:ite + 1, kts:kte) :: fqx
9077 REAL, DIMENSION(its:ite+1, kts:kte) :: fqxb
9078 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqy
9079 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqyb
9080 LOGICAL :: degrade_xs, degrade_ys
9081 LOGICAL :: degrade_xe, degrade_ye
9082 INTEGER :: jp1, jp0, jtmp
9083 ! definition of flux operators, 3rd, 4th, 5th or 6th order
9084 REAL :: flux3, flux4, flux5, flux6
9085 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel
9087 LOGICAL :: specified
9088 EXTERNAL WRF_ERROR_FATAL
9111 INTEGER :: ad_from10
9113 INTEGER :: ad_from11
9116 INTEGER :: ad_from12
9118 INTEGER :: ad_from13
9120 INTEGER :: ad_from14
9122 INTEGER :: ad_from15
9124 INTEGER :: ad_from16
9126 INTEGER :: ad_from17
9128 INTEGER :: ad_from18
9130 INTEGER :: ad_from19
9132 INTEGER :: ad_from20
9134 INTEGER :: ad_from21
9136 INTEGER :: ad_from22
9138 INTEGER :: ad_from23
9140 INTEGER :: ad_from24
9142 INTEGER :: ad_from25
9144 INTEGER :: ad_from26
9146 INTEGER :: ad_from27
9148 INTEGER :: ad_from28
9150 INTEGER :: ad_from29
9152 INTEGER :: ad_from30
9154 INTEGER :: ad_from31
9156 INTEGER :: ad_from32
9158 INTEGER :: ad_from33
9160 INTEGER :: ad_from34
9162 INTEGER :: ad_from35
9164 INTEGER :: ad_from36
9166 INTEGER :: ad_from37
9168 INTEGER :: ad_from38
9170 INTEGER :: ad_from39
9172 INTEGER :: ad_from40
9174 INTEGER :: ad_from41
9176 INTEGER :: ad_from42
9178 INTEGER :: ad_from43
9180 INTEGER :: ad_from44
9182 INTEGER :: ad_from45
9184 INTEGER :: ad_from46
9186 INTEGER :: ad_from47
9188 INTEGER :: ad_from48
9190 INTEGER :: ad_from49
9192 INTEGER :: ad_from50
9194 INTEGER :: ad_from51
9196 INTEGER :: ad_from52
9198 INTEGER :: ad_from53
9200 INTEGER :: ad_from54
9202 INTEGER :: ad_from55
9204 INTEGER :: ad_from56
9206 INTEGER :: ad_from57
9208 INTEGER :: ad_from58
9210 INTEGER :: ad_from59
9212 INTEGER :: ad_from60
9214 INTEGER :: ad_from61
9216 INTEGER :: ad_from62
9218 INTEGER :: ad_from63
9220 INTEGER :: ad_from64
9222 INTEGER :: ad_from65
9224 INTEGER :: ad_from66
9226 INTEGER :: ad_from67
9228 INTEGER :: ad_from68
9230 INTEGER :: ad_from69
9232 INTEGER :: ad_from70
9234 INTEGER :: ad_from71
9236 INTEGER :: ad_from72
9238 INTEGER :: ad_from73
9240 INTEGER :: ad_from74
9556 IF (config_flags%specified .OR. config_flags%nested) specified = &
9558 IF (kte .GT. kde - 1) THEN
9563 horz_order = config_flags%h_sca_adv_order
9564 vert_order = config_flags%v_sca_adv_order
9565 ! here is the choice of flux operators
9566 ! begin with horizontal flux divergence
9567 IF (horz_order .EQ. 6) THEN
9568 ! determine boundary mods for flux operators
9569 ! We degrade the flux operators from 3rd/4th order
9570 ! to second order one gridpoint in from the boundaries for
9571 ! all boundary conditions except periodic and symmetry - these
9572 ! conditions have boundary zone data fill for correct application
9573 ! of the higher order flux stencils
9578 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
9579 & its .GT. ids + 3) degrade_xs = .false.
9580 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
9581 & ite .LT. ide - 3) degrade_xe = .false.
9582 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
9583 & jts .GT. jds + 3) degrade_ys = .false.
9584 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
9585 & jte .LT. jde - 4) degrade_ye = .false.
9586 !--------------- y - advection first
9588 IF (ite .GT. ide - 1) THEN
9594 IF (jte .GT. jde - 1) THEN
9599 ! higher order flux has a 5 or 7 point stencil, so compute
9600 ! bounds so we can switch to second order flux close to the boundary
9603 IF (degrade_ys) THEN
9604 IF (jts .LT. jds + 1) THEN
9611 IF (degrade_ye) THEN
9612 IF (jte .GT. jde - 2) THEN
9619 IF (config_flags%polar) THEN
9620 IF (jte .GT. jde - 1) THEN
9626 ! compute fluxes, 5th or 6th order
9630 j_loop_y_flux_6:DO j=ad_from63,j_end+1
9631 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
9632 CALL PUSHINTEGER4(k)
9635 DO i=ad_from50,i_end
9638 CALL PUSHINTEGER4(i - 1)
9639 CALL PUSHINTEGER4(ad_from50)
9643 DO i=ad_from51,i_end
9645 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
9647 CALL PUSHINTEGER4(i - 1)
9648 CALL PUSHINTEGER4(ad_from51)
9649 CALL PUSHCONTROL3B(0)
9650 ELSE IF (j .EQ. jds + 1) THEN
9651 CALL PUSHINTEGER4(k)
9652 ! 2nd order flux next to south boundary
9656 CALL PUSHINTEGER4(i - 1)
9657 CALL PUSHINTEGER4(ad_from52)
9662 CALL PUSHINTEGER4(i - 1)
9663 CALL PUSHINTEGER4(ad_from53)
9664 CALL PUSHCONTROL3B(1)
9665 ELSE IF (j .EQ. jds + 2) THEN
9666 CALL PUSHINTEGER4(k)
9667 ! third of 4th order flux 2 in from south boundary
9670 DO i=ad_from54,i_end
9673 CALL PUSHINTEGER4(i - 1)
9674 CALL PUSHINTEGER4(ad_from54)
9678 DO i=ad_from55,i_end
9680 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
9682 CALL PUSHINTEGER4(i - 1)
9683 CALL PUSHINTEGER4(ad_from55)
9684 CALL PUSHCONTROL3B(2)
9685 ELSE IF (j .EQ. jde - 1) THEN
9686 CALL PUSHINTEGER4(k)
9687 ! 2nd order flux next to north boundary
9691 CALL PUSHINTEGER4(i - 1)
9692 CALL PUSHINTEGER4(ad_from56)
9697 CALL PUSHINTEGER4(i - 1)
9698 CALL PUSHINTEGER4(ad_from57)
9699 CALL PUSHCONTROL3B(3)
9700 ELSE IF (j .EQ. jde - 2) THEN
9701 CALL PUSHINTEGER4(k)
9702 ! 3rd or 4th order flux 2 in from north boundary
9705 DO i=ad_from58,i_end
9708 CALL PUSHINTEGER4(i - 1)
9709 CALL PUSHINTEGER4(ad_from58)
9713 DO i=ad_from59,i_end
9715 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
9717 CALL PUSHINTEGER4(i - 1)
9718 CALL PUSHINTEGER4(ad_from59)
9719 CALL PUSHCONTROL3B(4)
9721 CALL PUSHCONTROL3B(5)
9723 ! y flux-divergence into tendency
9724 ! Comments for polar boundary conditions
9725 ! Same process as for advect_u - tendencies run from jds to jde-1
9726 ! (latitudes are as for u grid, longitudes are displaced)
9727 ! Therefore: flow is only from one side for points next to poles
9728 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
9729 CALL PUSHINTEGER4(k)
9733 CALL PUSHINTEGER4(i - 1)
9734 CALL PUSHINTEGER4(ad_from60)
9736 CALL PUSHCONTROL2B(0)
9737 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
9738 CALL PUSHINTEGER4(k)
9742 CALL PUSHINTEGER4(i - 1)
9743 CALL PUSHINTEGER4(ad_from61)
9745 CALL PUSHCONTROL2B(1)
9746 ELSE IF (j .GT. j_start) THEN
9748 CALL PUSHINTEGER4(k)
9752 CALL PUSHINTEGER4(i - 1)
9753 CALL PUSHINTEGER4(ad_from62)
9755 CALL PUSHCONTROL2B(2)
9757 CALL PUSHCONTROL2B(3)
9760 CALL PUSHINTEGER4(jp1)
9762 CALL PUSHINTEGER4(jp0)
9764 END DO j_loop_y_flux_6
9765 CALL PUSHINTEGER4(j - 1)
9766 CALL PUSHINTEGER4(ad_from63)
9767 ! next, x - flux divergence
9769 IF (ite .GT. ide - 1) THEN
9775 IF (jte .GT. jde - 1) THEN
9780 ! higher order flux has a 5 or 7 point stencil, so compute
9781 ! bounds so we can switch to second order flux close to the boundary
9784 IF (degrade_xs) THEN
9785 IF (ids + 1 .LT. its) THEN
9790 IF (i_start + 2 .GT. ids + 3) THEN
9793 i_start_f = i_start + 2
9796 IF (degrade_xe) THEN
9797 IF (ide - 2 .GT. ite) THEN
9806 DO j=ad_from66,j_end
9807 CALL PUSHINTEGER4(k)
9808 ! 5th or 6th order flux
9810 DO i=i_start_f,i_end_f
9815 DO i=i_start_f,i_end_f
9817 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
9819 ! lower order fluxes close to boundaries (if not periodic or symmetric)
9820 IF (degrade_xs) THEN
9822 DO i=ad_from64,i_start_f-1
9823 IF (i .EQ. ids + 1) THEN
9824 CALL PUSHINTEGER4(k)
9825 CALL PUSHCONTROL1B(0)
9827 CALL PUSHCONTROL1B(1)
9829 IF (i .EQ. ids + 2) THEN
9830 CALL PUSHINTEGER4(k)
9837 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
9838 CALL PUSHCONTROL1B(1)
9840 CALL PUSHCONTROL1B(0)
9843 CALL PUSHINTEGER4(ad_from64)
9844 CALL PUSHCONTROL1B(0)
9846 CALL PUSHCONTROL1B(1)
9848 IF (degrade_xe) THEN
9849 DO i=i_end_f+1,i_end+1
9850 IF (i .EQ. ide - 1) THEN
9851 CALL PUSHINTEGER4(k)
9852 CALL PUSHCONTROL1B(0)
9854 CALL PUSHCONTROL1B(1)
9856 IF (i .EQ. ide - 2) THEN
9857 CALL PUSHINTEGER4(k)
9858 ! third order flux one in from the boundary
9864 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
9865 CALL PUSHCONTROL1B(1)
9867 CALL PUSHCONTROL1B(0)
9870 CALL PUSHINTEGER4(i - 1)
9871 CALL PUSHCONTROL1B(1)
9873 CALL PUSHCONTROL1B(0)
9875 CALL PUSHINTEGER4(k)
9876 ! x flux-divergence into tendency
9880 CALL PUSHINTEGER4(i - 1)
9881 CALL PUSHINTEGER4(ad_from65)
9884 CALL PUSHINTEGER4(j - 1)
9885 CALL PUSHINTEGER4(ad_from66)
9886 CALL PUSHCONTROL3B(7)
9887 ELSE IF (horz_order .EQ. 5) THEN
9888 ! determine boundary mods for flux operators
9889 ! We degrade the flux operators from 3rd/4th order
9890 ! to second order one gridpoint in from the boundaries for
9891 ! all boundary conditions except periodic and symmetry - these
9892 ! conditions have boundary zone data fill for correct application
9893 ! of the higher order flux stencils
9898 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
9899 & its .GT. ids + 3) degrade_xs = .false.
9900 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
9901 & ite .LT. ide - 3) degrade_xe = .false.
9902 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
9903 & jts .GT. jds + 3) degrade_ys = .false.
9904 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
9905 & jte .LT. jde - 4) degrade_ye = .false.
9906 !--------------- y - advection first
9908 IF (ite .GT. ide - 1) THEN
9914 IF (jte .GT. jde - 1) THEN
9919 ! higher order flux has a 5 or 7 point stencil, so compute
9920 ! bounds so we can switch to second order flux close to the boundary
9923 IF (degrade_ys) THEN
9924 IF (jts .LT. jds + 1) THEN
9931 IF (degrade_ye) THEN
9932 IF (jte .GT. jde - 2) THEN
9939 IF (config_flags%polar) THEN
9940 IF (jte .GT. jde - 1) THEN
9946 ! compute fluxes, 5th or 6th order
9950 j_loop_y_flux_5:DO j=ad_from12,j_end+1
9951 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
9952 CALL PUSHINTEGER4(k)
9958 CALL PUSHINTEGER4(i - 1)
9959 CALL PUSHINTEGER4(ad_from)
9965 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
9967 CALL PUSHINTEGER4(i - 1)
9968 CALL PUSHINTEGER4(ad_from0)
9969 CALL PUSHCONTROL3B(0)
9970 ELSE IF (j .EQ. jds + 1) THEN
9971 CALL PUSHINTEGER4(k)
9972 ! 2nd order flux next to south boundary
9976 CALL PUSHINTEGER4(i - 1)
9977 CALL PUSHINTEGER4(ad_from1)
9982 CALL PUSHINTEGER4(i - 1)
9983 CALL PUSHINTEGER4(ad_from2)
9984 CALL PUSHCONTROL3B(1)
9985 ELSE IF (j .EQ. jds + 2) THEN
9986 CALL PUSHINTEGER4(k)
9987 ! third of 4th order flux 2 in from south boundary
9993 CALL PUSHINTEGER4(i - 1)
9994 CALL PUSHINTEGER4(ad_from3)
10000 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
10002 CALL PUSHINTEGER4(i - 1)
10003 CALL PUSHINTEGER4(ad_from4)
10004 CALL PUSHCONTROL3B(2)
10005 ELSE IF (j .EQ. jde - 1) THEN
10006 CALL PUSHINTEGER4(k)
10007 ! 2nd order flux next to north boundary
10011 CALL PUSHINTEGER4(i - 1)
10012 CALL PUSHINTEGER4(ad_from5)
10017 CALL PUSHINTEGER4(i - 1)
10018 CALL PUSHINTEGER4(ad_from6)
10019 CALL PUSHCONTROL3B(3)
10020 ELSE IF (j .EQ. jde - 2) THEN
10021 CALL PUSHINTEGER4(k)
10022 ! 3rd or 4th order flux 2 in from north boundary
10025 DO i=ad_from7,i_end
10026 CALL PUSHREAL8(vel)
10028 CALL PUSHINTEGER4(i - 1)
10029 CALL PUSHINTEGER4(ad_from7)
10033 DO i=ad_from8,i_end
10034 CALL PUSHREAL8(vel)
10035 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
10037 CALL PUSHINTEGER4(i - 1)
10038 CALL PUSHINTEGER4(ad_from8)
10039 CALL PUSHCONTROL3B(4)
10041 CALL PUSHCONTROL3B(5)
10043 ! y flux-divergence into tendency
10044 ! Comments for polar boundary conditions
10045 ! Same process as for advect_u - tendencies run from jds to jde-1
10046 ! (latitudes are as for u grid, longitudes are displaced)
10047 ! Therefore: flow is only from one side for points next to poles
10048 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
10049 CALL PUSHINTEGER4(k)
10053 CALL PUSHINTEGER4(i - 1)
10054 CALL PUSHINTEGER4(ad_from9)
10056 CALL PUSHCONTROL2B(0)
10057 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
10058 CALL PUSHINTEGER4(k)
10060 ad_from10 = i_start
10062 CALL PUSHINTEGER4(i - 1)
10063 CALL PUSHINTEGER4(ad_from10)
10065 CALL PUSHCONTROL2B(1)
10066 ELSE IF (j .GT. j_start) THEN
10068 CALL PUSHINTEGER4(k)
10070 ad_from11 = i_start
10072 CALL PUSHINTEGER4(i - 1)
10073 CALL PUSHINTEGER4(ad_from11)
10075 CALL PUSHCONTROL2B(2)
10077 CALL PUSHCONTROL2B(3)
10080 CALL PUSHINTEGER4(jp1)
10082 CALL PUSHINTEGER4(jp0)
10084 END DO j_loop_y_flux_5
10085 CALL PUSHINTEGER4(j - 1)
10086 CALL PUSHINTEGER4(ad_from12)
10087 ! next, x - flux divergence
10089 IF (ite .GT. ide - 1) THEN
10095 IF (jte .GT. jde - 1) THEN
10100 ! higher order flux has a 5 or 7 point stencil, so compute
10101 ! bounds so we can switch to second order flux close to the boundary
10102 i_start_f = i_start
10103 i_end_f = i_end + 1
10104 IF (degrade_xs) THEN
10105 IF (ids + 1 .LT. its) THEN
10110 IF (i_start + 2 .GT. ids + 3) THEN
10111 i_start_f = ids + 3
10113 i_start_f = i_start + 2
10116 IF (degrade_xe) THEN
10117 IF (ide - 2 .GT. ite) THEN
10124 ad_from15 = j_start
10126 DO j=ad_from15,j_end
10127 CALL PUSHINTEGER4(k)
10128 ! 5th or 6th order flux
10130 DO i=i_start_f,i_end_f
10131 CALL PUSHREAL8(vel)
10135 DO i=i_start_f,i_end_f
10136 CALL PUSHREAL8(vel)
10137 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
10139 ! lower order fluxes close to boundaries (if not periodic or symmetric)
10140 IF (degrade_xs) THEN
10141 ad_from13 = i_start
10142 DO i=ad_from13,i_start_f-1
10143 IF (i .EQ. ids + 1) THEN
10144 CALL PUSHINTEGER4(k)
10145 CALL PUSHCONTROL1B(0)
10147 CALL PUSHCONTROL1B(1)
10149 IF (i .EQ. ids + 2) THEN
10150 CALL PUSHINTEGER4(k)
10153 CALL PUSHREAL8(vel)
10156 CALL PUSHREAL8(vel)
10157 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
10158 CALL PUSHCONTROL1B(1)
10160 CALL PUSHCONTROL1B(0)
10163 CALL PUSHINTEGER4(ad_from13)
10164 CALL PUSHCONTROL1B(0)
10166 CALL PUSHCONTROL1B(1)
10168 IF (degrade_xe) THEN
10169 DO i=i_end_f+1,i_end+1
10170 IF (i .EQ. ide - 1) THEN
10171 CALL PUSHINTEGER4(k)
10172 CALL PUSHCONTROL1B(0)
10174 CALL PUSHCONTROL1B(1)
10176 IF (i .EQ. ide - 2) THEN
10177 CALL PUSHINTEGER4(k)
10178 ! third order flux one in from the boundary
10180 CALL PUSHREAL8(vel)
10183 CALL PUSHREAL8(vel)
10184 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
10185 CALL PUSHCONTROL1B(1)
10187 CALL PUSHCONTROL1B(0)
10190 CALL PUSHINTEGER4(i - 1)
10191 CALL PUSHCONTROL1B(1)
10193 CALL PUSHCONTROL1B(0)
10195 CALL PUSHINTEGER4(k)
10196 ! x flux-divergence into tendency
10198 ad_from14 = i_start
10200 CALL PUSHINTEGER4(i - 1)
10201 CALL PUSHINTEGER4(ad_from14)
10204 CALL PUSHINTEGER4(j - 1)
10205 CALL PUSHINTEGER4(ad_from15)
10206 CALL PUSHCONTROL3B(6)
10207 ELSE IF (horz_order .EQ. 4) THEN
10208 degrade_xs = .true.
10209 degrade_xe = .true.
10210 degrade_ys = .true.
10211 degrade_ye = .true.
10212 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
10213 & its .GT. ids + 2) degrade_xs = .false.
10214 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
10215 & ite .LT. ide - 2) degrade_xe = .false.
10216 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
10217 & jts .GT. jds + 2) degrade_ys = .false.
10218 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
10219 & jte .LT. jde - 3) degrade_ye = .false.
10220 IF (kte .GT. kde - 1) THEN
10226 IF (ite .GT. ide - 1) THEN
10232 IF (jte .GT. jde - 1) THEN
10237 ! 3rd or 4th order flux has a 5 point stencil, so compute
10238 ! bounds so we can switch to second order flux close to the boundary
10239 i_start_f = i_start
10240 i_end_f = i_end + 1
10241 IF (degrade_xs) THEN
10243 i_start_f = i_start + 1
10245 IF (degrade_xe) THEN
10249 ad_from17 = j_start
10251 DO j=ad_from17,j_end
10253 DO i=i_start_f,i_end_f
10254 CALL PUSHREAL8(vel)
10258 DO i=i_start_f,i_end_f
10259 CALL PUSHREAL8(vel)
10260 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
10262 ! second order flux close to boundaries (if not periodic or symmetric)
10263 IF (degrade_xs) THEN
10264 CALL PUSHINTEGER4(k)
10265 CALL PUSHCONTROL1B(0)
10267 CALL PUSHCONTROL1B(1)
10269 IF (degrade_xe) THEN
10270 CALL PUSHINTEGER4(k)
10271 CALL PUSHCONTROL1B(1)
10273 CALL PUSHCONTROL1B(0)
10275 CALL PUSHINTEGER4(k)
10276 ! x flux-divergence into tendency
10278 ad_from16 = i_start
10280 CALL PUSHINTEGER4(i - 1)
10281 CALL PUSHINTEGER4(ad_from16)
10284 CALL PUSHINTEGER4(j - 1)
10285 CALL PUSHINTEGER4(ad_from17)
10286 CALL PUSHINTEGER4(i_start)
10287 ! next -> y flux divergence calculation
10289 IF (ite .GT. ide - 1) THEN
10290 CALL PUSHINTEGER4(i_end)
10292 CALL PUSHCONTROL1B(0)
10294 CALL PUSHINTEGER4(i_end)
10296 CALL PUSHCONTROL1B(1)
10299 IF (jte .GT. jde - 1) THEN
10304 ! 3rd or 4th order flux has a 5 point stencil, so compute
10305 ! bounds so we can switch to second order flux close to the boundary
10306 j_start_f = j_start
10307 j_end_f = j_end + 1
10308 IF (degrade_ys) THEN
10310 j_start_f = j_start + 1
10312 IF (degrade_ye) THEN
10316 IF (config_flags%polar) THEN
10317 IF (jte .GT. jde - 1) THEN
10325 ad_from27 = j_start
10326 DO j=ad_from27,j_end+1
10327 IF (j .LT. j_start_f .AND. degrade_ys) THEN
10328 CALL PUSHINTEGER4(k)
10330 ad_from18 = i_start
10332 CALL PUSHINTEGER4(i - 1)
10333 CALL PUSHINTEGER4(ad_from18)
10336 ad_from19 = i_start
10338 CALL PUSHINTEGER4(i - 1)
10339 CALL PUSHINTEGER4(ad_from19)
10340 CALL PUSHCONTROL2B(0)
10341 ELSE IF (j .GT. j_end_f .AND. degrade_ye) THEN
10342 CALL PUSHINTEGER4(k)
10344 ad_from20 = i_start
10346 CALL PUSHINTEGER4(i - 1)
10347 CALL PUSHINTEGER4(ad_from20)
10350 ad_from21 = i_start
10352 CALL PUSHINTEGER4(i - 1)
10353 CALL PUSHINTEGER4(ad_from21)
10354 CALL PUSHCONTROL2B(1)
10356 CALL PUSHINTEGER4(k)
10357 ! 3rd or 4th order flux
10359 ad_from22 = i_start
10360 DO i=ad_from22,i_end
10361 CALL PUSHREAL8(vel)
10363 CALL PUSHINTEGER4(i - 1)
10364 CALL PUSHINTEGER4(ad_from22)
10367 ad_from23 = i_start
10368 DO i=ad_from23,i_end
10369 CALL PUSHREAL8(vel)
10370 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
10372 CALL PUSHINTEGER4(i - 1)
10373 CALL PUSHINTEGER4(ad_from23)
10374 CALL PUSHCONTROL2B(2)
10376 ! y flux-divergence into tendency
10377 ! Comments for polar boundary conditions
10378 ! Same process as for advect_u - tendencies run from jds to jde-1
10379 ! (latitudes are as for u grid, longitudes are displaced)
10380 ! Therefore: flow is only from one side for points next to poles
10381 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
10382 CALL PUSHINTEGER4(k)
10384 ad_from24 = i_start
10386 CALL PUSHINTEGER4(i - 1)
10387 CALL PUSHINTEGER4(ad_from24)
10389 CALL PUSHCONTROL2B(0)
10390 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
10391 CALL PUSHINTEGER4(k)
10393 ad_from25 = i_start
10395 CALL PUSHINTEGER4(i - 1)
10396 CALL PUSHINTEGER4(ad_from25)
10398 CALL PUSHCONTROL2B(1)
10399 ELSE IF (j .GT. j_start) THEN
10401 CALL PUSHINTEGER4(k)
10403 ad_from26 = i_start
10405 CALL PUSHINTEGER4(i - 1)
10406 CALL PUSHINTEGER4(ad_from26)
10408 CALL PUSHCONTROL2B(2)
10410 CALL PUSHCONTROL2B(3)
10413 CALL PUSHINTEGER4(jp1)
10415 CALL PUSHINTEGER4(jp0)
10418 CALL PUSHINTEGER4(j - 1)
10419 CALL PUSHINTEGER4(ad_from27)
10420 CALL PUSHCONTROL3B(5)
10421 ELSE IF (horz_order .EQ. 3) THEN
10422 degrade_xs = .true.
10423 degrade_xe = .true.
10424 degrade_ys = .true.
10425 degrade_ye = .true.
10426 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
10427 & its .GT. ids + 2) degrade_xs = .false.
10428 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
10429 & ite .LT. ide - 2) degrade_xe = .false.
10430 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
10431 & jts .GT. jds + 2) degrade_ys = .false.
10432 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
10433 & jte .LT. jde - 3) degrade_ye = .false.
10434 IF (kte .GT. kde - 1) THEN
10440 IF (ite .GT. ide - 1) THEN
10446 IF (jte .GT. jde - 1) THEN
10451 ! 3rd or 4th order flux has a 5 point stencil, so compute
10452 ! bounds so we can switch to second order flux close to the boundary
10453 i_start_f = i_start
10454 i_end_f = i_end + 1
10455 IF (degrade_xs) THEN
10457 i_start_f = i_start + 1
10459 IF (degrade_xe) THEN
10463 ad_from29 = j_start
10465 DO j=ad_from29,j_end
10467 DO i=i_start_f,i_end_f
10468 CALL PUSHREAL8(vel)
10472 DO i=i_start_f,i_end_f
10473 CALL PUSHREAL8(vel)
10474 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
10476 ! second order flux close to boundaries (if not periodic or symmetric)
10477 IF (degrade_xs) THEN
10478 CALL PUSHINTEGER4(k)
10479 CALL PUSHCONTROL1B(0)
10481 CALL PUSHCONTROL1B(1)
10483 IF (degrade_xe) THEN
10484 CALL PUSHINTEGER4(k)
10485 CALL PUSHCONTROL1B(1)
10487 CALL PUSHCONTROL1B(0)
10489 CALL PUSHINTEGER4(k)
10490 ! x flux-divergence into tendency
10492 ad_from28 = i_start
10494 CALL PUSHINTEGER4(i - 1)
10495 CALL PUSHINTEGER4(ad_from28)
10498 CALL PUSHINTEGER4(j - 1)
10499 CALL PUSHINTEGER4(ad_from29)
10500 CALL PUSHINTEGER4(i_start)
10501 ! next -> y flux divergence calculation
10503 IF (ite .GT. ide - 1) THEN
10504 CALL PUSHINTEGER4(i_end)
10506 CALL PUSHCONTROL1B(0)
10508 CALL PUSHINTEGER4(i_end)
10510 CALL PUSHCONTROL1B(1)
10513 IF (jte .GT. jde - 1) THEN
10518 ! 3rd or 4th order flux has a 5 point stencil, so compute
10519 ! bounds so we can switch to second order flux close to the boundary
10520 j_start_f = j_start
10521 j_end_f = j_end + 1
10522 IF (degrade_ys) THEN
10524 j_start_f = j_start + 1
10526 IF (degrade_ye) THEN
10530 IF (config_flags%polar) THEN
10531 IF (jte .GT. jde - 1) THEN
10539 ad_from39 = j_start
10540 DO j=ad_from39,j_end+1
10541 IF (j .LT. j_start_f .AND. degrade_ys) THEN
10542 CALL PUSHINTEGER4(k)
10544 ad_from30 = i_start
10546 CALL PUSHINTEGER4(i - 1)
10547 CALL PUSHINTEGER4(ad_from30)
10550 ad_from31 = i_start
10552 CALL PUSHINTEGER4(i - 1)
10553 CALL PUSHINTEGER4(ad_from31)
10554 CALL PUSHCONTROL2B(0)
10555 ELSE IF (j .GT. j_end_f .AND. degrade_ye) THEN
10556 CALL PUSHINTEGER4(k)
10558 ad_from32 = i_start
10560 CALL PUSHINTEGER4(i - 1)
10561 CALL PUSHINTEGER4(ad_from32)
10564 ad_from33 = i_start
10566 CALL PUSHINTEGER4(i - 1)
10567 CALL PUSHINTEGER4(ad_from33)
10568 CALL PUSHCONTROL2B(1)
10570 CALL PUSHINTEGER4(k)
10571 ! 3rd or 4th order flux
10573 ad_from34 = i_start
10574 DO i=ad_from34,i_end
10575 CALL PUSHREAL8(vel)
10577 CALL PUSHINTEGER4(i - 1)
10578 CALL PUSHINTEGER4(ad_from34)
10581 ad_from35 = i_start
10582 DO i=ad_from35,i_end
10583 CALL PUSHREAL8(vel)
10584 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
10586 CALL PUSHINTEGER4(i - 1)
10587 CALL PUSHINTEGER4(ad_from35)
10588 CALL PUSHCONTROL2B(2)
10590 ! y flux-divergence into tendency
10591 ! Comments for polar boundary conditions
10592 ! Same process as for advect_u - tendencies run from jds to jde-1
10593 ! (latitudes are as for u grid, longitudes are displaced)
10594 ! Therefore: flow is only from one side for points next to poles
10595 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
10596 CALL PUSHINTEGER4(k)
10598 ad_from36 = i_start
10600 CALL PUSHINTEGER4(i - 1)
10601 CALL PUSHINTEGER4(ad_from36)
10603 CALL PUSHCONTROL2B(0)
10604 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
10605 CALL PUSHINTEGER4(k)
10607 ad_from37 = i_start
10609 CALL PUSHINTEGER4(i - 1)
10610 CALL PUSHINTEGER4(ad_from37)
10612 CALL PUSHCONTROL2B(1)
10613 ELSE IF (j .GT. j_start) THEN
10615 CALL PUSHINTEGER4(k)
10617 ad_from38 = i_start
10619 CALL PUSHINTEGER4(i - 1)
10620 CALL PUSHINTEGER4(ad_from38)
10622 CALL PUSHCONTROL2B(2)
10624 CALL PUSHCONTROL2B(3)
10627 CALL PUSHINTEGER4(jp1)
10629 CALL PUSHINTEGER4(jp0)
10632 CALL PUSHINTEGER4(j - 1)
10633 CALL PUSHINTEGER4(ad_from39)
10634 CALL PUSHCONTROL3B(4)
10635 ELSE IF (horz_order .EQ. 2) THEN
10637 IF (ite .GT. ide - 1) THEN
10643 IF (jte .GT. jde - 1) THEN
10648 IF (.NOT.config_flags%periodic_x) THEN
10649 IF (config_flags%open_xs .OR. specified) THEN
10650 IF (ids + 1 .LT. its) THEN
10656 IF (config_flags%open_xe .OR. specified) THEN
10657 IF (ide - 2 .GT. ite) THEN
10664 ad_from42 = j_start
10665 DO j=ad_from42,j_end
10666 CALL PUSHINTEGER4(k)
10668 ad_from40 = i_start
10670 CALL PUSHINTEGER4(i - 1)
10671 CALL PUSHINTEGER4(ad_from40)
10674 ad_from41 = i_start
10676 CALL PUSHINTEGER4(i - 1)
10677 CALL PUSHINTEGER4(ad_from41)
10679 CALL PUSHINTEGER4(j - 1)
10680 CALL PUSHINTEGER4(ad_from42)
10682 IF (ite .GT. ide - 1) THEN
10687 ! Polar boundary conditions are like open or specified
10688 IF ((config_flags%open_ys .OR. specified) .OR. config_flags%polar) &
10690 IF (jds + 1 .LT. jts) THEN
10696 IF ((config_flags%open_ye .OR. specified) .OR. config_flags%polar) &
10698 IF (jde - 2 .GT. jte) THEN
10704 ad_from45 = j_start
10705 DO j=ad_from45,j_end
10706 CALL PUSHINTEGER4(k)
10708 ad_from43 = i_start
10710 CALL PUSHINTEGER4(i - 1)
10711 CALL PUSHINTEGER4(ad_from43)
10714 ad_from44 = i_start
10716 CALL PUSHINTEGER4(i - 1)
10717 CALL PUSHINTEGER4(ad_from44)
10719 CALL PUSHINTEGER4(j - 1)
10720 CALL PUSHINTEGER4(ad_from45)
10721 ! Polar boundary condition ... not covered in above j-loop
10722 IF (config_flags%polar) THEN
10723 IF (jts .EQ. jds) THEN
10724 CALL PUSHINTEGER4(k)
10726 ad_from46 = i_start
10728 CALL PUSHINTEGER4(i - 1)
10729 CALL PUSHINTEGER4(ad_from46)
10732 ad_from47 = i_start
10734 CALL PUSHINTEGER4(i - 1)
10735 CALL PUSHINTEGER4(ad_from47)
10736 CALL PUSHCONTROL1B(0)
10738 CALL PUSHCONTROL1B(1)
10740 IF (jte .EQ. jde) THEN
10741 CALL PUSHINTEGER4(k)
10743 ad_from48 = i_start
10745 CALL PUSHINTEGER4(i - 1)
10746 CALL PUSHINTEGER4(ad_from48)
10749 ad_from49 = i_start
10751 CALL PUSHINTEGER4(i - 1)
10752 CALL PUSHINTEGER4(ad_from49)
10753 CALL PUSHCONTROL3B(3)
10755 CALL PUSHCONTROL3B(2)
10758 CALL PUSHCONTROL3B(1)
10761 CALL PUSHCONTROL3B(0)
10763 ! pick up the the horizontal radiation boundary conditions.
10764 ! (these are the computations that don't require 'cb'.
10765 ! first, set to index ranges
10767 IF (ite .GT. ide - 1) THEN
10772 CALL PUSHINTEGER4(j_start)
10774 IF (jte .GT. jde - 1) THEN
10779 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
10780 ad_from67 = j_start
10781 DO j=ad_from67,j_end
10782 CALL PUSHINTEGER4(k)
10784 uw = 0.5*(fzm(k)*(ru(its, k, j)+ru(its+1, k, j))+fzp(k)*(ru(its&
10785 & , k-1, j)+ru(its+1, k-1, j)))
10786 IF (uw .GT. 0.) THEN
10789 CALL PUSHCONTROL1B(0)
10793 CALL PUSHCONTROL1B(1)
10797 CALL PUSHINTEGER4(j - 1)
10798 CALL PUSHINTEGER4(ad_from67)
10799 CALL PUSHINTEGER4(k)
10801 ad_from68 = j_start
10802 DO j=ad_from68,j_end
10803 uw = 0.5*((2.-fzm(k-1))*(ru(its, k-1, j)+ru(its+1, k-1, j))-fzp(k-&
10804 & 1)*(ru(its, k-2, j)+ru(its+1, k-2, j)))
10805 IF (uw .GT. 0.) THEN
10808 CALL PUSHCONTROL1B(0)
10812 CALL PUSHCONTROL1B(1)
10815 CALL PUSHINTEGER4(j - 1)
10816 CALL PUSHINTEGER4(ad_from68)
10817 CALL PUSHCONTROL1B(0)
10819 CALL PUSHCONTROL1B(1)
10821 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
10822 ad_from69 = j_start
10823 DO j=ad_from69,j_end
10824 CALL PUSHINTEGER4(k)
10826 uw = 0.5*(fzm(k)*(ru(ite-1, k, j)+ru(ite, k, j))+fzp(k)*(ru(ite-&
10827 & 1, k-1, j)+ru(ite, k-1, j)))
10828 IF (uw .LT. 0.) THEN
10831 CALL PUSHCONTROL1B(0)
10835 CALL PUSHCONTROL1B(1)
10839 CALL PUSHINTEGER4(j - 1)
10840 CALL PUSHINTEGER4(ad_from69)
10841 CALL PUSHINTEGER4(k)
10843 ad_from70 = j_start
10844 DO j=ad_from70,j_end
10845 uw = 0.5*((2.-fzm(k-1))*(ru(ite-1, k-1, j)+ru(ite, k-1, j))-fzp(k-&
10846 & 1)*(ru(ite-1, k-2, j)+ru(ite, k-2, j)))
10847 IF (uw .LT. 0.) THEN
10850 CALL PUSHCONTROL1B(0)
10854 CALL PUSHCONTROL1B(1)
10857 CALL PUSHINTEGER4(j - 1)
10858 CALL PUSHINTEGER4(ad_from70)
10859 CALL PUSHCONTROL1B(0)
10861 CALL PUSHCONTROL1B(1)
10863 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
10864 ad_from71 = i_start
10865 DO i=ad_from71,i_end
10866 CALL PUSHINTEGER4(k)
10868 vw = 0.5*(fzm(k)*(rv(i, k, jts)+rv(i, k, jts+1))+fzp(k)*(rv(i, k&
10869 & -1, jts)+rv(i, k-1, jts+1)))
10870 IF (vw .GT. 0.) THEN
10873 CALL PUSHCONTROL1B(0)
10877 CALL PUSHCONTROL1B(1)
10881 CALL PUSHINTEGER4(i - 1)
10882 CALL PUSHINTEGER4(ad_from71)
10883 CALL PUSHINTEGER4(k)
10885 ad_from72 = i_start
10886 DO i=ad_from72,i_end
10887 vw = 0.5*((2.-fzm(k-1))*(rv(i, k-1, jts)+rv(i, k-1, jts+1))-fzp(k-&
10888 & 1)*(rv(i, k-2, jts)+rv(i, k-2, jts+1)))
10889 IF (vw .GT. 0.) THEN
10892 CALL PUSHCONTROL1B(0)
10896 CALL PUSHCONTROL1B(1)
10899 CALL PUSHINTEGER4(i - 1)
10900 CALL PUSHINTEGER4(ad_from72)
10901 CALL PUSHCONTROL1B(0)
10903 CALL PUSHCONTROL1B(1)
10905 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
10906 ad_from73 = i_start
10907 DO i=ad_from73,i_end
10908 CALL PUSHINTEGER4(k)
10910 vw = 0.5*(fzm(k)*(rv(i, k, jte-1)+rv(i, k, jte))+fzp(k)*(rv(i, k&
10911 & -1, jte-1)+rv(i, k-1, jte)))
10912 IF (vw .LT. 0.) THEN
10915 CALL PUSHCONTROL1B(0)
10919 CALL PUSHCONTROL1B(1)
10923 CALL PUSHINTEGER4(i - 1)
10924 CALL PUSHINTEGER4(ad_from73)
10925 CALL PUSHINTEGER4(k)
10927 ad_from74 = i_start
10928 DO i=ad_from74,i_end
10929 vw = 0.5*((2.-fzm(k-1))*(rv(i, k-1, jte-1)+rv(i, k-1, jte))-fzp(k-&
10930 & 1)*(rv(i, k-2, jte-1)+rv(i, k-2, jte)))
10931 IF (vw .LT. 0.) THEN
10934 CALL PUSHCONTROL1B(0)
10938 CALL PUSHCONTROL1B(1)
10941 CALL PUSHINTEGER4(i - 1)
10942 CALL PUSHINTEGER4(ad_from74)
10943 CALL PUSHCONTROL1B(1)
10945 CALL PUSHCONTROL1B(0)
10947 !-------------------- vertical advection
10948 ! ADT eqn 46 has 3rd term on RHS (dividing through by my) = - partial d/dz (w rho w /my)
10949 ! Here we have: - partial d/dz (w*rom) = - partial d/dz (w rho w / my)
10950 ! Therefore we don't need to make a correction for advect_w
10952 IF (ite .GT. ide - 1) THEN
10953 CALL PUSHINTEGER4(i_end)
10955 CALL PUSHCONTROL1B(0)
10957 CALL PUSHINTEGER4(i_end)
10959 CALL PUSHCONTROL1B(1)
10962 IF (jte .GT. jde - 1) THEN
10963 CALL PUSHINTEGER4(j_end)
10965 CALL PUSHCONTROL1B(0)
10967 CALL PUSHINTEGER4(j_end)
10969 CALL PUSHCONTROL1B(1)
10971 IF (vert_order .EQ. 6) THEN
10973 CALL PUSHINTEGER4(k)
10976 CALL PUSHREAL8(vel)
10980 CALL PUSHREAL8(vel)
10982 CALL PUSHINTEGER4(k)
10983 ! pick up flux contribution for w at the lid. wcs, 13 march 2004
10987 DO j=j_end,j_start,-1
10988 DO i=i_end,i_start,-1
10989 vfluxb(i, k) = vfluxb(i, k) + rdzu(k-1)*2.*tendencyb(i, k, j)
10992 DO i=i_end,i_start,-1
10993 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzu(k)*tendencyb(i, k, j)
10994 vfluxb(i, k) = vfluxb(i, k) + rdzu(k)*tendencyb(i, k, j)
10997 CALL POPINTEGER4(k)
10998 DO i=i_end,i_start,-1
11000 temp63b96 = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
11001 temp63b97 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
11002 romb(i, k, j) = romb(i, k, j) + temp63b96
11003 romb(i, k-1, j) = romb(i, k-1, j) + temp63b96
11004 wb(i, k, j) = wb(i, k, j) + temp63b97
11005 wb(i, k-1, j) = wb(i, k-1, j) + temp63b97
11008 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
11009 temp63b98 = vel*vfluxb(i, k)/12.0
11010 velb = (7.*(w(i, k, j)+w(i, k-1, j))-w(i, k+1, j)-w(i, k-2, j))*&
11011 & vfluxb(i, k)/12.0
11012 wb(i, k, j) = wb(i, k, j) + 7.*temp63b98
11013 wb(i, k-1, j) = wb(i, k-1, j) + 7.*temp63b98
11014 wb(i, k+1, j) = wb(i, k+1, j) - temp63b98
11015 wb(i, k-2, j) = wb(i, k-2, j) - temp63b98
11017 romb(i, k, j) = romb(i, k, j) + 0.5*velb
11018 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
11020 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
11021 temp63b99 = vel*vfluxb(i, k)/12.0
11022 velb = (7.*(w(i, k, j)+w(i, k-1, j))-w(i, k+1, j)-w(i, k-2, j))*&
11023 & vfluxb(i, k)/12.0
11024 wb(i, k, j) = wb(i, k, j) + 7.*temp63b99
11025 wb(i, k-1, j) = wb(i, k-1, j) + 7.*temp63b99
11026 wb(i, k+1, j) = wb(i, k+1, j) - temp63b99
11027 wb(i, k-2, j) = wb(i, k-2, j) - temp63b99
11030 romb(i, k, j) = romb(i, k, j) + 0.5*velb
11031 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
11033 temp63b100 = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
11034 temp63b101 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
11035 romb(i, k, j) = romb(i, k, j) + temp63b100
11036 romb(i, k-1, j) = romb(i, k-1, j) + temp63b100
11037 wb(i, k, j) = wb(i, k, j) + temp63b101
11038 wb(i, k-1, j) = wb(i, k-1, j) + temp63b101
11041 DO k=ktf-1,kts+3,-1
11042 DO i=i_end,i_start,-1
11043 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
11044 temp63b95 = vel*vfluxb(i, k)/60.0
11045 velb = (37.*(w(i, k, j)+w(i, k-1, j))-8.*(w(i, k+1, j)+w(i, k-&
11046 & 2, j))+w(i, k+2, j)+w(i, k-3, j))*vfluxb(i, k)/60.0
11047 wb(i, k, j) = wb(i, k, j) + 37.*temp63b95
11048 wb(i, k-1, j) = wb(i, k-1, j) + 37.*temp63b95
11049 wb(i, k+1, j) = wb(i, k+1, j) - 8.*temp63b95
11050 wb(i, k-2, j) = wb(i, k-2, j) - 8.*temp63b95
11051 wb(i, k+2, j) = wb(i, k+2, j) + temp63b95
11052 wb(i, k-3, j) = wb(i, k-3, j) + temp63b95
11055 romb(i, k, j) = romb(i, k, j) + 0.5*velb
11056 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
11059 CALL POPINTEGER4(k)
11061 ELSE IF (vert_order .EQ. 5) THEN
11063 CALL PUSHINTEGER4(k)
11066 CALL PUSHREAL8(vel)
11070 CALL PUSHREAL8(vel)
11072 CALL PUSHINTEGER4(k)
11073 ! pick up flux contribution for w at the lid, wcs. 13 march 2004
11077 DO j=j_end,j_start,-1
11078 DO i=i_end,i_start,-1
11079 vfluxb(i, k) = vfluxb(i, k) + rdzu(k-1)*2.*tendencyb(i, k, j)
11082 DO i=i_end,i_start,-1
11083 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzu(k)*tendencyb(i, k, j)
11084 vfluxb(i, k) = vfluxb(i, k) + rdzu(k)*tendencyb(i, k, j)
11087 CALL POPINTEGER4(k)
11088 DO i=i_end,i_start,-1
11090 temp75b = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
11091 temp75b0 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
11092 romb(i, k, j) = romb(i, k, j) + temp75b
11093 romb(i, k-1, j) = romb(i, k-1, j) + temp75b
11094 wb(i, k, j) = wb(i, k, j) + temp75b0
11095 wb(i, k-1, j) = wb(i, k-1, j) + temp75b0
11098 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
11099 temp71 = w(i, k+1, j) - w(i, k-2, j) - 3.*(w(i, k, j)-w(i, k-1, &
11101 temp74 = SIGN(1., -vel)
11102 temp73 = temp74/12.0
11103 temp72 = SIGN(1, time_step)
11104 temp71b = vel*vfluxb(i, k)
11105 temp71b0 = temp71b/12.0
11106 temp71b1 = temp72*temp73*temp71b
11107 velb = ((7.*(w(i, k, j)+w(i, k-1, j))-w(i, k+1, j)-w(i, k-2, j))&
11108 & /12.0+temp72*(temp73*temp71))*vfluxb(i, k)
11109 wb(i, k, j) = wb(i, k, j) + 7.*temp71b0 - 3.*temp71b1
11110 wb(i, k-1, j) = wb(i, k-1, j) + 3.*temp71b1 + 7.*temp71b0
11111 wb(i, k+1, j) = wb(i, k+1, j) + temp71b1 - temp71b0
11112 wb(i, k-2, j) = wb(i, k-2, j) - temp71b1 - temp71b0
11114 romb(i, k, j) = romb(i, k, j) + 0.5*velb
11115 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
11117 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
11118 temp67 = w(i, k+1, j) - w(i, k-2, j) - 3.*(w(i, k, j)-w(i, k-1, &
11120 temp70 = SIGN(1., -vel)
11121 temp69 = temp70/12.0
11122 temp68 = SIGN(1, time_step)
11123 temp67b = vel*vfluxb(i, k)
11124 temp67b0 = temp67b/12.0
11125 temp67b1 = temp68*temp69*temp67b
11126 velb = ((7.*(w(i, k, j)+w(i, k-1, j))-w(i, k+1, j)-w(i, k-2, j))&
11127 & /12.0+temp68*(temp69*temp67))*vfluxb(i, k)
11128 wb(i, k, j) = wb(i, k, j) + 7.*temp67b0 - 3.*temp67b1
11129 wb(i, k-1, j) = wb(i, k-1, j) + 3.*temp67b1 + 7.*temp67b0
11130 wb(i, k+1, j) = wb(i, k+1, j) + temp67b1 - temp67b0
11131 wb(i, k-2, j) = wb(i, k-2, j) - temp67b1 - temp67b0
11134 romb(i, k, j) = romb(i, k, j) + 0.5*velb
11135 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
11137 temp67b2 = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
11138 temp67b3 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
11139 romb(i, k, j) = romb(i, k, j) + temp67b2
11140 romb(i, k-1, j) = romb(i, k-1, j) + temp67b2
11141 wb(i, k, j) = wb(i, k, j) + temp67b3
11142 wb(i, k-1, j) = wb(i, k-1, j) + temp67b3
11145 DO k=ktf-1,kts+3,-1
11146 DO i=i_end,i_start,-1
11147 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
11148 temp63 = w(i, k+2, j) - w(i, k-3, j) + 10.*(w(i, k, j)-w(i, k-&
11149 & 1, j)) - 5.*(w(i, k+1, j)-w(i, k-2, j))
11150 temp66 = SIGN(1., -vel)
11151 temp65 = temp66/60.0
11152 temp64 = SIGN(1, time_step)
11153 temp63b102 = vel*vfluxb(i, k)
11154 temp63b103 = temp63b102/60.0
11155 temp63b104 = -(temp64*temp65*temp63b102)
11156 velb = ((37.*(w(i, k, j)+w(i, k-1, j))-8.*(w(i, k+1, j)+w(i, k&
11157 & -2, j))+w(i, k+2, j)+w(i, k-3, j))/60.0-temp64*(temp65*&
11158 & temp63))*vfluxb(i, k)
11159 wb(i, k, j) = wb(i, k, j) + 10.*temp63b104 + 37.*temp63b103
11160 wb(i, k-1, j) = wb(i, k-1, j) + 37.*temp63b103 - 10.*&
11162 wb(i, k+1, j) = wb(i, k+1, j) - 5.*temp63b104 - 8.*temp63b103
11163 wb(i, k-2, j) = wb(i, k-2, j) + 5.*temp63b104 - 8.*temp63b103
11164 wb(i, k+2, j) = wb(i, k+2, j) + temp63b104 + temp63b103
11165 wb(i, k-3, j) = wb(i, k-3, j) + temp63b103 - temp63b104
11168 romb(i, k, j) = romb(i, k, j) + 0.5*velb
11169 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
11172 CALL POPINTEGER4(k)
11174 ELSE IF (vert_order .EQ. 4) THEN
11176 CALL PUSHINTEGER4(k)
11179 CALL PUSHREAL8(vel)
11182 CALL PUSHINTEGER4(k)
11183 ! pick up flux contribution for w at the lid, wcs. 13 march 2004
11187 DO j=j_end,j_start,-1
11188 DO i=i_end,i_start,-1
11189 vfluxb(i, k) = vfluxb(i, k) + rdzu(k-1)*2.*tendencyb(i, k, j)
11192 DO i=i_end,i_start,-1
11193 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzu(k)*tendencyb(i, k, j)
11194 vfluxb(i, k) = vfluxb(i, k) + rdzu(k)*tendencyb(i, k, j)
11197 CALL POPINTEGER4(k)
11198 DO i=i_end,i_start,-1
11200 temp75b2 = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
11201 temp75b3 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
11202 romb(i, k, j) = romb(i, k, j) + temp75b2
11203 romb(i, k-1, j) = romb(i, k-1, j) + temp75b2
11204 wb(i, k, j) = wb(i, k, j) + temp75b3
11205 wb(i, k-1, j) = wb(i, k-1, j) + temp75b3
11208 temp75b4 = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
11209 temp75b5 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
11210 romb(i, k, j) = romb(i, k, j) + temp75b4
11211 romb(i, k-1, j) = romb(i, k-1, j) + temp75b4
11212 wb(i, k, j) = wb(i, k, j) + temp75b5
11213 wb(i, k-1, j) = wb(i, k-1, j) + temp75b5
11217 DO i=i_end,i_start,-1
11218 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
11219 temp75b1 = vel*vfluxb(i, k)/12.0
11220 velb = (7.*(w(i, k, j)+w(i, k-1, j))-w(i, k+1, j)-w(i, k-2, j)&
11221 & )*vfluxb(i, k)/12.0
11222 wb(i, k, j) = wb(i, k, j) + 7.*temp75b1
11223 wb(i, k-1, j) = wb(i, k-1, j) + 7.*temp75b1
11224 wb(i, k+1, j) = wb(i, k+1, j) - temp75b1
11225 wb(i, k-2, j) = wb(i, k-2, j) - temp75b1
11228 romb(i, k, j) = romb(i, k, j) + 0.5*velb
11229 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
11232 CALL POPINTEGER4(k)
11234 ELSE IF (vert_order .EQ. 3) THEN
11236 CALL PUSHINTEGER4(k)
11239 CALL PUSHREAL8(vel)
11242 CALL PUSHINTEGER4(k)
11243 ! pick up flux contribution for w at the lid, wcs. 13 march 2004
11247 DO j=j_end,j_start,-1
11248 DO i=i_end,i_start,-1
11249 vfluxb(i, k) = vfluxb(i, k) + rdzu(k-1)*2.*tendencyb(i, k, j)
11252 DO i=i_end,i_start,-1
11253 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzu(k)*tendencyb(i, k, j)
11254 vfluxb(i, k) = vfluxb(i, k) + rdzu(k)*tendencyb(i, k, j)
11257 CALL POPINTEGER4(k)
11258 DO i=i_end,i_start,-1
11260 temp79b = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
11261 temp79b0 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
11262 romb(i, k, j) = romb(i, k, j) + temp79b
11263 romb(i, k-1, j) = romb(i, k-1, j) + temp79b
11264 wb(i, k, j) = wb(i, k, j) + temp79b0
11265 wb(i, k-1, j) = wb(i, k-1, j) + temp79b0
11268 temp79b1 = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
11269 temp79b2 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
11270 romb(i, k, j) = romb(i, k, j) + temp79b1
11271 romb(i, k-1, j) = romb(i, k-1, j) + temp79b1
11272 wb(i, k, j) = wb(i, k, j) + temp79b2
11273 wb(i, k-1, j) = wb(i, k-1, j) + temp79b2
11277 DO i=i_end,i_start,-1
11278 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
11279 temp75 = w(i, k+1, j) - w(i, k-2, j) - 3.*(w(i, k, j)-w(i, k-1&
11281 temp78 = SIGN(1., -vel)
11282 temp77 = temp78/12.0
11283 temp76 = SIGN(1, time_step)
11284 temp75b6 = vel*vfluxb(i, k)
11285 temp75b7 = temp75b6/12.0
11286 temp75b8 = temp76*temp77*temp75b6
11287 velb = ((7.*(w(i, k, j)+w(i, k-1, j))-w(i, k+1, j)-w(i, k-2, j&
11288 & ))/12.0+temp76*(temp77*temp75))*vfluxb(i, k)
11289 wb(i, k, j) = wb(i, k, j) + 7.*temp75b7 - 3.*temp75b8
11290 wb(i, k-1, j) = wb(i, k-1, j) + 3.*temp75b8 + 7.*temp75b7
11291 wb(i, k+1, j) = wb(i, k+1, j) + temp75b8 - temp75b7
11292 wb(i, k-2, j) = wb(i, k-2, j) - temp75b8 - temp75b7
11295 romb(i, k, j) = romb(i, k, j) + 0.5*velb
11296 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
11299 CALL POPINTEGER4(k)
11301 ELSE IF (vert_order .EQ. 2) THEN
11303 CALL PUSHINTEGER4(k)
11304 ! pick up flux contribution for w at the lid, wcs. 13 march 2004
11308 DO j=j_end,j_start,-1
11309 DO i=i_end,i_start,-1
11310 vfluxb(i, k) = vfluxb(i, k) + rdzu(k-1)*2.*tendencyb(i, k, j)
11313 DO i=i_end,i_start,-1
11314 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzu(k)*tendencyb(i, k, j)
11315 vfluxb(i, k) = vfluxb(i, k) + rdzu(k)*tendencyb(i, k, j)
11318 DO k=ktf+1,kts+1,-1
11319 DO i=i_end,i_start,-1
11320 temp79b3 = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
11321 temp79b4 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
11322 romb(i, k, j) = romb(i, k, j) + temp79b3
11323 romb(i, k-1, j) = romb(i, k-1, j) + temp79b3
11324 wb(i, k, j) = wb(i, k, j) + temp79b4
11325 wb(i, k-1, j) = wb(i, k-1, j) + temp79b4
11329 CALL POPINTEGER4(k)
11332 CALL POPCONTROL1B(branch)
11333 IF (branch .EQ. 0) THEN
11334 CALL POPINTEGER4(j_end)
11336 CALL POPINTEGER4(j_end)
11338 CALL POPCONTROL1B(branch)
11339 IF (branch .EQ. 0) THEN
11340 CALL POPINTEGER4(i_end)
11342 CALL POPINTEGER4(i_end)
11344 CALL POPCONTROL1B(branch)
11345 IF (branch .NE. 0) THEN
11346 CALL POPINTEGER4(ad_from74)
11347 CALL POPINTEGER4(ad_to74)
11348 DO i=ad_to74,ad_from74,-1
11349 temp63b91 = -(rdy*tendencyb(i, k, j_end))
11350 temp63b92 = w(i, k, j_end)*temp63b91
11351 temp63b93 = (2.-fzm(k-1))*temp63b92
11352 temp63b94 = -(fzp(k-1)*temp63b92)
11353 vbb = (w_old(i, k, j_end)-w_old(i, k, j_end-1))*temp63b91
11354 w_oldb(i, k, j_end) = w_oldb(i, k, j_end) + vb*temp63b91
11355 w_oldb(i, k, j_end-1) = w_oldb(i, k, j_end-1) - vb*temp63b91
11356 wb(i, k, j_end) = wb(i, k, j_end) + ((2.-fzm(k-1))*(rv(i, k-1, jte&
11357 & )-rv(i, k-1, jte-1))-fzp(k-1)*(rv(i, k-2, jte)-rv(i, k-2, jte-1)&
11359 rvb(i, k-1, jte) = rvb(i, k-1, jte) + temp63b93
11360 rvb(i, k-1, jte-1) = rvb(i, k-1, jte-1) - temp63b93
11361 rvb(i, k-2, jte) = rvb(i, k-2, jte) + temp63b94
11362 rvb(i, k-2, jte-1) = rvb(i, k-2, jte-1) - temp63b94
11363 CALL POPCONTROL1B(branch)
11364 IF (branch .EQ. 0) THEN
11371 temp63b89 = 0.5*(2.-fzm(k-1))*vwb
11372 temp63b90 = -(0.5*fzp(k-1)*vwb)
11373 rvb(i, k-1, jte-1) = rvb(i, k-1, jte-1) + temp63b89
11374 rvb(i, k-1, jte) = rvb(i, k-1, jte) + temp63b89
11375 rvb(i, k-2, jte-1) = rvb(i, k-2, jte-1) + temp63b90
11376 rvb(i, k-2, jte) = rvb(i, k-2, jte) + temp63b90
11378 CALL POPINTEGER4(k)
11379 CALL POPINTEGER4(ad_from73)
11380 CALL POPINTEGER4(ad_to73)
11381 DO i=ad_to73,ad_from73,-1
11383 temp63b87 = -(rdy*tendencyb(i, k, j_end))
11384 temp63b88 = w(i, k, j_end)*temp63b87
11385 vbb = (w_old(i, k, j_end)-w_old(i, k, j_end-1))*temp63b87
11386 w_oldb(i, k, j_end) = w_oldb(i, k, j_end) + vb*temp63b87
11387 w_oldb(i, k, j_end-1) = w_oldb(i, k, j_end-1) - vb*temp63b87
11388 wb(i, k, j_end) = wb(i, k, j_end) + (fzm(k)*(rv(i, k, jte)-rv(i&
11389 & , k, jte-1))+fzp(k)*(rv(i, k-1, jte)-rv(i, k-1, jte-1)))*&
11391 rvb(i, k, jte) = rvb(i, k, jte) + fzm(k)*temp63b88
11392 rvb(i, k, jte-1) = rvb(i, k, jte-1) - fzm(k)*temp63b88
11393 rvb(i, k-1, jte) = rvb(i, k-1, jte) + fzp(k)*temp63b88
11394 rvb(i, k-1, jte-1) = rvb(i, k-1, jte-1) - fzp(k)*temp63b88
11395 CALL POPCONTROL1B(branch)
11396 IF (branch .EQ. 0) THEN
11403 temp63b86 = 0.5*vwb
11404 rvb(i, k, jte-1) = rvb(i, k, jte-1) + fzm(k)*temp63b86
11405 rvb(i, k, jte) = rvb(i, k, jte) + fzm(k)*temp63b86
11406 rvb(i, k-1, jte-1) = rvb(i, k-1, jte-1) + fzp(k)*temp63b86
11407 rvb(i, k-1, jte) = rvb(i, k-1, jte) + fzp(k)*temp63b86
11409 CALL POPINTEGER4(k)
11412 CALL POPCONTROL1B(branch)
11413 IF (branch .EQ. 0) THEN
11414 CALL POPINTEGER4(ad_from72)
11415 CALL POPINTEGER4(ad_to72)
11416 DO i=ad_to72,ad_from72,-1
11417 temp63b82 = -(rdy*tendencyb(i, k, jts))
11418 temp63b83 = w(i, k, jts)*temp63b82
11419 temp63b84 = (2.-fzm(k-1))*temp63b83
11420 temp63b85 = -(fzp(k-1)*temp63b83)
11421 vbb = (w_old(i, k, jts+1)-w_old(i, k, jts))*temp63b82
11422 w_oldb(i, k, jts+1) = w_oldb(i, k, jts+1) + vb*temp63b82
11423 w_oldb(i, k, jts) = w_oldb(i, k, jts) - vb*temp63b82
11424 wb(i, k, jts) = wb(i, k, jts) + ((2.-fzm(k-1))*(rv(i, k-1, jts+1)-&
11425 & rv(i, k-1, jts))-fzp(k-1)*(rv(i, k-2, jts+1)-rv(i, k-2, jts)))*&
11427 rvb(i, k-1, jts+1) = rvb(i, k-1, jts+1) + temp63b84
11428 rvb(i, k-1, jts) = rvb(i, k-1, jts) - temp63b84
11429 rvb(i, k-2, jts+1) = rvb(i, k-2, jts+1) + temp63b85
11430 rvb(i, k-2, jts) = rvb(i, k-2, jts) - temp63b85
11431 CALL POPCONTROL1B(branch)
11432 IF (branch .EQ. 0) THEN
11439 temp63b80 = 0.5*(2.-fzm(k-1))*vwb
11440 temp63b81 = -(0.5*fzp(k-1)*vwb)
11441 rvb(i, k-1, jts) = rvb(i, k-1, jts) + temp63b80
11442 rvb(i, k-1, jts+1) = rvb(i, k-1, jts+1) + temp63b80
11443 rvb(i, k-2, jts) = rvb(i, k-2, jts) + temp63b81
11444 rvb(i, k-2, jts+1) = rvb(i, k-2, jts+1) + temp63b81
11446 CALL POPINTEGER4(k)
11447 CALL POPINTEGER4(ad_from71)
11448 CALL POPINTEGER4(ad_to71)
11449 DO i=ad_to71,ad_from71,-1
11451 temp63b78 = -(rdy*tendencyb(i, k, jts))
11452 temp63b79 = w(i, k, jts)*temp63b78
11453 vbb = (w_old(i, k, jts+1)-w_old(i, k, jts))*temp63b78
11454 w_oldb(i, k, jts+1) = w_oldb(i, k, jts+1) + vb*temp63b78
11455 w_oldb(i, k, jts) = w_oldb(i, k, jts) - vb*temp63b78
11456 wb(i, k, jts) = wb(i, k, jts) + (fzm(k)*(rv(i, k, jts+1)-rv(i, k&
11457 & , jts))+fzp(k)*(rv(i, k-1, jts+1)-rv(i, k-1, jts)))*temp63b78
11458 rvb(i, k, jts+1) = rvb(i, k, jts+1) + fzm(k)*temp63b79
11459 rvb(i, k, jts) = rvb(i, k, jts) - fzm(k)*temp63b79
11460 rvb(i, k-1, jts+1) = rvb(i, k-1, jts+1) + fzp(k)*temp63b79
11461 rvb(i, k-1, jts) = rvb(i, k-1, jts) - fzp(k)*temp63b79
11462 CALL POPCONTROL1B(branch)
11463 IF (branch .EQ. 0) THEN
11470 temp63b77 = 0.5*vwb
11471 rvb(i, k, jts) = rvb(i, k, jts) + fzm(k)*temp63b77
11472 rvb(i, k, jts+1) = rvb(i, k, jts+1) + fzm(k)*temp63b77
11473 rvb(i, k-1, jts) = rvb(i, k-1, jts) + fzp(k)*temp63b77
11474 rvb(i, k-1, jts+1) = rvb(i, k-1, jts+1) + fzp(k)*temp63b77
11476 CALL POPINTEGER4(k)
11479 CALL POPCONTROL1B(branch)
11480 IF (branch .EQ. 0) THEN
11481 CALL POPINTEGER4(ad_from70)
11482 CALL POPINTEGER4(ad_to70)
11483 DO j=ad_to70,ad_from70,-1
11484 temp63b73 = -(rdx*tendencyb(i_end, k, j))
11485 temp63b74 = w(i_end, k, j)*temp63b73
11486 temp63b75 = (2.-fzm(k-1))*temp63b74
11487 temp63b76 = -(fzp(k-1)*temp63b74)
11488 ubb = (w_old(i_end, k, j)-w_old(i_end-1, k, j))*temp63b73
11489 w_oldb(i_end, k, j) = w_oldb(i_end, k, j) + ub*temp63b73
11490 w_oldb(i_end-1, k, j) = w_oldb(i_end-1, k, j) - ub*temp63b73
11491 wb(i_end, k, j) = wb(i_end, k, j) + ((2.-fzm(k-1))*(ru(ite, k-1, j&
11492 & )-ru(ite-1, k-1, j))-fzp(k-1)*(ru(ite, k-2, j)-ru(ite-1, k-2, j)&
11494 rub(ite, k-1, j) = rub(ite, k-1, j) + temp63b75
11495 rub(ite-1, k-1, j) = rub(ite-1, k-1, j) - temp63b75
11496 rub(ite, k-2, j) = rub(ite, k-2, j) + temp63b76
11497 rub(ite-1, k-2, j) = rub(ite-1, k-2, j) - temp63b76
11498 CALL POPCONTROL1B(branch)
11499 IF (branch .EQ. 0) THEN
11506 temp63b71 = 0.5*(2.-fzm(k-1))*uwb
11507 temp63b72 = -(0.5*fzp(k-1)*uwb)
11508 rub(ite-1, k-1, j) = rub(ite-1, k-1, j) + temp63b71
11509 rub(ite, k-1, j) = rub(ite, k-1, j) + temp63b71
11510 rub(ite-1, k-2, j) = rub(ite-1, k-2, j) + temp63b72
11511 rub(ite, k-2, j) = rub(ite, k-2, j) + temp63b72
11513 CALL POPINTEGER4(k)
11514 CALL POPINTEGER4(ad_from69)
11515 CALL POPINTEGER4(ad_to69)
11516 DO j=ad_to69,ad_from69,-1
11518 temp63b69 = -(rdx*tendencyb(i_end, k, j))
11519 temp63b70 = w(i_end, k, j)*temp63b69
11520 ubb = (w_old(i_end, k, j)-w_old(i_end-1, k, j))*temp63b69
11521 w_oldb(i_end, k, j) = w_oldb(i_end, k, j) + ub*temp63b69
11522 w_oldb(i_end-1, k, j) = w_oldb(i_end-1, k, j) - ub*temp63b69
11523 wb(i_end, k, j) = wb(i_end, k, j) + (fzm(k)*(ru(ite, k, j)-ru(&
11524 & ite-1, k, j))+fzp(k)*(ru(ite, k-1, j)-ru(ite-1, k-1, j)))*&
11526 rub(ite, k, j) = rub(ite, k, j) + fzm(k)*temp63b70
11527 rub(ite-1, k, j) = rub(ite-1, k, j) - fzm(k)*temp63b70
11528 rub(ite, k-1, j) = rub(ite, k-1, j) + fzp(k)*temp63b70
11529 rub(ite-1, k-1, j) = rub(ite-1, k-1, j) - fzp(k)*temp63b70
11530 CALL POPCONTROL1B(branch)
11531 IF (branch .EQ. 0) THEN
11538 temp63b68 = 0.5*uwb
11539 rub(ite-1, k, j) = rub(ite-1, k, j) + fzm(k)*temp63b68
11540 rub(ite, k, j) = rub(ite, k, j) + fzm(k)*temp63b68
11541 rub(ite-1, k-1, j) = rub(ite-1, k-1, j) + fzp(k)*temp63b68
11542 rub(ite, k-1, j) = rub(ite, k-1, j) + fzp(k)*temp63b68
11544 CALL POPINTEGER4(k)
11547 CALL POPCONTROL1B(branch)
11548 IF (branch .EQ. 0) THEN
11549 CALL POPINTEGER4(ad_from68)
11550 CALL POPINTEGER4(ad_to68)
11551 DO j=ad_to68,ad_from68,-1
11552 temp63b64 = -(rdx*tendencyb(its, k, j))
11553 temp63b65 = w(its, k, j)*temp63b64
11554 temp63b66 = (2.-fzm(k-1))*temp63b65
11555 temp63b67 = -(fzp(k-1)*temp63b65)
11556 ubb = (w_old(its+1, k, j)-w_old(its, k, j))*temp63b64
11557 w_oldb(its+1, k, j) = w_oldb(its+1, k, j) + ub*temp63b64
11558 w_oldb(its, k, j) = w_oldb(its, k, j) - ub*temp63b64
11559 wb(its, k, j) = wb(its, k, j) + ((2.-fzm(k-1))*(ru(its+1, k-1, j)-&
11560 & ru(its, k-1, j))-fzp(k-1)*(ru(its+1, k-2, j)-ru(its, k-2, j)))*&
11562 rub(its+1, k-1, j) = rub(its+1, k-1, j) + temp63b66
11563 rub(its, k-1, j) = rub(its, k-1, j) - temp63b66
11564 rub(its+1, k-2, j) = rub(its+1, k-2, j) + temp63b67
11565 rub(its, k-2, j) = rub(its, k-2, j) - temp63b67
11566 CALL POPCONTROL1B(branch)
11567 IF (branch .EQ. 0) THEN
11574 temp63b62 = 0.5*(2.-fzm(k-1))*uwb
11575 temp63b63 = -(0.5*fzp(k-1)*uwb)
11576 rub(its, k-1, j) = rub(its, k-1, j) + temp63b62
11577 rub(its+1, k-1, j) = rub(its+1, k-1, j) + temp63b62
11578 rub(its, k-2, j) = rub(its, k-2, j) + temp63b63
11579 rub(its+1, k-2, j) = rub(its+1, k-2, j) + temp63b63
11581 CALL POPINTEGER4(k)
11582 CALL POPINTEGER4(ad_from67)
11583 CALL POPINTEGER4(ad_to67)
11584 DO j=ad_to67,ad_from67,-1
11586 temp63b60 = -(rdx*tendencyb(its, k, j))
11587 temp63b61 = w(its, k, j)*temp63b60
11588 ubb = (w_old(its+1, k, j)-w_old(its, k, j))*temp63b60
11589 w_oldb(its+1, k, j) = w_oldb(its+1, k, j) + ub*temp63b60
11590 w_oldb(its, k, j) = w_oldb(its, k, j) - ub*temp63b60
11591 wb(its, k, j) = wb(its, k, j) + (fzm(k)*(ru(its+1, k, j)-ru(its&
11592 & , k, j))+fzp(k)*(ru(its+1, k-1, j)-ru(its, k-1, j)))*temp63b60
11593 rub(its+1, k, j) = rub(its+1, k, j) + fzm(k)*temp63b61
11594 rub(its, k, j) = rub(its, k, j) - fzm(k)*temp63b61
11595 rub(its+1, k-1, j) = rub(its+1, k-1, j) + fzp(k)*temp63b61
11596 rub(its, k-1, j) = rub(its, k-1, j) - fzp(k)*temp63b61
11597 CALL POPCONTROL1B(branch)
11598 IF (branch .EQ. 0) THEN
11605 temp63b59 = 0.5*uwb
11606 rub(its, k, j) = rub(its, k, j) + fzm(k)*temp63b59
11607 rub(its+1, k, j) = rub(its+1, k, j) + fzm(k)*temp63b59
11608 rub(its, k-1, j) = rub(its, k-1, j) + fzp(k)*temp63b59
11609 rub(its+1, k-1, j) = rub(its+1, k-1, j) + fzp(k)*temp63b59
11611 CALL POPINTEGER4(k)
11614 CALL POPINTEGER4(j_start)
11615 CALL POPCONTROL3B(branch)
11616 IF (branch .LT. 4) THEN
11617 IF (branch .LT. 2) THEN
11618 IF (branch .EQ. 0) GOTO 100
11620 IF (branch .NE. 2) THEN
11621 CALL POPINTEGER4(ad_from49)
11622 CALL POPINTEGER4(ad_to49)
11623 DO i=ad_to49,ad_from49,-1
11624 mrdy = msftx(i, jde-1)*rdy
11625 temp63b28 = mrdy*0.5*tendencyb(i, k, jde-1)
11626 temp63b29 = (w(i, k, jde-1)+w(i, k, jde-2))*temp63b28
11627 temp63b30 = ((2.-fzm(k-1))*rv(i, k-1, jde-1)-fzp(k-1)*rv(i, k-&
11628 & 2, jde-1))*temp63b28
11629 rvb(i, k-1, jde-1) = rvb(i, k-1, jde-1) + (2.-fzm(k-1))*&
11631 rvb(i, k-2, jde-1) = rvb(i, k-2, jde-1) - fzp(k-1)*temp63b29
11632 wb(i, k, jde-1) = wb(i, k, jde-1) + temp63b30
11633 wb(i, k, jde-2) = wb(i, k, jde-2) + temp63b30
11636 CALL POPINTEGER4(ad_from48)
11637 CALL POPINTEGER4(ad_to48)
11638 DO i=ad_to48,ad_from48,-1
11639 mrdy = msftx(i, jde-1)*rdy
11640 temp63b25 = mrdy*0.5*tendencyb(i, k, jde-1)
11641 temp63b26 = (w(i, k, jde-1)+w(i, k, jde-2))*temp63b25
11642 temp63b27 = (fzm(k)*rv(i, k, jde-1)+fzp(k)*rv(i, k-1, jde-1)&
11644 rvb(i, k, jde-1) = rvb(i, k, jde-1) + fzm(k)*temp63b26
11645 rvb(i, k-1, jde-1) = rvb(i, k-1, jde-1) + fzp(k)*temp63b26
11646 wb(i, k, jde-1) = wb(i, k, jde-1) + temp63b27
11647 wb(i, k, jde-2) = wb(i, k, jde-2) + temp63b27
11650 CALL POPINTEGER4(k)
11652 CALL POPCONTROL1B(branch)
11653 IF (branch .EQ. 0) THEN
11654 CALL POPINTEGER4(ad_from47)
11655 CALL POPINTEGER4(ad_to47)
11656 DO i=ad_to47,ad_from47,-1
11657 mrdy = msftx(i, jds)*rdy
11658 temp63b22 = -(mrdy*0.5*tendencyb(i, k, jds))
11659 temp63b23 = (w(i, k, jds+1)+w(i, k, jds))*temp63b22
11660 temp63b24 = ((2.-fzm(k-1))*rv(i, k-1, jds+1)-fzp(k-1)*rv(i, k-&
11661 & 2, jds+1))*temp63b22
11662 rvb(i, k-1, jds+1) = rvb(i, k-1, jds+1) + (2.-fzm(k-1))*&
11664 rvb(i, k-2, jds+1) = rvb(i, k-2, jds+1) - fzp(k-1)*temp63b23
11665 wb(i, k, jds+1) = wb(i, k, jds+1) + temp63b24
11666 wb(i, k, jds) = wb(i, k, jds) + temp63b24
11669 CALL POPINTEGER4(ad_from46)
11670 CALL POPINTEGER4(ad_to46)
11671 DO i=ad_to46,ad_from46,-1
11672 mrdy = msftx(i, jds)*rdy
11673 temp63b19 = -(mrdy*0.5*tendencyb(i, k, jds))
11674 temp63b20 = (w(i, k, jds+1)+w(i, k, jds))*temp63b19
11675 temp63b21 = (fzm(k)*rv(i, k, jds+1)+fzp(k)*rv(i, k-1, jds+1)&
11677 rvb(i, k, jds+1) = rvb(i, k, jds+1) + fzm(k)*temp63b20
11678 rvb(i, k-1, jds+1) = rvb(i, k-1, jds+1) + fzp(k)*temp63b20
11679 wb(i, k, jds+1) = wb(i, k, jds+1) + temp63b21
11680 wb(i, k, jds) = wb(i, k, jds) + temp63b21
11683 CALL POPINTEGER4(k)
11686 CALL POPINTEGER4(ad_from45)
11687 CALL POPINTEGER4(ad_to45)
11688 DO j=ad_to45,ad_from45,-1
11689 CALL POPINTEGER4(ad_from44)
11690 CALL POPINTEGER4(ad_to44)
11691 DO i=ad_to44,ad_from44,-1
11692 mrdy = msftx(i, j)*rdy
11693 temp63b14 = -(mrdy*0.5*tendencyb(i, k, j))
11694 temp63b15 = (w(i, k, j+1)+w(i, k, j))*temp63b14
11695 temp63b16 = ((2.-fzm(k-1))*rv(i, k-1, j+1)-fzp(k-1)*rv(i, k-2, j&
11697 temp63b17 = -((w(i, k, j)+w(i, k, j-1))*temp63b14)
11698 temp63b18 = -(((2.-fzm(k-1))*rv(i, k-1, j)-fzp(k-1)*rv(i, k-2, j&
11700 rvb(i, k-1, j+1) = rvb(i, k-1, j+1) + (2.-fzm(k-1))*temp63b15
11701 rvb(i, k-2, j+1) = rvb(i, k-2, j+1) - fzp(k-1)*temp63b15
11702 wb(i, k, j+1) = wb(i, k, j+1) + temp63b16
11703 wb(i, k, j) = wb(i, k, j) + temp63b18 + temp63b16
11704 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*temp63b17
11705 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*temp63b17
11706 wb(i, k, j-1) = wb(i, k, j-1) + temp63b18
11709 CALL POPINTEGER4(ad_from43)
11710 CALL POPINTEGER4(ad_to43)
11711 DO i=ad_to43,ad_from43,-1
11712 mrdy = msftx(i, j)*rdy
11713 temp63b9 = -(mrdy*0.5*tendencyb(i, k, j))
11714 temp63b10 = (w(i, k, j+1)+w(i, k, j))*temp63b9
11715 temp63b11 = (fzm(k)*rv(i, k, j+1)+fzp(k)*rv(i, k-1, j+1))*&
11717 temp63b12 = -((w(i, k, j)+w(i, k, j-1))*temp63b9)
11718 temp63b13 = -((fzm(k)*rv(i, k, j)+fzp(k)*rv(i, k-1, j))*&
11720 rvb(i, k, j+1) = rvb(i, k, j+1) + fzm(k)*temp63b10
11721 rvb(i, k-1, j+1) = rvb(i, k-1, j+1) + fzp(k)*temp63b10
11722 wb(i, k, j+1) = wb(i, k, j+1) + temp63b11
11723 wb(i, k, j) = wb(i, k, j) + temp63b13 + temp63b11
11724 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*temp63b12
11725 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*temp63b12
11726 wb(i, k, j-1) = wb(i, k, j-1) + temp63b13
11729 CALL POPINTEGER4(k)
11731 CALL POPINTEGER4(ad_from42)
11732 CALL POPINTEGER4(ad_to42)
11733 DO j=ad_to42,ad_from42,-1
11734 CALL POPINTEGER4(ad_from41)
11735 CALL POPINTEGER4(ad_to41)
11736 DO i=ad_to41,ad_from41,-1
11737 mrdx = msftx(i, j)*rdx
11738 temp63b4 = -(mrdx*0.5*tendencyb(i, k, j))
11739 temp63b5 = (w(i+1, k, j)+w(i, k, j))*temp63b4
11740 temp63b6 = ((2.-fzm(k-1))*ru(i+1, k-1, j)-fzp(k-1)*ru(i+1, k-2, &
11742 temp63b7 = -((w(i, k, j)+w(i-1, k, j))*temp63b4)
11743 temp63b8 = -(((2.-fzm(k-1))*ru(i, k-1, j)-fzp(k-1)*ru(i, k-2, j)&
11745 rub(i+1, k-1, j) = rub(i+1, k-1, j) + (2.-fzm(k-1))*temp63b5
11746 rub(i+1, k-2, j) = rub(i+1, k-2, j) - fzp(k-1)*temp63b5
11747 wb(i+1, k, j) = wb(i+1, k, j) + temp63b6
11748 wb(i, k, j) = wb(i, k, j) + temp63b8 + temp63b6
11749 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*temp63b7
11750 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*temp63b7
11751 wb(i-1, k, j) = wb(i-1, k, j) + temp63b8
11754 CALL POPINTEGER4(ad_from40)
11755 CALL POPINTEGER4(ad_to40)
11756 DO i=ad_to40,ad_from40,-1
11757 mrdx = msftx(i, j)*rdx
11758 temp63b = -(mrdx*0.5*tendencyb(i, k, j))
11759 temp63b0 = (w(i+1, k, j)+w(i, k, j))*temp63b
11760 temp63b1 = (fzm(k)*ru(i+1, k, j)+fzp(k)*ru(i+1, k-1, j))*&
11762 temp63b2 = -((w(i, k, j)+w(i-1, k, j))*temp63b)
11763 temp63b3 = -((fzm(k)*ru(i, k, j)+fzp(k)*ru(i, k-1, j))*temp63b&
11765 rub(i+1, k, j) = rub(i+1, k, j) + fzm(k)*temp63b0
11766 rub(i+1, k-1, j) = rub(i+1, k-1, j) + fzp(k)*temp63b0
11767 wb(i+1, k, j) = wb(i+1, k, j) + temp63b1
11768 wb(i, k, j) = wb(i, k, j) + temp63b3 + temp63b1
11769 rub(i, k, j) = rub(i, k, j) + fzm(k)*temp63b2
11770 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*temp63b2
11771 wb(i-1, k, j) = wb(i-1, k, j) + temp63b3
11774 CALL POPINTEGER4(k)
11776 ELSE IF (branch .LT. 6) THEN
11777 IF (branch .EQ. 4) THEN
11779 CALL POPINTEGER4(ad_from39)
11780 CALL POPINTEGER4(ad_to39)
11781 DO j=ad_to39,ad_from39,-1
11782 CALL POPINTEGER4(jp0)
11783 CALL POPINTEGER4(jp1)
11784 CALL POPCONTROL2B(branch)
11785 IF (branch .LT. 2) THEN
11786 IF (branch .EQ. 0) THEN
11788 CALL POPINTEGER4(ad_from36)
11789 CALL POPINTEGER4(ad_to36)
11790 DO i=ad_to36,ad_from36,-1
11791 mrdy = msftx(i, j-1)*rdy
11792 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k&
11796 CALL POPINTEGER4(k)
11799 CALL POPINTEGER4(ad_from37)
11800 CALL POPINTEGER4(ad_to37)
11801 DO i=ad_to37,ad_from37,-1
11802 mrdy = msftx(i, j-1)*rdy
11803 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k&
11807 CALL POPINTEGER4(k)
11809 ELSE IF (branch .EQ. 2) THEN
11810 DO k=ktf+1,kts+1,-1
11811 CALL POPINTEGER4(ad_from38)
11812 CALL POPINTEGER4(ad_to38)
11813 DO i=ad_to38,ad_from38,-1
11814 mrdy = msftx(i, j-1)*rdy
11815 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
11817 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
11821 CALL POPINTEGER4(k)
11823 CALL POPCONTROL2B(branch)
11824 IF (branch .EQ. 0) THEN
11825 CALL POPINTEGER4(ad_from31)
11826 CALL POPINTEGER4(ad_to31)
11827 DO i=ad_to31,ad_from31,-1
11828 temp55b9 = 0.5*(w(i, k, j_start)+w(i, k, j_start-1))*fqyb(i&
11830 temp55b10 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j_start)-fzp(k-1)*&
11831 & rv(i, k-2, j_start))*fqyb(i, k, jp1)
11832 rvb(i, k-1, j_start) = rvb(i, k-1, j_start) + (2.-fzm(k-1))*&
11834 rvb(i, k-2, j_start) = rvb(i, k-2, j_start) - fzp(k-1)*&
11836 wb(i, k, j_start) = wb(i, k, j_start) + temp55b10
11837 wb(i, k, j_start-1) = wb(i, k, j_start-1) + temp55b10
11838 fqyb(i, k, jp1) = 0.0
11841 CALL POPINTEGER4(ad_from30)
11842 CALL POPINTEGER4(ad_to30)
11843 DO i=ad_to30,ad_from30,-1
11844 temp55b7 = 0.5*(w(i, k, j_start)+w(i, k, j_start-1))*fqyb(&
11846 temp55b8 = 0.5*(fzm(k)*rv(i, k, j_start)+fzp(k)*rv(i, k-1&
11847 & , j_start))*fqyb(i, k, jp1)
11848 rvb(i, k, j_start) = rvb(i, k, j_start) + fzm(k)*temp55b7
11849 rvb(i, k-1, j_start) = rvb(i, k-1, j_start) + fzp(k)*&
11851 wb(i, k, j_start) = wb(i, k, j_start) + temp55b8
11852 wb(i, k, j_start-1) = wb(i, k, j_start-1) + temp55b8
11853 fqyb(i, k, jp1) = 0.0
11856 CALL POPINTEGER4(k)
11857 ELSE IF (branch .EQ. 1) THEN
11858 CALL POPINTEGER4(ad_from33)
11859 CALL POPINTEGER4(ad_to33)
11860 DO i=ad_to33,ad_from33,-1
11861 temp55b13 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
11862 temp55b14 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j)-fzp(k-1)*rv(i, &
11863 & k-2, j))*fqyb(i, k, jp1)
11864 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*temp55b13
11865 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*temp55b13
11866 wb(i, k, j) = wb(i, k, j) + temp55b14
11867 wb(i, k, j-1) = wb(i, k, j-1) + temp55b14
11868 fqyb(i, k, jp1) = 0.0
11871 CALL POPINTEGER4(ad_from32)
11872 CALL POPINTEGER4(ad_to32)
11873 DO i=ad_to32,ad_from32,-1
11874 temp55b11 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
11875 temp55b12 = 0.5*(fzm(k)*rv(i, k, j)+fzp(k)*rv(i, k-1, j))*&
11877 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*temp55b11
11878 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*temp55b11
11879 wb(i, k, j) = wb(i, k, j) + temp55b12
11880 wb(i, k, j-1) = wb(i, k, j-1) + temp55b12
11881 fqyb(i, k, jp1) = 0.0
11884 CALL POPINTEGER4(k)
11886 CALL POPINTEGER4(ad_from35)
11887 CALL POPINTEGER4(ad_to35)
11888 DO i=ad_to35,ad_from35,-1
11889 temp59 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i, k&
11891 temp62 = SIGN(1., vel)
11892 temp61 = temp62/12.0
11893 temp60 = SIGN(1, time_step)
11894 temp59b = vel*fqyb(i, k, jp1)
11895 temp59b0 = temp59b/12.0
11896 temp59b1 = temp60*temp61*temp59b
11897 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j&
11898 & -2))/12.0+temp60*(temp61*temp59))*fqyb(i, k, jp1)
11899 wb(i, k, j) = wb(i, k, j) + 7.*temp59b0 - 3.*temp59b1
11900 wb(i, k, j-1) = wb(i, k, j-1) + 3.*temp59b1 + 7.*temp59b0
11901 wb(i, k, j+1) = wb(i, k, j+1) + temp59b1 - temp59b0
11902 wb(i, k, j-2) = wb(i, k, j-2) - temp59b1 - temp59b0
11903 fqyb(i, k, jp1) = 0.0
11905 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
11906 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
11909 CALL POPINTEGER4(ad_from34)
11910 CALL POPINTEGER4(ad_to34)
11911 DO i=ad_to34,ad_from34,-1
11912 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
11913 temp55 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i&
11915 temp58 = SIGN(1., vel)
11916 temp57 = temp58/12.0
11917 temp56 = SIGN(1, time_step)
11918 temp55b15 = vel*fqyb(i, k, jp1)
11919 temp55b16 = temp55b15/12.0
11920 temp55b17 = temp56*temp57*temp55b15
11921 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k&
11922 & , j-2))/12.0+temp56*(temp57*temp55))*fqyb(i, k, jp1)
11923 wb(i, k, j) = wb(i, k, j) + 7.*temp55b16 - 3.*temp55b17
11924 wb(i, k, j-1) = wb(i, k, j-1) + 3.*temp55b17 + 7.*&
11926 wb(i, k, j+1) = wb(i, k, j+1) + temp55b17 - temp55b16
11927 wb(i, k, j-2) = wb(i, k, j-2) - temp55b17 - temp55b16
11928 fqyb(i, k, jp1) = 0.0
11930 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
11931 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
11934 CALL POPINTEGER4(k)
11937 CALL POPCONTROL1B(branch)
11938 IF (branch .EQ. 0) THEN
11939 CALL POPINTEGER4(i_end)
11941 CALL POPINTEGER4(i_end)
11943 CALL POPINTEGER4(i_start)
11945 CALL POPINTEGER4(ad_from29)
11946 CALL POPINTEGER4(ad_to29)
11947 DO j=ad_to29,ad_from29,-1
11948 DO k=ktf+1,kts+1,-1
11949 CALL POPINTEGER4(ad_from28)
11950 CALL POPINTEGER4(ad_to28)
11951 DO i=ad_to28,ad_from28,-1
11952 mrdx = msftx(i, j)*rdx
11953 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
11954 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
11957 CALL POPINTEGER4(k)
11958 CALL POPCONTROL1B(branch)
11959 IF (branch .NE. 0) THEN
11961 temp55b5 = 0.5*(w(i_end+1, k, j)+w(i_end, k, j))*fqxb(i_end+1&
11963 temp55b6 = 0.5*((2.-fzm(k-1))*ru(i_end+1, k-1, j)-fzp(k-1)*ru(&
11964 & i_end+1, k-2, j))*fqxb(i_end+1, k)
11965 rub(i_end+1, k-1, j) = rub(i_end+1, k-1, j) + (2.-fzm(k-1))*&
11967 rub(i_end+1, k-2, j) = rub(i_end+1, k-2, j) - fzp(k-1)*&
11969 wb(i_end+1, k, j) = wb(i_end+1, k, j) + temp55b6
11970 wb(i_end, k, j) = wb(i_end, k, j) + temp55b6
11971 fqxb(i_end+1, k) = 0.0
11973 temp55b3 = 0.5*(w(i_end+1, k, j)+w(i_end, k, j))*fqxb(i_end+&
11975 temp55b4 = 0.5*(fzm(k)*ru(i_end+1, k, j)+fzp(k)*ru(i_end+1, &
11976 & k-1, j))*fqxb(i_end+1, k)
11977 rub(i_end+1, k, j) = rub(i_end+1, k, j) + fzm(k)*temp55b3
11978 rub(i_end+1, k-1, j) = rub(i_end+1, k-1, j) + fzp(k)*&
11980 wb(i_end+1, k, j) = wb(i_end+1, k, j) + temp55b4
11981 wb(i_end, k, j) = wb(i_end, k, j) + temp55b4
11982 fqxb(i_end+1, k) = 0.0
11984 CALL POPINTEGER4(k)
11986 CALL POPCONTROL1B(branch)
11987 IF (branch .EQ. 0) THEN
11989 temp55b1 = 0.5*(w(i_start, k, j)+w(i_start-1, k, j))*fqxb(&
11991 temp55b2 = 0.5*((2.-fzm(k-1))*ru(i_start, k-1, j)-fzp(k-1)*ru(&
11992 & i_start, k-2, j))*fqxb(i_start, k)
11993 rub(i_start, k-1, j) = rub(i_start, k-1, j) + (2.-fzm(k-1))*&
11995 rub(i_start, k-2, j) = rub(i_start, k-2, j) - fzp(k-1)*&
11997 wb(i_start, k, j) = wb(i_start, k, j) + temp55b2
11998 wb(i_start-1, k, j) = wb(i_start-1, k, j) + temp55b2
11999 fqxb(i_start, k) = 0.0
12001 temp55b = 0.5*(w(i_start, k, j)+w(i_start-1, k, j))*fqxb(&
12003 temp55b0 = 0.5*(fzm(k)*ru(i_start, k, j)+fzp(k)*ru(i_start, &
12004 & k-1, j))*fqxb(i_start, k)
12005 rub(i_start, k, j) = rub(i_start, k, j) + fzm(k)*temp55b
12006 rub(i_start, k-1, j) = rub(i_start, k-1, j) + fzp(k)*temp55b
12007 wb(i_start, k, j) = wb(i_start, k, j) + temp55b0
12008 wb(i_start-1, k, j) = wb(i_start-1, k, j) + temp55b0
12009 fqxb(i_start, k) = 0.0
12011 CALL POPINTEGER4(k)
12014 DO i=i_end_f,i_start_f,-1
12015 temp51 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-1, k&
12017 temp54 = SIGN(1., vel)
12018 temp53 = temp54/12.0
12019 temp52 = SIGN(1, time_step)
12020 temp51b = vel*fqxb(i, k)
12021 temp51b0 = temp51b/12.0
12022 temp51b1 = temp52*temp53*temp51b
12023 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k, j&
12024 & ))/12.0+temp52*(temp53*temp51))*fqxb(i, k)
12025 wb(i, k, j) = wb(i, k, j) + 7.*temp51b0 - 3.*temp51b1
12026 wb(i-1, k, j) = wb(i-1, k, j) + 3.*temp51b1 + 7.*temp51b0
12027 wb(i+1, k, j) = wb(i+1, k, j) + temp51b1 - temp51b0
12028 wb(i-2, k, j) = wb(i-2, k, j) - temp51b1 - temp51b0
12031 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
12032 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
12035 DO i=i_end_f,i_start_f,-1
12036 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
12037 temp47 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-1&
12039 temp50 = SIGN(1., vel)
12040 temp49 = temp50/12.0
12041 temp48 = SIGN(1, time_step)
12042 temp47b19 = vel*fqxb(i, k)
12043 temp47b20 = temp47b19/12.0
12044 temp47b21 = temp48*temp49*temp47b19
12045 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k&
12046 & , j))/12.0+temp48*(temp49*temp47))*fqxb(i, k)
12047 wb(i, k, j) = wb(i, k, j) + 7.*temp47b20 - 3.*temp47b21
12048 wb(i-1, k, j) = wb(i-1, k, j) + 3.*temp47b21 + 7.*temp47b20
12049 wb(i+1, k, j) = wb(i+1, k, j) + temp47b21 - temp47b20
12050 wb(i-2, k, j) = wb(i-2, k, j) - temp47b21 - temp47b20
12053 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
12054 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
12060 CALL POPINTEGER4(ad_from27)
12061 CALL POPINTEGER4(ad_to27)
12062 DO j=ad_to27,ad_from27,-1
12063 CALL POPINTEGER4(jp0)
12064 CALL POPINTEGER4(jp1)
12065 CALL POPCONTROL2B(branch)
12066 IF (branch .LT. 2) THEN
12067 IF (branch .EQ. 0) THEN
12069 CALL POPINTEGER4(ad_from24)
12070 CALL POPINTEGER4(ad_to24)
12071 DO i=ad_to24,ad_from24,-1
12072 mrdy = msftx(i, j-1)*rdy
12073 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k&
12077 CALL POPINTEGER4(k)
12080 CALL POPINTEGER4(ad_from25)
12081 CALL POPINTEGER4(ad_to25)
12082 DO i=ad_to25,ad_from25,-1
12083 mrdy = msftx(i, j-1)*rdy
12084 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k&
12088 CALL POPINTEGER4(k)
12090 ELSE IF (branch .EQ. 2) THEN
12091 DO k=ktf+1,kts+1,-1
12092 CALL POPINTEGER4(ad_from26)
12093 CALL POPINTEGER4(ad_to26)
12094 DO i=ad_to26,ad_from26,-1
12095 mrdy = msftx(i, j-1)*rdy
12096 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
12098 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
12102 CALL POPINTEGER4(k)
12104 CALL POPCONTROL2B(branch)
12105 IF (branch .EQ. 0) THEN
12106 CALL POPINTEGER4(ad_from19)
12107 CALL POPINTEGER4(ad_to19)
12108 DO i=ad_to19,ad_from19,-1
12109 temp47b11 = 0.5*(w(i, k, j_start)+w(i, k, j_start-1))*fqyb(i&
12111 temp47b12 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j_start)-fzp(k-1)*&
12112 & rv(i, k-2, j_start))*fqyb(i, k, jp1)
12113 rvb(i, k-1, j_start) = rvb(i, k-1, j_start) + (2.-fzm(k-1))*&
12115 rvb(i, k-2, j_start) = rvb(i, k-2, j_start) - fzp(k-1)*&
12117 wb(i, k, j_start) = wb(i, k, j_start) + temp47b12
12118 wb(i, k, j_start-1) = wb(i, k, j_start-1) + temp47b12
12119 fqyb(i, k, jp1) = 0.0
12122 CALL POPINTEGER4(ad_from18)
12123 CALL POPINTEGER4(ad_to18)
12124 DO i=ad_to18,ad_from18,-1
12125 temp47b9 = 0.5*(w(i, k, j_start)+w(i, k, j_start-1))*fqyb(&
12127 temp47b10 = 0.5*(fzm(k)*rv(i, k, j_start)+fzp(k)*rv(i, k-1&
12128 & , j_start))*fqyb(i, k, jp1)
12129 rvb(i, k, j_start) = rvb(i, k, j_start) + fzm(k)*temp47b9
12130 rvb(i, k-1, j_start) = rvb(i, k-1, j_start) + fzp(k)*&
12132 wb(i, k, j_start) = wb(i, k, j_start) + temp47b10
12133 wb(i, k, j_start-1) = wb(i, k, j_start-1) + temp47b10
12134 fqyb(i, k, jp1) = 0.0
12137 CALL POPINTEGER4(k)
12138 ELSE IF (branch .EQ. 1) THEN
12139 CALL POPINTEGER4(ad_from21)
12140 CALL POPINTEGER4(ad_to21)
12141 DO i=ad_to21,ad_from21,-1
12142 temp47b15 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
12143 temp47b16 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j)-fzp(k-1)*rv(i, &
12144 & k-2, j))*fqyb(i, k, jp1)
12145 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*temp47b15
12146 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*temp47b15
12147 wb(i, k, j) = wb(i, k, j) + temp47b16
12148 wb(i, k, j-1) = wb(i, k, j-1) + temp47b16
12149 fqyb(i, k, jp1) = 0.0
12152 CALL POPINTEGER4(ad_from20)
12153 CALL POPINTEGER4(ad_to20)
12154 DO i=ad_to20,ad_from20,-1
12155 temp47b13 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
12156 temp47b14 = 0.5*(fzm(k)*rv(i, k, j)+fzp(k)*rv(i, k-1, j))*&
12158 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*temp47b13
12159 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*temp47b13
12160 wb(i, k, j) = wb(i, k, j) + temp47b14
12161 wb(i, k, j-1) = wb(i, k, j-1) + temp47b14
12162 fqyb(i, k, jp1) = 0.0
12165 CALL POPINTEGER4(k)
12167 CALL POPINTEGER4(ad_from23)
12168 CALL POPINTEGER4(ad_to23)
12169 DO i=ad_to23,ad_from23,-1
12170 temp47b18 = vel*fqyb(i, k, jp1)/12.0
12171 velb = (7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j-&
12172 & 2))*fqyb(i, k, jp1)/12.0
12173 wb(i, k, j) = wb(i, k, j) + 7.*temp47b18
12174 wb(i, k, j-1) = wb(i, k, j-1) + 7.*temp47b18
12175 wb(i, k, j+1) = wb(i, k, j+1) - temp47b18
12176 wb(i, k, j-2) = wb(i, k, j-2) - temp47b18
12177 fqyb(i, k, jp1) = 0.0
12179 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
12180 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
12183 CALL POPINTEGER4(ad_from22)
12184 CALL POPINTEGER4(ad_to22)
12185 DO i=ad_to22,ad_from22,-1
12186 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
12187 temp47b17 = vel*fqyb(i, k, jp1)/12.0
12188 velb = (7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, &
12189 & j-2))*fqyb(i, k, jp1)/12.0
12190 wb(i, k, j) = wb(i, k, j) + 7.*temp47b17
12191 wb(i, k, j-1) = wb(i, k, j-1) + 7.*temp47b17
12192 wb(i, k, j+1) = wb(i, k, j+1) - temp47b17
12193 wb(i, k, j-2) = wb(i, k, j-2) - temp47b17
12194 fqyb(i, k, jp1) = 0.0
12196 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
12197 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
12200 CALL POPINTEGER4(k)
12203 CALL POPCONTROL1B(branch)
12204 IF (branch .EQ. 0) THEN
12205 CALL POPINTEGER4(i_end)
12207 CALL POPINTEGER4(i_end)
12209 CALL POPINTEGER4(i_start)
12211 CALL POPINTEGER4(ad_from17)
12212 CALL POPINTEGER4(ad_to17)
12213 DO j=ad_to17,ad_from17,-1
12214 DO k=ktf+1,kts+1,-1
12215 CALL POPINTEGER4(ad_from16)
12216 CALL POPINTEGER4(ad_to16)
12217 DO i=ad_to16,ad_from16,-1
12218 mrdx = msftx(i, j)*rdx
12219 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
12220 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
12223 CALL POPINTEGER4(k)
12224 CALL POPCONTROL1B(branch)
12225 IF (branch .NE. 0) THEN
12227 temp47b7 = 0.5*(w(i_end+1, k, j)+w(i_end, k, j))*fqxb(i_end+1&
12229 temp47b8 = 0.5*((2.-fzm(k-1))*ru(i_end+1, k-1, j)-fzp(k-1)*ru(&
12230 & i_end+1, k-2, j))*fqxb(i_end+1, k)
12231 rub(i_end+1, k-1, j) = rub(i_end+1, k-1, j) + (2.-fzm(k-1))*&
12233 rub(i_end+1, k-2, j) = rub(i_end+1, k-2, j) - fzp(k-1)*&
12235 wb(i_end+1, k, j) = wb(i_end+1, k, j) + temp47b8
12236 wb(i_end, k, j) = wb(i_end, k, j) + temp47b8
12237 fqxb(i_end+1, k) = 0.0
12239 temp47b5 = 0.5*(w(i_end+1, k, j)+w(i_end, k, j))*fqxb(i_end+&
12241 temp47b6 = 0.5*(fzm(k)*ru(i_end+1, k, j)+fzp(k)*ru(i_end+1, &
12242 & k-1, j))*fqxb(i_end+1, k)
12243 rub(i_end+1, k, j) = rub(i_end+1, k, j) + fzm(k)*temp47b5
12244 rub(i_end+1, k-1, j) = rub(i_end+1, k-1, j) + fzp(k)*&
12246 wb(i_end+1, k, j) = wb(i_end+1, k, j) + temp47b6
12247 wb(i_end, k, j) = wb(i_end, k, j) + temp47b6
12248 fqxb(i_end+1, k) = 0.0
12250 CALL POPINTEGER4(k)
12252 CALL POPCONTROL1B(branch)
12253 IF (branch .EQ. 0) THEN
12255 temp47b3 = 0.5*(w(i_start, k, j)+w(i_start-1, k, j))*fqxb(&
12257 temp47b4 = 0.5*((2.-fzm(k-1))*ru(i_start, k-1, j)-fzp(k-1)*ru(&
12258 & i_start, k-2, j))*fqxb(i_start, k)
12259 rub(i_start, k-1, j) = rub(i_start, k-1, j) + (2.-fzm(k-1))*&
12261 rub(i_start, k-2, j) = rub(i_start, k-2, j) - fzp(k-1)*&
12263 wb(i_start, k, j) = wb(i_start, k, j) + temp47b4
12264 wb(i_start-1, k, j) = wb(i_start-1, k, j) + temp47b4
12265 fqxb(i_start, k) = 0.0
12267 temp47b1 = 0.5*(w(i_start, k, j)+w(i_start-1, k, j))*fqxb(&
12269 temp47b2 = 0.5*(fzm(k)*ru(i_start, k, j)+fzp(k)*ru(i_start, &
12270 & k-1, j))*fqxb(i_start, k)
12271 rub(i_start, k, j) = rub(i_start, k, j) + fzm(k)*temp47b1
12272 rub(i_start, k-1, j) = rub(i_start, k-1, j) + fzp(k)*&
12274 wb(i_start, k, j) = wb(i_start, k, j) + temp47b2
12275 wb(i_start-1, k, j) = wb(i_start-1, k, j) + temp47b2
12276 fqxb(i_start, k) = 0.0
12278 CALL POPINTEGER4(k)
12281 DO i=i_end_f,i_start_f,-1
12282 temp47b0 = vel*fqxb(i, k)/12.0
12283 velb = (7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k, j)&
12284 & )*fqxb(i, k)/12.0
12285 wb(i, k, j) = wb(i, k, j) + 7.*temp47b0
12286 wb(i-1, k, j) = wb(i-1, k, j) + 7.*temp47b0
12287 wb(i+1, k, j) = wb(i+1, k, j) - temp47b0
12288 wb(i-2, k, j) = wb(i-2, k, j) - temp47b0
12291 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
12292 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
12295 DO i=i_end_f,i_start_f,-1
12296 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
12297 temp47b = vel*fqxb(i, k)/12.0
12298 velb = (7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k, &
12299 & j))*fqxb(i, k)/12.0
12300 wb(i, k, j) = wb(i, k, j) + 7.*temp47b
12301 wb(i-1, k, j) = wb(i-1, k, j) + 7.*temp47b
12302 wb(i+1, k, j) = wb(i+1, k, j) - temp47b
12303 wb(i-2, k, j) = wb(i-2, k, j) - temp47b
12306 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
12307 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
12312 ELSE IF (branch .EQ. 6) THEN
12314 CALL POPINTEGER4(ad_from15)
12315 CALL POPINTEGER4(ad_to15)
12316 DO j=ad_to15,ad_from15,-1
12317 DO k=ktf+1,kts+1,-1
12318 CALL POPINTEGER4(ad_from14)
12319 CALL POPINTEGER4(ad_to14)
12320 DO i=ad_to14,ad_from14,-1
12321 mrdx = msftx(i, j)*rdx
12322 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
12323 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
12326 CALL POPINTEGER4(k)
12327 CALL POPCONTROL1B(branch)
12328 IF (branch .NE. 0) THEN
12329 CALL POPINTEGER4(ad_to13)
12330 DO i=ad_to13,i_end_f+1,-1
12331 CALL POPCONTROL1B(branch)
12332 IF (branch .NE. 0) THEN
12334 temp43 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-1&
12336 temp46 = SIGN(1., vel)
12337 temp45 = temp46/12.0
12338 temp44 = SIGN(1, time_step)
12339 temp43b = vel*fqxb(i, k)
12340 temp43b0 = temp43b/12.0
12341 temp43b1 = temp44*temp45*temp43b
12342 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k&
12343 & , j))/12.0+temp44*(temp45*temp43))*fqxb(i, k)
12344 wb(i, k, j) = wb(i, k, j) + 7.*temp43b0 - 3.*temp43b1
12345 wb(i-1, k, j) = wb(i-1, k, j) + 3.*temp43b1 + 7.*temp43b0
12346 wb(i+1, k, j) = wb(i+1, k, j) + temp43b1 - temp43b0
12347 wb(i-2, k, j) = wb(i-2, k, j) - temp43b1 - temp43b0
12350 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
12351 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
12353 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
12354 temp39 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-&
12356 temp42 = SIGN(1., vel)
12357 temp41 = temp42/12.0
12358 temp40 = SIGN(1, time_step)
12359 temp39b3 = vel*fqxb(i, k)
12360 temp39b4 = temp39b3/12.0
12361 temp39b5 = temp40*temp41*temp39b3
12362 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, &
12363 & k, j))/12.0+temp40*(temp41*temp39))*fqxb(i, k)
12364 wb(i, k, j) = wb(i, k, j) + 7.*temp39b4 - 3.*temp39b5
12365 wb(i-1, k, j) = wb(i-1, k, j) + 3.*temp39b5 + 7.*temp39b4
12366 wb(i+1, k, j) = wb(i+1, k, j) + temp39b5 - temp39b4
12367 wb(i-2, k, j) = wb(i-2, k, j) - temp39b5 - temp39b4
12370 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
12371 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
12373 CALL POPINTEGER4(k)
12375 CALL POPCONTROL1B(branch)
12376 IF (branch .EQ. 0) THEN
12378 temp39b1 = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
12379 temp39b2 = 0.5*((2.-fzm(k-1))*ru(i, k-1, j)-fzp(k-1)*ru(i, k&
12380 & -2, j))*fqxb(i, k)
12381 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*temp39b1
12382 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*temp39b1
12383 wb(i, k, j) = wb(i, k, j) + temp39b2
12384 wb(i-1, k, j) = wb(i-1, k, j) + temp39b2
12387 temp39b = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
12388 temp39b0 = 0.5*(fzm(k)*ru(i, k, j)+fzp(k)*ru(i, k-1, j))*&
12390 rub(i, k, j) = rub(i, k, j) + fzm(k)*temp39b
12391 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*temp39b
12392 wb(i, k, j) = wb(i, k, j) + temp39b0
12393 wb(i-1, k, j) = wb(i-1, k, j) + temp39b0
12396 CALL POPINTEGER4(k)
12400 CALL POPCONTROL1B(branch)
12401 IF (branch .EQ. 0) THEN
12402 CALL POPINTEGER4(ad_from13)
12403 DO i=i_start_f-1,ad_from13,-1
12404 CALL POPCONTROL1B(branch)
12405 IF (branch .NE. 0) THEN
12407 temp35 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-1&
12409 temp38 = SIGN(1., vel)
12410 temp37 = temp38/12.0
12411 temp36 = SIGN(1, time_step)
12412 temp35b = vel*fqxb(i, k)
12413 temp35b0 = temp35b/12.0
12414 temp35b1 = temp36*temp37*temp35b
12415 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k&
12416 & , j))/12.0+temp36*(temp37*temp35))*fqxb(i, k)
12417 wb(i, k, j) = wb(i, k, j) + 7.*temp35b0 - 3.*temp35b1
12418 wb(i-1, k, j) = wb(i-1, k, j) + 3.*temp35b1 + 7.*temp35b0
12419 wb(i+1, k, j) = wb(i+1, k, j) + temp35b1 - temp35b0
12420 wb(i-2, k, j) = wb(i-2, k, j) - temp35b1 - temp35b0
12423 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
12424 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
12426 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
12427 temp31 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-&
12429 temp34 = SIGN(1., vel)
12430 temp33 = temp34/12.0
12431 temp32 = SIGN(1, time_step)
12432 temp31b3 = vel*fqxb(i, k)
12433 temp31b4 = temp31b3/12.0
12434 temp31b5 = temp32*temp33*temp31b3
12435 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, &
12436 & k, j))/12.0+temp32*(temp33*temp31))*fqxb(i, k)
12437 wb(i, k, j) = wb(i, k, j) + 7.*temp31b4 - 3.*temp31b5
12438 wb(i-1, k, j) = wb(i-1, k, j) + 3.*temp31b5 + 7.*temp31b4
12439 wb(i+1, k, j) = wb(i+1, k, j) + temp31b5 - temp31b4
12440 wb(i-2, k, j) = wb(i-2, k, j) - temp31b5 - temp31b4
12443 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
12444 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
12446 CALL POPINTEGER4(k)
12448 CALL POPCONTROL1B(branch)
12449 IF (branch .EQ. 0) THEN
12451 temp31b1 = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
12452 temp31b2 = 0.5*((2.-fzm(k-1))*ru(i, k-1, j)-fzp(k-1)*ru(i, k&
12453 & -2, j))*fqxb(i, k)
12454 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*temp31b1
12455 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*temp31b1
12456 wb(i, k, j) = wb(i, k, j) + temp31b2
12457 wb(i-1, k, j) = wb(i-1, k, j) + temp31b2
12460 temp31b = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
12461 temp31b0 = 0.5*(fzm(k)*ru(i, k, j)+fzp(k)*ru(i, k-1, j))*&
12463 rub(i, k, j) = rub(i, k, j) + fzm(k)*temp31b
12464 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*temp31b
12465 wb(i, k, j) = wb(i, k, j) + temp31b0
12466 wb(i-1, k, j) = wb(i-1, k, j) + temp31b0
12469 CALL POPINTEGER4(k)
12474 DO i=i_end_f,i_start_f,-1
12475 temp27 = w(i+2, k, j) - w(i-3, k, j) + 10.*(w(i, k, j)-w(i-1, k&
12476 & , j)) - 5.*(w(i+1, k, j)-w(i-2, k, j))
12477 temp30 = SIGN(1., vel)
12478 temp29 = temp30/60.0
12479 temp28 = SIGN(1, time_step)
12480 temp27b = vel*fqxb(i, k)
12481 temp27b0 = temp27b/60.0
12482 temp27b1 = -(temp28*temp29*temp27b)
12483 velb = ((37.*(w(i, k, j)+w(i-1, k, j))-8.*(w(i+1, k, j)+w(i-2, k&
12484 & , j))+w(i+2, k, j)+w(i-3, k, j))/60.0-temp28*(temp29*temp27))*&
12486 wb(i, k, j) = wb(i, k, j) + 10.*temp27b1 + 37.*temp27b0
12487 wb(i-1, k, j) = wb(i-1, k, j) + 37.*temp27b0 - 10.*temp27b1
12488 wb(i+1, k, j) = wb(i+1, k, j) - 5.*temp27b1 - 8.*temp27b0
12489 wb(i-2, k, j) = wb(i-2, k, j) + 5.*temp27b1 - 8.*temp27b0
12490 wb(i+2, k, j) = wb(i+2, k, j) + temp27b1 + temp27b0
12491 wb(i-3, k, j) = wb(i-3, k, j) + temp27b0 - temp27b1
12494 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
12495 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
12498 DO i=i_end_f,i_start_f,-1
12499 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
12500 temp23 = w(i+2, k, j) - w(i-3, k, j) + 10.*(w(i, k, j)-w(i-1, &
12501 & k, j)) - 5.*(w(i+1, k, j)-w(i-2, k, j))
12502 temp26 = SIGN(1., vel)
12503 temp25 = temp26/60.0
12504 temp24 = SIGN(1, time_step)
12505 temp23b = vel*fqxb(i, k)
12506 temp23b0 = temp23b/60.0
12507 temp23b1 = -(temp24*temp25*temp23b)
12508 velb = ((37.*(w(i, k, j)+w(i-1, k, j))-8.*(w(i+1, k, j)+w(i-2&
12509 & , k, j))+w(i+2, k, j)+w(i-3, k, j))/60.0-temp24*(temp25*&
12510 & temp23))*fqxb(i, k)
12511 wb(i, k, j) = wb(i, k, j) + 10.*temp23b1 + 37.*temp23b0
12512 wb(i-1, k, j) = wb(i-1, k, j) + 37.*temp23b0 - 10.*temp23b1
12513 wb(i+1, k, j) = wb(i+1, k, j) - 5.*temp23b1 - 8.*temp23b0
12514 wb(i-2, k, j) = wb(i-2, k, j) + 5.*temp23b1 - 8.*temp23b0
12515 wb(i+2, k, j) = wb(i+2, k, j) + temp23b1 + temp23b0
12516 wb(i-3, k, j) = wb(i-3, k, j) + temp23b0 - temp23b1
12519 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
12520 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
12523 CALL POPINTEGER4(k)
12526 CALL POPINTEGER4(ad_from12)
12527 CALL POPINTEGER4(ad_to12)
12528 DO j=ad_to12,ad_from12,-1
12529 CALL POPINTEGER4(jp0)
12530 CALL POPINTEGER4(jp1)
12531 CALL POPCONTROL2B(branch)
12532 IF (branch .LT. 2) THEN
12533 IF (branch .EQ. 0) THEN
12535 CALL POPINTEGER4(ad_from9)
12536 CALL POPINTEGER4(ad_to9)
12537 DO i=ad_to9,ad_from9,-1
12538 mrdy = msftx(i, j-1)*rdy
12539 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
12543 CALL POPINTEGER4(k)
12546 CALL POPINTEGER4(ad_from10)
12547 CALL POPINTEGER4(ad_to10)
12548 DO i=ad_to10,ad_from10,-1
12549 mrdy = msftx(i, j-1)*rdy
12550 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
12554 CALL POPINTEGER4(k)
12556 ELSE IF (branch .EQ. 2) THEN
12557 DO k=ktf+1,kts+1,-1
12558 CALL POPINTEGER4(ad_from11)
12559 CALL POPINTEGER4(ad_to11)
12560 DO i=ad_to11,ad_from11,-1
12561 mrdy = msftx(i, j-1)*rdy
12562 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1&
12564 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1&
12568 CALL POPINTEGER4(k)
12570 CALL POPCONTROL3B(branch)
12571 IF (branch .LT. 3) THEN
12572 IF (branch .EQ. 0) THEN
12573 CALL POPINTEGER4(ad_from0)
12574 CALL POPINTEGER4(ad_to0)
12575 DO i=ad_to0,ad_from0,-1
12576 temp3 = w(i, k, j+2) - w(i, k, j-3) + 10.*(w(i, k, j)-w(i, k&
12577 & , j-1)) - 5.*(w(i, k, j+1)-w(i, k, j-2))
12578 temp6 = SIGN(1., vel)
12580 temp4 = SIGN(1, time_step)
12581 temp3b = vel*fqyb(i, k, jp1)
12582 temp3b0 = temp3b/60.0
12583 temp3b1 = -(temp4*temp5*temp3b)
12584 velb = ((37.*(w(i, k, j)+w(i, k, j-1))-8.*(w(i, k, j+1)+w(i&
12585 & , k, j-2))+w(i, k, j+2)+w(i, k, j-3))/60.0-temp4*(temp5*&
12586 & temp3))*fqyb(i, k, jp1)
12587 wb(i, k, j) = wb(i, k, j) + 10.*temp3b1 + 37.*temp3b0
12588 wb(i, k, j-1) = wb(i, k, j-1) + 37.*temp3b0 - 10.*temp3b1
12589 wb(i, k, j+1) = wb(i, k, j+1) - 5.*temp3b1 - 8.*temp3b0
12590 wb(i, k, j-2) = wb(i, k, j-2) + 5.*temp3b1 - 8.*temp3b0
12591 wb(i, k, j+2) = wb(i, k, j+2) + temp3b1 + temp3b0
12592 wb(i, k, j-3) = wb(i, k, j-3) + temp3b0 - temp3b1
12593 fqyb(i, k, jp1) = 0.0
12595 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
12596 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
12599 CALL POPINTEGER4(ad_from)
12600 CALL POPINTEGER4(ad_to)
12601 DO i=ad_to,ad_from,-1
12602 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
12603 temp = w(i, k, j+2) - w(i, k, j-3) + 10.*(w(i, k, j)-w(i, &
12604 & k, j-1)) - 5.*(w(i, k, j+1)-w(i, k, j-2))
12605 temp2 = SIGN(1., vel)
12607 temp0 = SIGN(1, time_step)
12608 tempb = vel*fqyb(i, k, jp1)
12609 tempb0 = tempb/60.0
12610 tempb1 = -(temp0*temp1*tempb)
12611 velb = ((37.*(w(i, k, j)+w(i, k, j-1))-8.*(w(i, k, j+1)+w(&
12612 & i, k, j-2))+w(i, k, j+2)+w(i, k, j-3))/60.0-temp0*(temp1&
12613 & *temp))*fqyb(i, k, jp1)
12614 wb(i, k, j) = wb(i, k, j) + 10.*tempb1 + 37.*tempb0
12615 wb(i, k, j-1) = wb(i, k, j-1) + 37.*tempb0 - 10.*tempb1
12616 wb(i, k, j+1) = wb(i, k, j+1) - 5.*tempb1 - 8.*tempb0
12617 wb(i, k, j-2) = wb(i, k, j-2) + 5.*tempb1 - 8.*tempb0
12618 wb(i, k, j+2) = wb(i, k, j+2) + tempb1 + tempb0
12619 wb(i, k, j-3) = wb(i, k, j-3) + tempb0 - tempb1
12620 fqyb(i, k, jp1) = 0.0
12622 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
12623 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
12626 CALL POPINTEGER4(k)
12627 ELSE IF (branch .EQ. 1) THEN
12628 CALL POPINTEGER4(ad_from2)
12629 CALL POPINTEGER4(ad_to2)
12630 DO i=ad_to2,ad_from2,-1
12631 temp7b1 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
12632 temp7b2 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j)-fzp(k-1)*rv(i, k-&
12633 & 2, j))*fqyb(i, k, jp1)
12634 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*temp7b1
12635 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*temp7b1
12636 wb(i, k, j) = wb(i, k, j) + temp7b2
12637 wb(i, k, j-1) = wb(i, k, j-1) + temp7b2
12638 fqyb(i, k, jp1) = 0.0
12641 CALL POPINTEGER4(ad_from1)
12642 CALL POPINTEGER4(ad_to1)
12643 DO i=ad_to1,ad_from1,-1
12644 temp7b = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
12645 temp7b0 = 0.5*(fzm(k)*rv(i, k, j)+fzp(k)*rv(i, k-1, j))*&
12647 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*temp7b
12648 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*temp7b
12649 wb(i, k, j) = wb(i, k, j) + temp7b0
12650 wb(i, k, j-1) = wb(i, k, j-1) + temp7b0
12651 fqyb(i, k, jp1) = 0.0
12654 CALL POPINTEGER4(k)
12656 CALL POPINTEGER4(ad_from4)
12657 CALL POPINTEGER4(ad_to4)
12658 DO i=ad_to4,ad_from4,-1
12659 temp11 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i, k&
12661 temp14 = SIGN(1., vel)
12662 temp13 = temp14/12.0
12663 temp12 = SIGN(1, time_step)
12664 temp11b = vel*fqyb(i, k, jp1)
12665 temp11b0 = temp11b/12.0
12666 temp11b1 = temp12*temp13*temp11b
12667 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j&
12668 & -2))/12.0+temp12*(temp13*temp11))*fqyb(i, k, jp1)
12669 wb(i, k, j) = wb(i, k, j) + 7.*temp11b0 - 3.*temp11b1
12670 wb(i, k, j-1) = wb(i, k, j-1) + 3.*temp11b1 + 7.*temp11b0
12671 wb(i, k, j+1) = wb(i, k, j+1) + temp11b1 - temp11b0
12672 wb(i, k, j-2) = wb(i, k, j-2) - temp11b1 - temp11b0
12673 fqyb(i, k, jp1) = 0.0
12675 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
12676 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
12679 CALL POPINTEGER4(ad_from3)
12680 CALL POPINTEGER4(ad_to3)
12681 DO i=ad_to3,ad_from3,-1
12682 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
12683 temp7 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i, &
12685 temp10 = SIGN(1., vel)
12686 temp9 = temp10/12.0
12687 temp8 = SIGN(1, time_step)
12688 temp7b3 = vel*fqyb(i, k, jp1)
12689 temp7b4 = temp7b3/12.0
12690 temp7b5 = temp8*temp9*temp7b3
12691 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k&
12692 & , j-2))/12.0+temp8*(temp9*temp7))*fqyb(i, k, jp1)
12693 wb(i, k, j) = wb(i, k, j) + 7.*temp7b4 - 3.*temp7b5
12694 wb(i, k, j-1) = wb(i, k, j-1) + 3.*temp7b5 + 7.*temp7b4
12695 wb(i, k, j+1) = wb(i, k, j+1) + temp7b5 - temp7b4
12696 wb(i, k, j-2) = wb(i, k, j-2) - temp7b5 - temp7b4
12697 fqyb(i, k, jp1) = 0.0
12699 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
12700 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
12703 CALL POPINTEGER4(k)
12705 ELSE IF (branch .EQ. 3) THEN
12706 CALL POPINTEGER4(ad_from6)
12707 CALL POPINTEGER4(ad_to6)
12708 DO i=ad_to6,ad_from6,-1
12709 temp15b1 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
12710 temp15b2 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j)-fzp(k-1)*rv(i, k-2&
12711 & , j))*fqyb(i, k, jp1)
12712 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*temp15b1
12713 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*temp15b1
12714 wb(i, k, j) = wb(i, k, j) + temp15b2
12715 wb(i, k, j-1) = wb(i, k, j-1) + temp15b2
12716 fqyb(i, k, jp1) = 0.0
12719 CALL POPINTEGER4(ad_from5)
12720 CALL POPINTEGER4(ad_to5)
12721 DO i=ad_to5,ad_from5,-1
12722 temp15b = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
12723 temp15b0 = 0.5*(fzm(k)*rv(i, k, j)+fzp(k)*rv(i, k-1, j))*&
12725 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*temp15b
12726 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*temp15b
12727 wb(i, k, j) = wb(i, k, j) + temp15b0
12728 wb(i, k, j-1) = wb(i, k, j-1) + temp15b0
12729 fqyb(i, k, jp1) = 0.0
12732 CALL POPINTEGER4(k)
12733 ELSE IF (branch .EQ. 4) THEN
12734 CALL POPINTEGER4(ad_from8)
12735 CALL POPINTEGER4(ad_to8)
12736 DO i=ad_to8,ad_from8,-1
12737 temp19 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i, k, &
12739 temp22 = SIGN(1., vel)
12740 temp21 = temp22/12.0
12741 temp20 = SIGN(1, time_step)
12742 temp19b = vel*fqyb(i, k, jp1)
12743 temp19b0 = temp19b/12.0
12744 temp19b1 = temp20*temp21*temp19b
12745 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j-2&
12746 & ))/12.0+temp20*(temp21*temp19))*fqyb(i, k, jp1)
12747 wb(i, k, j) = wb(i, k, j) + 7.*temp19b0 - 3.*temp19b1
12748 wb(i, k, j-1) = wb(i, k, j-1) + 3.*temp19b1 + 7.*temp19b0
12749 wb(i, k, j+1) = wb(i, k, j+1) + temp19b1 - temp19b0
12750 wb(i, k, j-2) = wb(i, k, j-2) - temp19b1 - temp19b0
12751 fqyb(i, k, jp1) = 0.0
12753 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
12754 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
12757 CALL POPINTEGER4(ad_from7)
12758 CALL POPINTEGER4(ad_to7)
12759 DO i=ad_to7,ad_from7,-1
12760 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
12761 temp15 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i, k&
12763 temp18 = SIGN(1., vel)
12764 temp17 = temp18/12.0
12765 temp16 = SIGN(1, time_step)
12766 temp15b3 = vel*fqyb(i, k, jp1)
12767 temp15b4 = temp15b3/12.0
12768 temp15b5 = temp16*temp17*temp15b3
12769 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j&
12770 & -2))/12.0+temp16*(temp17*temp15))*fqyb(i, k, jp1)
12771 wb(i, k, j) = wb(i, k, j) + 7.*temp15b4 - 3.*temp15b5
12772 wb(i, k, j-1) = wb(i, k, j-1) + 3.*temp15b5 + 7.*temp15b4
12773 wb(i, k, j+1) = wb(i, k, j+1) + temp15b5 - temp15b4
12774 wb(i, k, j-2) = wb(i, k, j-2) - temp15b5 - temp15b4
12775 fqyb(i, k, jp1) = 0.0
12777 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
12778 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
12781 CALL POPINTEGER4(k)
12786 CALL POPINTEGER4(ad_from66)
12787 CALL POPINTEGER4(ad_to66)
12788 DO j=ad_to66,ad_from66,-1
12789 DO k=ktf+1,kts+1,-1
12790 CALL POPINTEGER4(ad_from65)
12791 CALL POPINTEGER4(ad_to65)
12792 DO i=ad_to65,ad_from65,-1
12793 mrdx = msftx(i, j)*rdx
12794 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
12795 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
12798 CALL POPINTEGER4(k)
12799 CALL POPCONTROL1B(branch)
12800 IF (branch .NE. 0) THEN
12801 CALL POPINTEGER4(ad_to64)
12802 DO i=ad_to64,i_end_f+1,-1
12803 CALL POPCONTROL1B(branch)
12804 IF (branch .NE. 0) THEN
12806 temp63b58 = vel*fqxb(i, k)/12.0
12807 velb = (7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k, &
12808 & j))*fqxb(i, k)/12.0
12809 wb(i, k, j) = wb(i, k, j) + 7.*temp63b58
12810 wb(i-1, k, j) = wb(i-1, k, j) + 7.*temp63b58
12811 wb(i+1, k, j) = wb(i+1, k, j) - temp63b58
12812 wb(i-2, k, j) = wb(i-2, k, j) - temp63b58
12815 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
12816 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
12818 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
12819 temp63b57 = vel*fqxb(i, k)/12.0
12820 velb = (7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k&
12821 & , j))*fqxb(i, k)/12.0
12822 wb(i, k, j) = wb(i, k, j) + 7.*temp63b57
12823 wb(i-1, k, j) = wb(i-1, k, j) + 7.*temp63b57
12824 wb(i+1, k, j) = wb(i+1, k, j) - temp63b57
12825 wb(i-2, k, j) = wb(i-2, k, j) - temp63b57
12828 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
12829 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
12831 CALL POPINTEGER4(k)
12833 CALL POPCONTROL1B(branch)
12834 IF (branch .EQ. 0) THEN
12836 temp63b55 = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
12837 temp63b56 = 0.5*((2.-fzm(k-1))*ru(i, k-1, j)-fzp(k-1)*ru(i, &
12838 & k-2, j))*fqxb(i, k)
12839 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*temp63b55
12840 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*temp63b55
12841 wb(i, k, j) = wb(i, k, j) + temp63b56
12842 wb(i-1, k, j) = wb(i-1, k, j) + temp63b56
12845 temp63b53 = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
12846 temp63b54 = 0.5*(fzm(k)*ru(i, k, j)+fzp(k)*ru(i, k-1, j))*&
12848 rub(i, k, j) = rub(i, k, j) + fzm(k)*temp63b53
12849 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*temp63b53
12850 wb(i, k, j) = wb(i, k, j) + temp63b54
12851 wb(i-1, k, j) = wb(i-1, k, j) + temp63b54
12854 CALL POPINTEGER4(k)
12858 CALL POPCONTROL1B(branch)
12859 IF (branch .EQ. 0) THEN
12860 CALL POPINTEGER4(ad_from64)
12861 DO i=i_start_f-1,ad_from64,-1
12862 CALL POPCONTROL1B(branch)
12863 IF (branch .NE. 0) THEN
12865 temp63b52 = vel*fqxb(i, k)/12.0
12866 velb = (7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k, &
12867 & j))*fqxb(i, k)/12.0
12868 wb(i, k, j) = wb(i, k, j) + 7.*temp63b52
12869 wb(i-1, k, j) = wb(i-1, k, j) + 7.*temp63b52
12870 wb(i+1, k, j) = wb(i+1, k, j) - temp63b52
12871 wb(i-2, k, j) = wb(i-2, k, j) - temp63b52
12874 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
12875 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
12877 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
12878 temp63b51 = vel*fqxb(i, k)/12.0
12879 velb = (7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k&
12880 & , j))*fqxb(i, k)/12.0
12881 wb(i, k, j) = wb(i, k, j) + 7.*temp63b51
12882 wb(i-1, k, j) = wb(i-1, k, j) + 7.*temp63b51
12883 wb(i+1, k, j) = wb(i+1, k, j) - temp63b51
12884 wb(i-2, k, j) = wb(i-2, k, j) - temp63b51
12887 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
12888 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
12890 CALL POPINTEGER4(k)
12892 CALL POPCONTROL1B(branch)
12893 IF (branch .EQ. 0) THEN
12895 temp63b49 = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
12896 temp63b50 = 0.5*((2.-fzm(k-1))*ru(i, k-1, j)-fzp(k-1)*ru(i, &
12897 & k-2, j))*fqxb(i, k)
12898 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*temp63b49
12899 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*temp63b49
12900 wb(i, k, j) = wb(i, k, j) + temp63b50
12901 wb(i-1, k, j) = wb(i-1, k, j) + temp63b50
12904 temp63b47 = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
12905 temp63b48 = 0.5*(fzm(k)*ru(i, k, j)+fzp(k)*ru(i, k-1, j))*&
12907 rub(i, k, j) = rub(i, k, j) + fzm(k)*temp63b47
12908 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*temp63b47
12909 wb(i, k, j) = wb(i, k, j) + temp63b48
12910 wb(i-1, k, j) = wb(i-1, k, j) + temp63b48
12913 CALL POPINTEGER4(k)
12918 DO i=i_end_f,i_start_f,-1
12919 temp63b46 = vel*fqxb(i, k)/60.0
12920 velb = (37.*(w(i, k, j)+w(i-1, k, j))-8.*(w(i+1, k, j)+w(i-2, k&
12921 & , j))+w(i+2, k, j)+w(i-3, k, j))*fqxb(i, k)/60.0
12922 wb(i, k, j) = wb(i, k, j) + 37.*temp63b46
12923 wb(i-1, k, j) = wb(i-1, k, j) + 37.*temp63b46
12924 wb(i+1, k, j) = wb(i+1, k, j) - 8.*temp63b46
12925 wb(i-2, k, j) = wb(i-2, k, j) - 8.*temp63b46
12926 wb(i+2, k, j) = wb(i+2, k, j) + temp63b46
12927 wb(i-3, k, j) = wb(i-3, k, j) + temp63b46
12930 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
12931 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
12934 DO i=i_end_f,i_start_f,-1
12935 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
12936 temp63b45 = vel*fqxb(i, k)/60.0
12937 velb = (37.*(w(i, k, j)+w(i-1, k, j))-8.*(w(i+1, k, j)+w(i-2, &
12938 & k, j))+w(i+2, k, j)+w(i-3, k, j))*fqxb(i, k)/60.0
12939 wb(i, k, j) = wb(i, k, j) + 37.*temp63b45
12940 wb(i-1, k, j) = wb(i-1, k, j) + 37.*temp63b45
12941 wb(i+1, k, j) = wb(i+1, k, j) - 8.*temp63b45
12942 wb(i-2, k, j) = wb(i-2, k, j) - 8.*temp63b45
12943 wb(i+2, k, j) = wb(i+2, k, j) + temp63b45
12944 wb(i-3, k, j) = wb(i-3, k, j) + temp63b45
12947 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
12948 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
12951 CALL POPINTEGER4(k)
12954 CALL POPINTEGER4(ad_from63)
12955 CALL POPINTEGER4(ad_to63)
12956 DO j=ad_to63,ad_from63,-1
12957 CALL POPINTEGER4(jp0)
12958 CALL POPINTEGER4(jp1)
12959 CALL POPCONTROL2B(branch)
12960 IF (branch .LT. 2) THEN
12961 IF (branch .EQ. 0) THEN
12963 CALL POPINTEGER4(ad_from60)
12964 CALL POPINTEGER4(ad_to60)
12965 DO i=ad_to60,ad_from60,-1
12966 mrdy = msftx(i, j-1)*rdy
12967 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
12971 CALL POPINTEGER4(k)
12974 CALL POPINTEGER4(ad_from61)
12975 CALL POPINTEGER4(ad_to61)
12976 DO i=ad_to61,ad_from61,-1
12977 mrdy = msftx(i, j-1)*rdy
12978 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
12982 CALL POPINTEGER4(k)
12984 ELSE IF (branch .EQ. 2) THEN
12985 DO k=ktf+1,kts+1,-1
12986 CALL POPINTEGER4(ad_from62)
12987 CALL POPINTEGER4(ad_to62)
12988 DO i=ad_to62,ad_from62,-1
12989 mrdy = msftx(i, j-1)*rdy
12990 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1&
12992 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1&
12996 CALL POPINTEGER4(k)
12998 CALL POPCONTROL3B(branch)
12999 IF (branch .LT. 3) THEN
13000 IF (branch .EQ. 0) THEN
13001 CALL POPINTEGER4(ad_from51)
13002 CALL POPINTEGER4(ad_to51)
13003 DO i=ad_to51,ad_from51,-1
13004 temp63b32 = vel*fqyb(i, k, jp1)/60.0
13005 velb = (37.*(w(i, k, j)+w(i, k, j-1))-8.*(w(i, k, j+1)+w(i, &
13006 & k, j-2))+w(i, k, j+2)+w(i, k, j-3))*fqyb(i, k, jp1)/60.0
13007 wb(i, k, j) = wb(i, k, j) + 37.*temp63b32
13008 wb(i, k, j-1) = wb(i, k, j-1) + 37.*temp63b32
13009 wb(i, k, j+1) = wb(i, k, j+1) - 8.*temp63b32
13010 wb(i, k, j-2) = wb(i, k, j-2) - 8.*temp63b32
13011 wb(i, k, j+2) = wb(i, k, j+2) + temp63b32
13012 wb(i, k, j-3) = wb(i, k, j-3) + temp63b32
13013 fqyb(i, k, jp1) = 0.0
13015 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
13016 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
13019 CALL POPINTEGER4(ad_from50)
13020 CALL POPINTEGER4(ad_to50)
13021 DO i=ad_to50,ad_from50,-1
13022 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
13023 temp63b31 = vel*fqyb(i, k, jp1)/60.0
13024 velb = (37.*(w(i, k, j)+w(i, k, j-1))-8.*(w(i, k, j+1)+w(i&
13025 & , k, j-2))+w(i, k, j+2)+w(i, k, j-3))*fqyb(i, k, jp1)/&
13027 wb(i, k, j) = wb(i, k, j) + 37.*temp63b31
13028 wb(i, k, j-1) = wb(i, k, j-1) + 37.*temp63b31
13029 wb(i, k, j+1) = wb(i, k, j+1) - 8.*temp63b31
13030 wb(i, k, j-2) = wb(i, k, j-2) - 8.*temp63b31
13031 wb(i, k, j+2) = wb(i, k, j+2) + temp63b31
13032 wb(i, k, j-3) = wb(i, k, j-3) + temp63b31
13033 fqyb(i, k, jp1) = 0.0
13035 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
13036 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
13039 CALL POPINTEGER4(k)
13040 ELSE IF (branch .EQ. 1) THEN
13041 CALL POPINTEGER4(ad_from53)
13042 CALL POPINTEGER4(ad_to53)
13043 DO i=ad_to53,ad_from53,-1
13044 temp63b35 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
13045 temp63b36 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j)-fzp(k-1)*rv(i, &
13046 & k-2, j))*fqyb(i, k, jp1)
13047 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*temp63b35
13048 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*temp63b35
13049 wb(i, k, j) = wb(i, k, j) + temp63b36
13050 wb(i, k, j-1) = wb(i, k, j-1) + temp63b36
13051 fqyb(i, k, jp1) = 0.0
13054 CALL POPINTEGER4(ad_from52)
13055 CALL POPINTEGER4(ad_to52)
13056 DO i=ad_to52,ad_from52,-1
13057 temp63b33 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
13058 temp63b34 = 0.5*(fzm(k)*rv(i, k, j)+fzp(k)*rv(i, k-1, j))*&
13060 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*temp63b33
13061 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*temp63b33
13062 wb(i, k, j) = wb(i, k, j) + temp63b34
13063 wb(i, k, j-1) = wb(i, k, j-1) + temp63b34
13064 fqyb(i, k, jp1) = 0.0
13067 CALL POPINTEGER4(k)
13069 CALL POPINTEGER4(ad_from55)
13070 CALL POPINTEGER4(ad_to55)
13071 DO i=ad_to55,ad_from55,-1
13072 temp63b38 = vel*fqyb(i, k, jp1)/12.0
13073 velb = (7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j-&
13074 & 2))*fqyb(i, k, jp1)/12.0
13075 wb(i, k, j) = wb(i, k, j) + 7.*temp63b38
13076 wb(i, k, j-1) = wb(i, k, j-1) + 7.*temp63b38
13077 wb(i, k, j+1) = wb(i, k, j+1) - temp63b38
13078 wb(i, k, j-2) = wb(i, k, j-2) - temp63b38
13079 fqyb(i, k, jp1) = 0.0
13081 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
13082 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
13085 CALL POPINTEGER4(ad_from54)
13086 CALL POPINTEGER4(ad_to54)
13087 DO i=ad_to54,ad_from54,-1
13088 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
13089 temp63b37 = vel*fqyb(i, k, jp1)/12.0
13090 velb = (7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, &
13091 & j-2))*fqyb(i, k, jp1)/12.0
13092 wb(i, k, j) = wb(i, k, j) + 7.*temp63b37
13093 wb(i, k, j-1) = wb(i, k, j-1) + 7.*temp63b37
13094 wb(i, k, j+1) = wb(i, k, j+1) - temp63b37
13095 wb(i, k, j-2) = wb(i, k, j-2) - temp63b37
13096 fqyb(i, k, jp1) = 0.0
13098 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
13099 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
13102 CALL POPINTEGER4(k)
13104 ELSE IF (branch .EQ. 3) THEN
13105 CALL POPINTEGER4(ad_from57)
13106 CALL POPINTEGER4(ad_to57)
13107 DO i=ad_to57,ad_from57,-1
13108 temp63b41 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
13109 temp63b42 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j)-fzp(k-1)*rv(i, k-&
13110 & 2, j))*fqyb(i, k, jp1)
13111 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*temp63b41
13112 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*temp63b41
13113 wb(i, k, j) = wb(i, k, j) + temp63b42
13114 wb(i, k, j-1) = wb(i, k, j-1) + temp63b42
13115 fqyb(i, k, jp1) = 0.0
13118 CALL POPINTEGER4(ad_from56)
13119 CALL POPINTEGER4(ad_to56)
13120 DO i=ad_to56,ad_from56,-1
13121 temp63b39 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
13122 temp63b40 = 0.5*(fzm(k)*rv(i, k, j)+fzp(k)*rv(i, k-1, j))*&
13124 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*temp63b39
13125 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*temp63b39
13126 wb(i, k, j) = wb(i, k, j) + temp63b40
13127 wb(i, k, j-1) = wb(i, k, j-1) + temp63b40
13128 fqyb(i, k, jp1) = 0.0
13131 CALL POPINTEGER4(k)
13132 ELSE IF (branch .EQ. 4) THEN
13133 CALL POPINTEGER4(ad_from59)
13134 CALL POPINTEGER4(ad_to59)
13135 DO i=ad_to59,ad_from59,-1
13136 temp63b44 = vel*fqyb(i, k, jp1)/12.0
13137 velb = (7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j-2)&
13138 & )*fqyb(i, k, jp1)/12.0
13139 wb(i, k, j) = wb(i, k, j) + 7.*temp63b44
13140 wb(i, k, j-1) = wb(i, k, j-1) + 7.*temp63b44
13141 wb(i, k, j+1) = wb(i, k, j+1) - temp63b44
13142 wb(i, k, j-2) = wb(i, k, j-2) - temp63b44
13143 fqyb(i, k, jp1) = 0.0
13145 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
13146 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
13149 CALL POPINTEGER4(ad_from58)
13150 CALL POPINTEGER4(ad_to58)
13151 DO i=ad_to58,ad_from58,-1
13152 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
13153 temp63b43 = vel*fqyb(i, k, jp1)/12.0
13154 velb = (7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j-&
13155 & 2))*fqyb(i, k, jp1)/12.0
13156 wb(i, k, j) = wb(i, k, j) + 7.*temp63b43
13157 wb(i, k, j-1) = wb(i, k, j-1) + 7.*temp63b43
13158 wb(i, k, j+1) = wb(i, k, j+1) - temp63b43
13159 wb(i, k, j-2) = wb(i, k, j-2) - temp63b43
13160 fqyb(i, k, jp1) = 0.0
13162 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
13163 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
13166 CALL POPINTEGER4(k)
13171 END SUBROUTINE A_ADVECT_W
13173 ! Generated by TAPENADE (INRIA, Tropics team)
13174 ! Tapenade 3.5 (r3785) - 22 Mar 2011 18:35
13176 ! Differentiation of advect_scalar_pd in reverse (adjoint) mode:
13177 ! gradient of useful results: rom field tendency h_tendency
13178 ! z_tendency ru rv mu_old field_old mut
13179 ! with respect to varying inputs: rom field tendency h_tendency
13180 ! z_tendency ru rv mu_old field_old mut
13181 ! RW status of diff variables: rom:incr field:incr tendency:in-out
13182 ! h_tendency:in-out z_tendency:in-out ru:incr rv:incr
13183 ! mu_old:incr field_old:incr mut:incr
13184 SUBROUTINE A_ADVECT_SCALAR_PD(field, fieldb, field_old, field_oldb, &
13185 & tendency, tendencyb, h_tendency, h_tendencyb, z_tendency, z_tendencyb&
13186 & , ru, rub, rv, rvb, rom, romb, mut, mutb, mub, mu_old, mu_oldb, &
13187 & time_step, config_flags, tenddec, msfux, msfuy, msfvx, msfvy, msftx, &
13188 & msfty, fzm, fzp, rdx, rdy, rdzw, dt, ids, ide, jds, jde, kds, kde, ims&
13189 & , ime, jms, jme, kms, kme, its, ite, jts, jte, kts, kte)
13192 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
13194 LOGICAL, INTENT(IN) :: tenddec
13195 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
13196 & jme, kms, kme, its, ite, jts, jte, kts, kte
13197 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: field, &
13198 & field_old, ru, rv, rom
13199 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: fieldb, field_oldb, rub&
13201 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut, mub, mu_old
13202 REAL, DIMENSION(ims:ime, jms:jme) :: mutb, mu_oldb
13203 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
13204 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: tendencyb
13205 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: h_tendency, z_tendency
13206 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: h_tendencyb, z_tendencyb
13207 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
13208 & msfvy, msftx, msfty
13209 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzw
13210 REAL, INTENT(IN) :: rdx, rdy, dt
13211 INTEGER, INTENT(IN) :: time_step
13213 INTEGER :: i, j, k, itf, jtf, ktf
13214 INTEGER :: i_start, i_end, j_start, j_end
13215 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
13216 INTEGER :: jmin, jmax, jp, jm, imin, imax
13217 REAL :: mrdx, mrdy, ub, vb, uw, vw, mu
13218 REAL :: ubb, vbb, mub0
13219 ! storage for high and low order fluxes
13220 REAL, DIMENSION(its - 1:ite + 2, kts:kte, jts - 1:jte + 2) :: fqx, fqy&
13222 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: fqxb, fqyb, fqzb
13223 REAL, DIMENSION(its - 1:ite + 2, kts:kte, jts - 1:jte + 2) :: fqxl, &
13225 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: fqxlb, fqylb, &
13227 INTEGER :: horz_order, vert_order
13228 LOGICAL :: degrade_xs, degrade_ys
13229 LOGICAL :: degrade_xe, degrade_ye
13230 INTEGER :: jp1, jp0, jtmp
13231 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: flux_out, ph_low
13232 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: flux_outb, ph_lowb
13235 REAL, PARAMETER :: eps=1.e-20
13236 ! definition of flux operators, 3rd, 4th, 5th or 6th order
13237 REAL :: flux3, flux4, flux5, flux6, flux_upwind
13238 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel, cr
13240 ! flux_upwind(q_im1, q_i, cr ) = 0.5*(1.+sign(1.,cr))*q_im1 &
13241 ! +0.5*(1.-sign(1.,cr))*q_i
13242 ! flux_upwind(q_im1, q_i, cr ) = 0.
13244 LOGICAL, PARAMETER :: pd_limit=.true.
13248 INTEGER :: ad_from0
13250 INTEGER :: ad_from1
13252 INTEGER :: ad_from2
13254 INTEGER :: ad_from3
13256 INTEGER :: ad_from4
13258 INTEGER :: ad_from5
13260 INTEGER :: ad_from6
13262 INTEGER :: ad_from7
13264 INTEGER :: ad_from8
13266 INTEGER :: ad_from9
13268 INTEGER :: ad_from10
13270 INTEGER :: ad_from11
13272 INTEGER :: ad_from12
13274 INTEGER :: ad_from13
13276 INTEGER :: ad_from14
13278 INTEGER :: ad_from15
13280 INTEGER :: ad_from16
13282 INTEGER :: ad_from17
13284 INTEGER :: ad_from18
13286 INTEGER :: ad_from19
13288 INTEGER :: ad_from20
13290 INTEGER :: ad_from21
13292 INTEGER :: ad_from22
13294 INTEGER :: ad_from23
13296 INTEGER :: ad_from24
13298 INTEGER :: ad_from25
13300 INTEGER :: ad_from26
13302 INTEGER :: ad_from27
13304 INTEGER :: ad_from28
13306 INTEGER :: ad_from29
13308 INTEGER :: ad_from30
13310 INTEGER :: ad_from31
13312 INTEGER :: ad_from32
13314 INTEGER :: ad_from33
13316 INTEGER :: ad_from34
13318 INTEGER :: ad_from35
13320 INTEGER :: ad_from36
13322 INTEGER :: ad_from37
13324 INTEGER :: ad_from38
13326 INTEGER :: ad_from39
13328 INTEGER :: ad_from40
13330 INTEGER :: ad_from41
13332 INTEGER :: ad_from42
13334 INTEGER :: ad_from43
13336 INTEGER :: ad_from44
13338 INTEGER :: ad_from45
13340 INTEGER :: ad_from46
13342 INTEGER :: ad_from47
13344 INTEGER :: ad_from48
13346 INTEGER :: ad_from49
13348 INTEGER :: ad_from50
13350 INTEGER :: ad_from51
13352 INTEGER :: ad_from52
13354 INTEGER :: ad_from53
13356 INTEGER :: ad_from54
13358 INTEGER :: ad_from55
13360 INTEGER :: ad_from56
13362 INTEGER :: ad_from57
13364 INTEGER :: ad_from58
13366 INTEGER :: ad_from59
13368 INTEGER :: ad_from60
13370 INTEGER :: ad_from61
13372 INTEGER :: ad_from62
13374 INTEGER :: ad_from63
14282 ! set order for the advection schemes
14283 ! write(6,*) ' in pd advection routine '
14284 ! Empty arrays just in case:
14285 IF (config_flags%polar) THEN
14293 IF (kte .GT. kde - 1) THEN
14298 horz_order = config_flags%h_sca_adv_order
14299 vert_order = config_flags%v_sca_adv_order
14300 ! determine boundary mods for flux operators
14301 ! We degrade the flux operators from 3rd/4th order
14302 ! to second order one gridpoint in from the boundaries for
14303 ! all boundary conditions except periodic and symmetry - these
14304 ! conditions have boundary zone data fill for correct application
14305 ! of the higher order flux stencils
14306 degrade_xs = .true.
14307 degrade_xe = .true.
14308 degrade_ys = .true.
14309 degrade_ye = .true.
14310 ! begin with horizontal flux divergence
14311 ! here is the choice of flux operators
14312 IF (horz_order .EQ. 6) THEN
14313 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
14314 & its .GT. ids + 3) degrade_xs = .false.
14315 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
14316 & ite .LT. ide - 4) degrade_xe = .false.
14317 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
14318 & jts .GT. jds + 3) degrade_ys = .false.
14319 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
14320 & jte .LT. jde - 4) degrade_ye = .false.
14321 IF (kte .GT. kde - 1) THEN
14327 IF (ite .GT. ide - 1) THEN
14334 IF (jte .GT. jde - 1) THEN
14340 j_start_f = j_start
14341 j_end_f = j_end + 1
14342 !-- modify loop bounds if open or specified
14343 ! IF(degrade_xs) i_start = MAX(its-1,ids-1)
14344 ! IF(degrade_xe) i_end = MIN(ite+1,ide-2)
14345 IF (degrade_xs) THEN
14346 IF (its - 1 .LT. ids) THEN
14352 IF (degrade_xe) THEN
14353 IF (ite + 1 .GT. ide - 1) THEN
14359 IF (degrade_ys) THEN
14360 IF (jts - 1 .LT. jds + 1) THEN
14365 j_start_f = jds + 3
14367 IF (degrade_ye) THEN
14368 IF (jte + 1 .GT. jde - 2) THEN
14375 ad_from26 = j_start
14376 ! compute fluxes, 6th order
14377 j_loop_y_flux_6:DO j=ad_from26,j_end+1
14378 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
14381 ad_from21 = i_start
14382 DO i=ad_from21,i_end
14385 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
14387 mu = 0.5*(mut(i, j)+mut(i, j-1))
14388 CALL PUSHREAL8(vel)
14391 IF (cr .GE. 0.) THEN
14393 CALL PUSHCONTROL1B(0)
14396 CALL PUSHCONTROL1B(1)
14399 IF (1.0 .GT. y1) THEN
14400 CALL PUSHREAL8(min3)
14402 CALL PUSHCONTROL1B(0)
14404 CALL PUSHREAL8(min3)
14406 CALL PUSHCONTROL1B(1)
14408 IF (cr .GE. 0.) THEN
14410 CALL PUSHCONTROL1B(0)
14413 CALL PUSHCONTROL1B(1)
14416 IF (-1.0 .LT. y52) THEN
14417 CALL PUSHREAL8(max2)
14419 CALL PUSHCONTROL1B(0)
14421 CALL PUSHREAL8(max2)
14423 CALL PUSHCONTROL1B(1)
14425 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min3*field_old(i, k, j-1)+&
14426 & 0.5*max2*field_old(i, k, j))
14427 fqy(i, k, j) = vel*(37./60.*(field(i, k, j)+field(i, k, j-1)&
14428 & )-2./15.*(field(i, k, j+1)+field(i, k, j-2))+1./60.*(field&
14429 & (i, k, j+2)+field(i, k, j-3)))
14430 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
14432 CALL PUSHINTEGER4(i - 1)
14433 CALL PUSHINTEGER4(ad_from21)
14435 CALL PUSHCONTROL3B(5)
14436 ELSE IF (j .EQ. jds + 1) THEN
14437 ! 2nd order flux next to south boundary
14439 ad_from22 = i_start
14440 DO i=ad_from22,i_end
14443 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
14445 mu = 0.5*(mut(i, j)+mut(i, j-1))
14446 CALL PUSHREAL8(vel)
14449 IF (cr .GE. 0.) THEN
14451 CALL PUSHCONTROL1B(0)
14454 CALL PUSHCONTROL1B(1)
14457 IF (1.0 .GT. y2) THEN
14458 CALL PUSHREAL8(min4)
14460 CALL PUSHCONTROL1B(0)
14462 CALL PUSHREAL8(min4)
14464 CALL PUSHCONTROL1B(1)
14466 IF (cr .GE. 0.) THEN
14468 CALL PUSHCONTROL1B(0)
14471 CALL PUSHCONTROL1B(1)
14474 IF (-1.0 .LT. y53) THEN
14475 CALL PUSHREAL8(max3)
14477 CALL PUSHCONTROL1B(0)
14479 CALL PUSHREAL8(max3)
14481 CALL PUSHCONTROL1B(1)
14483 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min4*field_old(i, k, j-1)+&
14484 & 0.5*max3*field_old(i, k, j))
14485 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j&
14487 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
14489 CALL PUSHINTEGER4(i - 1)
14490 CALL PUSHINTEGER4(ad_from22)
14492 CALL PUSHCONTROL3B(4)
14493 ELSE IF (j .EQ. jds + 2) THEN
14494 ! third of 4th order flux 2 in from south boundary
14496 ad_from23 = i_start
14497 DO i=ad_from23,i_end
14500 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
14502 mu = 0.5*(mut(i, j)+mut(i, j-1))
14503 CALL PUSHREAL8(vel)
14506 IF (cr .GE. 0.) THEN
14508 CALL PUSHCONTROL1B(0)
14511 CALL PUSHCONTROL1B(1)
14514 IF (1.0 .GT. y3) THEN
14515 CALL PUSHREAL8(min5)
14517 CALL PUSHCONTROL1B(0)
14519 CALL PUSHREAL8(min5)
14521 CALL PUSHCONTROL1B(1)
14523 IF (cr .GE. 0.) THEN
14525 CALL PUSHCONTROL1B(0)
14528 CALL PUSHCONTROL1B(1)
14531 IF (-1.0 .LT. y54) THEN
14532 CALL PUSHREAL8(max4)
14534 CALL PUSHCONTROL1B(0)
14536 CALL PUSHREAL8(max4)
14538 CALL PUSHCONTROL1B(1)
14540 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min5*field_old(i, k, j-1)+&
14541 & 0.5*max4*field_old(i, k, j))
14542 fqy(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k, j-1))&
14543 & -1./12.*(field(i, k, j+1)+field(i, k, j-2)))
14544 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
14546 CALL PUSHINTEGER4(i - 1)
14547 CALL PUSHINTEGER4(ad_from23)
14549 CALL PUSHCONTROL3B(3)
14550 ELSE IF (j .EQ. jde - 1) THEN
14551 ! 2nd order flux next to north boundary
14553 ad_from24 = i_start
14554 DO i=ad_from24,i_end
14557 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
14559 mu = 0.5*(mut(i, j)+mut(i, j-1))
14560 CALL PUSHREAL8(vel)
14563 IF (cr .GE. 0.) THEN
14565 CALL PUSHCONTROL1B(0)
14568 CALL PUSHCONTROL1B(1)
14571 IF (1.0 .GT. y4) THEN
14572 CALL PUSHREAL8(min6)
14574 CALL PUSHCONTROL1B(0)
14576 CALL PUSHREAL8(min6)
14578 CALL PUSHCONTROL1B(1)
14580 IF (cr .GE. 0.) THEN
14582 CALL PUSHCONTROL1B(0)
14585 CALL PUSHCONTROL1B(1)
14588 IF (-1.0 .LT. y55) THEN
14589 CALL PUSHREAL8(max5)
14591 CALL PUSHCONTROL1B(0)
14593 CALL PUSHREAL8(max5)
14595 CALL PUSHCONTROL1B(1)
14597 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min6*field_old(i, k, j-1)+&
14598 & 0.5*max5*field_old(i, k, j))
14599 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j&
14601 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
14603 CALL PUSHINTEGER4(i - 1)
14604 CALL PUSHINTEGER4(ad_from24)
14606 CALL PUSHCONTROL3B(2)
14607 ELSE IF (j .EQ. jde - 2) THEN
14608 ! 3rd or 4th order flux 2 in from north boundary
14610 ad_from25 = i_start
14611 DO i=ad_from25,i_end
14614 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
14616 mu = 0.5*(mut(i, j)+mut(i, j-1))
14617 CALL PUSHREAL8(vel)
14620 IF (cr .GE. 0.) THEN
14622 CALL PUSHCONTROL1B(0)
14625 CALL PUSHCONTROL1B(1)
14628 IF (1.0 .GT. y5) THEN
14629 CALL PUSHREAL8(min7)
14631 CALL PUSHCONTROL1B(0)
14633 CALL PUSHREAL8(min7)
14635 CALL PUSHCONTROL1B(1)
14637 IF (cr .GE. 0.) THEN
14639 CALL PUSHCONTROL1B(0)
14642 CALL PUSHCONTROL1B(1)
14645 IF (-1.0 .LT. y56) THEN
14646 CALL PUSHREAL8(max6)
14648 CALL PUSHCONTROL1B(0)
14650 CALL PUSHREAL8(max6)
14652 CALL PUSHCONTROL1B(1)
14654 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min7*field_old(i, k, j-1)+&
14655 & 0.5*max6*field_old(i, k, j))
14656 fqy(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k, j-1))&
14657 & -1./12.*(field(i, k, j+1)+field(i, k, j-2)))
14658 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
14660 CALL PUSHINTEGER4(i - 1)
14661 CALL PUSHINTEGER4(ad_from25)
14663 CALL PUSHCONTROL3B(1)
14665 CALL PUSHCONTROL3B(0)
14667 END DO j_loop_y_flux_6
14668 CALL PUSHINTEGER4(j - 1)
14669 CALL PUSHINTEGER4(ad_from26)
14671 !-- these bounds are for periodic and sym conditions
14673 IF (ite .GT. ide - 1) THEN
14679 i_start_f = i_start
14680 i_end_f = i_end + 1
14682 IF (jte .GT. jde - 1) THEN
14688 !-- modify loop bounds for open and specified b.c
14689 ! IF(degrade_ys) j_start = MAX(jts-1,jds+1)
14690 ! IF(degrade_ye) j_end = MIN(jte+1,jde-2)
14691 IF (degrade_ys) THEN
14692 IF (jts - 1 .LT. jds) THEN
14698 IF (degrade_ye) THEN
14699 IF (jte + 1 .GT. jde - 1) THEN
14705 IF (degrade_xs) THEN
14706 IF (ids + 1 .LT. its - 1) THEN
14711 i_start_f = ids + 3
14713 IF (degrade_xe) THEN
14714 IF (ide - 2 .GT. ite + 1) THEN
14721 ad_from28 = j_start
14723 DO j=ad_from28,j_end
14726 DO i=i_start_f,i_end_f
14729 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
14731 mu = 0.5*(mut(i, j)+mut(i-1, j))
14732 CALL PUSHREAL8(vel)
14735 IF (cr .GE. 0.) THEN
14737 CALL PUSHCONTROL1B(0)
14740 CALL PUSHCONTROL1B(1)
14743 IF (1.0 .GT. y6) THEN
14744 CALL PUSHREAL8(min10)
14746 CALL PUSHCONTROL1B(0)
14748 CALL PUSHREAL8(min10)
14750 CALL PUSHCONTROL1B(1)
14752 IF (cr .GE. 0.) THEN
14754 CALL PUSHCONTROL1B(0)
14757 CALL PUSHCONTROL1B(1)
14760 IF (-1.0 .LT. y57) THEN
14761 CALL PUSHREAL8(max7)
14763 CALL PUSHCONTROL1B(0)
14765 CALL PUSHREAL8(max7)
14767 CALL PUSHCONTROL1B(1)
14769 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min10*field_old(i-1, k, j)+0.5&
14770 & *max7*field_old(i, k, j))
14771 fqx(i, k, j) = vel*(37./60.*(field(i, k, j)+field(i-1, k, j))-&
14772 & 2./15.*(field(i+1, k, j)+field(i-2, k, j))+1./60.*(field(i+2&
14773 & , k, j)+field(i-3, k, j)))
14774 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
14777 ! lower order fluxes close to boundaries (if not periodic or symmetric)
14778 IF (degrade_xs) THEN
14779 ad_from27 = i_start
14780 DO i=ad_from27,i_start_f-1
14781 IF (i .EQ. ids + 1) THEN
14786 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
14788 mu = 0.5*(mut(i, j)+mut(i-1, j))
14789 CALL PUSHREAL8(vel)
14790 vel = ru(i, k, j)/mu
14792 IF (cr .GE. 0.) THEN
14794 CALL PUSHCONTROL1B(0)
14797 CALL PUSHCONTROL1B(1)
14800 IF (1.0 .GT. y7) THEN
14801 CALL PUSHREAL8(min11)
14803 CALL PUSHCONTROL1B(0)
14805 CALL PUSHREAL8(min11)
14807 CALL PUSHCONTROL1B(1)
14809 IF (cr .GE. 0.) THEN
14811 CALL PUSHCONTROL1B(0)
14814 CALL PUSHCONTROL1B(1)
14817 IF (-1.0 .LT. y58) THEN
14818 CALL PUSHREAL8(max8)
14820 CALL PUSHCONTROL1B(0)
14822 CALL PUSHREAL8(max8)
14824 CALL PUSHCONTROL1B(1)
14826 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min11*field_old(i-1, k, j)&
14827 & +0.5*max8*field_old(i, k, j))
14828 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, &
14830 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
14832 CALL PUSHCONTROL1B(0)
14834 CALL PUSHCONTROL1B(1)
14836 IF (i .EQ. ids + 2) THEN
14841 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
14843 mu = 0.5*(mut(i, j)+mut(i-1, j))
14844 CALL PUSHREAL8(vel)
14847 IF (cr .GE. 0.) THEN
14849 CALL PUSHCONTROL1B(0)
14852 CALL PUSHCONTROL1B(1)
14855 IF (1.0 .GT. y8) THEN
14856 CALL PUSHREAL8(min12)
14858 CALL PUSHCONTROL1B(0)
14860 CALL PUSHREAL8(min12)
14862 CALL PUSHCONTROL1B(1)
14864 IF (cr .GE. 0.) THEN
14866 CALL PUSHCONTROL1B(0)
14869 CALL PUSHCONTROL1B(1)
14872 IF (-1.0 .LT. y59) THEN
14873 CALL PUSHREAL8(max9)
14875 CALL PUSHCONTROL1B(0)
14877 CALL PUSHREAL8(max9)
14879 CALL PUSHCONTROL1B(1)
14881 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min12*field_old(i-1, k, j)&
14882 & +0.5*max9*field_old(i, k, j))
14883 fqx(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i-1, k, j&
14884 & ))-1./12.*(field(i+1, k, j)+field(i-2, k, j)))
14885 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
14887 CALL PUSHCONTROL1B(1)
14889 CALL PUSHCONTROL1B(0)
14892 CALL PUSHINTEGER4(ad_from27)
14893 CALL PUSHCONTROL1B(0)
14895 CALL PUSHCONTROL1B(1)
14897 IF (degrade_xe) THEN
14898 DO i=i_end_f+1,i_end+1
14899 IF (i .EQ. ide - 1) THEN
14900 ! second order flux next to the boundary
14904 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
14906 mu = 0.5*(mut(i, j)+mut(i-1, j))
14907 CALL PUSHREAL8(vel)
14910 IF (cr .GE. 0.) THEN
14912 CALL PUSHCONTROL1B(0)
14915 CALL PUSHCONTROL1B(1)
14918 IF (1.0 .GT. y9) THEN
14919 CALL PUSHREAL8(min13)
14921 CALL PUSHCONTROL1B(0)
14923 CALL PUSHREAL8(min13)
14925 CALL PUSHCONTROL1B(1)
14927 IF (cr .GE. 0.) THEN
14929 CALL PUSHCONTROL1B(0)
14932 CALL PUSHCONTROL1B(1)
14935 IF (-1.0 .LT. y60) THEN
14936 CALL PUSHREAL8(max10)
14938 CALL PUSHCONTROL1B(0)
14940 CALL PUSHREAL8(max10)
14942 CALL PUSHCONTROL1B(1)
14944 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min13*field_old(i-1, k, j)&
14945 & +0.5*max10*field_old(i, k, j))
14946 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, &
14948 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
14950 CALL PUSHCONTROL1B(0)
14952 CALL PUSHCONTROL1B(1)
14954 IF (i .EQ. ide - 2) THEN
14955 ! fourth order flux one in from the boundary
14959 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
14961 mu = 0.5*(mut(i, j)+mut(i-1, j))
14962 CALL PUSHREAL8(vel)
14965 IF (cr .GE. 0.) THEN
14967 CALL PUSHCONTROL1B(0)
14970 CALL PUSHCONTROL1B(1)
14973 IF (1.0 .GT. y10) THEN
14974 CALL PUSHREAL8(min14)
14976 CALL PUSHCONTROL1B(0)
14978 CALL PUSHREAL8(min14)
14980 CALL PUSHCONTROL1B(1)
14982 IF (cr .GE. 0.) THEN
14984 CALL PUSHCONTROL1B(0)
14987 CALL PUSHCONTROL1B(1)
14990 IF (-1.0 .LT. y61) THEN
14991 CALL PUSHREAL8(max11)
14993 CALL PUSHCONTROL1B(0)
14995 CALL PUSHREAL8(max11)
14997 CALL PUSHCONTROL1B(1)
14999 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min14*field_old(i-1, k, j)&
15000 & +0.5*max11*field_old(i, k, j))
15001 fqx(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i-1, k, j&
15002 & ))-1./12.*(field(i+1, k, j)+field(i-2, k, j)))
15003 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
15005 CALL PUSHCONTROL1B(1)
15007 CALL PUSHCONTROL1B(0)
15010 CALL PUSHINTEGER4(i - 1)
15011 CALL PUSHCONTROL1B(1)
15013 CALL PUSHCONTROL1B(0)
15016 CALL PUSHINTEGER4(j - 1)
15017 CALL PUSHINTEGER4(ad_from28)
15018 CALL PUSHCONTROL3B(5)
15019 ELSE IF (horz_order .EQ. 5) THEN
15020 ! enddo for outer J loop
15021 !--- end of 6th order horizontal flux calculation
15022 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
15023 & its .GT. ids + 3) degrade_xs = .false.
15024 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
15025 & ite .LT. ide - 4) degrade_xe = .false.
15026 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
15027 & jts .GT. jds + 3) degrade_ys = .false.
15028 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
15029 & jte .LT. jde - 4) degrade_ye = .false.
15030 IF (kte .GT. kde - 1) THEN
15036 IF (ite .GT. ide - 1) THEN
15043 IF (jte .GT. jde - 1) THEN
15049 j_start_f = j_start
15050 j_end_f = j_end + 1
15051 !-- modify loop bounds if open or specified
15052 ! IF(degrade_xs) i_start = MAX(its-1,ids-1)
15053 ! IF(degrade_xe) i_end = MIN(ite+1,ide-2)
15054 IF (degrade_xs) THEN
15055 IF (its - 1 .LT. ids) THEN
15061 IF (degrade_xe) THEN
15062 IF (ite + 1 .GT. ide - 1) THEN
15068 IF (degrade_ys) THEN
15069 IF (jts - 1 .LT. jds + 1) THEN
15074 j_start_f = jds + 3
15076 IF (degrade_ye) THEN
15077 IF (jte + 1 .GT. jde - 2) THEN
15085 ! compute fluxes, 5th order
15086 j_loop_y_flux_5:DO j=ad_from4,j_end+1
15087 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
15094 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
15096 mu = 0.5*(mut(i, j)+mut(i, j-1))
15097 CALL PUSHREAL8(vel)
15100 IF (cr .GE. 0.) THEN
15102 CALL PUSHCONTROL1B(0)
15105 CALL PUSHCONTROL1B(1)
15108 IF (1.0 .GT. y11) THEN
15109 CALL PUSHREAL8(min17)
15111 CALL PUSHCONTROL1B(0)
15113 CALL PUSHREAL8(min17)
15115 CALL PUSHCONTROL1B(1)
15117 IF (cr .GE. 0.) THEN
15119 CALL PUSHCONTROL1B(0)
15122 CALL PUSHCONTROL1B(1)
15125 IF (-1.0 .LT. y62) THEN
15126 CALL PUSHREAL8(max12)
15128 CALL PUSHCONTROL1B(0)
15130 CALL PUSHREAL8(max12)
15132 CALL PUSHCONTROL1B(1)
15134 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min17*field_old(i, k, j-1)+&
15135 & 0.5*max12*field_old(i, k, j))
15136 fqy(i, k, j) = vel*(37./60.*(field(i, k, j)+field(i, k, j-1)&
15137 & )-2./15.*(field(i, k, j+1)+field(i, k, j-2))+1./60.*(field&
15138 & (i, k, j+2)+field(i, k, j-3))-SIGN(1, time_step)*SIGN(1., &
15139 & vel)*(1./60.)*(field(i, k, j+2)-field(i, k, j-3)-5.*(field&
15140 & (i, k, j+1)-field(i, k, j-2))+10.*(field(i, k, j)-field(i&
15142 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
15144 CALL PUSHINTEGER4(i - 1)
15145 CALL PUSHINTEGER4(ad_from)
15147 CALL PUSHCONTROL3B(5)
15148 ELSE IF (j .EQ. jds + 1) THEN
15149 ! 2nd order flux next to south boundary
15152 DO i=ad_from0,i_end
15155 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
15157 mu = 0.5*(mut(i, j)+mut(i, j-1))
15158 CALL PUSHREAL8(vel)
15161 IF (cr .GE. 0.) THEN
15163 CALL PUSHCONTROL1B(0)
15166 CALL PUSHCONTROL1B(1)
15169 IF (1.0 .GT. y12) THEN
15170 CALL PUSHREAL8(min18)
15172 CALL PUSHCONTROL1B(0)
15174 CALL PUSHREAL8(min18)
15176 CALL PUSHCONTROL1B(1)
15178 IF (cr .GE. 0.) THEN
15180 CALL PUSHCONTROL1B(0)
15183 CALL PUSHCONTROL1B(1)
15186 IF (-1.0 .LT. y63) THEN
15187 CALL PUSHREAL8(max13)
15189 CALL PUSHCONTROL1B(0)
15191 CALL PUSHREAL8(max13)
15193 CALL PUSHCONTROL1B(1)
15195 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min18*field_old(i, k, j-1)+&
15196 & 0.5*max13*field_old(i, k, j))
15197 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j&
15199 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
15201 CALL PUSHINTEGER4(i - 1)
15202 CALL PUSHINTEGER4(ad_from0)
15204 CALL PUSHCONTROL3B(4)
15205 ELSE IF (j .EQ. jds + 2) THEN
15206 ! third of 4th order flux 2 in from south boundary
15209 DO i=ad_from1,i_end
15212 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
15214 mu = 0.5*(mut(i, j)+mut(i, j-1))
15215 CALL PUSHREAL8(vel)
15218 IF (cr .GE. 0.) THEN
15220 CALL PUSHCONTROL1B(0)
15223 CALL PUSHCONTROL1B(1)
15226 IF (1.0 .GT. y13) THEN
15227 CALL PUSHREAL8(min19)
15229 CALL PUSHCONTROL1B(0)
15231 CALL PUSHREAL8(min19)
15233 CALL PUSHCONTROL1B(1)
15235 IF (cr .GE. 0.) THEN
15237 CALL PUSHCONTROL1B(0)
15240 CALL PUSHCONTROL1B(1)
15243 IF (-1.0 .LT. y64) THEN
15244 CALL PUSHREAL8(max14)
15246 CALL PUSHCONTROL1B(0)
15248 CALL PUSHREAL8(max14)
15250 CALL PUSHCONTROL1B(1)
15252 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min19*field_old(i, k, j-1)+&
15253 & 0.5*max14*field_old(i, k, j))
15254 fqy(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k, j-1))&
15255 & -1./12.*(field(i, k, j+1)+field(i, k, j-2))+SIGN(1, &
15256 & time_step)*SIGN(1., vel)*(1./12.)*(field(i, k, j+1)-field(&
15257 & i, k, j-2)-3.*(field(i, k, j)-field(i, k, j-1))))
15258 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
15260 CALL PUSHINTEGER4(i - 1)
15261 CALL PUSHINTEGER4(ad_from1)
15263 CALL PUSHCONTROL3B(3)
15264 ELSE IF (j .EQ. jde - 1) THEN
15265 ! 2nd order flux next to north boundary
15268 DO i=ad_from2,i_end
15271 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
15273 mu = 0.5*(mut(i, j)+mut(i, j-1))
15274 CALL PUSHREAL8(vel)
15277 IF (cr .GE. 0.) THEN
15279 CALL PUSHCONTROL1B(0)
15282 CALL PUSHCONTROL1B(1)
15285 IF (1.0 .GT. y14) THEN
15286 CALL PUSHREAL8(min20)
15288 CALL PUSHCONTROL1B(0)
15290 CALL PUSHREAL8(min20)
15292 CALL PUSHCONTROL1B(1)
15294 IF (cr .GE. 0.) THEN
15296 CALL PUSHCONTROL1B(0)
15299 CALL PUSHCONTROL1B(1)
15302 IF (-1.0 .LT. y65) THEN
15303 CALL PUSHREAL8(max15)
15305 CALL PUSHCONTROL1B(0)
15307 CALL PUSHREAL8(max15)
15309 CALL PUSHCONTROL1B(1)
15311 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min20*field_old(i, k, j-1)+&
15312 & 0.5*max15*field_old(i, k, j))
15313 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j&
15315 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
15317 CALL PUSHINTEGER4(i - 1)
15318 CALL PUSHINTEGER4(ad_from2)
15320 CALL PUSHCONTROL3B(2)
15321 ELSE IF (j .EQ. jde - 2) THEN
15322 ! 3rd or 4th order flux 2 in from north boundary
15325 DO i=ad_from3,i_end
15328 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
15330 mu = 0.5*(mut(i, j)+mut(i, j-1))
15331 CALL PUSHREAL8(vel)
15334 IF (cr .GE. 0.) THEN
15336 CALL PUSHCONTROL1B(0)
15339 CALL PUSHCONTROL1B(1)
15342 IF (1.0 .GT. y15) THEN
15343 CALL PUSHREAL8(min21)
15345 CALL PUSHCONTROL1B(0)
15347 CALL PUSHREAL8(min21)
15349 CALL PUSHCONTROL1B(1)
15351 IF (cr .GE. 0.) THEN
15353 CALL PUSHCONTROL1B(0)
15356 CALL PUSHCONTROL1B(1)
15359 IF (-1.0 .LT. y66) THEN
15360 CALL PUSHREAL8(max16)
15362 CALL PUSHCONTROL1B(0)
15364 CALL PUSHREAL8(max16)
15366 CALL PUSHCONTROL1B(1)
15368 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min21*field_old(i, k, j-1)+&
15369 & 0.5*max16*field_old(i, k, j))
15370 fqy(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k, j-1))&
15371 & -1./12.*(field(i, k, j+1)+field(i, k, j-2))+SIGN(1, &
15372 & time_step)*SIGN(1., vel)*(1./12.)*(field(i, k, j+1)-field(&
15373 & i, k, j-2)-3.*(field(i, k, j)-field(i, k, j-1))))
15374 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
15376 CALL PUSHINTEGER4(i - 1)
15377 CALL PUSHINTEGER4(ad_from3)
15379 CALL PUSHCONTROL3B(1)
15381 CALL PUSHCONTROL3B(0)
15383 END DO j_loop_y_flux_5
15384 CALL PUSHINTEGER4(j - 1)
15385 CALL PUSHINTEGER4(ad_from4)
15387 !-- these bounds are for periodic and sym conditions
15389 IF (ite .GT. ide - 1) THEN
15395 i_start_f = i_start
15396 i_end_f = i_end + 1
15398 IF (jte .GT. jde - 1) THEN
15404 !-- modify loop bounds for open and specified b.c
15405 ! IF(degrade_ys) j_start = MAX(jts-1,jds+1)
15406 ! IF(degrade_ye) j_end = MIN(jte+1,jde-2)
15407 IF (degrade_ys) THEN
15408 IF (jts - 1 .LT. jds) THEN
15414 IF (degrade_ye) THEN
15415 IF (jte + 1 .GT. jde - 1) THEN
15421 IF (degrade_xs) THEN
15422 IF (ids + 1 .LT. its - 1) THEN
15427 i_start_f = ids + 3
15429 IF (degrade_xe) THEN
15430 IF (ide - 2 .GT. ite + 1) THEN
15439 DO j=ad_from6,j_end
15442 DO i=i_start_f,i_end_f
15445 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
15447 mu = 0.5*(mut(i, j)+mut(i-1, j))
15448 CALL PUSHREAL8(vel)
15451 IF (cr .GE. 0.) THEN
15453 CALL PUSHCONTROL1B(0)
15456 CALL PUSHCONTROL1B(1)
15459 IF (1.0 .GT. y16) THEN
15460 CALL PUSHREAL8(min24)
15462 CALL PUSHCONTROL1B(0)
15464 CALL PUSHREAL8(min24)
15466 CALL PUSHCONTROL1B(1)
15468 IF (cr .GE. 0.) THEN
15470 CALL PUSHCONTROL1B(0)
15473 CALL PUSHCONTROL1B(1)
15476 IF (-1.0 .LT. y67) THEN
15477 CALL PUSHREAL8(max17)
15479 CALL PUSHCONTROL1B(0)
15481 CALL PUSHREAL8(max17)
15483 CALL PUSHCONTROL1B(1)
15485 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min24*field_old(i-1, k, j)+0.5&
15486 & *max17*field_old(i, k, j))
15487 fqx(i, k, j) = vel*(37./60.*(field(i, k, j)+field(i-1, k, j))-&
15488 & 2./15.*(field(i+1, k, j)+field(i-2, k, j))+1./60.*(field(i+2&
15489 & , k, j)+field(i-3, k, j))-SIGN(1, time_step)*SIGN(1., vel)*(&
15490 & 1./60.)*(field(i+2, k, j)-field(i-3, k, j)-5.*(field(i+1, k&
15491 & , j)-field(i-2, k, j))+10.*(field(i, k, j)-field(i-1, k, j))&
15493 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
15496 ! lower order fluxes close to boundaries (if not periodic or symmetric)
15497 IF (degrade_xs) THEN
15499 DO i=ad_from5,i_start_f-1
15500 IF (i .EQ. ids + 1) THEN
15505 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
15507 mu = 0.5*(mut(i, j)+mut(i-1, j))
15508 CALL PUSHREAL8(vel)
15509 vel = ru(i, k, j)/mu
15511 IF (cr .GE. 0.) THEN
15513 CALL PUSHCONTROL1B(0)
15516 CALL PUSHCONTROL1B(1)
15519 IF (1.0 .GT. y17) THEN
15520 CALL PUSHREAL8(min25)
15522 CALL PUSHCONTROL1B(0)
15524 CALL PUSHREAL8(min25)
15526 CALL PUSHCONTROL1B(1)
15528 IF (cr .GE. 0.) THEN
15530 CALL PUSHCONTROL1B(0)
15533 CALL PUSHCONTROL1B(1)
15536 IF (-1.0 .LT. y68) THEN
15537 CALL PUSHREAL8(max18)
15539 CALL PUSHCONTROL1B(0)
15541 CALL PUSHREAL8(max18)
15543 CALL PUSHCONTROL1B(1)
15545 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min25*field_old(i-1, k, j)&
15546 & +0.5*max18*field_old(i, k, j))
15547 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, &
15549 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
15551 CALL PUSHCONTROL1B(0)
15553 CALL PUSHCONTROL1B(1)
15555 IF (i .EQ. ids + 2) THEN
15560 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
15562 mu = 0.5*(mut(i, j)+mut(i-1, j))
15563 CALL PUSHREAL8(vel)
15566 IF (cr .GE. 0.) THEN
15568 CALL PUSHCONTROL1B(0)
15571 CALL PUSHCONTROL1B(1)
15574 IF (1.0 .GT. y18) THEN
15575 CALL PUSHREAL8(min26)
15577 CALL PUSHCONTROL1B(0)
15579 CALL PUSHREAL8(min26)
15581 CALL PUSHCONTROL1B(1)
15583 IF (cr .GE. 0.) THEN
15585 CALL PUSHCONTROL1B(0)
15588 CALL PUSHCONTROL1B(1)
15591 IF (-1.0 .LT. y69) THEN
15592 CALL PUSHREAL8(max19)
15594 CALL PUSHCONTROL1B(0)
15596 CALL PUSHREAL8(max19)
15598 CALL PUSHCONTROL1B(1)
15600 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min26*field_old(i-1, k, j)&
15601 & +0.5*max19*field_old(i, k, j))
15602 fqx(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i-1, k, j&
15603 & ))-1./12.*(field(i+1, k, j)+field(i-2, k, j))+SIGN(1, &
15604 & time_step)*SIGN(1., vel)*(1./12.)*(field(i+1, k, j)-&
15605 & field(i-2, k, j)-3.*(field(i, k, j)-field(i-1, k, j))))
15606 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
15608 CALL PUSHCONTROL1B(1)
15610 CALL PUSHCONTROL1B(0)
15613 CALL PUSHINTEGER4(ad_from5)
15614 CALL PUSHCONTROL1B(0)
15616 CALL PUSHCONTROL1B(1)
15618 IF (degrade_xe) THEN
15619 DO i=i_end_f+1,i_end+1
15620 IF (i .EQ. ide - 1) THEN
15621 ! second order flux next to the boundary
15625 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
15627 mu = 0.5*(mut(i, j)+mut(i-1, j))
15628 CALL PUSHREAL8(vel)
15631 IF (cr .GE. 0.) THEN
15633 CALL PUSHCONTROL1B(0)
15636 CALL PUSHCONTROL1B(1)
15639 IF (1.0 .GT. y19) THEN
15640 CALL PUSHREAL8(min27)
15642 CALL PUSHCONTROL1B(0)
15644 CALL PUSHREAL8(min27)
15646 CALL PUSHCONTROL1B(1)
15648 IF (cr .GE. 0.) THEN
15650 CALL PUSHCONTROL1B(0)
15653 CALL PUSHCONTROL1B(1)
15656 IF (-1.0 .LT. y70) THEN
15657 CALL PUSHREAL8(max20)
15659 CALL PUSHCONTROL1B(0)
15661 CALL PUSHREAL8(max20)
15663 CALL PUSHCONTROL1B(1)
15665 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min27*field_old(i-1, k, j)&
15666 & +0.5*max20*field_old(i, k, j))
15667 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, &
15669 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
15671 CALL PUSHCONTROL1B(0)
15673 CALL PUSHCONTROL1B(1)
15675 IF (i .EQ. ide - 2) THEN
15676 ! third order flux one in from the boundary
15680 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
15682 mu = 0.5*(mut(i, j)+mut(i-1, j))
15683 CALL PUSHREAL8(vel)
15686 IF (cr .GE. 0.) THEN
15688 CALL PUSHCONTROL1B(0)
15691 CALL PUSHCONTROL1B(1)
15694 IF (1.0 .GT. y20) THEN
15695 CALL PUSHREAL8(min28)
15697 CALL PUSHCONTROL1B(0)
15699 CALL PUSHREAL8(min28)
15701 CALL PUSHCONTROL1B(1)
15703 IF (cr .GE. 0.) THEN
15705 CALL PUSHCONTROL1B(0)
15708 CALL PUSHCONTROL1B(1)
15711 IF (-1.0 .LT. y71) THEN
15712 CALL PUSHREAL8(max21)
15714 CALL PUSHCONTROL1B(0)
15716 CALL PUSHREAL8(max21)
15718 CALL PUSHCONTROL1B(1)
15720 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min28*field_old(i-1, k, j)&
15721 & +0.5*max21*field_old(i, k, j))
15722 fqx(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i-1, k, j&
15723 & ))-1./12.*(field(i+1, k, j)+field(i-2, k, j))+SIGN(1, &
15724 & time_step)*SIGN(1., vel)*(1./12.)*(field(i+1, k, j)-&
15725 & field(i-2, k, j)-3.*(field(i, k, j)-field(i-1, k, j))))
15726 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
15728 CALL PUSHCONTROL1B(1)
15730 CALL PUSHCONTROL1B(0)
15733 CALL PUSHINTEGER4(i - 1)
15734 CALL PUSHCONTROL1B(1)
15736 CALL PUSHCONTROL1B(0)
15739 CALL PUSHINTEGER4(j - 1)
15740 CALL PUSHINTEGER4(ad_from6)
15741 CALL PUSHCONTROL3B(4)
15742 ELSE IF (horz_order .EQ. 4) THEN
15743 ! enddo for outer J loop
15744 !--- end of 5th order horizontal flux calculation
15745 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
15746 & its .GT. ids + 1) degrade_xs = .false.
15747 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
15748 & ite .LT. ide - 2) degrade_xe = .false.
15749 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
15750 & jts .GT. jds + 1) degrade_ys = .false.
15751 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
15752 & jte .LT. jde - 2) degrade_ye = .false.
15753 IF (kte .GT. kde - 1) THEN
15759 IF (ite .GT. ide - 1) THEN
15766 IF (jte .GT. jde - 1) THEN
15772 j_start_f = j_start
15773 j_end_f = j_end + 1
15774 !-- modify loop bounds if open or specified
15775 IF (degrade_xs) i_start = its
15776 IF (degrade_xe) THEN
15777 IF (ite .GT. ide - 1) THEN
15783 IF (degrade_ys) THEN
15784 IF (jts .LT. jds + 1) THEN
15789 j_start_f = jds + 2
15791 IF (degrade_ye) THEN
15792 IF (jte .GT. jde - 2) THEN
15799 ad_from10 = j_start
15800 ! compute fluxes, 4th order
15801 j_loop_y_flux_4:DO j=ad_from10,j_end+1
15802 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
15806 DO i=ad_from7,i_end
15809 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
15811 mu = 0.5*(mut(i, j)+mut(i, j-1))
15812 CALL PUSHREAL8(vel)
15815 IF (cr .GE. 0.) THEN
15817 CALL PUSHCONTROL1B(0)
15820 CALL PUSHCONTROL1B(1)
15823 IF (1.0 .GT. y21) THEN
15824 CALL PUSHREAL8(min31)
15826 CALL PUSHCONTROL1B(0)
15828 CALL PUSHREAL8(min31)
15830 CALL PUSHCONTROL1B(1)
15832 IF (cr .GE. 0.) THEN
15834 CALL PUSHCONTROL1B(0)
15837 CALL PUSHCONTROL1B(1)
15840 IF (-1.0 .LT. y72) THEN
15841 CALL PUSHREAL8(max22)
15843 CALL PUSHCONTROL1B(0)
15845 CALL PUSHREAL8(max22)
15847 CALL PUSHCONTROL1B(1)
15849 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min31*field_old(i, k, j-1)+&
15850 & 0.5*max22*field_old(i, k, j))
15851 fqy(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k, j-1))&
15852 & -1./12.*(field(i, k, j+1)+field(i, k, j-2)))
15853 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
15855 CALL PUSHINTEGER4(i - 1)
15856 CALL PUSHINTEGER4(ad_from7)
15858 CALL PUSHCONTROL2B(3)
15859 ELSE IF (j .EQ. jds + 1) THEN
15860 ! 2nd order flux next to south boundary
15863 DO i=ad_from8,i_end
15866 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
15868 mu = 0.5*(mut(i, j)+mut(i, j-1))
15869 CALL PUSHREAL8(vel)
15872 IF (cr .GE. 0.) THEN
15874 CALL PUSHCONTROL1B(0)
15877 CALL PUSHCONTROL1B(1)
15880 IF (1.0 .GT. y22) THEN
15881 CALL PUSHREAL8(min32)
15883 CALL PUSHCONTROL1B(0)
15885 CALL PUSHREAL8(min32)
15887 CALL PUSHCONTROL1B(1)
15889 IF (cr .GE. 0.) THEN
15891 CALL PUSHCONTROL1B(0)
15894 CALL PUSHCONTROL1B(1)
15897 IF (-1.0 .LT. y73) THEN
15898 CALL PUSHREAL8(max23)
15900 CALL PUSHCONTROL1B(0)
15902 CALL PUSHREAL8(max23)
15904 CALL PUSHCONTROL1B(1)
15906 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min32*field_old(i, k, j-1)+&
15907 & 0.5*max23*field_old(i, k, j))
15908 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j&
15910 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
15912 CALL PUSHINTEGER4(i - 1)
15913 CALL PUSHINTEGER4(ad_from8)
15915 CALL PUSHCONTROL2B(2)
15916 ELSE IF (j .EQ. jde - 1) THEN
15917 ! 2nd order flux next to north boundary
15920 DO i=ad_from9,i_end
15923 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
15925 mu = 0.5*(mut(i, j)+mut(i, j-1))
15926 CALL PUSHREAL8(vel)
15929 IF (cr .GE. 0.) THEN
15931 CALL PUSHCONTROL1B(0)
15934 CALL PUSHCONTROL1B(1)
15937 IF (1.0 .GT. y23) THEN
15938 CALL PUSHREAL8(min33)
15940 CALL PUSHCONTROL1B(0)
15942 CALL PUSHREAL8(min33)
15944 CALL PUSHCONTROL1B(1)
15946 IF (cr .GE. 0.) THEN
15948 CALL PUSHCONTROL1B(0)
15951 CALL PUSHCONTROL1B(1)
15954 IF (-1.0 .LT. y74) THEN
15955 CALL PUSHREAL8(max24)
15957 CALL PUSHCONTROL1B(0)
15959 CALL PUSHREAL8(max24)
15961 CALL PUSHCONTROL1B(1)
15963 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min33*field_old(i, k, j-1)+&
15964 & 0.5*max24*field_old(i, k, j))
15965 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j&
15967 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
15969 CALL PUSHINTEGER4(i - 1)
15970 CALL PUSHINTEGER4(ad_from9)
15972 CALL PUSHCONTROL2B(1)
15974 CALL PUSHCONTROL2B(0)
15976 END DO j_loop_y_flux_4
15977 CALL PUSHINTEGER4(j - 1)
15978 CALL PUSHINTEGER4(ad_from10)
15980 !-- these bounds are for periodic and sym conditions
15982 IF (ite .GT. ide - 1) THEN
15988 i_start_f = i_start
15989 i_end_f = i_end + 1
15991 IF (jte .GT. jde - 1) THEN
15997 !-- modify loop bounds for open and specified b.c
15998 IF (degrade_ys) j_start = jts
15999 IF (degrade_ye) THEN
16000 IF (jte .GT. jde - 1) THEN
16006 IF (degrade_xs) THEN
16007 IF (ids + 1 .LT. its) THEN
16012 i_start_f = i_start + 1
16014 IF (degrade_xe) THEN
16015 IF (ide - 2 .GT. ite) THEN
16022 ad_from11 = j_start
16024 DO j=ad_from11,j_end
16027 CALL PUSHINTEGER4(i)
16028 DO i=i_start_f,i_end_f
16031 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
16033 mu = 0.5*(mut(i, j)+mut(i-1, j))
16034 CALL PUSHREAL8(vel)
16037 IF (cr .GE. 0.) THEN
16039 CALL PUSHCONTROL1B(0)
16042 CALL PUSHCONTROL1B(1)
16045 IF (1.0 .GT. y24) THEN
16046 CALL PUSHREAL8(min36)
16048 CALL PUSHCONTROL1B(0)
16050 CALL PUSHREAL8(min36)
16052 CALL PUSHCONTROL1B(1)
16054 IF (cr .GE. 0.) THEN
16056 CALL PUSHCONTROL1B(0)
16059 CALL PUSHCONTROL1B(1)
16062 IF (-1.0 .LT. y75) THEN
16063 CALL PUSHREAL8(max25)
16065 CALL PUSHCONTROL1B(0)
16067 CALL PUSHREAL8(max25)
16069 CALL PUSHCONTROL1B(1)
16071 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min36*field_old(i-1, k, j)+0.5&
16072 & *max25*field_old(i, k, j))
16073 fqx(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i-1, k, j))-&
16074 & 1./12.*(field(i+1, k, j)+field(i-2, k, j)))
16075 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
16078 ! lower order fluxes close to boundaries (if not periodic or symmetric)
16079 IF (degrade_xs) THEN
16080 IF (i_start .EQ. ids + 1) THEN
16081 CALL PUSHINTEGER4(i)
16082 ! second order flux next to the boundary
16087 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
16089 mu = 0.5*(mut(i, j)+mut(i-1, j))
16090 CALL PUSHREAL8(vel)
16091 vel = ru(i, k, j)/mu
16093 IF (cr .GE. 0.) THEN
16095 CALL PUSHCONTROL1B(0)
16098 CALL PUSHCONTROL1B(1)
16101 IF (1.0 .GT. y25) THEN
16102 CALL PUSHREAL8(min37)
16104 CALL PUSHCONTROL1B(0)
16106 CALL PUSHREAL8(min37)
16108 CALL PUSHCONTROL1B(1)
16110 IF (cr .GE. 0.) THEN
16112 CALL PUSHCONTROL1B(0)
16115 CALL PUSHCONTROL1B(1)
16118 IF (-1.0 .LT. y76) THEN
16119 CALL PUSHREAL8(max26)
16121 CALL PUSHCONTROL1B(0)
16123 CALL PUSHREAL8(max26)
16125 CALL PUSHCONTROL1B(1)
16127 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min37*field_old(i-1, k, j)+&
16128 & 0.5*max26*field_old(i, k, j))
16129 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, k&
16131 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
16133 CALL PUSHCONTROL2B(0)
16135 CALL PUSHCONTROL2B(1)
16138 CALL PUSHCONTROL2B(2)
16140 IF (degrade_xe) THEN
16141 IF (i_end .EQ. ide - 2) THEN
16142 CALL PUSHINTEGER4(i)
16143 ! second order flux next to the boundary
16148 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
16150 mu = 0.5*(mut(i, j)+mut(i-1, j))
16151 CALL PUSHREAL8(vel)
16154 IF (cr .GE. 0.) THEN
16156 CALL PUSHCONTROL1B(0)
16159 CALL PUSHCONTROL1B(1)
16162 IF (1.0 .GT. y26) THEN
16163 CALL PUSHREAL8(min38)
16165 CALL PUSHCONTROL1B(0)
16167 CALL PUSHREAL8(min38)
16169 CALL PUSHCONTROL1B(1)
16171 IF (cr .GE. 0.) THEN
16173 CALL PUSHCONTROL1B(0)
16176 CALL PUSHCONTROL1B(1)
16179 IF (-1.0 .LT. y77) THEN
16180 CALL PUSHREAL8(max27)
16182 CALL PUSHCONTROL1B(0)
16184 CALL PUSHREAL8(max27)
16186 CALL PUSHCONTROL1B(1)
16188 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min38*field_old(i-1, k, j)+&
16189 & 0.5*max27*field_old(i, k, j))
16190 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, k&
16192 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
16194 CALL PUSHCONTROL2B(2)
16196 CALL PUSHCONTROL2B(1)
16199 CALL PUSHCONTROL2B(0)
16202 CALL PUSHINTEGER4(j - 1)
16203 CALL PUSHINTEGER4(ad_from11)
16204 CALL PUSHCONTROL3B(3)
16205 ELSE IF (horz_order .EQ. 3) THEN
16206 ! enddo for outer J loop
16207 !--- end of 4th order horizontal flux calculation
16208 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
16209 & its .GT. ids + 2) degrade_xs = .false.
16210 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
16211 & ite .LT. ide - 1) degrade_xe = .false.
16212 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
16213 & jts .GT. jds + 2) degrade_ys = .false.
16214 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
16215 & jte .LT. jde - 1) degrade_ye = .false.
16216 IF (kte .GT. kde - 1) THEN
16222 IF (ite .GT. ide - 1) THEN
16229 IF (jte .GT. jde - 1) THEN
16235 j_start_f = j_start
16236 j_end_f = j_end + 1
16237 !-- modify loop bounds if open or specified
16238 IF (degrade_xs) i_start = its
16239 IF (degrade_xe) THEN
16240 IF (ite .GT. ide - 1) THEN
16246 IF (degrade_ys) THEN
16247 IF (jts .LT. jds + 1) THEN
16252 j_start_f = jds + 2
16254 IF (degrade_ye) THEN
16255 IF (jte .GT. jde - 2) THEN
16262 ad_from15 = j_start
16263 ! compute fluxes, 3rd order
16264 j_loop_y_flux_3:DO j=ad_from15,j_end+1
16265 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
16268 ad_from12 = i_start
16269 DO i=ad_from12,i_end
16272 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
16274 mu = 0.5*(mut(i, j)+mut(i, j-1))
16275 CALL PUSHREAL8(vel)
16278 IF (cr .GE. 0.) THEN
16280 CALL PUSHCONTROL1B(0)
16283 CALL PUSHCONTROL1B(1)
16286 IF (1.0 .GT. y27) THEN
16287 CALL PUSHREAL8(min41)
16289 CALL PUSHCONTROL1B(0)
16291 CALL PUSHREAL8(min41)
16293 CALL PUSHCONTROL1B(1)
16295 IF (cr .GE. 0.) THEN
16297 CALL PUSHCONTROL1B(0)
16300 CALL PUSHCONTROL1B(1)
16303 IF (-1.0 .LT. y78) THEN
16304 CALL PUSHREAL8(max28)
16306 CALL PUSHCONTROL1B(0)
16308 CALL PUSHREAL8(max28)
16310 CALL PUSHCONTROL1B(1)
16312 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min41*field_old(i, k, j-1)+&
16313 & 0.5*max28*field_old(i, k, j))
16314 fqy(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k, j-1))&
16315 & -1./12.*(field(i, k, j+1)+field(i, k, j-2))+SIGN(1, &
16316 & time_step)*SIGN(1., vel)*(1./12.)*(field(i, k, j+1)-field(&
16317 & i, k, j-2)-3.*(field(i, k, j)-field(i, k, j-1))))
16318 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
16320 CALL PUSHINTEGER4(i - 1)
16321 CALL PUSHINTEGER4(ad_from12)
16323 CALL PUSHCONTROL2B(3)
16324 ELSE IF (j .EQ. jds + 1) THEN
16325 ! 2nd order flux next to south boundary
16327 ad_from13 = i_start
16328 DO i=ad_from13,i_end
16331 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
16333 mu = 0.5*(mut(i, j)+mut(i, j-1))
16334 CALL PUSHREAL8(vel)
16337 IF (cr .GE. 0.) THEN
16339 CALL PUSHCONTROL1B(0)
16342 CALL PUSHCONTROL1B(1)
16345 IF (1.0 .GT. y28) THEN
16346 CALL PUSHREAL8(min42)
16348 CALL PUSHCONTROL1B(0)
16350 CALL PUSHREAL8(min42)
16352 CALL PUSHCONTROL1B(1)
16354 IF (cr .GE. 0.) THEN
16356 CALL PUSHCONTROL1B(0)
16359 CALL PUSHCONTROL1B(1)
16362 IF (-1.0 .LT. y79) THEN
16363 CALL PUSHREAL8(max29)
16365 CALL PUSHCONTROL1B(0)
16367 CALL PUSHREAL8(max29)
16369 CALL PUSHCONTROL1B(1)
16371 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min42*field_old(i, k, j-1)+&
16372 & 0.5*max29*field_old(i, k, j))
16373 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j&
16375 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
16377 CALL PUSHINTEGER4(i - 1)
16378 CALL PUSHINTEGER4(ad_from13)
16380 CALL PUSHCONTROL2B(2)
16381 ELSE IF (j .EQ. jde - 1) THEN
16382 ! 2nd order flux next to north boundary
16384 ad_from14 = i_start
16385 DO i=ad_from14,i_end
16388 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
16390 mu = 0.5*(mut(i, j)+mut(i, j-1))
16391 CALL PUSHREAL8(vel)
16394 IF (cr .GE. 0.) THEN
16396 CALL PUSHCONTROL1B(0)
16399 CALL PUSHCONTROL1B(1)
16402 IF (1.0 .GT. y29) THEN
16403 CALL PUSHREAL8(min43)
16405 CALL PUSHCONTROL1B(0)
16407 CALL PUSHREAL8(min43)
16409 CALL PUSHCONTROL1B(1)
16411 IF (cr .GE. 0.) THEN
16413 CALL PUSHCONTROL1B(0)
16416 CALL PUSHCONTROL1B(1)
16419 IF (-1.0 .LT. y80) THEN
16420 CALL PUSHREAL8(max30)
16422 CALL PUSHCONTROL1B(0)
16424 CALL PUSHREAL8(max30)
16426 CALL PUSHCONTROL1B(1)
16428 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min43*field_old(i, k, j-1)+&
16429 & 0.5*max30*field_old(i, k, j))
16430 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j&
16432 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
16434 CALL PUSHINTEGER4(i - 1)
16435 CALL PUSHINTEGER4(ad_from14)
16437 CALL PUSHCONTROL2B(1)
16439 CALL PUSHCONTROL2B(0)
16441 END DO j_loop_y_flux_3
16442 CALL PUSHINTEGER4(j - 1)
16443 CALL PUSHINTEGER4(ad_from15)
16445 !-- these bounds are for periodic and sym conditions
16447 IF (ite .GT. ide - 1) THEN
16453 i_start_f = i_start
16454 i_end_f = i_end + 1
16456 IF (jte .GT. jde - 1) THEN
16462 !-- modify loop bounds for open and specified b.c
16463 IF (degrade_ys) j_start = jts
16464 IF (degrade_ye) THEN
16465 IF (jte .GT. jde - 1) THEN
16471 IF (degrade_xs) THEN
16472 IF (ids + 1 .LT. its) THEN
16477 i_start_f = i_start + 1
16479 IF (degrade_xe) THEN
16480 IF (ide - 2 .GT. ite) THEN
16487 ad_from16 = j_start
16489 DO j=ad_from16,j_end
16492 CALL PUSHINTEGER4(i)
16493 DO i=i_start_f,i_end_f
16496 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
16498 mu = 0.5*(mut(i, j)+mut(i-1, j))
16499 CALL PUSHREAL8(vel)
16502 IF (cr .GE. 0.) THEN
16504 CALL PUSHCONTROL1B(0)
16507 CALL PUSHCONTROL1B(1)
16510 IF (1.0 .GT. y30) THEN
16511 CALL PUSHREAL8(min46)
16513 CALL PUSHCONTROL1B(0)
16515 CALL PUSHREAL8(min46)
16517 CALL PUSHCONTROL1B(1)
16519 IF (cr .GE. 0.) THEN
16521 CALL PUSHCONTROL1B(0)
16524 CALL PUSHCONTROL1B(1)
16527 IF (-1.0 .LT. y81) THEN
16528 CALL PUSHREAL8(max31)
16530 CALL PUSHCONTROL1B(0)
16532 CALL PUSHREAL8(max31)
16534 CALL PUSHCONTROL1B(1)
16536 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min46*field_old(i-1, k, j)+0.5&
16537 & *max31*field_old(i, k, j))
16538 fqx(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i-1, k, j))-&
16539 & 1./12.*(field(i+1, k, j)+field(i-2, k, j))+SIGN(1, time_step&
16540 & )*SIGN(1., vel)*(1./12.)*(field(i+1, k, j)-field(i-2, k, j)-&
16541 & 3.*(field(i, k, j)-field(i-1, k, j))))
16542 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
16545 ! lower order fluxes close to boundaries (if not periodic or symmetric)
16546 IF (degrade_xs) THEN
16547 IF (i_start .EQ. ids + 1) THEN
16548 CALL PUSHINTEGER4(i)
16549 ! second order flux next to the boundary
16554 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
16556 mu = 0.5*(mut(i, j)+mut(i-1, j))
16557 CALL PUSHREAL8(vel)
16558 vel = ru(i, k, j)/mu
16560 IF (cr .GE. 0.) THEN
16562 CALL PUSHCONTROL1B(0)
16565 CALL PUSHCONTROL1B(1)
16568 IF (1.0 .GT. y31) THEN
16569 CALL PUSHREAL8(min47)
16571 CALL PUSHCONTROL1B(0)
16573 CALL PUSHREAL8(min47)
16575 CALL PUSHCONTROL1B(1)
16577 IF (cr .GE. 0.) THEN
16579 CALL PUSHCONTROL1B(0)
16582 CALL PUSHCONTROL1B(1)
16585 IF (-1.0 .LT. y82) THEN
16586 CALL PUSHREAL8(max32)
16588 CALL PUSHCONTROL1B(0)
16590 CALL PUSHREAL8(max32)
16592 CALL PUSHCONTROL1B(1)
16594 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min47*field_old(i-1, k, j)+&
16595 & 0.5*max32*field_old(i, k, j))
16596 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, k&
16598 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
16600 CALL PUSHCONTROL2B(0)
16602 CALL PUSHCONTROL2B(1)
16605 CALL PUSHCONTROL2B(2)
16607 IF (degrade_xe) THEN
16608 IF (i_end .EQ. ide - 2) THEN
16609 CALL PUSHINTEGER4(i)
16610 ! second order flux next to the boundary
16615 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
16617 mu = 0.5*(mut(i, j)+mut(i-1, j))
16618 CALL PUSHREAL8(vel)
16621 IF (cr .GE. 0.) THEN
16623 CALL PUSHCONTROL1B(0)
16626 CALL PUSHCONTROL1B(1)
16629 IF (1.0 .GT. y32) THEN
16630 CALL PUSHREAL8(min48)
16632 CALL PUSHCONTROL1B(0)
16634 CALL PUSHREAL8(min48)
16636 CALL PUSHCONTROL1B(1)
16638 IF (cr .GE. 0.) THEN
16640 CALL PUSHCONTROL1B(0)
16643 CALL PUSHCONTROL1B(1)
16646 IF (-1.0 .LT. y83) THEN
16647 CALL PUSHREAL8(max33)
16649 CALL PUSHCONTROL1B(0)
16651 CALL PUSHREAL8(max33)
16653 CALL PUSHCONTROL1B(1)
16655 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min48*field_old(i-1, k, j)+&
16656 & 0.5*max33*field_old(i, k, j))
16657 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, k&
16659 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
16661 CALL PUSHCONTROL2B(2)
16663 CALL PUSHCONTROL2B(1)
16666 CALL PUSHCONTROL2B(0)
16669 CALL PUSHINTEGER4(j - 1)
16670 CALL PUSHINTEGER4(ad_from16)
16671 CALL PUSHCONTROL3B(2)
16672 ELSE IF (horz_order .EQ. 2) THEN
16673 ! enddo for outer J loop
16674 !--- end of 3rd order horizontal flux calculation
16675 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
16676 & its .GT. ids + 1) degrade_xs = .false.
16677 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
16678 & ite .LT. ide - 2) degrade_xe = .false.
16679 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
16680 & jts .GT. jds + 1) degrade_ys = .false.
16681 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
16682 & jte .LT. jde - 2) degrade_ye = .false.
16683 IF (kte .GT. kde - 1) THEN
16689 IF (ite .GT. ide - 1) THEN
16696 IF (jte .GT. jde - 1) THEN
16702 !-- modify loop bounds if open or specified
16703 IF (degrade_xs) i_start = its
16704 IF (degrade_xe) THEN
16705 IF (ite .GT. ide - 1) THEN
16711 IF (degrade_ys) THEN
16712 IF (jts .LT. jds + 1) THEN
16718 IF (degrade_ye) THEN
16719 IF (jte .GT. jde - 2) THEN
16725 ad_from18 = j_start
16726 ! compute fluxes, 2nd order, y flux
16727 DO j=ad_from18,j_end+1
16729 ad_from17 = i_start
16730 DO i=ad_from17,i_end
16733 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
16735 mu = 0.5*(mut(i, j)+mut(i, j-1))
16736 CALL PUSHREAL8(vel)
16739 IF (cr .GE. 0.) THEN
16741 CALL PUSHCONTROL1B(0)
16744 CALL PUSHCONTROL1B(1)
16747 IF (1.0 .GT. y33) THEN
16748 CALL PUSHREAL8(min51)
16750 CALL PUSHCONTROL1B(0)
16752 CALL PUSHREAL8(min51)
16754 CALL PUSHCONTROL1B(1)
16756 IF (cr .GE. 0.) THEN
16758 CALL PUSHCONTROL1B(0)
16761 CALL PUSHCONTROL1B(1)
16764 IF (-1.0 .LT. y84) THEN
16765 CALL PUSHREAL8(max34)
16767 CALL PUSHCONTROL1B(0)
16769 CALL PUSHREAL8(max34)
16771 CALL PUSHCONTROL1B(1)
16773 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min51*field_old(i, k, j-1)+0.5&
16774 & *max34*field_old(i, k, j))
16775 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j-1&
16777 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
16779 CALL PUSHINTEGER4(i - 1)
16780 CALL PUSHINTEGER4(ad_from17)
16783 CALL PUSHINTEGER4(j - 1)
16784 CALL PUSHINTEGER4(ad_from18)
16785 ad_from20 = j_start
16787 DO j=ad_from20,j_end
16789 ad_from19 = i_start
16790 DO i=ad_from19,i_end+1
16793 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
16795 mu = 0.5*(mut(i, j)+mut(i-1, j))
16796 CALL PUSHREAL8(vel)
16799 IF (cr .GE. 0.) THEN
16801 CALL PUSHCONTROL1B(0)
16804 CALL PUSHCONTROL1B(1)
16807 IF (1.0 .GT. y34) THEN
16808 CALL PUSHREAL8(min52)
16810 CALL PUSHCONTROL1B(0)
16812 CALL PUSHREAL8(min52)
16814 CALL PUSHCONTROL1B(1)
16816 IF (cr .GE. 0.) THEN
16818 CALL PUSHCONTROL1B(0)
16821 CALL PUSHCONTROL1B(1)
16824 IF (-1.0 .LT. y85) THEN
16825 CALL PUSHREAL8(max35)
16827 CALL PUSHCONTROL1B(0)
16829 CALL PUSHREAL8(max35)
16831 CALL PUSHCONTROL1B(1)
16833 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min52*field_old(i-1, k, j)+0.5&
16834 & *max35*field_old(i, k, j))
16835 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, k, j&
16837 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
16839 CALL PUSHINTEGER4(i - 1)
16840 CALL PUSHINTEGER4(ad_from19)
16843 CALL PUSHINTEGER4(j - 1)
16844 CALL PUSHINTEGER4(ad_from20)
16845 CALL PUSHCONTROL3B(1)
16847 CALL PUSHCONTROL3B(0)
16849 ! pick up the rest of the horizontal radiation boundary conditions.
16850 ! (these are the computations that don't require 'cb'.
16851 ! first, set to index ranges
16853 IF (ite .GT. ide - 1) THEN
16859 IF (jte .GT. jde - 1) THEN
16864 ! compute x (u) conditions for v, w, or scalar
16865 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
16866 ad_from29 = j_start
16867 DO j=ad_from29,j_end
16869 IF (0.5*(ru(its, k, j)+ru(its+1, k, j)) .GT. 0.) THEN
16872 CALL PUSHCONTROL1B(0)
16875 ub = 0.5*(ru(its, k, j)+ru(its+1, k, j))
16876 CALL PUSHCONTROL1B(1)
16880 CALL PUSHINTEGER4(j - 1)
16881 CALL PUSHINTEGER4(ad_from29)
16882 CALL PUSHCONTROL1B(0)
16884 CALL PUSHCONTROL1B(1)
16886 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
16887 ad_from30 = j_start
16888 DO j=ad_from30,j_end
16890 IF (0.5*(ru(ite-1, k, j)+ru(ite, k, j)) .LT. 0.) THEN
16893 CALL PUSHCONTROL1B(0)
16896 ub = 0.5*(ru(ite-1, k, j)+ru(ite, k, j))
16897 CALL PUSHCONTROL1B(1)
16901 CALL PUSHINTEGER4(j - 1)
16902 CALL PUSHINTEGER4(ad_from30)
16903 CALL PUSHCONTROL1B(0)
16905 CALL PUSHCONTROL1B(1)
16907 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
16908 ad_from31 = i_start
16909 CALL PUSHINTEGER4(i)
16910 DO i=ad_from31,i_end
16912 IF (0.5*(rv(i, k, jts)+rv(i, k, jts+1)) .GT. 0.) THEN
16915 CALL PUSHCONTROL1B(0)
16918 vb = 0.5*(rv(i, k, jts)+rv(i, k, jts+1))
16919 CALL PUSHCONTROL1B(1)
16923 CALL PUSHINTEGER4(i - 1)
16924 CALL PUSHINTEGER4(ad_from31)
16925 CALL PUSHCONTROL1B(0)
16927 CALL PUSHCONTROL1B(1)
16929 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
16930 ad_from32 = i_start
16931 CALL PUSHINTEGER4(i)
16932 DO i=ad_from32,i_end
16934 IF (0.5*(rv(i, k, jte-1)+rv(i, k, jte)) .LT. 0.) THEN
16937 CALL PUSHCONTROL1B(0)
16940 vb = 0.5*(rv(i, k, jte-1)+rv(i, k, jte))
16941 CALL PUSHCONTROL1B(1)
16945 CALL PUSHINTEGER4(i - 1)
16946 CALL PUSHINTEGER4(ad_from32)
16947 CALL PUSHCONTROL1B(0)
16949 CALL PUSHCONTROL1B(1)
16951 IF (config_flags%polar .AND. jts .EQ. jds) THEN
16952 ad_from33 = i_start
16953 CALL PUSHINTEGER4(i)
16954 ! Assuming rv(i,k,jds) = 0.
16955 DO i=ad_from33,i_end
16957 IF (0.5*rv(i, k, jts+1) .GT. 0.) THEN
16960 CALL PUSHCONTROL1B(0)
16963 vb = 0.5*rv(i, k, jts+1)
16964 CALL PUSHCONTROL1B(1)
16968 CALL PUSHINTEGER4(i - 1)
16969 CALL PUSHINTEGER4(ad_from33)
16970 CALL PUSHCONTROL1B(0)
16972 CALL PUSHCONTROL1B(1)
16974 IF (config_flags%polar .AND. jte .EQ. jde) THEN
16975 ad_from34 = i_start
16976 CALL PUSHINTEGER4(i)
16977 ! Assuming rv(i,k,jde) = 0.
16978 DO i=ad_from34,i_end
16980 IF (0.5*rv(i, k, jte-1) .LT. 0.) THEN
16983 CALL PUSHCONTROL1B(0)
16986 vb = 0.5*rv(i, k, jte-1)
16987 CALL PUSHCONTROL1B(1)
16991 CALL PUSHINTEGER4(i - 1)
16992 CALL PUSHINTEGER4(ad_from34)
16993 CALL PUSHCONTROL1B(1)
16995 CALL PUSHCONTROL1B(0)
16997 !-------------------- vertical advection
16998 !-- loop bounds for periodic or sym conditions
17000 IF (ite .GT. ide - 1) THEN
17005 CALL PUSHINTEGER4(i_end)
17008 IF (jte .GT. jde - 1) THEN
17013 CALL PUSHINTEGER4(j_end)
17015 !-- loop bounds for open or specified conditions
17016 IF (degrade_xs) THEN
17017 IF (its - 1 .LT. ids) THEN
17023 IF (degrade_xe) THEN
17024 IF (ite + 1 .GT. ide - 1) THEN
17030 IF (degrade_ys) THEN
17031 IF (jts - 1 .LT. jds) THEN
17037 IF (degrade_ye) THEN
17038 IF (jte + 1 .GT. jde - 1) THEN
17044 IF (vert_order .EQ. 6) THEN
17045 ad_from38 = j_start
17046 DO j=ad_from38,j_end
17047 ad_from35 = i_start
17048 CALL PUSHINTEGER4(i)
17049 DO i=ad_from35,i_end
17052 fqz(i, kde, j) = 0.
17053 fqzl(i, kde, j) = 0.
17055 CALL PUSHINTEGER4(i - 1)
17056 CALL PUSHINTEGER4(ad_from35)
17057 CALL PUSHINTEGER4(k)
17059 ad_from36 = i_start
17060 DO i=ad_from36,i_end
17062 dz = 2./(rdzw(k)+rdzw(k-1))
17064 mu = 0.5*(mut(i, j)+mut(i, j))
17065 CALL PUSHREAL8(vel)
17068 IF (cr .GE. 0.) THEN
17070 CALL PUSHCONTROL1B(0)
17073 CALL PUSHCONTROL1B(1)
17076 IF (1.0 .GT. y35) THEN
17077 CALL PUSHREAL8(min55)
17079 CALL PUSHCONTROL1B(0)
17081 CALL PUSHREAL8(min55)
17083 CALL PUSHCONTROL1B(1)
17085 IF (cr .GE. 0.) THEN
17087 CALL PUSHCONTROL1B(0)
17090 CALL PUSHCONTROL1B(1)
17093 IF (-1.0 .LT. y86) THEN
17094 CALL PUSHREAL8(max36)
17096 CALL PUSHCONTROL1B(0)
17098 CALL PUSHREAL8(max36)
17100 CALL PUSHCONTROL1B(1)
17102 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min55*field_old(i, k-1, j)+0.5&
17103 & *max36*field_old(i, k, j))
17104 fqz(i, k, j) = vel*(37./60.*(field(i, k, j)+field(i, k-1, j))-&
17105 & 2./15.*(field(i, k+1, j)+field(i, k-2, j))+1./60.*(field(i, &
17106 & k+2, j)+field(i, k-3, j)))
17107 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17109 CALL PUSHINTEGER4(i - 1)
17110 CALL PUSHINTEGER4(ad_from36)
17112 ad_from37 = i_start
17113 DO i=ad_from37,i_end
17114 CALL PUSHINTEGER4(k)
17117 dz = 2./(rdzw(k)+rdzw(k-1))
17119 mu = 0.5*(mut(i, j)+mut(i, j))
17120 CALL PUSHREAL8(vel)
17123 IF (cr .GE. 0.) THEN
17125 CALL PUSHCONTROL1B(0)
17128 CALL PUSHCONTROL1B(1)
17131 IF (1.0 .GT. y36) THEN
17132 CALL PUSHREAL8(min56)
17134 CALL PUSHCONTROL1B(0)
17136 CALL PUSHREAL8(min56)
17138 CALL PUSHCONTROL1B(1)
17140 IF (cr .GE. 0.) THEN
17142 CALL PUSHCONTROL1B(0)
17145 CALL PUSHCONTROL1B(1)
17148 IF (-1.0 .LT. y87) THEN
17149 CALL PUSHREAL8(max37)
17151 CALL PUSHCONTROL1B(0)
17153 CALL PUSHREAL8(max37)
17155 CALL PUSHCONTROL1B(1)
17157 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min56*field_old(i, k-1, j)+0.5*&
17158 & max37*field_old(i, k, j))
17159 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(&
17161 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17164 dz = 2./(rdzw(k)+rdzw(k-1))
17165 mu = 0.5*(mut(i, j)+mut(i, j))
17166 CALL PUSHREAL8(vel)
17169 IF (cr .GE. 0.) THEN
17171 CALL PUSHCONTROL1B(0)
17174 CALL PUSHCONTROL1B(1)
17177 IF (1.0 .GT. y37) THEN
17178 CALL PUSHREAL8(min57)
17180 CALL PUSHCONTROL1B(0)
17182 CALL PUSHREAL8(min57)
17184 CALL PUSHCONTROL1B(1)
17186 IF (cr .GE. 0.) THEN
17188 CALL PUSHCONTROL1B(0)
17191 CALL PUSHCONTROL1B(1)
17194 IF (-1.0 .LT. y88) THEN
17195 CALL PUSHREAL8(max38)
17197 CALL PUSHCONTROL1B(0)
17199 CALL PUSHREAL8(max38)
17201 CALL PUSHCONTROL1B(1)
17203 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min57*field_old(i, k-1, j)+0.5*&
17204 & max38*field_old(i, k, j))
17205 fqz(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k-1, j))-1./&
17206 & 12.*(field(i, k+1, j)+field(i, k-2, j)))
17207 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17210 dz = 2./(rdzw(k)+rdzw(k-1))
17211 mu = 0.5*(mut(i, j)+mut(i, j))
17212 CALL PUSHREAL8(vel)
17215 IF (cr .GE. 0.) THEN
17217 CALL PUSHCONTROL1B(0)
17220 CALL PUSHCONTROL1B(1)
17223 IF (1.0 .GT. y38) THEN
17224 CALL PUSHREAL8(min58)
17226 CALL PUSHCONTROL1B(0)
17228 CALL PUSHREAL8(min58)
17230 CALL PUSHCONTROL1B(1)
17232 IF (cr .GE. 0.) THEN
17234 CALL PUSHCONTROL1B(0)
17237 CALL PUSHCONTROL1B(1)
17240 IF (-1.0 .LT. y89) THEN
17241 CALL PUSHREAL8(max39)
17243 CALL PUSHCONTROL1B(0)
17245 CALL PUSHREAL8(max39)
17247 CALL PUSHCONTROL1B(1)
17249 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min58*field_old(i, k-1, j)+0.5*&
17250 & max39*field_old(i, k, j))
17251 fqz(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k-1, j))-1./&
17252 & 12.*(field(i, k+1, j)+field(i, k-2, j)))
17253 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17256 dz = 2./(rdzw(k)+rdzw(k-1))
17257 mu = 0.5*(mut(i, j)+mut(i, j))
17258 CALL PUSHREAL8(vel)
17261 IF (cr .GE. 0.) THEN
17263 CALL PUSHCONTROL1B(0)
17266 CALL PUSHCONTROL1B(1)
17269 IF (1.0 .GT. y39) THEN
17270 CALL PUSHREAL8(min59)
17272 CALL PUSHCONTROL1B(0)
17274 CALL PUSHREAL8(min59)
17276 CALL PUSHCONTROL1B(1)
17278 IF (cr .GE. 0.) THEN
17280 CALL PUSHCONTROL1B(0)
17283 CALL PUSHCONTROL1B(1)
17286 IF (-1.0 .LT. y90) THEN
17287 CALL PUSHREAL8(max40)
17289 CALL PUSHCONTROL1B(0)
17291 CALL PUSHREAL8(max40)
17293 CALL PUSHCONTROL1B(1)
17295 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min59*field_old(i, k-1, j)+0.5*&
17296 & max40*field_old(i, k, j))
17297 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(&
17299 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17301 CALL PUSHINTEGER4(i - 1)
17302 CALL PUSHINTEGER4(ad_from37)
17304 CALL PUSHINTEGER4(j - 1)
17305 CALL PUSHINTEGER4(ad_from38)
17306 CALL PUSHCONTROL3B(0)
17307 ELSE IF (vert_order .EQ. 5) THEN
17308 ad_from42 = j_start
17309 DO j=ad_from42,j_end
17310 ad_from39 = i_start
17311 CALL PUSHINTEGER4(i)
17312 DO i=ad_from39,i_end
17315 fqz(i, kde, j) = 0.
17316 fqzl(i, kde, j) = 0.
17318 CALL PUSHINTEGER4(i - 1)
17319 CALL PUSHINTEGER4(ad_from39)
17320 CALL PUSHINTEGER4(k)
17322 ad_from40 = i_start
17323 DO i=ad_from40,i_end
17325 dz = 2./(rdzw(k)+rdzw(k-1))
17327 mu = 0.5*(mut(i, j)+mut(i, j))
17328 CALL PUSHREAL8(vel)
17331 IF (cr .GE. 0.) THEN
17333 CALL PUSHCONTROL1B(0)
17336 CALL PUSHCONTROL1B(1)
17339 IF (1.0 .GT. y40) THEN
17340 CALL PUSHREAL8(min60)
17342 CALL PUSHCONTROL1B(0)
17344 CALL PUSHREAL8(min60)
17346 CALL PUSHCONTROL1B(1)
17348 IF (cr .GE. 0.) THEN
17350 CALL PUSHCONTROL1B(0)
17353 CALL PUSHCONTROL1B(1)
17356 IF (-1.0 .LT. y91) THEN
17357 CALL PUSHREAL8(max41)
17359 CALL PUSHCONTROL1B(0)
17361 CALL PUSHREAL8(max41)
17363 CALL PUSHCONTROL1B(1)
17365 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min60*field_old(i, k-1, j)+0.5&
17366 & *max41*field_old(i, k, j))
17367 fqz(i, k, j) = vel*(37./60.*(field(i, k, j)+field(i, k-1, j))-&
17368 & 2./15.*(field(i, k+1, j)+field(i, k-2, j))+1./60.*(field(i, &
17369 & k+2, j)+field(i, k-3, j))-SIGN(1, time_step)*SIGN(1., -vel)*&
17370 & (1./60.)*(field(i, k+2, j)-field(i, k-3, j)-5.*(field(i, k+1&
17371 & , j)-field(i, k-2, j))+10.*(field(i, k, j)-field(i, k-1, j))&
17373 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17375 CALL PUSHINTEGER4(i - 1)
17376 CALL PUSHINTEGER4(ad_from40)
17378 ad_from41 = i_start
17379 DO i=ad_from41,i_end
17380 CALL PUSHINTEGER4(k)
17383 dz = 2./(rdzw(k)+rdzw(k-1))
17385 mu = 0.5*(mut(i, j)+mut(i, j))
17386 CALL PUSHREAL8(vel)
17389 IF (cr .GE. 0.) THEN
17391 CALL PUSHCONTROL1B(0)
17394 CALL PUSHCONTROL1B(1)
17397 IF (1.0 .GT. y41) THEN
17398 CALL PUSHREAL8(min61)
17400 CALL PUSHCONTROL1B(0)
17402 CALL PUSHREAL8(min61)
17404 CALL PUSHCONTROL1B(1)
17406 IF (cr .GE. 0.) THEN
17408 CALL PUSHCONTROL1B(0)
17411 CALL PUSHCONTROL1B(1)
17414 IF (-1.0 .LT. y92) THEN
17415 CALL PUSHREAL8(max42)
17417 CALL PUSHCONTROL1B(0)
17419 CALL PUSHREAL8(max42)
17421 CALL PUSHCONTROL1B(1)
17423 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min61*field_old(i, k-1, j)+0.5*&
17424 & max42*field_old(i, k, j))
17425 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(&
17427 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17430 dz = 2./(rdzw(k)+rdzw(k-1))
17431 mu = 0.5*(mut(i, j)+mut(i, j))
17432 CALL PUSHREAL8(vel)
17435 IF (cr .GE. 0.) THEN
17437 CALL PUSHCONTROL1B(0)
17440 CALL PUSHCONTROL1B(1)
17443 IF (1.0 .GT. y42) THEN
17444 CALL PUSHREAL8(min62)
17446 CALL PUSHCONTROL1B(0)
17448 CALL PUSHREAL8(min62)
17450 CALL PUSHCONTROL1B(1)
17452 IF (cr .GE. 0.) THEN
17454 CALL PUSHCONTROL1B(0)
17457 CALL PUSHCONTROL1B(1)
17460 IF (-1.0 .LT. y93) THEN
17461 CALL PUSHREAL8(max43)
17463 CALL PUSHCONTROL1B(0)
17465 CALL PUSHREAL8(max43)
17467 CALL PUSHCONTROL1B(1)
17469 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min62*field_old(i, k-1, j)+0.5*&
17470 & max43*field_old(i, k, j))
17471 fqz(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k-1, j))-1./&
17472 & 12.*(field(i, k+1, j)+field(i, k-2, j))+SIGN(1, time_step)*&
17473 & SIGN(1., -vel)*(1./12.)*(field(i, k+1, j)-field(i, k-2, j)-3.*&
17474 & (field(i, k, j)-field(i, k-1, j))))
17475 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17478 dz = 2./(rdzw(k)+rdzw(k-1))
17479 mu = 0.5*(mut(i, j)+mut(i, j))
17480 CALL PUSHREAL8(vel)
17483 IF (cr .GE. 0.) THEN
17485 CALL PUSHCONTROL1B(0)
17488 CALL PUSHCONTROL1B(1)
17491 IF (1.0 .GT. y43) THEN
17492 CALL PUSHREAL8(min63)
17494 CALL PUSHCONTROL1B(0)
17496 CALL PUSHREAL8(min63)
17498 CALL PUSHCONTROL1B(1)
17500 IF (cr .GE. 0.) THEN
17502 CALL PUSHCONTROL1B(0)
17505 CALL PUSHCONTROL1B(1)
17508 IF (-1.0 .LT. y94) THEN
17509 CALL PUSHREAL8(max44)
17511 CALL PUSHCONTROL1B(0)
17513 CALL PUSHREAL8(max44)
17515 CALL PUSHCONTROL1B(1)
17517 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min63*field_old(i, k-1, j)+0.5*&
17518 & max44*field_old(i, k, j))
17519 fqz(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k-1, j))-1./&
17520 & 12.*(field(i, k+1, j)+field(i, k-2, j))+SIGN(1, time_step)*&
17521 & SIGN(1., -vel)*(1./12.)*(field(i, k+1, j)-field(i, k-2, j)-3.*&
17522 & (field(i, k, j)-field(i, k-1, j))))
17523 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17526 dz = 2./(rdzw(k)+rdzw(k-1))
17527 mu = 0.5*(mut(i, j)+mut(i, j))
17528 CALL PUSHREAL8(vel)
17531 IF (cr .GE. 0.) THEN
17533 CALL PUSHCONTROL1B(0)
17536 CALL PUSHCONTROL1B(1)
17539 IF (1.0 .GT. y44) THEN
17540 CALL PUSHREAL8(min64)
17542 CALL PUSHCONTROL1B(0)
17544 CALL PUSHREAL8(min64)
17546 CALL PUSHCONTROL1B(1)
17548 IF (cr .GE. 0.) THEN
17550 CALL PUSHCONTROL1B(0)
17553 CALL PUSHCONTROL1B(1)
17556 IF (-1.0 .LT. y95) THEN
17557 CALL PUSHREAL8(max45)
17559 CALL PUSHCONTROL1B(0)
17561 CALL PUSHREAL8(max45)
17563 CALL PUSHCONTROL1B(1)
17565 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min64*field_old(i, k-1, j)+0.5*&
17566 & max45*field_old(i, k, j))
17567 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(&
17569 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17571 CALL PUSHINTEGER4(i - 1)
17572 CALL PUSHINTEGER4(ad_from41)
17574 CALL PUSHINTEGER4(j - 1)
17575 CALL PUSHINTEGER4(ad_from42)
17576 CALL PUSHCONTROL3B(1)
17577 ELSE IF (vert_order .EQ. 4) THEN
17578 ad_from46 = j_start
17579 DO j=ad_from46,j_end
17580 ad_from43 = i_start
17581 CALL PUSHINTEGER4(i)
17582 DO i=ad_from43,i_end
17585 fqz(i, kde, j) = 0.
17586 fqzl(i, kde, j) = 0.
17588 CALL PUSHINTEGER4(i - 1)
17589 CALL PUSHINTEGER4(ad_from43)
17590 CALL PUSHINTEGER4(k)
17592 ad_from44 = i_start
17593 DO i=ad_from44,i_end
17595 dz = 2./(rdzw(k)+rdzw(k-1))
17597 mu = 0.5*(mut(i, j)+mut(i, j))
17598 CALL PUSHREAL8(vel)
17601 IF (cr .GE. 0.) THEN
17603 CALL PUSHCONTROL1B(0)
17606 CALL PUSHCONTROL1B(1)
17609 IF (1.0 .GT. y45) THEN
17610 CALL PUSHREAL8(min65)
17612 CALL PUSHCONTROL1B(0)
17614 CALL PUSHREAL8(min65)
17616 CALL PUSHCONTROL1B(1)
17618 IF (cr .GE. 0.) THEN
17620 CALL PUSHCONTROL1B(0)
17623 CALL PUSHCONTROL1B(1)
17626 IF (-1.0 .LT. y96) THEN
17627 CALL PUSHREAL8(max46)
17629 CALL PUSHCONTROL1B(0)
17631 CALL PUSHREAL8(max46)
17633 CALL PUSHCONTROL1B(1)
17635 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min65*field_old(i, k-1, j)+0.5&
17636 & *max46*field_old(i, k, j))
17637 fqz(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k-1, j))-&
17638 & 1./12.*(field(i, k+1, j)+field(i, k-2, j)))
17639 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17641 CALL PUSHINTEGER4(i - 1)
17642 CALL PUSHINTEGER4(ad_from44)
17644 ad_from45 = i_start
17645 DO i=ad_from45,i_end
17646 CALL PUSHINTEGER4(k)
17649 dz = 2./(rdzw(k)+rdzw(k-1))
17651 mu = 0.5*(mut(i, j)+mut(i, j))
17652 CALL PUSHREAL8(vel)
17655 IF (cr .GE. 0.) THEN
17657 CALL PUSHCONTROL1B(0)
17660 CALL PUSHCONTROL1B(1)
17663 IF (1.0 .GT. y46) THEN
17664 CALL PUSHREAL8(min66)
17666 CALL PUSHCONTROL1B(0)
17668 CALL PUSHREAL8(min66)
17670 CALL PUSHCONTROL1B(1)
17672 IF (cr .GE. 0.) THEN
17674 CALL PUSHCONTROL1B(0)
17677 CALL PUSHCONTROL1B(1)
17680 IF (-1.0 .LT. y97) THEN
17681 CALL PUSHREAL8(max47)
17683 CALL PUSHCONTROL1B(0)
17685 CALL PUSHREAL8(max47)
17687 CALL PUSHCONTROL1B(1)
17689 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min66*field_old(i, k-1, j)+0.5*&
17690 & max47*field_old(i, k, j))
17691 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(&
17693 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17696 dz = 2./(rdzw(k)+rdzw(k-1))
17697 mu = 0.5*(mut(i, j)+mut(i, j))
17698 CALL PUSHREAL8(vel)
17701 IF (cr .GE. 0.) THEN
17703 CALL PUSHCONTROL1B(0)
17706 CALL PUSHCONTROL1B(1)
17709 IF (1.0 .GT. y47) THEN
17710 CALL PUSHREAL8(min67)
17712 CALL PUSHCONTROL1B(0)
17714 CALL PUSHREAL8(min67)
17716 CALL PUSHCONTROL1B(1)
17718 IF (cr .GE. 0.) THEN
17720 CALL PUSHCONTROL1B(0)
17723 CALL PUSHCONTROL1B(1)
17726 IF (-1.0 .LT. y98) THEN
17727 CALL PUSHREAL8(max48)
17729 CALL PUSHCONTROL1B(0)
17731 CALL PUSHREAL8(max48)
17733 CALL PUSHCONTROL1B(1)
17735 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min67*field_old(i, k-1, j)+0.5*&
17736 & max48*field_old(i, k, j))
17737 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(&
17739 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17741 CALL PUSHINTEGER4(i - 1)
17742 CALL PUSHINTEGER4(ad_from45)
17744 CALL PUSHINTEGER4(j - 1)
17745 CALL PUSHINTEGER4(ad_from46)
17746 CALL PUSHCONTROL3B(2)
17747 ELSE IF (vert_order .EQ. 3) THEN
17748 ad_from50 = j_start
17749 DO j=ad_from50,j_end
17750 ad_from47 = i_start
17751 CALL PUSHINTEGER4(i)
17752 DO i=ad_from47,i_end
17755 fqz(i, kde, j) = 0.
17756 fqzl(i, kde, j) = 0.
17758 CALL PUSHINTEGER4(i - 1)
17759 CALL PUSHINTEGER4(ad_from47)
17760 CALL PUSHINTEGER4(k)
17762 ad_from48 = i_start
17763 DO i=ad_from48,i_end
17765 dz = 2./(rdzw(k)+rdzw(k-1))
17767 mu = 0.5*(mut(i, j)+mut(i, j))
17768 CALL PUSHREAL8(vel)
17771 IF (cr .GE. 0.) THEN
17773 CALL PUSHCONTROL1B(0)
17776 CALL PUSHCONTROL1B(1)
17779 IF (1.0 .GT. y48) THEN
17780 CALL PUSHREAL8(min68)
17782 CALL PUSHCONTROL1B(0)
17784 CALL PUSHREAL8(min68)
17786 CALL PUSHCONTROL1B(1)
17788 IF (cr .GE. 0.) THEN
17790 CALL PUSHCONTROL1B(0)
17793 CALL PUSHCONTROL1B(1)
17796 IF (-1.0 .LT. y99) THEN
17797 CALL PUSHREAL8(max49)
17799 CALL PUSHCONTROL1B(0)
17801 CALL PUSHREAL8(max49)
17803 CALL PUSHCONTROL1B(1)
17805 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min68*field_old(i, k-1, j)+0.5&
17806 & *max49*field_old(i, k, j))
17807 fqz(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k-1, j))-&
17808 & 1./12.*(field(i, k+1, j)+field(i, k-2, j))+SIGN(1, time_step&
17809 & )*SIGN(1., -vel)*(1./12.)*(field(i, k+1, j)-field(i, k-2, j)&
17810 & -3.*(field(i, k, j)-field(i, k-1, j))))
17811 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17813 CALL PUSHINTEGER4(i - 1)
17814 CALL PUSHINTEGER4(ad_from48)
17816 ad_from49 = i_start
17817 DO i=ad_from49,i_end
17818 CALL PUSHINTEGER4(k)
17821 dz = 2./(rdzw(k)+rdzw(k-1))
17823 mu = 0.5*(mut(i, j)+mut(i, j))
17824 CALL PUSHREAL8(vel)
17827 IF (cr .GE. 0.) THEN
17829 CALL PUSHCONTROL1B(0)
17832 CALL PUSHCONTROL1B(1)
17835 IF (1.0 .GT. y49) THEN
17836 CALL PUSHREAL8(min69)
17838 CALL PUSHCONTROL1B(0)
17840 CALL PUSHREAL8(min69)
17842 CALL PUSHCONTROL1B(1)
17844 IF (cr .GE. 0.) THEN
17846 CALL PUSHCONTROL1B(0)
17849 CALL PUSHCONTROL1B(1)
17852 IF (-1.0 .LT. y100) THEN
17853 CALL PUSHREAL8(max50)
17855 CALL PUSHCONTROL1B(0)
17857 CALL PUSHREAL8(max50)
17859 CALL PUSHCONTROL1B(1)
17861 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min69*field_old(i, k-1, j)+0.5*&
17862 & max50*field_old(i, k, j))
17863 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(&
17865 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17868 dz = 2./(rdzw(k)+rdzw(k-1))
17869 mu = 0.5*(mut(i, j)+mut(i, j))
17870 CALL PUSHREAL8(vel)
17873 IF (cr .GE. 0.) THEN
17875 CALL PUSHCONTROL1B(0)
17878 CALL PUSHCONTROL1B(1)
17881 IF (1.0 .GT. y50) THEN
17882 CALL PUSHREAL8(min70)
17884 CALL PUSHCONTROL1B(0)
17886 CALL PUSHREAL8(min70)
17888 CALL PUSHCONTROL1B(1)
17890 IF (cr .GE. 0.) THEN
17892 CALL PUSHCONTROL1B(0)
17895 CALL PUSHCONTROL1B(1)
17898 IF (-1.0 .LT. y101) THEN
17899 CALL PUSHREAL8(max51)
17901 CALL PUSHCONTROL1B(0)
17903 CALL PUSHREAL8(max51)
17905 CALL PUSHCONTROL1B(1)
17907 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min70*field_old(i, k-1, j)+0.5*&
17908 & max51*field_old(i, k, j))
17909 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(&
17911 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17913 CALL PUSHINTEGER4(i - 1)
17914 CALL PUSHINTEGER4(ad_from49)
17916 CALL PUSHINTEGER4(j - 1)
17917 CALL PUSHINTEGER4(ad_from50)
17918 CALL PUSHCONTROL3B(3)
17919 ELSE IF (vert_order .EQ. 2) THEN
17920 ad_from53 = j_start
17921 DO j=ad_from53,j_end
17922 ad_from51 = i_start
17923 CALL PUSHINTEGER4(i)
17924 DO i=ad_from51,i_end
17927 fqz(i, kde, j) = 0.
17928 fqzl(i, kde, j) = 0.
17930 CALL PUSHINTEGER4(i - 1)
17931 CALL PUSHINTEGER4(ad_from51)
17933 ad_from52 = i_start
17934 DO i=ad_from52,i_end
17936 dz = 2./(rdzw(k)+rdzw(k-1))
17938 mu = 0.5*(mut(i, j)+mut(i, j))
17939 CALL PUSHREAL8(vel)
17942 IF (cr .GE. 0.) THEN
17944 CALL PUSHCONTROL1B(0)
17947 CALL PUSHCONTROL1B(1)
17950 IF (1.0 .GT. y51) THEN
17951 CALL PUSHREAL8(min71)
17953 CALL PUSHCONTROL1B(0)
17955 CALL PUSHREAL8(min71)
17957 CALL PUSHCONTROL1B(1)
17959 IF (cr .GE. 0.) THEN
17961 CALL PUSHCONTROL1B(0)
17964 CALL PUSHCONTROL1B(1)
17967 IF (-1.0 .LT. y102) THEN
17968 CALL PUSHREAL8(max52)
17970 CALL PUSHCONTROL1B(0)
17972 CALL PUSHREAL8(max52)
17974 CALL PUSHCONTROL1B(1)
17976 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min71*field_old(i, k-1, j)+0.5&
17977 & *max52*field_old(i, k, j))
17978 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*&
17979 & field(i, k-1, j))
17980 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
17982 CALL PUSHINTEGER4(i - 1)
17983 CALL PUSHINTEGER4(ad_from52)
17986 CALL PUSHINTEGER4(j - 1)
17987 CALL PUSHINTEGER4(ad_from53)
17988 CALL PUSHCONTROL3B(4)
17990 CALL PUSHCONTROL3B(5)
17993 ! positive definite filter
17995 IF (ite .GT. ide - 1) THEN
18002 IF (jte .GT. jde - 1) THEN
18008 !-- loop bounds for open or specified conditions
18009 IF (degrade_xs) THEN
18010 IF (its - 1 .LT. ids) THEN
18016 IF (degrade_xe) THEN
18017 IF (ite + 1 .GT. ide - 1) THEN
18023 IF (degrade_ys) THEN
18024 IF (jts - 1 .LT. jds) THEN
18030 IF (degrade_ye) THEN
18031 IF (jte + 1 .GT. jde - 1) THEN
18037 IF (config_flags%specified .OR. config_flags%nested) THEN
18038 IF (degrade_xs) THEN
18039 IF (its - 1 .LT. ids + 1) THEN
18045 IF (degrade_xe) THEN
18046 IF (ite + 1 .GT. ide - 2) THEN
18052 IF (degrade_ys) THEN
18053 IF (jts - 1 .LT. jds + 1) THEN
18059 IF (degrade_ye) THEN
18060 IF (jte + 1 .GT. jde - 2) THEN
18067 IF (config_flags%open_xs) THEN
18068 IF (degrade_xs) THEN
18069 IF (its - 1 .LT. ids + 1) THEN
18076 IF (config_flags%open_xe) THEN
18077 IF (degrade_xe) THEN
18078 IF (ite + 1 .GT. ide - 2) THEN
18085 IF (config_flags%open_ys) THEN
18086 IF (degrade_ys) THEN
18087 IF (jts - 1 .LT. jds + 1) THEN
18094 IF (config_flags%open_ye) THEN
18095 IF (degrade_ye) THEN
18096 IF (jte + 1 .GT. jde - 2) THEN
18103 ad_from55 = j_start
18105 ! We don't want to change j_start and j_end
18106 ! for polar BC's since we want to calculate
18107 ! fluxes for directions other than y at the
18109 !-- here is the limiter...
18110 DO j=ad_from55,j_end
18111 CALL PUSHINTEGER4(k)
18113 ad_from54 = i_start
18114 CALL PUSHINTEGER4(i)
18115 DO i=ad_from54,i_end
18116 CALL PUSHREAL8(ph_low(i,k,j))
18117 ph_low(i,k,j) = (mub(i, j)+mu_old(i, j))*field_old(i, k, j) - dt*(&
18118 & msftx(i, j)*msfty(i, j)*(rdx*(fqxl(i+1, k, j)-fqxl(i, k, j))&
18119 & +rdy*(fqyl(i, k, j+1)-fqyl(i, k, j)))+msfty(i, j)*rdzw(k)*(&
18120 & fqzl(i, k+1, j)-fqzl(i, k, j)))
18122 CALL PUSHINTEGER4(i - 1)
18123 CALL PUSHINTEGER4(ad_from54)
18126 CALL PUSHINTEGER4(j - 1)
18127 CALL PUSHINTEGER4(ad_from55)
18129 ad_from55 = j_start
18130 DO j=ad_from55,j_end
18131 CALL PUSHINTEGER4(k)
18133 ad_from54 = i_start
18134 CALL PUSHINTEGER4(i)
18135 DO i=ad_from54,i_end
18136 IF (0. .LT. fqx(i+1, k, j)) THEN
18137 max1 = fqx(i+1, k, j)
18138 CALL PUSHCONTROL1B(1)
18140 CALL PUSHCONTROL1B(0)
18143 IF (0. .GT. fqx(i, k, j)) THEN
18144 min74 = fqx(i, k, j)
18145 CALL PUSHCONTROL1B(1)
18147 CALL PUSHCONTROL1B(0)
18150 IF (0. .LT. fqy(i, k, j+1)) THEN
18151 max53 = fqy(i, k, j+1)
18152 CALL PUSHCONTROL1B(1)
18154 CALL PUSHCONTROL1B(0)
18157 IF (0. .GT. fqy(i, k, j)) THEN
18158 min75 = fqy(i, k, j)
18159 CALL PUSHCONTROL1B(1)
18161 CALL PUSHCONTROL1B(0)
18164 IF (0. .GT. fqz(i, k+1, j)) THEN
18165 min76 = fqz(i, k+1, j)
18166 CALL PUSHCONTROL1B(1)
18168 CALL PUSHCONTROL1B(0)
18171 IF (0. .LT. fqz(i, k, j)) THEN
18172 max54 = fqz(i, k, j)
18173 CALL PUSHCONTROL1B(0)
18175 CALL PUSHCONTROL1B(1)
18178 CALL PUSHREAL8(flux_out(i,k,j))
18179 flux_out(i,k,j) = dt*(msftx(i, j)*msfty(i, j)*(rdx*(max1-min74)+rdy*(&
18180 & max53-min75))+msfty(i, j)*rdzw(k)*(min76-max54))
18182 CALL PUSHINTEGER4(i - 1)
18183 CALL PUSHINTEGER4(ad_from54)
18186 CALL PUSHINTEGER4(j - 1)
18187 CALL PUSHINTEGER4(ad_from55)
18189 ad_from55 = j_start
18190 DO j=ad_from55,j_end
18191 CALL PUSHINTEGER4(k)
18193 ad_from54 = i_start
18194 CALL PUSHINTEGER4(i)
18195 DO i=ad_from54,i_end
18196 IF (flux_out(i,k,j) .GT. ph_low(i,k,j)) THEN
18197 IF (0. .LT. ph_low(i,k,j)/(flux_out(i,k,j)+eps)) THEN
18198 CALL PUSHREAL8(scale)
18199 scale = ph_low(i,k,j)/(flux_out(i,k,j)+eps)
18200 CALL PUSHCONTROL1B(0)
18202 CALL PUSHREAL8(scale)
18204 CALL PUSHCONTROL1B(1)
18206 IF (fqx(i+1, k, j) .GT. 0.) THEN
18207 CALL PUSHREAL8(fqx(i+1, k, j))
18208 fqx(i+1, k, j) = scale*fqx(i+1, k, j)
18209 CALL PUSHCONTROL1B(0)
18211 CALL PUSHCONTROL1B(1)
18213 IF (fqx(i, k, j) .LT. 0.) THEN
18214 CALL PUSHREAL8(fqx(i, k, j))
18215 fqx(i, k, j) = scale*fqx(i, k, j)
18216 CALL PUSHCONTROL1B(0)
18218 CALL PUSHCONTROL1B(1)
18220 IF (fqy(i, k, j+1) .GT. 0.) THEN
18221 CALL PUSHREAL8(fqy(i, k, j+1))
18222 fqy(i, k, j+1) = scale*fqy(i, k, j+1)
18223 CALL PUSHCONTROL1B(0)
18225 CALL PUSHCONTROL1B(1)
18227 IF (fqy(i, k, j) .LT. 0.) THEN
18228 CALL PUSHREAL8(fqy(i, k, j))
18229 fqy(i, k, j) = scale*fqy(i, k, j)
18230 CALL PUSHCONTROL1B(0)
18232 CALL PUSHCONTROL1B(1)
18234 ! note: z flux is opposite sign in mass coordinate because
18235 ! vertical coordinate decreases with increasing k
18236 IF (fqz(i, k+1, j) .LT. 0.) THEN
18237 CALL PUSHREAL8(fqz(i, k+1, j))
18238 fqz(i, k+1, j) = scale*fqz(i, k+1, j)
18239 CALL PUSHCONTROL1B(0)
18241 CALL PUSHCONTROL1B(1)
18243 IF (fqz(i, k, j) .GT. 0.) THEN
18244 CALL PUSHREAL8(fqz(i, k, j))
18245 fqz(i, k, j) = scale*fqz(i, k, j)
18246 CALL PUSHCONTROL2B(2)
18248 CALL PUSHCONTROL2B(1)
18251 CALL PUSHCONTROL2B(0)
18254 CALL PUSHINTEGER4(i - 1)
18255 CALL PUSHINTEGER4(ad_from54)
18258 CALL PUSHINTEGER4(j - 1)
18259 CALL PUSHINTEGER4(ad_from55)
18260 CALL PUSHCONTROL1B(1)
18262 CALL PUSHCONTROL1B(0)
18264 ! add in the pd-limited flux divergence
18266 IF (ite .GT. ide - 1) THEN
18272 IF (jte .GT. jde - 1) THEN
18277 ad_from57 = j_start
18278 DO j=ad_from57,j_end
18279 CALL PUSHINTEGER4(k)
18281 ad_from56 = i_start
18282 CALL PUSHINTEGER4(i)
18284 CALL PUSHINTEGER4(i - 1)
18285 CALL PUSHINTEGER4(ad_from56)
18288 CALL PUSHINTEGER4(j - 1)
18289 CALL PUSHINTEGER4(ad_from57)
18291 ad_from59 = j_start
18292 DO j=ad_from59,j_end
18293 CALL PUSHINTEGER4(k)
18295 ad_from58 = i_start
18296 CALL PUSHINTEGER4(i)
18298 CALL PUSHINTEGER4(i - 1)
18299 CALL PUSHINTEGER4(ad_from58)
18302 CALL PUSHINTEGER4(j - 1)
18303 CALL PUSHINTEGER4(ad_from59)
18304 CALL PUSHCONTROL1B(0)
18306 CALL PUSHCONTROL1B(1)
18308 ! x flux divergence
18310 IF (degrade_xs) THEN
18311 IF (its .LT. ids + 1) THEN
18317 IF (degrade_xe) THEN
18318 IF (ite .GT. ide - 2) THEN
18324 ad_from61 = j_start
18325 DO j=ad_from61,j_end
18326 CALL PUSHINTEGER4(k)
18328 ad_from60 = i_start
18329 CALL PUSHINTEGER4(i)
18331 CALL PUSHINTEGER4(i - 1)
18332 CALL PUSHINTEGER4(ad_from60)
18335 CALL PUSHINTEGER4(j - 1)
18336 CALL PUSHINTEGER4(ad_from61)
18338 ad_from63 = j_start
18339 DO j=ad_from63,j_end
18340 CALL PUSHINTEGER4(k)
18342 ad_from62 = i_start
18343 CALL PUSHINTEGER4(i)
18345 CALL PUSHINTEGER4(i - 1)
18346 CALL PUSHINTEGER4(ad_from62)
18349 CALL PUSHINTEGER4(j - 1)
18350 CALL PUSHINTEGER4(ad_from63)
18351 CALL PUSHCONTROL1B(1)
18353 CALL PUSHCONTROL1B(0)
18355 ! y flux divergence
18358 IF (ite .GT. ide - 1) THEN
18363 IF (degrade_ys) THEN
18364 IF (jts .LT. jds + 1) THEN
18370 IF (degrade_ye) THEN
18371 IF (jte .GT. jde - 2) THEN
18378 CALL PUSHINTEGER4(k)
18380 CALL PUSHINTEGER4(i)
18385 CALL PUSHINTEGER4(k)
18387 CALL PUSHINTEGER4(i)
18392 DO j=j_end,j_start,-1
18394 DO i=i_end,i_start,-1
18395 temp47b18 = -(msftx(i, j)*rdy*h_tendencyb(i, k, j))
18396 fqyb(i, k, j+1) = fqyb(i, k, j+1) + temp47b18
18397 fqyb(i, k, j) = fqyb(i, k, j) - temp47b18
18398 fqylb(i, k, j+1) = fqylb(i, k, j+1) + temp47b18
18399 fqylb(i, k, j) = fqylb(i, k, j) - temp47b18
18401 CALL POPINTEGER4(i)
18403 CALL POPINTEGER4(k)
18409 DO j=j_end,j_start,-1
18411 DO i=i_end,i_start,-1
18412 temp47b17 = -(msftx(i, j)*rdy*tendencyb(i, k, j))
18413 fqyb(i, k, j+1) = fqyb(i, k, j+1) + temp47b17
18414 fqyb(i, k, j) = fqyb(i, k, j) - temp47b17
18415 fqylb(i, k, j+1) = fqylb(i, k, j+1) + temp47b17
18416 fqylb(i, k, j) = fqylb(i, k, j) - temp47b17
18418 CALL POPINTEGER4(i)
18420 CALL POPINTEGER4(k)
18422 CALL POPCONTROL1B(branch)
18423 IF (branch .EQ. 0) THEN
18429 CALL POPINTEGER4(ad_from63)
18430 CALL POPINTEGER4(ad_to63)
18431 DO j=ad_to63,ad_from63,-1
18433 CALL POPINTEGER4(ad_from62)
18434 CALL POPINTEGER4(ad_to62)
18435 DO i=ad_to62,ad_from62,-1
18436 temp47b16 = -(msftx(i, j)*rdx*h_tendencyb(i, k, j))
18437 fqxb(i+1, k, j) = fqxb(i+1, k, j) + temp47b16
18438 fqxb(i, k, j) = fqxb(i, k, j) - temp47b16
18439 fqxlb(i+1, k, j) = fqxlb(i+1, k, j) + temp47b16
18440 fqxlb(i, k, j) = fqxlb(i, k, j) - temp47b16
18441 h_tendencyb(i, k, j) = 0.0
18443 CALL POPINTEGER4(i)
18445 CALL POPINTEGER4(k)
18448 CALL POPINTEGER4(ad_from61)
18449 CALL POPINTEGER4(ad_to61)
18450 DO j=ad_to61,ad_from61,-1
18452 CALL POPINTEGER4(ad_from60)
18453 CALL POPINTEGER4(ad_to60)
18454 DO i=ad_to60,ad_from60,-1
18455 temp47b15 = -(msftx(i, j)*rdx*tendencyb(i, k, j))
18456 fqxb(i+1, k, j) = fqxb(i+1, k, j) + temp47b15
18457 fqxb(i, k, j) = fqxb(i, k, j) - temp47b15
18458 fqxlb(i+1, k, j) = fqxlb(i+1, k, j) + temp47b15
18459 fqxlb(i, k, j) = fqxlb(i, k, j) - temp47b15
18461 CALL POPINTEGER4(i)
18463 CALL POPINTEGER4(k)
18465 CALL POPCONTROL1B(branch)
18466 IF (branch .EQ. 0) THEN
18469 CALL POPINTEGER4(ad_from59)
18470 CALL POPINTEGER4(ad_to59)
18471 DO j=ad_to59,ad_from59,-1
18473 CALL POPINTEGER4(ad_from58)
18474 CALL POPINTEGER4(ad_to58)
18475 DO i=ad_to58,ad_from58,-1
18476 temp47b14 = -(rdzw(k)*z_tendencyb(i, k, j))
18477 fqzb(i, k+1, j) = fqzb(i, k+1, j) + temp47b14
18478 fqzb(i, k, j) = fqzb(i, k, j) - temp47b14
18479 fqzlb(i, k+1, j) = fqzlb(i, k+1, j) + temp47b14
18480 fqzlb(i, k, j) = fqzlb(i, k, j) - temp47b14
18481 z_tendencyb(i, k, j) = 0.0
18483 CALL POPINTEGER4(i)
18485 CALL POPINTEGER4(k)
18491 CALL POPINTEGER4(ad_from57)
18492 CALL POPINTEGER4(ad_to57)
18493 DO j=ad_to57,ad_from57,-1
18495 CALL POPINTEGER4(ad_from56)
18496 CALL POPINTEGER4(ad_to56)
18497 DO i=ad_to56,ad_from56,-1
18498 temp47b13 = -(rdzw(k)*tendencyb(i, k, j))
18499 fqzb(i, k+1, j) = fqzb(i, k+1, j) + temp47b13
18500 fqzb(i, k, j) = fqzb(i, k, j) - temp47b13
18501 fqzlb(i, k+1, j) = fqzlb(i, k+1, j) + temp47b13
18502 fqzlb(i, k, j) = fqzlb(i, k, j) - temp47b13
18504 CALL POPINTEGER4(i)
18506 CALL POPINTEGER4(k)
18508 CALL POPCONTROL1B(branch)
18509 IF (branch .NE. 0) THEN
18510 CALL POPINTEGER4(ad_from55)
18511 CALL POPINTEGER4(ad_to55)
18512 DO j=ad_to55,ad_from55,-1
18514 CALL POPINTEGER4(ad_from54)
18515 CALL POPINTEGER4(ad_to54)
18516 DO i=ad_to54,ad_from54,-1
18517 CALL POPCONTROL2B(branch)
18518 IF (branch .EQ. 0) THEN
18519 flux_outb(i,k,j) = 0.0
18520 ph_lowb(i,k,j) = 0.0
18522 IF (branch .EQ. 1) THEN
18525 CALL POPREAL8(fqz(i, k, j))
18526 scaleb = fqz(i, k, j)*fqzb(i, k, j)
18527 fqzb(i, k, j) = scale*fqzb(i, k, j)
18529 CALL POPCONTROL1B(branch)
18530 IF (branch .EQ. 0) THEN
18531 CALL POPREAL8(fqz(i, k+1, j))
18532 scaleb = scaleb + fqz(i, k+1, j)*fqzb(i, k+1, j)
18533 fqzb(i, k+1, j) = scale*fqzb(i, k+1, j)
18535 CALL POPCONTROL1B(branch)
18536 IF (branch .EQ. 0) THEN
18537 CALL POPREAL8(fqy(i, k, j))
18538 scaleb = scaleb + fqy(i, k, j)*fqyb(i, k, j)
18539 fqyb(i, k, j) = scale*fqyb(i, k, j)
18541 CALL POPCONTROL1B(branch)
18542 IF (branch .EQ. 0) THEN
18543 CALL POPREAL8(fqy(i, k, j+1))
18544 scaleb = scaleb + fqy(i, k, j+1)*fqyb(i, k, j+1)
18545 fqyb(i, k, j+1) = scale*fqyb(i, k, j+1)
18547 CALL POPCONTROL1B(branch)
18548 IF (branch .EQ. 0) THEN
18549 CALL POPREAL8(fqx(i, k, j))
18550 scaleb = scaleb + fqx(i, k, j)*fqxb(i, k, j)
18551 fqxb(i, k, j) = scale*fqxb(i, k, j)
18553 CALL POPCONTROL1B(branch)
18554 IF (branch .EQ. 0) THEN
18555 CALL POPREAL8(fqx(i+1, k, j))
18556 scaleb = scaleb + fqx(i+1, k, j)*fqxb(i+1, k, j)
18557 fqxb(i+1, k, j) = scale*fqxb(i+1, k, j)
18559 CALL POPCONTROL1B(branch)
18560 IF (branch .EQ. 0) THEN
18561 CALL POPREAL8(scale)
18562 temp47b12 = scaleb/(eps+flux_out(i,k,j))
18563 ph_lowb(i,k,j) = temp47b12
18564 flux_outb(i,k,j) = -(ph_low(i,k,j)*temp47b12/(eps+flux_out(i,k,j)))
18566 CALL POPREAL8(scale)
18567 flux_outb(i,k,j) = 0.0
18568 ph_lowb(i,k,j) = 0.0
18572 CALL POPINTEGER4(i)
18574 CALL POPINTEGER4(k)
18576 CALL POPINTEGER4(ad_from55)
18577 CALL POPINTEGER4(ad_to55)
18578 DO j=ad_to55,ad_from55,-1
18580 CALL POPINTEGER4(ad_from54)
18581 CALL POPINTEGER4(ad_to54)
18582 DO i=ad_to54,ad_from54,-1
18583 CALL POPREAL8(flux_out(i,k,j))
18584 temp47b10 = dt*msftx(i, j)*msfty(i, j)*flux_outb(i,k,j)
18585 temp47b11 = msfty(i, j)*dt*rdzw(k)*flux_outb(i,k,j)
18586 max1b = rdx*temp47b10
18587 min74b = -(rdx*temp47b10)
18588 max53b = rdy*temp47b10
18589 min75b = -(rdy*temp47b10)
18591 max54b = -temp47b11
18592 CALL POPCONTROL1B(branch)
18593 IF (branch .EQ. 0) fqzb(i, k, j) = fqzb(i, k, j) + max54b
18594 CALL POPCONTROL1B(branch)
18595 IF (branch .NE. 0) fqzb(i, k+1, j) = fqzb(i, k+1, j) + min76b
18596 CALL POPCONTROL1B(branch)
18597 IF (branch .NE. 0) fqyb(i, k, j) = fqyb(i, k, j) + min75b
18598 CALL POPCONTROL1B(branch)
18599 IF (branch .NE. 0) fqyb(i, k, j+1) = fqyb(i, k, j+1) + max53b
18600 CALL POPCONTROL1B(branch)
18601 IF (branch .NE. 0) fqxb(i, k, j) = fqxb(i, k, j) + min74b
18602 CALL POPCONTROL1B(branch)
18603 IF (branch .NE. 0) fqxb(i+1, k, j) = fqxb(i+1, k, j) + max1b
18605 CALL POPINTEGER4(i)
18607 CALL POPINTEGER4(k)
18609 CALL POPINTEGER4(ad_from55)
18610 CALL POPINTEGER4(ad_to55)
18611 DO j=ad_to55,ad_from55,-1
18613 CALL POPINTEGER4(ad_from54)
18614 CALL POPINTEGER4(ad_to54)
18615 DO i=ad_to54,ad_from54,-1
18616 CALL POPREAL8(ph_low(i,k,j))
18617 temp47b8 = -(dt*msftx(i, j)*msfty(i, j)*ph_lowb(i,k,j))
18618 temp47b9 = -(dt*msfty(i, j)*rdzw(k)*ph_lowb(i,k,j))
18619 mu_oldb(i, j) = mu_oldb(i, j) + field_old(i, k, j)*ph_lowb(i,k,j)
18620 field_oldb(i, k, j) = field_oldb(i, k, j) + (mub(i, j)+mu_old(&
18621 & i, j))*ph_lowb(i,k,j)
18622 fqxlb(i+1, k, j) = fqxlb(i+1, k, j) + rdx*temp47b8
18623 fqxlb(i, k, j) = fqxlb(i, k, j) - rdx*temp47b8
18624 fqylb(i, k, j+1) = fqylb(i, k, j+1) + rdy*temp47b8
18625 fqylb(i, k, j) = fqylb(i, k, j) - rdy*temp47b8
18626 fqzlb(i, k+1, j) = fqzlb(i, k+1, j) + temp47b9
18627 fqzlb(i, k, j) = fqzlb(i, k, j) - temp47b9
18629 CALL POPINTEGER4(i)
18631 CALL POPINTEGER4(k)
18634 CALL POPCONTROL3B(branch)
18635 IF (branch .LT. 3) THEN
18636 IF (branch .EQ. 0) THEN
18637 CALL POPINTEGER4(ad_from38)
18638 CALL POPINTEGER4(ad_to38)
18639 DO j=ad_to38,ad_from38,-1
18640 CALL POPINTEGER4(ad_from37)
18641 CALL POPINTEGER4(ad_to37)
18642 DO i=ad_to37,ad_from37,-1
18643 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
18644 temp31b74 = rom(i, k, j)*fqzb(i, k, j)
18645 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
18646 & field(i, k-1, j))*fqzb(i, k, j)
18647 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp31b74
18648 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp31b74
18649 fqzb(i, k, j) = 0.0
18650 temp31b75 = dz*mu*fqzlb(i, k, j)/dt
18651 min59b = 0.5*field_old(i, k-1, j)*temp31b75
18652 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min59*&
18654 max40b = 0.5*field_old(i, k, j)*temp31b75
18655 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max40*&
18657 mub0 = (0.5*(min59*field_old(i, k-1, j))+0.5*(max40*field_old(&
18658 & i, k, j)))*dz*fqzlb(i, k, j)/dt
18659 fqzlb(i, k, j) = 0.0
18660 CALL POPCONTROL1B(branch)
18661 IF (branch .EQ. 0) THEN
18662 CALL POPREAL8(max40)
18665 CALL POPREAL8(max40)
18670 CALL POPCONTROL1B(branch)
18671 IF (branch .EQ. 0) THEN
18676 CALL POPCONTROL1B(branch)
18677 IF (branch .EQ. 0) THEN
18678 CALL POPREAL8(min59)
18681 CALL POPREAL8(min59)
18686 CALL POPCONTROL1B(branch)
18687 IF (branch .EQ. 0) THEN
18692 temp31b70 = dt*crb/(dz*mu)
18694 mub0 = mub0 - vel*temp31b70/mu
18696 romb(i, k, j) = romb(i, k, j) + velb
18697 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
18698 mu = 0.5*(mut(i, j)+mut(i, j))
18701 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
18702 temp31b71 = vel*fqzb(i, k, j)
18703 temp31b72 = 7.*temp31b71/12.
18704 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i, k&
18705 & +1, j)+field(i, k-2, j))/12.)*fqzb(i, k, j)
18706 fieldb(i, k, j) = fieldb(i, k, j) + temp31b72
18707 fieldb(i, k-1, j) = fieldb(i, k-1, j) + temp31b72
18708 fieldb(i, k+1, j) = fieldb(i, k+1, j) - temp31b71/12.
18709 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp31b71/12.
18710 fqzb(i, k, j) = 0.0
18711 temp31b73 = dz*mu*fqzlb(i, k, j)/dt
18712 min58b = 0.5*field_old(i, k-1, j)*temp31b73
18713 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min58*&
18715 max39b = 0.5*field_old(i, k, j)*temp31b73
18716 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max39*&
18718 mub0 = (0.5*(min58*field_old(i, k-1, j))+0.5*(max39*field_old(&
18719 & i, k, j)))*dz*fqzlb(i, k, j)/dt
18720 fqzlb(i, k, j) = 0.0
18721 CALL POPCONTROL1B(branch)
18722 IF (branch .EQ. 0) THEN
18723 CALL POPREAL8(max39)
18726 CALL POPREAL8(max39)
18731 CALL POPCONTROL1B(branch)
18732 IF (branch .EQ. 0) THEN
18737 CALL POPCONTROL1B(branch)
18738 IF (branch .EQ. 0) THEN
18739 CALL POPREAL8(min58)
18742 CALL POPREAL8(min58)
18747 CALL POPCONTROL1B(branch)
18748 IF (branch .EQ. 0) THEN
18753 temp31b66 = dt*crb/(dz*mu)
18754 velb = velb + temp31b66
18755 mub0 = mub0 - vel*temp31b66/mu
18757 romb(i, k, j) = romb(i, k, j) + velb
18758 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
18759 mu = 0.5*(mut(i, j)+mut(i, j))
18762 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
18763 temp31b67 = vel*fqzb(i, k, j)
18764 temp31b68 = 7.*temp31b67/12.
18765 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i, k&
18766 & +1, j)+field(i, k-2, j))/12.)*fqzb(i, k, j)
18767 fieldb(i, k, j) = fieldb(i, k, j) + temp31b68
18768 fieldb(i, k-1, j) = fieldb(i, k-1, j) + temp31b68
18769 fieldb(i, k+1, j) = fieldb(i, k+1, j) - temp31b67/12.
18770 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp31b67/12.
18771 fqzb(i, k, j) = 0.0
18772 temp31b69 = dz*mu*fqzlb(i, k, j)/dt
18773 min57b = 0.5*field_old(i, k-1, j)*temp31b69
18774 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min57*&
18776 max38b = 0.5*field_old(i, k, j)*temp31b69
18777 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max38*&
18779 mub0 = (0.5*(min57*field_old(i, k-1, j))+0.5*(max38*field_old(&
18780 & i, k, j)))*dz*fqzlb(i, k, j)/dt
18781 fqzlb(i, k, j) = 0.0
18782 CALL POPCONTROL1B(branch)
18783 IF (branch .EQ. 0) THEN
18784 CALL POPREAL8(max38)
18787 CALL POPREAL8(max38)
18792 CALL POPCONTROL1B(branch)
18793 IF (branch .EQ. 0) THEN
18798 CALL POPCONTROL1B(branch)
18799 IF (branch .EQ. 0) THEN
18800 CALL POPREAL8(min57)
18803 CALL POPREAL8(min57)
18808 CALL POPCONTROL1B(branch)
18809 IF (branch .EQ. 0) THEN
18814 temp31b63 = dt*crb/(dz*mu)
18815 velb = velb + temp31b63
18816 mub0 = mub0 - vel*temp31b63/mu
18818 romb(i, k, j) = romb(i, k, j) + velb
18819 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
18820 mu = 0.5*(mut(i, j)+mut(i, j))
18823 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
18824 temp31b64 = rom(i, k, j)*fqzb(i, k, j)
18825 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
18826 & field(i, k-1, j))*fqzb(i, k, j)
18827 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp31b64
18828 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp31b64
18829 fqzb(i, k, j) = 0.0
18830 temp31b65 = dz*mu*fqzlb(i, k, j)/dt
18831 min56b = 0.5*field_old(i, k-1, j)*temp31b65
18832 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min56*&
18834 max37b = 0.5*field_old(i, k, j)*temp31b65
18835 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max37*&
18837 mub0 = (0.5*(min56*field_old(i, k-1, j))+0.5*(max37*field_old(&
18838 & i, k, j)))*dz*fqzlb(i, k, j)/dt
18839 fqzlb(i, k, j) = 0.0
18840 CALL POPCONTROL1B(branch)
18841 IF (branch .EQ. 0) THEN
18842 CALL POPREAL8(max37)
18845 CALL POPREAL8(max37)
18850 CALL POPCONTROL1B(branch)
18851 IF (branch .EQ. 0) THEN
18856 CALL POPCONTROL1B(branch)
18857 IF (branch .EQ. 0) THEN
18858 CALL POPREAL8(min56)
18861 CALL POPREAL8(min56)
18866 CALL POPCONTROL1B(branch)
18867 IF (branch .EQ. 0) THEN
18872 temp31b62 = dt*crb/(dz*mu)
18874 mub0 = mub0 - vel*temp31b62/mu
18876 romb(i, k, j) = romb(i, k, j) + velb
18878 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
18880 CALL POPINTEGER4(k)
18882 DO k=ktf-2,kts+3,-1
18883 CALL POPINTEGER4(ad_from36)
18884 CALL POPINTEGER4(ad_to36)
18885 DO i=ad_to36,ad_from36,-1
18886 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
18887 temp31b58 = vel*fqzb(i, k, j)
18888 temp31b59 = 37.*temp31b58/60.
18889 temp31b60 = -(2.*temp31b58/15.)
18890 velb = (37.*((field(i, k, j)+field(i, k-1, j))/60.)-2.*((&
18891 & field(i, k+1, j)+field(i, k-2, j))/15.)+(field(i, k+2, j)+&
18892 & field(i, k-3, j))/60.)*fqzb(i, k, j)
18893 fieldb(i, k, j) = fieldb(i, k, j) + temp31b59
18894 fieldb(i, k-1, j) = fieldb(i, k-1, j) + temp31b59
18895 fieldb(i, k+1, j) = fieldb(i, k+1, j) + temp31b60
18896 fieldb(i, k-2, j) = fieldb(i, k-2, j) + temp31b60
18897 fieldb(i, k+2, j) = fieldb(i, k+2, j) + temp31b58/60.
18898 fieldb(i, k-3, j) = fieldb(i, k-3, j) + temp31b58/60.
18899 fqzb(i, k, j) = 0.0
18900 temp31b61 = dz*mu*fqzlb(i, k, j)/dt
18901 min55b = 0.5*field_old(i, k-1, j)*temp31b61
18902 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min55*&
18904 max36b = 0.5*field_old(i, k, j)*temp31b61
18905 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max36*&
18907 mub0 = (0.5*(min55*field_old(i, k-1, j))+0.5*(max36*&
18908 & field_old(i, k, j)))*dz*fqzlb(i, k, j)/dt
18909 fqzlb(i, k, j) = 0.0
18910 CALL POPCONTROL1B(branch)
18911 IF (branch .EQ. 0) THEN
18912 CALL POPREAL8(max36)
18915 CALL POPREAL8(max36)
18920 CALL POPCONTROL1B(branch)
18921 IF (branch .EQ. 0) THEN
18926 CALL POPCONTROL1B(branch)
18927 IF (branch .EQ. 0) THEN
18928 CALL POPREAL8(min55)
18931 CALL POPREAL8(min55)
18936 CALL POPCONTROL1B(branch)
18937 IF (branch .EQ. 0) THEN
18942 temp31b57 = dt*crb/(dz*mu)
18943 velb = velb + temp31b57
18944 mub0 = mub0 - vel*temp31b57/mu
18946 romb(i, k, j) = romb(i, k, j) + velb
18948 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
18952 CALL POPINTEGER4(k)
18953 CALL POPINTEGER4(ad_from35)
18954 CALL POPINTEGER4(ad_to35)
18955 DO i=ad_to35,ad_from35,-1
18956 fqzlb(i, kde, j) = 0.0
18957 fqzb(i, kde, j) = 0.0
18958 fqzlb(i, 1, j) = 0.0
18959 fqzb(i, 1, j) = 0.0
18961 CALL POPINTEGER4(i)
18963 ELSE IF (branch .EQ. 1) THEN
18964 CALL POPINTEGER4(ad_from42)
18965 CALL POPINTEGER4(ad_to42)
18966 DO j=ad_to42,ad_from42,-1
18967 CALL POPINTEGER4(ad_from41)
18968 CALL POPINTEGER4(ad_to41)
18969 DO i=ad_to41,ad_from41,-1
18970 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
18971 temp43b0 = rom(i, k, j)*fqzb(i, k, j)
18972 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
18973 & field(i, k-1, j))*fqzb(i, k, j)
18974 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp43b0
18975 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp43b0
18976 fqzb(i, k, j) = 0.0
18977 temp43b1 = dz*mu*fqzlb(i, k, j)/dt
18978 min64b = 0.5*field_old(i, k-1, j)*temp43b1
18979 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min64*&
18981 max45b = 0.5*field_old(i, k, j)*temp43b1
18982 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max45*temp43b1
18983 mub0 = (0.5*(min64*field_old(i, k-1, j))+0.5*(max45*field_old(&
18984 & i, k, j)))*dz*fqzlb(i, k, j)/dt
18985 fqzlb(i, k, j) = 0.0
18986 CALL POPCONTROL1B(branch)
18987 IF (branch .EQ. 0) THEN
18988 CALL POPREAL8(max45)
18991 CALL POPREAL8(max45)
18996 CALL POPCONTROL1B(branch)
18997 IF (branch .EQ. 0) THEN
19002 CALL POPCONTROL1B(branch)
19003 IF (branch .EQ. 0) THEN
19004 CALL POPREAL8(min64)
19007 CALL POPREAL8(min64)
19012 CALL POPCONTROL1B(branch)
19013 IF (branch .EQ. 0) THEN
19018 temp43b = dt*crb/(dz*mu)
19020 mub0 = mub0 - vel*temp43b/mu
19022 romb(i, k, j) = romb(i, k, j) + velb
19023 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19024 mu = 0.5*(mut(i, j)+mut(i, j))
19027 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19028 temp39 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k&
19029 & , j)-field(i, k-1, j))
19030 temp42 = SIGN(1., -vel)
19031 temp41 = temp42/12.
19032 temp40 = SIGN(1, time_step)
19033 temp39b0 = vel*fqzb(i, k, j)
19034 temp39b1 = 7.*temp39b0/12.
19035 temp39b2 = temp40*temp41*temp39b0
19036 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i, k&
19037 & +1, j)+field(i, k-2, j))/12.+temp40*(temp41*temp39))*fqzb(i&
19039 fieldb(i, k, j) = fieldb(i, k, j) + temp39b1 - 3.*temp39b2
19040 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*temp39b2 + temp39b1
19041 fieldb(i, k+1, j) = fieldb(i, k+1, j) + temp39b2 - temp39b0/&
19043 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp39b2 - temp39b0/&
19045 fqzb(i, k, j) = 0.0
19046 temp39b3 = dz*mu*fqzlb(i, k, j)/dt
19047 min63b = 0.5*field_old(i, k-1, j)*temp39b3
19048 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min63*&
19050 max44b = 0.5*field_old(i, k, j)*temp39b3
19051 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max44*temp39b3
19052 mub0 = (0.5*(min63*field_old(i, k-1, j))+0.5*(max44*field_old(&
19053 & i, k, j)))*dz*fqzlb(i, k, j)/dt
19054 fqzlb(i, k, j) = 0.0
19055 CALL POPCONTROL1B(branch)
19056 IF (branch .EQ. 0) THEN
19057 CALL POPREAL8(max44)
19060 CALL POPREAL8(max44)
19065 CALL POPCONTROL1B(branch)
19066 IF (branch .EQ. 0) THEN
19071 CALL POPCONTROL1B(branch)
19072 IF (branch .EQ. 0) THEN
19073 CALL POPREAL8(min63)
19076 CALL POPREAL8(min63)
19081 CALL POPCONTROL1B(branch)
19082 IF (branch .EQ. 0) THEN
19087 temp39b = dt*crb/(dz*mu)
19088 velb = velb + temp39b
19089 mub0 = mub0 - vel*temp39b/mu
19091 romb(i, k, j) = romb(i, k, j) + velb
19092 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19093 mu = 0.5*(mut(i, j)+mut(i, j))
19096 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19097 temp35 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k&
19098 & , j)-field(i, k-1, j))
19099 temp38 = SIGN(1., -vel)
19100 temp37 = temp38/12.
19101 temp36 = SIGN(1, time_step)
19102 temp35b3 = vel*fqzb(i, k, j)
19103 temp35b4 = 7.*temp35b3/12.
19104 temp35b5 = temp36*temp37*temp35b3
19105 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i, k&
19106 & +1, j)+field(i, k-2, j))/12.+temp36*(temp37*temp35))*fqzb(i&
19108 fieldb(i, k, j) = fieldb(i, k, j) + temp35b4 - 3.*temp35b5
19109 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*temp35b5 + temp35b4
19110 fieldb(i, k+1, j) = fieldb(i, k+1, j) + temp35b5 - temp35b3/&
19112 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp35b5 - temp35b3/&
19114 fqzb(i, k, j) = 0.0
19115 temp35b6 = dz*mu*fqzlb(i, k, j)/dt
19116 min62b = 0.5*field_old(i, k-1, j)*temp35b6
19117 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min62*&
19119 max43b = 0.5*field_old(i, k, j)*temp35b6
19120 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max43*temp35b6
19121 mub0 = (0.5*(min62*field_old(i, k-1, j))+0.5*(max43*field_old(&
19122 & i, k, j)))*dz*fqzlb(i, k, j)/dt
19123 fqzlb(i, k, j) = 0.0
19124 CALL POPCONTROL1B(branch)
19125 IF (branch .EQ. 0) THEN
19126 CALL POPREAL8(max43)
19129 CALL POPREAL8(max43)
19134 CALL POPCONTROL1B(branch)
19135 IF (branch .EQ. 0) THEN
19140 CALL POPCONTROL1B(branch)
19141 IF (branch .EQ. 0) THEN
19142 CALL POPREAL8(min62)
19145 CALL POPREAL8(min62)
19150 CALL POPCONTROL1B(branch)
19151 IF (branch .EQ. 0) THEN
19156 temp35b0 = dt*crb/(dz*mu)
19157 velb = velb + temp35b0
19158 mub0 = mub0 - vel*temp35b0/mu
19160 romb(i, k, j) = romb(i, k, j) + velb
19161 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19162 mu = 0.5*(mut(i, j)+mut(i, j))
19165 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19166 temp35b1 = rom(i, k, j)*fqzb(i, k, j)
19167 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
19168 & field(i, k-1, j))*fqzb(i, k, j)
19169 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp35b1
19170 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp35b1
19171 fqzb(i, k, j) = 0.0
19172 temp35b2 = dz*mu*fqzlb(i, k, j)/dt
19173 min61b = 0.5*field_old(i, k-1, j)*temp35b2
19174 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min61*&
19176 max42b = 0.5*field_old(i, k, j)*temp35b2
19177 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max42*temp35b2
19178 mub0 = (0.5*(min61*field_old(i, k-1, j))+0.5*(max42*field_old(&
19179 & i, k, j)))*dz*fqzlb(i, k, j)/dt
19180 fqzlb(i, k, j) = 0.0
19181 CALL POPCONTROL1B(branch)
19182 IF (branch .EQ. 0) THEN
19183 CALL POPREAL8(max42)
19186 CALL POPREAL8(max42)
19191 CALL POPCONTROL1B(branch)
19192 IF (branch .EQ. 0) THEN
19197 CALL POPCONTROL1B(branch)
19198 IF (branch .EQ. 0) THEN
19199 CALL POPREAL8(min61)
19202 CALL POPREAL8(min61)
19207 CALL POPCONTROL1B(branch)
19208 IF (branch .EQ. 0) THEN
19213 temp35b = dt*crb/(dz*mu)
19215 mub0 = mub0 - vel*temp35b/mu
19217 romb(i, k, j) = romb(i, k, j) + velb
19219 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19221 CALL POPINTEGER4(k)
19223 DO k=ktf-2,kts+3,-1
19224 CALL POPINTEGER4(ad_from40)
19225 CALL POPINTEGER4(ad_to40)
19226 DO i=ad_to40,ad_from40,-1
19227 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19228 temp31 = field(i, k+2, j) - field(i, k-3, j) + 10.*(field(i&
19229 & , k, j)-field(i, k-1, j)) - 5.*(field(i, k+1, j)-field(i, &
19231 temp34 = SIGN(1., -vel)
19232 temp33 = temp34/60.
19233 temp32 = SIGN(1, time_step)
19234 temp31b77 = vel*fqzb(i, k, j)
19235 temp31b78 = 37.*temp31b77/60.
19236 temp31b79 = -(2.*temp31b77/15.)
19237 temp31b80 = -(temp32*temp33*temp31b77)
19238 velb = (37.*((field(i, k, j)+field(i, k-1, j))/60.)-2.*((&
19239 & field(i, k+1, j)+field(i, k-2, j))/15.)+(field(i, k+2, j)+&
19240 & field(i, k-3, j))/60.-temp32*(temp33*temp31))*fqzb(i, k, j&
19242 fieldb(i, k, j) = fieldb(i, k, j) + 10.*temp31b80 + &
19244 fieldb(i, k-1, j) = fieldb(i, k-1, j) + temp31b78 - 10.*&
19246 fieldb(i, k+1, j) = fieldb(i, k+1, j) + temp31b79 - 5.*&
19248 fieldb(i, k-2, j) = fieldb(i, k-2, j) + 5.*temp31b80 + &
19250 fieldb(i, k+2, j) = fieldb(i, k+2, j) + temp31b80 + &
19252 fieldb(i, k-3, j) = fieldb(i, k-3, j) + temp31b77/60. - &
19254 fqzb(i, k, j) = 0.0
19255 temp31b81 = dz*mu*fqzlb(i, k, j)/dt
19256 min60b = 0.5*field_old(i, k-1, j)*temp31b81
19257 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min60*&
19259 max41b = 0.5*field_old(i, k, j)*temp31b81
19260 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max41*&
19262 mub0 = (0.5*(min60*field_old(i, k-1, j))+0.5*(max41*&
19263 & field_old(i, k, j)))*dz*fqzlb(i, k, j)/dt
19264 fqzlb(i, k, j) = 0.0
19265 CALL POPCONTROL1B(branch)
19266 IF (branch .EQ. 0) THEN
19267 CALL POPREAL8(max41)
19270 CALL POPREAL8(max41)
19275 CALL POPCONTROL1B(branch)
19276 IF (branch .EQ. 0) THEN
19281 CALL POPCONTROL1B(branch)
19282 IF (branch .EQ. 0) THEN
19283 CALL POPREAL8(min60)
19286 CALL POPREAL8(min60)
19291 CALL POPCONTROL1B(branch)
19292 IF (branch .EQ. 0) THEN
19297 temp31b76 = dt*crb/(dz*mu)
19298 velb = velb + temp31b76
19299 mub0 = mub0 - vel*temp31b76/mu
19301 romb(i, k, j) = romb(i, k, j) + velb
19303 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19307 CALL POPINTEGER4(k)
19308 CALL POPINTEGER4(ad_from39)
19309 CALL POPINTEGER4(ad_to39)
19310 DO i=ad_to39,ad_from39,-1
19311 fqzlb(i, kde, j) = 0.0
19312 fqzb(i, kde, j) = 0.0
19313 fqzlb(i, 1, j) = 0.0
19314 fqzb(i, 1, j) = 0.0
19316 CALL POPINTEGER4(i)
19319 CALL POPINTEGER4(ad_from46)
19320 CALL POPINTEGER4(ad_to46)
19321 DO j=ad_to46,ad_from46,-1
19322 CALL POPINTEGER4(ad_from45)
19323 CALL POPINTEGER4(ad_to45)
19324 DO i=ad_to45,ad_from45,-1
19325 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19326 temp43b10 = rom(i, k, j)*fqzb(i, k, j)
19327 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
19328 & field(i, k-1, j))*fqzb(i, k, j)
19329 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp43b10
19330 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp43b10
19331 fqzb(i, k, j) = 0.0
19332 temp43b11 = dz*mu*fqzlb(i, k, j)/dt
19333 min67b = 0.5*field_old(i, k-1, j)*temp43b11
19334 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min67*&
19336 max48b = 0.5*field_old(i, k, j)*temp43b11
19337 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max48*&
19339 mub0 = (0.5*(min67*field_old(i, k-1, j))+0.5*(max48*field_old(&
19340 & i, k, j)))*dz*fqzlb(i, k, j)/dt
19341 fqzlb(i, k, j) = 0.0
19342 CALL POPCONTROL1B(branch)
19343 IF (branch .EQ. 0) THEN
19344 CALL POPREAL8(max48)
19347 CALL POPREAL8(max48)
19352 CALL POPCONTROL1B(branch)
19353 IF (branch .EQ. 0) THEN
19358 CALL POPCONTROL1B(branch)
19359 IF (branch .EQ. 0) THEN
19360 CALL POPREAL8(min67)
19363 CALL POPREAL8(min67)
19368 CALL POPCONTROL1B(branch)
19369 IF (branch .EQ. 0) THEN
19374 temp43b7 = dt*crb/(dz*mu)
19376 mub0 = mub0 - vel*temp43b7/mu
19378 romb(i, k, j) = romb(i, k, j) + velb
19379 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19380 mu = 0.5*(mut(i, j)+mut(i, j))
19383 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19384 temp43b8 = rom(i, k, j)*fqzb(i, k, j)
19385 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
19386 & field(i, k-1, j))*fqzb(i, k, j)
19387 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp43b8
19388 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp43b8
19389 fqzb(i, k, j) = 0.0
19390 temp43b9 = dz*mu*fqzlb(i, k, j)/dt
19391 min66b = 0.5*field_old(i, k-1, j)*temp43b9
19392 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min66*&
19394 max47b = 0.5*field_old(i, k, j)*temp43b9
19395 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max47*temp43b9
19396 mub0 = (0.5*(min66*field_old(i, k-1, j))+0.5*(max47*field_old(&
19397 & i, k, j)))*dz*fqzlb(i, k, j)/dt
19398 fqzlb(i, k, j) = 0.0
19399 CALL POPCONTROL1B(branch)
19400 IF (branch .EQ. 0) THEN
19401 CALL POPREAL8(max47)
19404 CALL POPREAL8(max47)
19409 CALL POPCONTROL1B(branch)
19410 IF (branch .EQ. 0) THEN
19415 CALL POPCONTROL1B(branch)
19416 IF (branch .EQ. 0) THEN
19417 CALL POPREAL8(min66)
19420 CALL POPREAL8(min66)
19425 CALL POPCONTROL1B(branch)
19426 IF (branch .EQ. 0) THEN
19431 temp43b6 = dt*crb/(dz*mu)
19433 mub0 = mub0 - vel*temp43b6/mu
19435 romb(i, k, j) = romb(i, k, j) + velb
19437 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19439 CALL POPINTEGER4(k)
19441 DO k=ktf-1,kts+2,-1
19442 CALL POPINTEGER4(ad_from44)
19443 CALL POPINTEGER4(ad_to44)
19444 DO i=ad_to44,ad_from44,-1
19445 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19446 temp43b3 = vel*fqzb(i, k, j)
19447 temp43b4 = 7.*temp43b3/12.
19448 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i&
19449 & , k+1, j)+field(i, k-2, j))/12.)*fqzb(i, k, j)
19450 fieldb(i, k, j) = fieldb(i, k, j) + temp43b4
19451 fieldb(i, k-1, j) = fieldb(i, k-1, j) + temp43b4
19452 fieldb(i, k+1, j) = fieldb(i, k+1, j) - temp43b3/12.
19453 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp43b3/12.
19454 fqzb(i, k, j) = 0.0
19455 temp43b5 = dz*mu*fqzlb(i, k, j)/dt
19456 min65b = 0.5*field_old(i, k-1, j)*temp43b5
19457 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min65*&
19459 max46b = 0.5*field_old(i, k, j)*temp43b5
19460 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max46*&
19462 mub0 = (0.5*(min65*field_old(i, k-1, j))+0.5*(max46*&
19463 & field_old(i, k, j)))*dz*fqzlb(i, k, j)/dt
19464 fqzlb(i, k, j) = 0.0
19465 CALL POPCONTROL1B(branch)
19466 IF (branch .EQ. 0) THEN
19467 CALL POPREAL8(max46)
19470 CALL POPREAL8(max46)
19475 CALL POPCONTROL1B(branch)
19476 IF (branch .EQ. 0) THEN
19481 CALL POPCONTROL1B(branch)
19482 IF (branch .EQ. 0) THEN
19483 CALL POPREAL8(min65)
19486 CALL POPREAL8(min65)
19491 CALL POPCONTROL1B(branch)
19492 IF (branch .EQ. 0) THEN
19497 temp43b2 = dt*crb/(dz*mu)
19498 velb = velb + temp43b2
19499 mub0 = mub0 - vel*temp43b2/mu
19501 romb(i, k, j) = romb(i, k, j) + velb
19503 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19507 CALL POPINTEGER4(k)
19508 CALL POPINTEGER4(ad_from43)
19509 CALL POPINTEGER4(ad_to43)
19510 DO i=ad_to43,ad_from43,-1
19511 fqzlb(i, kde, j) = 0.0
19512 fqzb(i, kde, j) = 0.0
19513 fqzlb(i, 1, j) = 0.0
19514 fqzb(i, 1, j) = 0.0
19516 CALL POPINTEGER4(i)
19519 ELSE IF (branch .EQ. 3) THEN
19520 CALL POPINTEGER4(ad_from50)
19521 CALL POPINTEGER4(ad_to50)
19522 DO j=ad_to50,ad_from50,-1
19523 CALL POPINTEGER4(ad_from49)
19524 CALL POPINTEGER4(ad_to49)
19525 DO i=ad_to49,ad_from49,-1
19526 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19527 temp47b3 = rom(i, k, j)*fqzb(i, k, j)
19528 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
19529 & field(i, k-1, j))*fqzb(i, k, j)
19530 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp47b3
19531 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp47b3
19532 fqzb(i, k, j) = 0.0
19533 temp47b4 = dz*mu*fqzlb(i, k, j)/dt
19534 min70b = 0.5*field_old(i, k-1, j)*temp47b4
19535 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min70*&
19537 max51b = 0.5*field_old(i, k, j)*temp47b4
19538 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max51*temp47b4
19539 mub0 = (0.5*(min70*field_old(i, k-1, j))+0.5*(max51*field_old(i&
19540 & , k, j)))*dz*fqzlb(i, k, j)/dt
19541 fqzlb(i, k, j) = 0.0
19542 CALL POPCONTROL1B(branch)
19543 IF (branch .EQ. 0) THEN
19544 CALL POPREAL8(max51)
19547 CALL POPREAL8(max51)
19552 CALL POPCONTROL1B(branch)
19553 IF (branch .EQ. 0) THEN
19554 crb = crb + abs101b
19556 crb = crb - abs101b
19558 CALL POPCONTROL1B(branch)
19559 IF (branch .EQ. 0) THEN
19560 CALL POPREAL8(min70)
19563 CALL POPREAL8(min70)
19568 CALL POPCONTROL1B(branch)
19569 IF (branch .EQ. 0) THEN
19574 temp47b0 = dt*crb/(dz*mu)
19576 mub0 = mub0 - vel*temp47b0/mu
19578 romb(i, k, j) = romb(i, k, j) + velb
19579 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19580 mu = 0.5*(mut(i, j)+mut(i, j))
19583 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19584 temp47b1 = rom(i, k, j)*fqzb(i, k, j)
19585 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
19586 & field(i, k-1, j))*fqzb(i, k, j)
19587 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp47b1
19588 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp47b1
19589 fqzb(i, k, j) = 0.0
19590 temp47b2 = dz*mu*fqzlb(i, k, j)/dt
19591 min69b = 0.5*field_old(i, k-1, j)*temp47b2
19592 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min69*&
19594 max50b = 0.5*field_old(i, k, j)*temp47b2
19595 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max50*temp47b2
19596 mub0 = (0.5*(min69*field_old(i, k-1, j))+0.5*(max50*field_old(i&
19597 & , k, j)))*dz*fqzlb(i, k, j)/dt
19598 fqzlb(i, k, j) = 0.0
19599 CALL POPCONTROL1B(branch)
19600 IF (branch .EQ. 0) THEN
19601 CALL POPREAL8(max50)
19604 CALL POPREAL8(max50)
19609 CALL POPCONTROL1B(branch)
19610 IF (branch .EQ. 0) THEN
19611 crb = crb + abs100b
19613 crb = crb - abs100b
19615 CALL POPCONTROL1B(branch)
19616 IF (branch .EQ. 0) THEN
19617 CALL POPREAL8(min69)
19620 CALL POPREAL8(min69)
19625 CALL POPCONTROL1B(branch)
19626 IF (branch .EQ. 0) THEN
19631 temp47b = dt*crb/(dz*mu)
19633 mub0 = mub0 - vel*temp47b/mu
19635 romb(i, k, j) = romb(i, k, j) + velb
19637 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19639 CALL POPINTEGER4(k)
19641 DO k=ktf-1,kts+2,-1
19642 CALL POPINTEGER4(ad_from48)
19643 CALL POPINTEGER4(ad_to48)
19644 DO i=ad_to48,ad_from48,-1
19645 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19646 temp43 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k&
19647 & , j)-field(i, k-1, j))
19648 temp46 = SIGN(1., -vel)
19649 temp45 = temp46/12.
19650 temp44 = SIGN(1, time_step)
19651 temp43b13 = vel*fqzb(i, k, j)
19652 temp43b14 = 7.*temp43b13/12.
19653 temp43b15 = temp44*temp45*temp43b13
19654 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i, k&
19655 & +1, j)+field(i, k-2, j))/12.+temp44*(temp45*temp43))*fqzb(i&
19657 fieldb(i, k, j) = fieldb(i, k, j) + temp43b14 - 3.*temp43b15
19658 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*temp43b15 + &
19660 fieldb(i, k+1, j) = fieldb(i, k+1, j) + temp43b15 - temp43b13/&
19662 fieldb(i, k-2, j) = fieldb(i, k-2, j) - temp43b15 - temp43b13/&
19664 fqzb(i, k, j) = 0.0
19665 temp43b16 = dz*mu*fqzlb(i, k, j)/dt
19666 min68b = 0.5*field_old(i, k-1, j)*temp43b16
19667 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min68*&
19669 max49b = 0.5*field_old(i, k, j)*temp43b16
19670 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max49*&
19672 mub0 = (0.5*(min68*field_old(i, k-1, j))+0.5*(max49*field_old(&
19673 & i, k, j)))*dz*fqzlb(i, k, j)/dt
19674 fqzlb(i, k, j) = 0.0
19675 CALL POPCONTROL1B(branch)
19676 IF (branch .EQ. 0) THEN
19677 CALL POPREAL8(max49)
19680 CALL POPREAL8(max49)
19685 CALL POPCONTROL1B(branch)
19686 IF (branch .EQ. 0) THEN
19691 CALL POPCONTROL1B(branch)
19692 IF (branch .EQ. 0) THEN
19693 CALL POPREAL8(min68)
19696 CALL POPREAL8(min68)
19701 CALL POPCONTROL1B(branch)
19702 IF (branch .EQ. 0) THEN
19707 temp43b12 = dt*crb/(dz*mu)
19708 velb = velb + temp43b12
19709 mub0 = mub0 - vel*temp43b12/mu
19711 romb(i, k, j) = romb(i, k, j) + velb
19713 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19717 CALL POPINTEGER4(k)
19718 CALL POPINTEGER4(ad_from47)
19719 CALL POPINTEGER4(ad_to47)
19720 DO i=ad_to47,ad_from47,-1
19721 fqzlb(i, kde, j) = 0.0
19722 fqzb(i, kde, j) = 0.0
19723 fqzlb(i, 1, j) = 0.0
19724 fqzb(i, 1, j) = 0.0
19726 CALL POPINTEGER4(i)
19728 ELSE IF (branch .EQ. 4) THEN
19729 CALL POPINTEGER4(ad_from53)
19730 CALL POPINTEGER4(ad_to53)
19731 DO j=ad_to53,ad_from53,-1
19733 CALL POPINTEGER4(ad_from52)
19734 CALL POPINTEGER4(ad_to52)
19735 DO i=ad_to52,ad_from52,-1
19736 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
19737 temp47b6 = rom(i, k, j)*fqzb(i, k, j)
19738 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
19739 & field(i, k-1, j))*fqzb(i, k, j)
19740 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*temp47b6
19741 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*temp47b6
19742 fqzb(i, k, j) = 0.0
19743 temp47b7 = dz*mu*fqzlb(i, k, j)/dt
19744 min71b = 0.5*field_old(i, k-1, j)*temp47b7
19745 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min71*&
19747 max52b = 0.5*field_old(i, k, j)*temp47b7
19748 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max52*temp47b7
19749 mub0 = (0.5*(min71*field_old(i, k-1, j))+0.5*(max52*field_old(&
19750 & i, k, j)))*dz*fqzlb(i, k, j)/dt
19751 fqzlb(i, k, j) = 0.0
19752 CALL POPCONTROL1B(branch)
19753 IF (branch .EQ. 0) THEN
19754 CALL POPREAL8(max52)
19757 CALL POPREAL8(max52)
19762 CALL POPCONTROL1B(branch)
19763 IF (branch .EQ. 0) THEN
19764 crb = crb + abs102b
19766 crb = crb - abs102b
19768 CALL POPCONTROL1B(branch)
19769 IF (branch .EQ. 0) THEN
19770 CALL POPREAL8(min71)
19773 CALL POPREAL8(min71)
19778 CALL POPCONTROL1B(branch)
19779 IF (branch .EQ. 0) THEN
19784 temp47b5 = dt*crb/(dz*mu)
19786 mub0 = mub0 - vel*temp47b5/mu
19788 romb(i, k, j) = romb(i, k, j) + velb
19790 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
19794 CALL POPINTEGER4(ad_from51)
19795 CALL POPINTEGER4(ad_to51)
19796 DO i=ad_to51,ad_from51,-1
19797 fqzlb(i, kde, j) = 0.0
19798 fqzb(i, kde, j) = 0.0
19799 fqzlb(i, 1, j) = 0.0
19800 fqzb(i, 1, j) = 0.0
19802 CALL POPINTEGER4(i)
19805 CALL POPINTEGER4(j_end)
19806 CALL POPINTEGER4(i_end)
19807 CALL POPCONTROL1B(branch)
19808 IF (branch .NE. 0) THEN
19809 CALL POPINTEGER4(ad_from34)
19810 CALL POPINTEGER4(ad_to34)
19811 DO i=ad_to34,ad_from34,-1
19813 temp31b56 = -(rdy*tendencyb(i, k, j_end))
19814 vbb = (field_old(i, k, j_end)-field_old(i, k, j_end-1))*&
19816 field_oldb(i, k, j_end) = field_oldb(i, k, j_end) + vb*temp31b56
19817 field_oldb(i, k, j_end-1) = field_oldb(i, k, j_end-1) - vb*&
19819 fieldb(i, k, j_end) = fieldb(i, k, j_end) - rv(i, k, jte-1)*&
19821 rvb(i, k, jte-1) = rvb(i, k, jte-1) - field(i, k, j_end)*&
19823 CALL POPCONTROL1B(branch)
19824 IF (branch .EQ. 0) THEN
19828 rvb(i, k, jte-1) = rvb(i, k, jte-1) + 0.5*vbb
19832 CALL POPINTEGER4(i)
19834 CALL POPCONTROL1B(branch)
19835 IF (branch .EQ. 0) THEN
19836 CALL POPINTEGER4(ad_from33)
19837 CALL POPINTEGER4(ad_to33)
19838 DO i=ad_to33,ad_from33,-1
19840 temp31b55 = -(rdy*tendencyb(i, k, jts))
19841 vbb = (field_old(i, k, jts+1)-field_old(i, k, jts))*temp31b55
19842 field_oldb(i, k, jts+1) = field_oldb(i, k, jts+1) + vb*temp31b55
19843 field_oldb(i, k, jts) = field_oldb(i, k, jts) - vb*temp31b55
19844 fieldb(i, k, jts) = fieldb(i, k, jts) + rv(i, k, jts+1)*&
19846 rvb(i, k, jts+1) = rvb(i, k, jts+1) + field(i, k, jts)*temp31b55
19847 CALL POPCONTROL1B(branch)
19848 IF (branch .EQ. 0) THEN
19852 rvb(i, k, jts+1) = rvb(i, k, jts+1) + 0.5*vbb
19856 CALL POPINTEGER4(i)
19858 CALL POPCONTROL1B(branch)
19859 IF (branch .EQ. 0) THEN
19860 CALL POPINTEGER4(ad_from32)
19861 CALL POPINTEGER4(ad_to32)
19862 DO i=ad_to32,ad_from32,-1
19864 temp31b53 = -(rdy*tendencyb(i, k, j_end))
19865 temp31b54 = field(i, k, j_end)*temp31b53
19866 vbb = (field_old(i, k, j_end)-field_old(i, k, j_end-1))*&
19868 field_oldb(i, k, j_end) = field_oldb(i, k, j_end) + vb*temp31b53
19869 field_oldb(i, k, j_end-1) = field_oldb(i, k, j_end-1) - vb*&
19871 fieldb(i, k, j_end) = fieldb(i, k, j_end) + (rv(i, k, jte)-rv(i&
19872 & , k, jte-1))*temp31b53
19873 rvb(i, k, jte) = rvb(i, k, jte) + temp31b54
19874 rvb(i, k, jte-1) = rvb(i, k, jte-1) - temp31b54
19875 CALL POPCONTROL1B(branch)
19876 IF (branch .EQ. 0) THEN
19880 rvb(i, k, jte-1) = rvb(i, k, jte-1) + 0.5*vbb
19881 rvb(i, k, jte) = rvb(i, k, jte) + 0.5*vbb
19885 CALL POPINTEGER4(i)
19887 CALL POPCONTROL1B(branch)
19888 IF (branch .EQ. 0) THEN
19889 CALL POPINTEGER4(ad_from31)
19890 CALL POPINTEGER4(ad_to31)
19891 DO i=ad_to31,ad_from31,-1
19893 temp31b51 = -(rdy*tendencyb(i, k, jts))
19894 temp31b52 = field(i, k, jts)*temp31b51
19895 vbb = (field_old(i, k, jts+1)-field_old(i, k, jts))*temp31b51
19896 field_oldb(i, k, jts+1) = field_oldb(i, k, jts+1) + vb*temp31b51
19897 field_oldb(i, k, jts) = field_oldb(i, k, jts) - vb*temp31b51
19898 fieldb(i, k, jts) = fieldb(i, k, jts) + (rv(i, k, jts+1)-rv(i, k&
19899 & , jts))*temp31b51
19900 rvb(i, k, jts+1) = rvb(i, k, jts+1) + temp31b52
19901 rvb(i, k, jts) = rvb(i, k, jts) - temp31b52
19902 CALL POPCONTROL1B(branch)
19903 IF (branch .EQ. 0) THEN
19907 rvb(i, k, jts) = rvb(i, k, jts) + 0.5*vbb
19908 rvb(i, k, jts+1) = rvb(i, k, jts+1) + 0.5*vbb
19912 CALL POPINTEGER4(i)
19914 CALL POPCONTROL1B(branch)
19915 IF (branch .EQ. 0) THEN
19916 CALL POPINTEGER4(ad_from30)
19917 CALL POPINTEGER4(ad_to30)
19918 DO j=ad_to30,ad_from30,-1
19920 temp31b49 = -(rdx*tendencyb(i_end, k, j))
19921 temp31b50 = field(i_end, k, j)*temp31b49
19922 ubb = (field_old(i_end, k, j)-field_old(i_end-1, k, j))*&
19924 field_oldb(i_end, k, j) = field_oldb(i_end, k, j) + ub*temp31b49
19925 field_oldb(i_end-1, k, j) = field_oldb(i_end-1, k, j) - ub*&
19927 fieldb(i_end, k, j) = fieldb(i_end, k, j) + (ru(ite, k, j)-ru(&
19928 & ite-1, k, j))*temp31b49
19929 rub(ite, k, j) = rub(ite, k, j) + temp31b50
19930 rub(ite-1, k, j) = rub(ite-1, k, j) - temp31b50
19931 CALL POPCONTROL1B(branch)
19932 IF (branch .EQ. 0) THEN
19936 rub(ite-1, k, j) = rub(ite-1, k, j) + 0.5*ubb
19937 rub(ite, k, j) = rub(ite, k, j) + 0.5*ubb
19942 CALL POPCONTROL1B(branch)
19943 IF (branch .EQ. 0) THEN
19944 CALL POPINTEGER4(ad_from29)
19945 CALL POPINTEGER4(ad_to29)
19946 DO j=ad_to29,ad_from29,-1
19948 temp31b47 = -(rdx*tendencyb(its, k, j))
19949 temp31b48 = field(its, k, j)*temp31b47
19950 ubb = (field_old(its+1, k, j)-field_old(its, k, j))*temp31b47
19951 field_oldb(its+1, k, j) = field_oldb(its+1, k, j) + ub*temp31b47
19952 field_oldb(its, k, j) = field_oldb(its, k, j) - ub*temp31b47
19953 fieldb(its, k, j) = fieldb(its, k, j) + (ru(its+1, k, j)-ru(its&
19954 & , k, j))*temp31b47
19955 rub(its+1, k, j) = rub(its+1, k, j) + temp31b48
19956 rub(its, k, j) = rub(its, k, j) - temp31b48
19957 CALL POPCONTROL1B(branch)
19958 IF (branch .EQ. 0) THEN
19962 rub(its, k, j) = rub(its, k, j) + 0.5*ubb
19963 rub(its+1, k, j) = rub(its+1, k, j) + 0.5*ubb
19968 CALL POPCONTROL3B(branch)
19969 IF (branch .LT. 3) THEN
19970 IF (branch .NE. 0) THEN
19971 IF (branch .EQ. 1) THEN
19972 CALL POPINTEGER4(ad_from20)
19973 CALL POPINTEGER4(ad_to20)
19974 DO j=ad_to20,ad_from20,-1
19976 CALL POPINTEGER4(ad_from19)
19977 CALL POPINTEGER4(ad_to19)
19978 DO i=ad_to19,ad_from19,-1
19979 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
19980 temp31b8 = 0.5*ru(i, k, j)*fqxb(i, k, j)
19981 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
19982 & 1, k, j))*fqxb(i, k, j)
19983 fieldb(i, k, j) = fieldb(i, k, j) + temp31b8
19984 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b8
19985 fqxb(i, k, j) = 0.0
19986 temp31b9 = dx*mu*fqxlb(i, k, j)/dt
19987 min52b = 0.5*field_old(i-1, k, j)*temp31b9
19988 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min52*&
19990 max35b = 0.5*field_old(i, k, j)*temp31b9
19991 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max35*&
19993 mub0 = (0.5*(min52*field_old(i-1, k, j))+0.5*(max35*&
19994 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
19995 fqxlb(i, k, j) = 0.0
19996 CALL POPCONTROL1B(branch)
19997 IF (branch .EQ. 0) THEN
19998 CALL POPREAL8(max35)
20001 CALL POPREAL8(max35)
20006 CALL POPCONTROL1B(branch)
20007 IF (branch .EQ. 0) THEN
20012 CALL POPCONTROL1B(branch)
20013 IF (branch .EQ. 0) THEN
20014 CALL POPREAL8(min52)
20017 CALL POPREAL8(min52)
20022 CALL POPCONTROL1B(branch)
20023 IF (branch .EQ. 0) THEN
20028 temp31b7 = dt*crb/(dx*mu)
20030 mub0 = mub0 - vel*temp31b7/mu
20032 rub(i, k, j) = rub(i, k, j) + velb
20034 mutb(i, j) = mutb(i, j) + 0.5*mub0
20035 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
20040 CALL POPINTEGER4(ad_from18)
20041 CALL POPINTEGER4(ad_to18)
20042 DO j=ad_to18,ad_from18,-1
20044 CALL POPINTEGER4(ad_from17)
20045 CALL POPINTEGER4(ad_to17)
20046 DO i=ad_to17,ad_from17,-1
20047 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
20048 temp31b5 = 0.5*rv(i, k, j)*fqyb(i, k, j)
20049 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i&
20050 & , k, j-1))*fqyb(i, k, j)
20051 fieldb(i, k, j) = fieldb(i, k, j) + temp31b5
20052 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp31b5
20053 fqyb(i, k, j) = 0.0
20054 temp31b6 = dy*mu*fqylb(i, k, j)/dt
20055 min51b = 0.5*field_old(i, k, j-1)*temp31b6
20056 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min51*&
20058 max34b = 0.5*field_old(i, k, j)*temp31b6
20059 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max34*&
20061 mub0 = (0.5*(min51*field_old(i, k, j-1))+0.5*(max34*&
20062 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
20063 fqylb(i, k, j) = 0.0
20064 CALL POPCONTROL1B(branch)
20065 IF (branch .EQ. 0) THEN
20066 CALL POPREAL8(max34)
20069 CALL POPREAL8(max34)
20074 CALL POPCONTROL1B(branch)
20075 IF (branch .EQ. 0) THEN
20080 CALL POPCONTROL1B(branch)
20081 IF (branch .EQ. 0) THEN
20082 CALL POPREAL8(min51)
20085 CALL POPREAL8(min51)
20090 CALL POPCONTROL1B(branch)
20091 IF (branch .EQ. 0) THEN
20096 temp31b4 = dt*crb/(dy*mu)
20098 mub0 = mub0 - vel*temp31b4/mu
20100 rvb(i, k, j) = rvb(i, k, j) + velb
20102 mutb(i, j) = mutb(i, j) + 0.5*mub0
20103 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
20109 CALL POPINTEGER4(ad_from16)
20110 CALL POPINTEGER4(ad_to16)
20111 DO j=ad_to16,ad_from16,-1
20112 CALL POPCONTROL2B(branch)
20113 IF (branch .NE. 0) THEN
20114 IF (branch .NE. 1) THEN
20116 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
20117 temp31b2 = 0.5*ru(i, k, j)*fqxb(i, k, j)
20118 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(&
20119 & i-1, k, j))*fqxb(i, k, j)
20120 fieldb(i, k, j) = fieldb(i, k, j) + temp31b2
20121 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b2
20122 fqxb(i, k, j) = 0.0
20123 temp31b3 = dx*mu*fqxlb(i, k, j)/dt
20124 min48b = 0.5*field_old(i-1, k, j)*temp31b3
20125 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*&
20127 max33b = 0.5*field_old(i, k, j)*temp31b3
20128 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max33*&
20130 mub0 = (0.5*(min48*field_old(i-1, k, j))+0.5*(max33*&
20131 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
20132 fqxlb(i, k, j) = 0.0
20133 CALL POPCONTROL1B(branch)
20134 IF (branch .EQ. 0) THEN
20135 CALL POPREAL8(max33)
20138 CALL POPREAL8(max33)
20143 CALL POPCONTROL1B(branch)
20144 IF (branch .EQ. 0) THEN
20149 CALL POPCONTROL1B(branch)
20150 IF (branch .EQ. 0) THEN
20151 CALL POPREAL8(min48)
20154 CALL POPREAL8(min48)
20159 CALL POPCONTROL1B(branch)
20160 IF (branch .EQ. 0) THEN
20165 temp31b1 = dt*crb/(dx*mu)
20167 mub0 = mub0 - vel*temp31b1/mu
20169 rub(i, k, j) = rub(i, k, j) + velb
20171 mutb(i, j) = mutb(i, j) + 0.5*mub0
20172 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
20175 CALL POPINTEGER4(i)
20178 CALL POPCONTROL2B(branch)
20179 IF (branch .EQ. 0) THEN
20181 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
20182 temp31b = 0.5*ru(i, k, j)*fqxb(i, k, j)
20183 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
20184 & 1, k, j))*fqxb(i, k, j)
20185 fieldb(i, k, j) = fieldb(i, k, j) + temp31b
20186 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b
20187 fqxb(i, k, j) = 0.0
20188 temp31b0 = dx*mu*fqxlb(i, k, j)/dt
20189 min47b = 0.5*field_old(i-1, k, j)*temp31b0
20190 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min47*&
20192 max32b = 0.5*field_old(i, k, j)*temp31b0
20193 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max32*&
20195 mub0 = (0.5*(min47*field_old(i-1, k, j))+0.5*(max32*&
20196 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
20197 fqxlb(i, k, j) = 0.0
20198 CALL POPCONTROL1B(branch)
20199 IF (branch .EQ. 0) THEN
20200 CALL POPREAL8(max32)
20203 CALL POPREAL8(max32)
20208 CALL POPCONTROL1B(branch)
20209 IF (branch .EQ. 0) THEN
20214 CALL POPCONTROL1B(branch)
20215 IF (branch .EQ. 0) THEN
20216 CALL POPREAL8(min47)
20219 CALL POPREAL8(min47)
20224 CALL POPCONTROL1B(branch)
20225 IF (branch .EQ. 0) THEN
20232 rub(i, k, j) = rub(i, k, j) + velb/mu
20233 mub0 = mub0 - ru(i, k, j)*velb/mu**2
20235 mutb(i, j) = mutb(i, j) + 0.5*mub0
20236 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
20239 CALL POPINTEGER4(i)
20242 DO i=i_end_f,i_start_f,-1
20243 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
20244 temp27 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i&
20245 & , k, j)-field(i-1, k, j))
20246 temp30 = SIGN(1., vel)
20247 temp29 = temp30/12.
20248 temp28 = SIGN(1, time_step)
20249 temp27b6 = vel*fqxb(i, k, j)
20250 temp27b7 = 7.*temp27b6/12.
20251 temp27b8 = temp28*temp29*temp27b6
20252 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(&
20253 & i+1, k, j)+field(i-2, k, j))/12.+temp28*(temp29*temp27))&
20255 fieldb(i, k, j) = fieldb(i, k, j) + temp27b7 - 3.*temp27b8
20256 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*temp27b8 + &
20258 fieldb(i+1, k, j) = fieldb(i+1, k, j) + temp27b8 - &
20260 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp27b8 - &
20262 fqxb(i, k, j) = 0.0
20263 temp27b9 = dx*mu*fqxlb(i, k, j)/dt
20264 min46b = 0.5*field_old(i-1, k, j)*temp27b9
20265 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min46*&
20267 max31b = 0.5*field_old(i, k, j)*temp27b9
20268 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max31*&
20270 mub0 = (0.5*(min46*field_old(i-1, k, j))+0.5*(max31*&
20271 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
20272 fqxlb(i, k, j) = 0.0
20273 CALL POPCONTROL1B(branch)
20274 IF (branch .EQ. 0) THEN
20275 CALL POPREAL8(max31)
20278 CALL POPREAL8(max31)
20283 CALL POPCONTROL1B(branch)
20284 IF (branch .EQ. 0) THEN
20289 CALL POPCONTROL1B(branch)
20290 IF (branch .EQ. 0) THEN
20291 CALL POPREAL8(min46)
20294 CALL POPREAL8(min46)
20299 CALL POPCONTROL1B(branch)
20300 IF (branch .EQ. 0) THEN
20305 temp27b5 = dt*crb/(dx*mu)
20306 velb = velb + temp27b5
20307 mub0 = mub0 - vel*temp27b5/mu
20309 rub(i, k, j) = rub(i, k, j) + velb
20311 mutb(i, j) = mutb(i, j) + 0.5*mub0
20312 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
20315 CALL POPINTEGER4(i)
20318 CALL POPINTEGER4(ad_from15)
20319 CALL POPINTEGER4(ad_to15)
20320 DO j=ad_to15,ad_from15,-1
20321 CALL POPCONTROL2B(branch)
20322 IF (branch .LT. 2) THEN
20323 IF (branch .NE. 0) THEN
20325 CALL POPINTEGER4(ad_from14)
20326 CALL POPINTEGER4(ad_to14)
20327 DO i=ad_to14,ad_from14,-1
20328 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
20329 temp27b3 = 0.5*rv(i, k, j)*fqyb(i, k, j)
20330 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+&
20331 & field(i, k, j-1))*fqyb(i, k, j)
20332 fieldb(i, k, j) = fieldb(i, k, j) + temp27b3
20333 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp27b3
20334 fqyb(i, k, j) = 0.0
20335 temp27b4 = dy*mu*fqylb(i, k, j)/dt
20336 min43b = 0.5*field_old(i, k, j-1)*temp27b4
20337 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*&
20339 max30b = 0.5*field_old(i, k, j)*temp27b4
20340 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max30*&
20342 mub0 = (0.5*(min43*field_old(i, k, j-1))+0.5*(max30*&
20343 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
20344 fqylb(i, k, j) = 0.0
20345 CALL POPCONTROL1B(branch)
20346 IF (branch .EQ. 0) THEN
20347 CALL POPREAL8(max30)
20350 CALL POPREAL8(max30)
20355 CALL POPCONTROL1B(branch)
20356 IF (branch .EQ. 0) THEN
20361 CALL POPCONTROL1B(branch)
20362 IF (branch .EQ. 0) THEN
20363 CALL POPREAL8(min43)
20366 CALL POPREAL8(min43)
20371 CALL POPCONTROL1B(branch)
20372 IF (branch .EQ. 0) THEN
20377 temp27b2 = dt*crb/(dy*mu)
20379 mub0 = mub0 - vel*temp27b2/mu
20381 rvb(i, k, j) = rvb(i, k, j) + velb
20383 mutb(i, j) = mutb(i, j) + 0.5*mub0
20384 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
20389 ELSE IF (branch .EQ. 2) THEN
20391 CALL POPINTEGER4(ad_from13)
20392 CALL POPINTEGER4(ad_to13)
20393 DO i=ad_to13,ad_from13,-1
20394 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
20395 temp27b0 = 0.5*rv(i, k, j)*fqyb(i, k, j)
20396 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(&
20397 & i, k, j-1))*fqyb(i, k, j)
20398 fieldb(i, k, j) = fieldb(i, k, j) + temp27b0
20399 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp27b0
20400 fqyb(i, k, j) = 0.0
20401 temp27b1 = dy*mu*fqylb(i, k, j)/dt
20402 min42b = 0.5*field_old(i, k, j-1)*temp27b1
20403 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*&
20405 max29b = 0.5*field_old(i, k, j)*temp27b1
20406 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max29*&
20408 mub0 = (0.5*(min42*field_old(i, k, j-1))+0.5*(max29*&
20409 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
20410 fqylb(i, k, j) = 0.0
20411 CALL POPCONTROL1B(branch)
20412 IF (branch .EQ. 0) THEN
20413 CALL POPREAL8(max29)
20416 CALL POPREAL8(max29)
20421 CALL POPCONTROL1B(branch)
20422 IF (branch .EQ. 0) THEN
20427 CALL POPCONTROL1B(branch)
20428 IF (branch .EQ. 0) THEN
20429 CALL POPREAL8(min42)
20432 CALL POPREAL8(min42)
20437 CALL POPCONTROL1B(branch)
20438 IF (branch .EQ. 0) THEN
20443 temp27b = dt*crb/(dy*mu)
20445 mub0 = mub0 - vel*temp27b/mu
20447 rvb(i, k, j) = rvb(i, k, j) + velb
20449 mutb(i, j) = mutb(i, j) + 0.5*mub0
20450 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
20456 CALL POPINTEGER4(ad_from12)
20457 CALL POPINTEGER4(ad_to12)
20458 DO i=ad_to12,ad_from12,-1
20459 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
20460 temp23 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field&
20461 & (i, k, j)-field(i, k, j-1))
20462 temp26 = SIGN(1., vel)
20463 temp25 = temp26/12.
20464 temp24 = SIGN(1, time_step)
20465 temp23b19 = vel*fqyb(i, k, j)
20466 temp23b20 = 7.*temp23b19/12.
20467 temp23b21 = temp24*temp25*temp23b19
20468 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(&
20469 & field(i, k, j+1)+field(i, k, j-2))/12.+temp24*(temp25*&
20470 & temp23))*fqyb(i, k, j)
20471 fieldb(i, k, j) = fieldb(i, k, j) + temp23b20 - 3.*&
20473 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*temp23b21 + &
20475 fieldb(i, k, j+1) = fieldb(i, k, j+1) + temp23b21 - &
20477 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp23b21 - &
20479 fqyb(i, k, j) = 0.0
20480 temp23b22 = dy*mu*fqylb(i, k, j)/dt
20481 min41b = 0.5*field_old(i, k, j-1)*temp23b22
20482 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*&
20484 max28b = 0.5*field_old(i, k, j)*temp23b22
20485 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max28*&
20487 mub0 = (0.5*(min41*field_old(i, k, j-1))+0.5*(max28*&
20488 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
20489 fqylb(i, k, j) = 0.0
20490 CALL POPCONTROL1B(branch)
20491 IF (branch .EQ. 0) THEN
20492 CALL POPREAL8(max28)
20495 CALL POPREAL8(max28)
20500 CALL POPCONTROL1B(branch)
20501 IF (branch .EQ. 0) THEN
20506 CALL POPCONTROL1B(branch)
20507 IF (branch .EQ. 0) THEN
20508 CALL POPREAL8(min41)
20511 CALL POPREAL8(min41)
20516 CALL POPCONTROL1B(branch)
20517 IF (branch .EQ. 0) THEN
20522 temp23b18 = dt*crb/(dy*mu)
20523 velb = velb + temp23b18
20524 mub0 = mub0 - vel*temp23b18/mu
20526 rvb(i, k, j) = rvb(i, k, j) + velb
20528 mutb(i, j) = mutb(i, j) + 0.5*mub0
20529 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
20537 ELSE IF (branch .EQ. 3) THEN
20538 CALL POPINTEGER4(ad_from11)
20539 CALL POPINTEGER4(ad_to11)
20540 DO j=ad_to11,ad_from11,-1
20541 CALL POPCONTROL2B(branch)
20542 IF (branch .NE. 0) THEN
20543 IF (branch .NE. 1) THEN
20545 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
20546 temp23b16 = 0.5*ru(i, k, j)*fqxb(i, k, j)
20547 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-1&
20548 & , k, j))*fqxb(i, k, j)
20549 fieldb(i, k, j) = fieldb(i, k, j) + temp23b16
20550 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp23b16
20551 fqxb(i, k, j) = 0.0
20552 temp23b17 = dx*mu*fqxlb(i, k, j)/dt
20553 min38b = 0.5*field_old(i-1, k, j)*temp23b17
20554 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min38*&
20556 max27b = 0.5*field_old(i, k, j)*temp23b17
20557 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max27*&
20559 mub0 = (0.5*(min38*field_old(i-1, k, j))+0.5*(max27*&
20560 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
20561 fqxlb(i, k, j) = 0.0
20562 CALL POPCONTROL1B(branch)
20563 IF (branch .EQ. 0) THEN
20564 CALL POPREAL8(max27)
20567 CALL POPREAL8(max27)
20572 CALL POPCONTROL1B(branch)
20573 IF (branch .EQ. 0) THEN
20578 CALL POPCONTROL1B(branch)
20579 IF (branch .EQ. 0) THEN
20580 CALL POPREAL8(min38)
20583 CALL POPREAL8(min38)
20588 CALL POPCONTROL1B(branch)
20589 IF (branch .EQ. 0) THEN
20594 temp23b15 = dt*crb/(dx*mu)
20596 mub0 = mub0 - vel*temp23b15/mu
20598 rub(i, k, j) = rub(i, k, j) + velb
20600 mutb(i, j) = mutb(i, j) + 0.5*mub0
20601 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
20604 CALL POPINTEGER4(i)
20607 CALL POPCONTROL2B(branch)
20608 IF (branch .EQ. 0) THEN
20610 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
20611 temp23b13 = 0.5*ru(i, k, j)*fqxb(i, k, j)
20612 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-1, k&
20613 & , j))*fqxb(i, k, j)
20614 fieldb(i, k, j) = fieldb(i, k, j) + temp23b13
20615 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp23b13
20616 fqxb(i, k, j) = 0.0
20617 temp23b14 = dx*mu*fqxlb(i, k, j)/dt
20618 min37b = 0.5*field_old(i-1, k, j)*temp23b14
20619 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min37*&
20621 max26b = 0.5*field_old(i, k, j)*temp23b14
20622 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max26*&
20624 mub0 = (0.5*(min37*field_old(i-1, k, j))+0.5*(max26*field_old(&
20625 & i, k, j)))*dx*fqxlb(i, k, j)/dt
20626 fqxlb(i, k, j) = 0.0
20627 CALL POPCONTROL1B(branch)
20628 IF (branch .EQ. 0) THEN
20629 CALL POPREAL8(max26)
20632 CALL POPREAL8(max26)
20637 CALL POPCONTROL1B(branch)
20638 IF (branch .EQ. 0) THEN
20643 CALL POPCONTROL1B(branch)
20644 IF (branch .EQ. 0) THEN
20645 CALL POPREAL8(min37)
20648 CALL POPREAL8(min37)
20653 CALL POPCONTROL1B(branch)
20654 IF (branch .EQ. 0) THEN
20661 rub(i, k, j) = rub(i, k, j) + velb/mu
20662 mub0 = mub0 - ru(i, k, j)*velb/mu**2
20664 mutb(i, j) = mutb(i, j) + 0.5*mub0
20665 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
20668 CALL POPINTEGER4(i)
20671 DO i=i_end_f,i_start_f,-1
20672 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
20673 temp23b10 = vel*fqxb(i, k, j)
20674 temp23b11 = 7.*temp23b10/12.
20675 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(i+1&
20676 & , k, j)+field(i-2, k, j))/12.)*fqxb(i, k, j)
20677 fieldb(i, k, j) = fieldb(i, k, j) + temp23b11
20678 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp23b11
20679 fieldb(i+1, k, j) = fieldb(i+1, k, j) - temp23b10/12.
20680 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp23b10/12.
20681 fqxb(i, k, j) = 0.0
20682 temp23b12 = dx*mu*fqxlb(i, k, j)/dt
20683 min36b = 0.5*field_old(i-1, k, j)*temp23b12
20684 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min36*&
20686 max25b = 0.5*field_old(i, k, j)*temp23b12
20687 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max25*&
20689 mub0 = (0.5*(min36*field_old(i-1, k, j))+0.5*(max25*field_old(&
20690 & i, k, j)))*dx*fqxlb(i, k, j)/dt
20691 fqxlb(i, k, j) = 0.0
20692 CALL POPCONTROL1B(branch)
20693 IF (branch .EQ. 0) THEN
20694 CALL POPREAL8(max25)
20697 CALL POPREAL8(max25)
20702 CALL POPCONTROL1B(branch)
20703 IF (branch .EQ. 0) THEN
20708 CALL POPCONTROL1B(branch)
20709 IF (branch .EQ. 0) THEN
20710 CALL POPREAL8(min36)
20713 CALL POPREAL8(min36)
20718 CALL POPCONTROL1B(branch)
20719 IF (branch .EQ. 0) THEN
20724 temp23b9 = dt*crb/(dx*mu)
20725 velb = velb + temp23b9
20726 mub0 = mub0 - vel*temp23b9/mu
20728 rub(i, k, j) = rub(i, k, j) + velb
20730 mutb(i, j) = mutb(i, j) + 0.5*mub0
20731 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
20734 CALL POPINTEGER4(i)
20737 CALL POPINTEGER4(ad_from10)
20738 CALL POPINTEGER4(ad_to10)
20739 DO j=ad_to10,ad_from10,-1
20740 CALL POPCONTROL2B(branch)
20741 IF (branch .LT. 2) THEN
20742 IF (branch .NE. 0) THEN
20744 CALL POPINTEGER4(ad_from9)
20745 CALL POPINTEGER4(ad_to9)
20746 DO i=ad_to9,ad_from9,-1
20747 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
20748 temp23b7 = 0.5*rv(i, k, j)*fqyb(i, k, j)
20749 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i&
20750 & , k, j-1))*fqyb(i, k, j)
20751 fieldb(i, k, j) = fieldb(i, k, j) + temp23b7
20752 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp23b7
20753 fqyb(i, k, j) = 0.0
20754 temp23b8 = dy*mu*fqylb(i, k, j)/dt
20755 min33b = 0.5*field_old(i, k, j-1)*temp23b8
20756 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min33*&
20758 max24b = 0.5*field_old(i, k, j)*temp23b8
20759 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max24*&
20761 mub0 = (0.5*(min33*field_old(i, k, j-1))+0.5*(max24*&
20762 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
20763 fqylb(i, k, j) = 0.0
20764 CALL POPCONTROL1B(branch)
20765 IF (branch .EQ. 0) THEN
20766 CALL POPREAL8(max24)
20769 CALL POPREAL8(max24)
20774 CALL POPCONTROL1B(branch)
20775 IF (branch .EQ. 0) THEN
20780 CALL POPCONTROL1B(branch)
20781 IF (branch .EQ. 0) THEN
20782 CALL POPREAL8(min33)
20785 CALL POPREAL8(min33)
20790 CALL POPCONTROL1B(branch)
20791 IF (branch .EQ. 0) THEN
20796 temp23b6 = dt*crb/(dy*mu)
20798 mub0 = mub0 - vel*temp23b6/mu
20800 rvb(i, k, j) = rvb(i, k, j) + velb
20802 mutb(i, j) = mutb(i, j) + 0.5*mub0
20803 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
20808 ELSE IF (branch .EQ. 2) THEN
20810 CALL POPINTEGER4(ad_from8)
20811 CALL POPINTEGER4(ad_to8)
20812 DO i=ad_to8,ad_from8,-1
20813 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
20814 temp23b4 = 0.5*rv(i, k, j)*fqyb(i, k, j)
20815 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i, k&
20816 & , j-1))*fqyb(i, k, j)
20817 fieldb(i, k, j) = fieldb(i, k, j) + temp23b4
20818 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp23b4
20819 fqyb(i, k, j) = 0.0
20820 temp23b5 = dy*mu*fqylb(i, k, j)/dt
20821 min32b = 0.5*field_old(i, k, j-1)*temp23b5
20822 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min32*&
20824 max23b = 0.5*field_old(i, k, j)*temp23b5
20825 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max23*&
20827 mub0 = (0.5*(min32*field_old(i, k, j-1))+0.5*(max23*&
20828 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
20829 fqylb(i, k, j) = 0.0
20830 CALL POPCONTROL1B(branch)
20831 IF (branch .EQ. 0) THEN
20832 CALL POPREAL8(max23)
20835 CALL POPREAL8(max23)
20840 CALL POPCONTROL1B(branch)
20841 IF (branch .EQ. 0) THEN
20846 CALL POPCONTROL1B(branch)
20847 IF (branch .EQ. 0) THEN
20848 CALL POPREAL8(min32)
20851 CALL POPREAL8(min32)
20856 CALL POPCONTROL1B(branch)
20857 IF (branch .EQ. 0) THEN
20862 temp23b3 = dt*crb/(dy*mu)
20864 mub0 = mub0 - vel*temp23b3/mu
20866 rvb(i, k, j) = rvb(i, k, j) + velb
20868 mutb(i, j) = mutb(i, j) + 0.5*mub0
20869 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
20875 CALL POPINTEGER4(ad_from7)
20876 CALL POPINTEGER4(ad_to7)
20877 DO i=ad_to7,ad_from7,-1
20878 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
20879 temp23b0 = vel*fqyb(i, k, j)
20880 temp23b1 = 7.*temp23b0/12.
20881 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(field(i&
20882 & , k, j+1)+field(i, k, j-2))/12.)*fqyb(i, k, j)
20883 fieldb(i, k, j) = fieldb(i, k, j) + temp23b1
20884 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp23b1
20885 fieldb(i, k, j+1) = fieldb(i, k, j+1) - temp23b0/12.
20886 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp23b0/12.
20887 fqyb(i, k, j) = 0.0
20888 temp23b2 = dy*mu*fqylb(i, k, j)/dt
20889 min31b = 0.5*field_old(i, k, j-1)*temp23b2
20890 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min31*&
20892 max22b = 0.5*field_old(i, k, j)*temp23b2
20893 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max22*&
20895 mub0 = (0.5*(min31*field_old(i, k, j-1))+0.5*(max22*&
20896 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
20897 fqylb(i, k, j) = 0.0
20898 CALL POPCONTROL1B(branch)
20899 IF (branch .EQ. 0) THEN
20900 CALL POPREAL8(max22)
20903 CALL POPREAL8(max22)
20908 CALL POPCONTROL1B(branch)
20909 IF (branch .EQ. 0) THEN
20914 CALL POPCONTROL1B(branch)
20915 IF (branch .EQ. 0) THEN
20916 CALL POPREAL8(min31)
20919 CALL POPREAL8(min31)
20924 CALL POPCONTROL1B(branch)
20925 IF (branch .EQ. 0) THEN
20930 temp23b = dt*crb/(dy*mu)
20931 velb = velb + temp23b
20932 mub0 = mub0 - vel*temp23b/mu
20934 rvb(i, k, j) = rvb(i, k, j) + velb
20936 mutb(i, j) = mutb(i, j) + 0.5*mub0
20937 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
20943 ELSE IF (branch .EQ. 4) THEN
20944 CALL POPINTEGER4(ad_from6)
20945 CALL POPINTEGER4(ad_to6)
20946 DO j=ad_to6,ad_from6,-1
20947 CALL POPCONTROL1B(branch)
20948 IF (branch .NE. 0) THEN
20949 CALL POPINTEGER4(ad_to5)
20950 DO i=ad_to5,i_end_f+1,-1
20951 CALL POPCONTROL1B(branch)
20952 IF (branch .NE. 0) THEN
20954 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
20955 temp19 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i&
20956 & , k, j)-field(i-1, k, j))
20957 temp22 = SIGN(1., vel)
20958 temp21 = temp22/12.
20959 temp20 = SIGN(1, time_step)
20960 temp19b3 = vel*fqxb(i, k, j)
20961 temp19b4 = 7.*temp19b3/12.
20962 temp19b5 = temp20*temp21*temp19b3
20963 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(&
20964 & i+1, k, j)+field(i-2, k, j))/12.+temp20*(temp21*temp19))&
20966 fieldb(i, k, j) = fieldb(i, k, j) + temp19b4 - 3.*temp19b5
20967 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*temp19b5 + &
20969 fieldb(i+1, k, j) = fieldb(i+1, k, j) + temp19b5 - &
20971 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp19b5 - &
20973 fqxb(i, k, j) = 0.0
20974 temp19b6 = dx*mu*fqxlb(i, k, j)/dt
20975 min28b = 0.5*field_old(i-1, k, j)*temp19b6
20976 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min28*&
20978 max21b = 0.5*field_old(i, k, j)*temp19b6
20979 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max21*&
20981 mub0 = (0.5*(min28*field_old(i-1, k, j))+0.5*(max21*&
20982 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
20983 fqxlb(i, k, j) = 0.0
20984 CALL POPCONTROL1B(branch)
20985 IF (branch .EQ. 0) THEN
20986 CALL POPREAL8(max21)
20989 CALL POPREAL8(max21)
20994 CALL POPCONTROL1B(branch)
20995 IF (branch .EQ. 0) THEN
21000 CALL POPCONTROL1B(branch)
21001 IF (branch .EQ. 0) THEN
21002 CALL POPREAL8(min28)
21005 CALL POPREAL8(min28)
21010 CALL POPCONTROL1B(branch)
21011 IF (branch .EQ. 0) THEN
21016 temp19b2 = dt*crb/(dx*mu)
21017 velb = velb + temp19b2
21018 mub0 = mub0 - vel*temp19b2/mu
21020 rub(i, k, j) = rub(i, k, j) + velb
21022 mutb(i, j) = mutb(i, j) + 0.5*mub0
21023 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
21027 CALL POPCONTROL1B(branch)
21028 IF (branch .EQ. 0) THEN
21030 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
21031 temp19b0 = 0.5*ru(i, k, j)*fqxb(i, k, j)
21032 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
21033 & 1, k, j))*fqxb(i, k, j)
21034 fieldb(i, k, j) = fieldb(i, k, j) + temp19b0
21035 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp19b0
21036 fqxb(i, k, j) = 0.0
21037 temp19b1 = dx*mu*fqxlb(i, k, j)/dt
21038 min27b = 0.5*field_old(i-1, k, j)*temp19b1
21039 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min27*&
21041 max20b = 0.5*field_old(i, k, j)*temp19b1
21042 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max20*&
21044 mub0 = (0.5*(min27*field_old(i-1, k, j))+0.5*(max20*&
21045 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
21046 fqxlb(i, k, j) = 0.0
21047 CALL POPCONTROL1B(branch)
21048 IF (branch .EQ. 0) THEN
21049 CALL POPREAL8(max20)
21052 CALL POPREAL8(max20)
21057 CALL POPCONTROL1B(branch)
21058 IF (branch .EQ. 0) THEN
21063 CALL POPCONTROL1B(branch)
21064 IF (branch .EQ. 0) THEN
21065 CALL POPREAL8(min27)
21068 CALL POPREAL8(min27)
21073 CALL POPCONTROL1B(branch)
21074 IF (branch .EQ. 0) THEN
21079 temp19b = dt*crb/(dx*mu)
21081 mub0 = mub0 - vel*temp19b/mu
21083 rub(i, k, j) = rub(i, k, j) + velb
21085 mutb(i, j) = mutb(i, j) + 0.5*mub0
21086 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
21092 CALL POPCONTROL1B(branch)
21093 IF (branch .EQ. 0) THEN
21094 CALL POPINTEGER4(ad_from5)
21095 DO i=i_start_f-1,ad_from5,-1
21096 CALL POPCONTROL1B(branch)
21097 IF (branch .NE. 0) THEN
21099 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
21100 temp15 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i&
21101 & , k, j)-field(i-1, k, j))
21102 temp18 = SIGN(1., vel)
21103 temp17 = temp18/12.
21104 temp16 = SIGN(1, time_step)
21105 temp15b2 = vel*fqxb(i, k, j)
21106 temp15b3 = 7.*temp15b2/12.
21107 temp15b4 = temp16*temp17*temp15b2
21108 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(&
21109 & i+1, k, j)+field(i-2, k, j))/12.+temp16*(temp17*temp15))&
21111 fieldb(i, k, j) = fieldb(i, k, j) + temp15b3 - 3.*temp15b4
21112 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*temp15b4 + &
21114 fieldb(i+1, k, j) = fieldb(i+1, k, j) + temp15b4 - &
21116 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp15b4 - &
21118 fqxb(i, k, j) = 0.0
21119 temp15b5 = dx*mu*fqxlb(i, k, j)/dt
21120 min26b = 0.5*field_old(i-1, k, j)*temp15b5
21121 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min26*&
21123 max19b = 0.5*field_old(i, k, j)*temp15b5
21124 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max19*&
21126 mub0 = (0.5*(min26*field_old(i-1, k, j))+0.5*(max19*&
21127 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
21128 fqxlb(i, k, j) = 0.0
21129 CALL POPCONTROL1B(branch)
21130 IF (branch .EQ. 0) THEN
21131 CALL POPREAL8(max19)
21134 CALL POPREAL8(max19)
21139 CALL POPCONTROL1B(branch)
21140 IF (branch .EQ. 0) THEN
21145 CALL POPCONTROL1B(branch)
21146 IF (branch .EQ. 0) THEN
21147 CALL POPREAL8(min26)
21150 CALL POPREAL8(min26)
21155 CALL POPCONTROL1B(branch)
21156 IF (branch .EQ. 0) THEN
21161 temp15b1 = dt*crb/(dx*mu)
21162 velb = velb + temp15b1
21163 mub0 = mub0 - vel*temp15b1/mu
21165 rub(i, k, j) = rub(i, k, j) + velb
21167 mutb(i, j) = mutb(i, j) + 0.5*mub0
21168 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
21172 CALL POPCONTROL1B(branch)
21173 IF (branch .EQ. 0) THEN
21175 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
21176 temp15b = 0.5*ru(i, k, j)*fqxb(i, k, j)
21177 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
21178 & 1, k, j))*fqxb(i, k, j)
21179 fieldb(i, k, j) = fieldb(i, k, j) + temp15b
21180 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp15b
21181 fqxb(i, k, j) = 0.0
21182 temp15b0 = dx*mu*fqxlb(i, k, j)/dt
21183 min25b = 0.5*field_old(i-1, k, j)*temp15b0
21184 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min25*&
21186 max18b = 0.5*field_old(i, k, j)*temp15b0
21187 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max18*&
21189 mub0 = (0.5*(min25*field_old(i-1, k, j))+0.5*(max18*&
21190 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
21191 fqxlb(i, k, j) = 0.0
21192 CALL POPCONTROL1B(branch)
21193 IF (branch .EQ. 0) THEN
21194 CALL POPREAL8(max18)
21197 CALL POPREAL8(max18)
21202 CALL POPCONTROL1B(branch)
21203 IF (branch .EQ. 0) THEN
21208 CALL POPCONTROL1B(branch)
21209 IF (branch .EQ. 0) THEN
21210 CALL POPREAL8(min25)
21213 CALL POPREAL8(min25)
21218 CALL POPCONTROL1B(branch)
21219 IF (branch .EQ. 0) THEN
21226 rub(i, k, j) = rub(i, k, j) + velb/mu
21227 mub0 = mub0 - ru(i, k, j)*velb/mu**2
21229 mutb(i, j) = mutb(i, j) + 0.5*mub0
21230 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
21237 DO i=i_end_f,i_start_f,-1
21238 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
21239 temp11 = field(i+2, k, j) - field(i-3, k, j) + 10.*(field(i, k&
21240 & , j)-field(i-1, k, j)) - 5.*(field(i+1, k, j)-field(i-2, k, &
21242 temp14 = SIGN(1., vel)
21243 temp13 = temp14/60.
21244 temp12 = SIGN(1, time_step)
21245 temp11b0 = vel*fqxb(i, k, j)
21246 temp11b1 = 37.*temp11b0/60.
21247 temp11b2 = -(2.*temp11b0/15.)
21248 temp11b3 = -(temp12*temp13*temp11b0)
21249 velb = (37.*((field(i, k, j)+field(i-1, k, j))/60.)-2.*((field&
21250 & (i+1, k, j)+field(i-2, k, j))/15.)+(field(i+2, k, j)+field(i&
21251 & -3, k, j))/60.-temp12*(temp13*temp11))*fqxb(i, k, j)
21252 fieldb(i, k, j) = fieldb(i, k, j) + 10.*temp11b3 + temp11b1
21253 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp11b1 - 10.*&
21255 fieldb(i+1, k, j) = fieldb(i+1, k, j) + temp11b2 - 5.*temp11b3
21256 fieldb(i-2, k, j) = fieldb(i-2, k, j) + 5.*temp11b3 + temp11b2
21257 fieldb(i+2, k, j) = fieldb(i+2, k, j) + temp11b3 + temp11b0/&
21259 fieldb(i-3, k, j) = fieldb(i-3, k, j) + temp11b0/60. - &
21261 fqxb(i, k, j) = 0.0
21262 temp11b4 = dx*mu*fqxlb(i, k, j)/dt
21263 min24b = 0.5*field_old(i-1, k, j)*temp11b4
21264 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min24*&
21266 max17b = 0.5*field_old(i, k, j)*temp11b4
21267 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max17*temp11b4
21268 mub0 = (0.5*(min24*field_old(i-1, k, j))+0.5*(max17*field_old(&
21269 & i, k, j)))*dx*fqxlb(i, k, j)/dt
21270 fqxlb(i, k, j) = 0.0
21271 CALL POPCONTROL1B(branch)
21272 IF (branch .EQ. 0) THEN
21273 CALL POPREAL8(max17)
21276 CALL POPREAL8(max17)
21281 CALL POPCONTROL1B(branch)
21282 IF (branch .EQ. 0) THEN
21287 CALL POPCONTROL1B(branch)
21288 IF (branch .EQ. 0) THEN
21289 CALL POPREAL8(min24)
21292 CALL POPREAL8(min24)
21297 CALL POPCONTROL1B(branch)
21298 IF (branch .EQ. 0) THEN
21303 temp11b = dt*crb/(dx*mu)
21304 velb = velb + temp11b
21305 mub0 = mub0 - vel*temp11b/mu
21307 rub(i, k, j) = rub(i, k, j) + velb
21309 mutb(i, j) = mutb(i, j) + 0.5*mub0
21310 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
21315 CALL POPINTEGER4(ad_from4)
21316 CALL POPINTEGER4(ad_to4)
21317 DO j=ad_to4,ad_from4,-1
21318 CALL POPCONTROL3B(branch)
21319 IF (branch .LT. 3) THEN
21320 IF (branch .NE. 0) THEN
21321 IF (branch .EQ. 1) THEN
21323 CALL POPINTEGER4(ad_from3)
21324 CALL POPINTEGER4(ad_to3)
21325 DO i=ad_to3,ad_from3,-1
21326 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
21327 temp7 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field(&
21328 & i, k, j)-field(i, k, j-1))
21329 temp10 = SIGN(1., vel)
21331 temp8 = SIGN(1, time_step)
21332 temp7b3 = vel*fqyb(i, k, j)
21333 temp7b4 = 7.*temp7b3/12.
21334 temp7b5 = temp8*temp9*temp7b3
21335 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(&
21336 & field(i, k, j+1)+field(i, k, j-2))/12.+temp8*(temp9*&
21337 & temp7))*fqyb(i, k, j)
21338 fieldb(i, k, j) = fieldb(i, k, j) + temp7b4 - 3.*temp7b5
21339 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*temp7b5 + &
21341 fieldb(i, k, j+1) = fieldb(i, k, j+1) + temp7b5 - &
21343 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp7b5 - &
21345 fqyb(i, k, j) = 0.0
21346 temp7b6 = dy*mu*fqylb(i, k, j)/dt
21347 min21b = 0.5*field_old(i, k, j-1)*temp7b6
21348 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*&
21350 max16b = 0.5*field_old(i, k, j)*temp7b6
21351 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max16*&
21353 mub0 = (0.5*(min21*field_old(i, k, j-1))+0.5*(max16*&
21354 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
21355 fqylb(i, k, j) = 0.0
21356 CALL POPCONTROL1B(branch)
21357 IF (branch .EQ. 0) THEN
21358 CALL POPREAL8(max16)
21361 CALL POPREAL8(max16)
21366 CALL POPCONTROL1B(branch)
21367 IF (branch .EQ. 0) THEN
21372 CALL POPCONTROL1B(branch)
21373 IF (branch .EQ. 0) THEN
21374 CALL POPREAL8(min21)
21377 CALL POPREAL8(min21)
21382 CALL POPCONTROL1B(branch)
21383 IF (branch .EQ. 0) THEN
21388 temp7b2 = dt*crb/(dy*mu)
21389 velb = velb + temp7b2
21390 mub0 = mub0 - vel*temp7b2/mu
21392 rvb(i, k, j) = rvb(i, k, j) + velb
21394 mutb(i, j) = mutb(i, j) + 0.5*mub0
21395 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
21401 CALL POPINTEGER4(ad_from2)
21402 CALL POPINTEGER4(ad_to2)
21403 DO i=ad_to2,ad_from2,-1
21404 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
21405 temp7b0 = 0.5*rv(i, k, j)*fqyb(i, k, j)
21406 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(&
21407 & i, k, j-1))*fqyb(i, k, j)
21408 fieldb(i, k, j) = fieldb(i, k, j) + temp7b0
21409 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp7b0
21410 fqyb(i, k, j) = 0.0
21411 temp7b1 = dy*mu*fqylb(i, k, j)/dt
21412 min20b = 0.5*field_old(i, k, j-1)*temp7b1
21413 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*&
21415 max15b = 0.5*field_old(i, k, j)*temp7b1
21416 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max15*&
21418 mub0 = (0.5*(min20*field_old(i, k, j-1))+0.5*(max15*&
21419 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
21420 fqylb(i, k, j) = 0.0
21421 CALL POPCONTROL1B(branch)
21422 IF (branch .EQ. 0) THEN
21423 CALL POPREAL8(max15)
21426 CALL POPREAL8(max15)
21431 CALL POPCONTROL1B(branch)
21432 IF (branch .EQ. 0) THEN
21437 CALL POPCONTROL1B(branch)
21438 IF (branch .EQ. 0) THEN
21439 CALL POPREAL8(min20)
21442 CALL POPREAL8(min20)
21447 CALL POPCONTROL1B(branch)
21448 IF (branch .EQ. 0) THEN
21453 temp7b = dt*crb/(dy*mu)
21455 mub0 = mub0 - vel*temp7b/mu
21457 rvb(i, k, j) = rvb(i, k, j) + velb
21459 mutb(i, j) = mutb(i, j) + 0.5*mub0
21460 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
21466 ELSE IF (branch .EQ. 3) THEN
21468 CALL POPINTEGER4(ad_from1)
21469 CALL POPINTEGER4(ad_to1)
21470 DO i=ad_to1,ad_from1,-1
21471 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
21472 temp3 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field(i, k&
21473 & , j)-field(i, k, j-1))
21474 temp6 = SIGN(1., vel)
21476 temp4 = SIGN(1, time_step)
21477 temp3b3 = vel*fqyb(i, k, j)
21478 temp3b4 = 7.*temp3b3/12.
21479 temp3b5 = temp4*temp5*temp3b3
21480 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(field(i&
21481 & , k, j+1)+field(i, k, j-2))/12.+temp4*(temp5*temp3))*fqyb(&
21483 fieldb(i, k, j) = fieldb(i, k, j) + temp3b4 - 3.*temp3b5
21484 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*temp3b5 + temp3b4
21485 fieldb(i, k, j+1) = fieldb(i, k, j+1) + temp3b5 - temp3b3/&
21487 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp3b5 - temp3b3/&
21489 fqyb(i, k, j) = 0.0
21490 temp3b6 = dy*mu*fqylb(i, k, j)/dt
21491 min19b = 0.5*field_old(i, k, j-1)*temp3b6
21492 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min19*&
21494 max14b = 0.5*field_old(i, k, j)*temp3b6
21495 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max14*&
21497 mub0 = (0.5*(min19*field_old(i, k, j-1))+0.5*(max14*&
21498 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
21499 fqylb(i, k, j) = 0.0
21500 CALL POPCONTROL1B(branch)
21501 IF (branch .EQ. 0) THEN
21502 CALL POPREAL8(max14)
21505 CALL POPREAL8(max14)
21510 CALL POPCONTROL1B(branch)
21511 IF (branch .EQ. 0) THEN
21516 CALL POPCONTROL1B(branch)
21517 IF (branch .EQ. 0) THEN
21518 CALL POPREAL8(min19)
21521 CALL POPREAL8(min19)
21526 CALL POPCONTROL1B(branch)
21527 IF (branch .EQ. 0) THEN
21532 temp3b2 = dt*crb/(dy*mu)
21533 velb = velb + temp3b2
21534 mub0 = mub0 - vel*temp3b2/mu
21536 rvb(i, k, j) = rvb(i, k, j) + velb
21538 mutb(i, j) = mutb(i, j) + 0.5*mub0
21539 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
21543 ELSE IF (branch .EQ. 4) THEN
21545 CALL POPINTEGER4(ad_from0)
21546 CALL POPINTEGER4(ad_to0)
21547 DO i=ad_to0,ad_from0,-1
21548 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
21549 temp3b0 = 0.5*rv(i, k, j)*fqyb(i, k, j)
21550 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i, k&
21551 & , j-1))*fqyb(i, k, j)
21552 fieldb(i, k, j) = fieldb(i, k, j) + temp3b0
21553 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp3b0
21554 fqyb(i, k, j) = 0.0
21555 temp3b1 = dy*mu*fqylb(i, k, j)/dt
21556 min18b = 0.5*field_old(i, k, j-1)*temp3b1
21557 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min18*&
21559 max13b = 0.5*field_old(i, k, j)*temp3b1
21560 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max13*&
21562 mub0 = (0.5*(min18*field_old(i, k, j-1))+0.5*(max13*&
21563 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
21564 fqylb(i, k, j) = 0.0
21565 CALL POPCONTROL1B(branch)
21566 IF (branch .EQ. 0) THEN
21567 CALL POPREAL8(max13)
21570 CALL POPREAL8(max13)
21575 CALL POPCONTROL1B(branch)
21576 IF (branch .EQ. 0) THEN
21581 CALL POPCONTROL1B(branch)
21582 IF (branch .EQ. 0) THEN
21583 CALL POPREAL8(min18)
21586 CALL POPREAL8(min18)
21591 CALL POPCONTROL1B(branch)
21592 IF (branch .EQ. 0) THEN
21597 temp3b = dt*crb/(dy*mu)
21599 mub0 = mub0 - vel*temp3b/mu
21601 rvb(i, k, j) = rvb(i, k, j) + velb
21603 mutb(i, j) = mutb(i, j) + 0.5*mub0
21604 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
21610 CALL POPINTEGER4(ad_from)
21611 CALL POPINTEGER4(ad_to)
21612 DO i=ad_to,ad_from,-1
21613 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
21614 temp = field(i, k, j+2) - field(i, k, j-3) + 10.*(field(i, k&
21615 & , j)-field(i, k, j-1)) - 5.*(field(i, k, j+1)-field(i, k, &
21617 temp2 = SIGN(1., vel)
21619 temp0 = SIGN(1, time_step)
21620 tempb0 = vel*fqyb(i, k, j)
21621 tempb1 = 37.*tempb0/60.
21622 tempb2 = -(2.*tempb0/15.)
21623 tempb3 = -(temp0*temp1*tempb0)
21624 velb = (37.*((field(i, k, j)+field(i, k, j-1))/60.)-2.*((&
21625 & field(i, k, j+1)+field(i, k, j-2))/15.)+(field(i, k, j+2)+&
21626 & field(i, k, j-3))/60.-temp0*(temp1*temp))*fqyb(i, k, j)
21627 fieldb(i, k, j) = fieldb(i, k, j) + 10.*tempb3 + tempb1
21628 fieldb(i, k, j-1) = fieldb(i, k, j-1) + tempb1 - 10.*tempb3
21629 fieldb(i, k, j+1) = fieldb(i, k, j+1) + tempb2 - 5.*tempb3
21630 fieldb(i, k, j-2) = fieldb(i, k, j-2) + 5.*tempb3 + tempb2
21631 fieldb(i, k, j+2) = fieldb(i, k, j+2) + tempb3 + tempb0/60.
21632 fieldb(i, k, j-3) = fieldb(i, k, j-3) + tempb0/60. - tempb3
21633 fqyb(i, k, j) = 0.0
21634 tempb4 = dy*mu*fqylb(i, k, j)/dt
21635 min17b = 0.5*field_old(i, k, j-1)*tempb4
21636 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min17*&
21638 max12b = 0.5*field_old(i, k, j)*tempb4
21639 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max12*tempb4
21640 mub0 = (0.5*(min17*field_old(i, k, j-1))+0.5*(max12*&
21641 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
21642 fqylb(i, k, j) = 0.0
21643 CALL POPCONTROL1B(branch)
21644 IF (branch .EQ. 0) THEN
21645 CALL POPREAL8(max12)
21648 CALL POPREAL8(max12)
21653 CALL POPCONTROL1B(branch)
21654 IF (branch .EQ. 0) THEN
21659 CALL POPCONTROL1B(branch)
21660 IF (branch .EQ. 0) THEN
21661 CALL POPREAL8(min17)
21664 CALL POPREAL8(min17)
21669 CALL POPCONTROL1B(branch)
21670 IF (branch .EQ. 0) THEN
21675 tempb = dt*crb/(dy*mu)
21676 velb = velb + tempb
21677 mub0 = mub0 - vel*tempb/mu
21679 rvb(i, k, j) = rvb(i, k, j) + velb
21681 mutb(i, j) = mutb(i, j) + 0.5*mub0
21682 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
21689 CALL POPINTEGER4(ad_from28)
21690 CALL POPINTEGER4(ad_to28)
21691 DO j=ad_to28,ad_from28,-1
21692 CALL POPCONTROL1B(branch)
21693 IF (branch .NE. 0) THEN
21694 CALL POPINTEGER4(ad_to27)
21695 DO i=ad_to27,i_end_f+1,-1
21696 CALL POPCONTROL1B(branch)
21697 IF (branch .NE. 0) THEN
21699 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
21700 temp31b44 = vel*fqxb(i, k, j)
21701 temp31b45 = 7.*temp31b44/12.
21702 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(&
21703 & i+1, k, j)+field(i-2, k, j))/12.)*fqxb(i, k, j)
21704 fieldb(i, k, j) = fieldb(i, k, j) + temp31b45
21705 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b45
21706 fieldb(i+1, k, j) = fieldb(i+1, k, j) - temp31b44/12.
21707 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp31b44/12.
21708 fqxb(i, k, j) = 0.0
21709 temp31b46 = dx*mu*fqxlb(i, k, j)/dt
21710 min14b = 0.5*field_old(i-1, k, j)*temp31b46
21711 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min14*&
21713 max11b = 0.5*field_old(i, k, j)*temp31b46
21714 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max11*&
21716 mub0 = (0.5*(min14*field_old(i-1, k, j))+0.5*(max11*&
21717 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
21718 fqxlb(i, k, j) = 0.0
21719 CALL POPCONTROL1B(branch)
21720 IF (branch .EQ. 0) THEN
21721 CALL POPREAL8(max11)
21724 CALL POPREAL8(max11)
21729 CALL POPCONTROL1B(branch)
21730 IF (branch .EQ. 0) THEN
21735 CALL POPCONTROL1B(branch)
21736 IF (branch .EQ. 0) THEN
21737 CALL POPREAL8(min14)
21740 CALL POPREAL8(min14)
21745 CALL POPCONTROL1B(branch)
21746 IF (branch .EQ. 0) THEN
21751 temp31b43 = dt*crb/(dx*mu)
21752 velb = velb + temp31b43
21753 mub0 = mub0 - vel*temp31b43/mu
21755 rub(i, k, j) = rub(i, k, j) + velb
21757 mutb(i, j) = mutb(i, j) + 0.5*mub0
21758 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
21762 CALL POPCONTROL1B(branch)
21763 IF (branch .EQ. 0) THEN
21765 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
21766 temp31b41 = 0.5*ru(i, k, j)*fqxb(i, k, j)
21767 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
21768 & 1, k, j))*fqxb(i, k, j)
21769 fieldb(i, k, j) = fieldb(i, k, j) + temp31b41
21770 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b41
21771 fqxb(i, k, j) = 0.0
21772 temp31b42 = dx*mu*fqxlb(i, k, j)/dt
21773 min13b = 0.5*field_old(i-1, k, j)*temp31b42
21774 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min13*&
21776 max10b = 0.5*field_old(i, k, j)*temp31b42
21777 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max10*&
21779 mub0 = (0.5*(min13*field_old(i-1, k, j))+0.5*(max10*&
21780 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
21781 fqxlb(i, k, j) = 0.0
21782 CALL POPCONTROL1B(branch)
21783 IF (branch .EQ. 0) THEN
21784 CALL POPREAL8(max10)
21787 CALL POPREAL8(max10)
21792 CALL POPCONTROL1B(branch)
21793 IF (branch .EQ. 0) THEN
21798 CALL POPCONTROL1B(branch)
21799 IF (branch .EQ. 0) THEN
21800 CALL POPREAL8(min13)
21803 CALL POPREAL8(min13)
21808 CALL POPCONTROL1B(branch)
21809 IF (branch .EQ. 0) THEN
21814 temp31b40 = dt*crb/(dx*mu)
21816 mub0 = mub0 - vel*temp31b40/mu
21818 rub(i, k, j) = rub(i, k, j) + velb
21820 mutb(i, j) = mutb(i, j) + 0.5*mub0
21821 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
21827 CALL POPCONTROL1B(branch)
21828 IF (branch .EQ. 0) THEN
21829 CALL POPINTEGER4(ad_from27)
21830 DO i=i_start_f-1,ad_from27,-1
21831 CALL POPCONTROL1B(branch)
21832 IF (branch .NE. 0) THEN
21834 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
21835 temp31b37 = vel*fqxb(i, k, j)
21836 temp31b38 = 7.*temp31b37/12.
21837 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(&
21838 & i+1, k, j)+field(i-2, k, j))/12.)*fqxb(i, k, j)
21839 fieldb(i, k, j) = fieldb(i, k, j) + temp31b38
21840 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b38
21841 fieldb(i+1, k, j) = fieldb(i+1, k, j) - temp31b37/12.
21842 fieldb(i-2, k, j) = fieldb(i-2, k, j) - temp31b37/12.
21843 fqxb(i, k, j) = 0.0
21844 temp31b39 = dx*mu*fqxlb(i, k, j)/dt
21845 min12b = 0.5*field_old(i-1, k, j)*temp31b39
21846 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min12*&
21848 max9b = 0.5*field_old(i, k, j)*temp31b39
21849 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max9*&
21851 mub0 = (0.5*(min12*field_old(i-1, k, j))+0.5*(max9*&
21852 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
21853 fqxlb(i, k, j) = 0.0
21854 CALL POPCONTROL1B(branch)
21855 IF (branch .EQ. 0) THEN
21856 CALL POPREAL8(max9)
21859 CALL POPREAL8(max9)
21864 CALL POPCONTROL1B(branch)
21865 IF (branch .EQ. 0) THEN
21870 CALL POPCONTROL1B(branch)
21871 IF (branch .EQ. 0) THEN
21872 CALL POPREAL8(min12)
21875 CALL POPREAL8(min12)
21880 CALL POPCONTROL1B(branch)
21881 IF (branch .EQ. 0) THEN
21886 temp31b36 = dt*crb/(dx*mu)
21887 velb = velb + temp31b36
21888 mub0 = mub0 - vel*temp31b36/mu
21890 rub(i, k, j) = rub(i, k, j) + velb
21892 mutb(i, j) = mutb(i, j) + 0.5*mub0
21893 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
21897 CALL POPCONTROL1B(branch)
21898 IF (branch .EQ. 0) THEN
21900 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
21901 temp31b34 = 0.5*ru(i, k, j)*fqxb(i, k, j)
21902 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
21903 & 1, k, j))*fqxb(i, k, j)
21904 fieldb(i, k, j) = fieldb(i, k, j) + temp31b34
21905 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b34
21906 fqxb(i, k, j) = 0.0
21907 temp31b35 = dx*mu*fqxlb(i, k, j)/dt
21908 min11b = 0.5*field_old(i-1, k, j)*temp31b35
21909 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min11*&
21911 max8b = 0.5*field_old(i, k, j)*temp31b35
21912 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max8*&
21914 mub0 = (0.5*(min11*field_old(i-1, k, j))+0.5*(max8*&
21915 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
21916 fqxlb(i, k, j) = 0.0
21917 CALL POPCONTROL1B(branch)
21918 IF (branch .EQ. 0) THEN
21919 CALL POPREAL8(max8)
21922 CALL POPREAL8(max8)
21927 CALL POPCONTROL1B(branch)
21928 IF (branch .EQ. 0) THEN
21933 CALL POPCONTROL1B(branch)
21934 IF (branch .EQ. 0) THEN
21935 CALL POPREAL8(min11)
21938 CALL POPREAL8(min11)
21943 CALL POPCONTROL1B(branch)
21944 IF (branch .EQ. 0) THEN
21951 rub(i, k, j) = rub(i, k, j) + velb/mu
21952 mub0 = mub0 - ru(i, k, j)*velb/mu**2
21954 mutb(i, j) = mutb(i, j) + 0.5*mub0
21955 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
21962 DO i=i_end_f,i_start_f,-1
21963 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
21964 temp31b30 = vel*fqxb(i, k, j)
21965 temp31b31 = 37.*temp31b30/60.
21966 temp31b32 = -(2.*temp31b30/15.)
21967 velb = (37.*((field(i, k, j)+field(i-1, k, j))/60.)-2.*((field&
21968 & (i+1, k, j)+field(i-2, k, j))/15.)+(field(i+2, k, j)+field(i&
21969 & -3, k, j))/60.)*fqxb(i, k, j)
21970 fieldb(i, k, j) = fieldb(i, k, j) + temp31b31
21971 fieldb(i-1, k, j) = fieldb(i-1, k, j) + temp31b31
21972 fieldb(i+1, k, j) = fieldb(i+1, k, j) + temp31b32
21973 fieldb(i-2, k, j) = fieldb(i-2, k, j) + temp31b32
21974 fieldb(i+2, k, j) = fieldb(i+2, k, j) + temp31b30/60.
21975 fieldb(i-3, k, j) = fieldb(i-3, k, j) + temp31b30/60.
21976 fqxb(i, k, j) = 0.0
21977 temp31b33 = dx*mu*fqxlb(i, k, j)/dt
21978 min10b = 0.5*field_old(i-1, k, j)*temp31b33
21979 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min10*&
21981 max7b = 0.5*field_old(i, k, j)*temp31b33
21982 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max7*temp31b33
21983 mub0 = (0.5*(min10*field_old(i-1, k, j))+0.5*(max7*field_old(i&
21984 & , k, j)))*dx*fqxlb(i, k, j)/dt
21985 fqxlb(i, k, j) = 0.0
21986 CALL POPCONTROL1B(branch)
21987 IF (branch .EQ. 0) THEN
21988 CALL POPREAL8(max7)
21991 CALL POPREAL8(max7)
21996 CALL POPCONTROL1B(branch)
21997 IF (branch .EQ. 0) THEN
22002 CALL POPCONTROL1B(branch)
22003 IF (branch .EQ. 0) THEN
22004 CALL POPREAL8(min10)
22007 CALL POPREAL8(min10)
22012 CALL POPCONTROL1B(branch)
22013 IF (branch .EQ. 0) THEN
22018 temp31b29 = dt*crb/(dx*mu)
22019 velb = velb + temp31b29
22020 mub0 = mub0 - vel*temp31b29/mu
22022 rub(i, k, j) = rub(i, k, j) + velb
22024 mutb(i, j) = mutb(i, j) + 0.5*mub0
22025 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
22030 CALL POPINTEGER4(ad_from26)
22031 CALL POPINTEGER4(ad_to26)
22032 DO j=ad_to26,ad_from26,-1
22033 CALL POPCONTROL3B(branch)
22034 IF (branch .LT. 3) THEN
22035 IF (branch .NE. 0) THEN
22036 IF (branch .EQ. 1) THEN
22038 CALL POPINTEGER4(ad_from25)
22039 CALL POPINTEGER4(ad_to25)
22040 DO i=ad_to25,ad_from25,-1
22041 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
22042 temp31b26 = vel*fqyb(i, k, j)
22043 temp31b27 = 7.*temp31b26/12.
22044 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(&
22045 & field(i, k, j+1)+field(i, k, j-2))/12.)*fqyb(i, k, j)
22046 fieldb(i, k, j) = fieldb(i, k, j) + temp31b27
22047 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp31b27
22048 fieldb(i, k, j+1) = fieldb(i, k, j+1) - temp31b26/12.
22049 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp31b26/12.
22050 fqyb(i, k, j) = 0.0
22051 temp31b28 = dy*mu*fqylb(i, k, j)/dt
22052 min7b = 0.5*field_old(i, k, j-1)*temp31b28
22053 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min7&
22055 max6b = 0.5*field_old(i, k, j)*temp31b28
22056 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max6*&
22058 mub0 = (0.5*(min7*field_old(i, k, j-1))+0.5*(max6*&
22059 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
22060 fqylb(i, k, j) = 0.0
22061 CALL POPCONTROL1B(branch)
22062 IF (branch .EQ. 0) THEN
22063 CALL POPREAL8(max6)
22066 CALL POPREAL8(max6)
22071 CALL POPCONTROL1B(branch)
22072 IF (branch .EQ. 0) THEN
22077 CALL POPCONTROL1B(branch)
22078 IF (branch .EQ. 0) THEN
22079 CALL POPREAL8(min7)
22082 CALL POPREAL8(min7)
22087 CALL POPCONTROL1B(branch)
22088 IF (branch .EQ. 0) THEN
22093 temp31b25 = dt*crb/(dy*mu)
22094 velb = velb + temp31b25
22095 mub0 = mub0 - vel*temp31b25/mu
22097 rvb(i, k, j) = rvb(i, k, j) + velb
22099 mutb(i, j) = mutb(i, j) + 0.5*mub0
22100 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
22106 CALL POPINTEGER4(ad_from24)
22107 CALL POPINTEGER4(ad_to24)
22108 DO i=ad_to24,ad_from24,-1
22109 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
22110 temp31b23 = 0.5*rv(i, k, j)*fqyb(i, k, j)
22111 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(&
22112 & i, k, j-1))*fqyb(i, k, j)
22113 fieldb(i, k, j) = fieldb(i, k, j) + temp31b23
22114 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp31b23
22115 fqyb(i, k, j) = 0.0
22116 temp31b24 = dy*mu*fqylb(i, k, j)/dt
22117 min6b = 0.5*field_old(i, k, j-1)*temp31b24
22118 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min6&
22120 max5b = 0.5*field_old(i, k, j)*temp31b24
22121 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max5*&
22123 mub0 = (0.5*(min6*field_old(i, k, j-1))+0.5*(max5*&
22124 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
22125 fqylb(i, k, j) = 0.0
22126 CALL POPCONTROL1B(branch)
22127 IF (branch .EQ. 0) THEN
22128 CALL POPREAL8(max5)
22131 CALL POPREAL8(max5)
22136 CALL POPCONTROL1B(branch)
22137 IF (branch .EQ. 0) THEN
22142 CALL POPCONTROL1B(branch)
22143 IF (branch .EQ. 0) THEN
22144 CALL POPREAL8(min6)
22147 CALL POPREAL8(min6)
22152 CALL POPCONTROL1B(branch)
22153 IF (branch .EQ. 0) THEN
22158 temp31b22 = dt*crb/(dy*mu)
22160 mub0 = mub0 - vel*temp31b22/mu
22162 rvb(i, k, j) = rvb(i, k, j) + velb
22164 mutb(i, j) = mutb(i, j) + 0.5*mub0
22165 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
22171 ELSE IF (branch .EQ. 3) THEN
22173 CALL POPINTEGER4(ad_from23)
22174 CALL POPINTEGER4(ad_to23)
22175 DO i=ad_to23,ad_from23,-1
22176 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
22177 temp31b19 = vel*fqyb(i, k, j)
22178 temp31b20 = 7.*temp31b19/12.
22179 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(field(i&
22180 & , k, j+1)+field(i, k, j-2))/12.)*fqyb(i, k, j)
22181 fieldb(i, k, j) = fieldb(i, k, j) + temp31b20
22182 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp31b20
22183 fieldb(i, k, j+1) = fieldb(i, k, j+1) - temp31b19/12.
22184 fieldb(i, k, j-2) = fieldb(i, k, j-2) - temp31b19/12.
22185 fqyb(i, k, j) = 0.0
22186 temp31b21 = dy*mu*fqylb(i, k, j)/dt
22187 min5b = 0.5*field_old(i, k, j-1)*temp31b21
22188 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min5*&
22190 max4b = 0.5*field_old(i, k, j)*temp31b21
22191 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max4*&
22193 mub0 = (0.5*(min5*field_old(i, k, j-1))+0.5*(max4*field_old(&
22194 & i, k, j)))*dy*fqylb(i, k, j)/dt
22195 fqylb(i, k, j) = 0.0
22196 CALL POPCONTROL1B(branch)
22197 IF (branch .EQ. 0) THEN
22198 CALL POPREAL8(max4)
22201 CALL POPREAL8(max4)
22206 CALL POPCONTROL1B(branch)
22207 IF (branch .EQ. 0) THEN
22212 CALL POPCONTROL1B(branch)
22213 IF (branch .EQ. 0) THEN
22214 CALL POPREAL8(min5)
22217 CALL POPREAL8(min5)
22222 CALL POPCONTROL1B(branch)
22223 IF (branch .EQ. 0) THEN
22228 temp31b18 = dt*crb/(dy*mu)
22229 velb = velb + temp31b18
22230 mub0 = mub0 - vel*temp31b18/mu
22232 rvb(i, k, j) = rvb(i, k, j) + velb
22234 mutb(i, j) = mutb(i, j) + 0.5*mub0
22235 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
22239 ELSE IF (branch .EQ. 4) THEN
22241 CALL POPINTEGER4(ad_from22)
22242 CALL POPINTEGER4(ad_to22)
22243 DO i=ad_to22,ad_from22,-1
22244 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
22245 temp31b16 = 0.5*rv(i, k, j)*fqyb(i, k, j)
22246 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i, k&
22247 & , j-1))*fqyb(i, k, j)
22248 fieldb(i, k, j) = fieldb(i, k, j) + temp31b16
22249 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp31b16
22250 fqyb(i, k, j) = 0.0
22251 temp31b17 = dy*mu*fqylb(i, k, j)/dt
22252 min4b = 0.5*field_old(i, k, j-1)*temp31b17
22253 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min4*&
22255 max3b = 0.5*field_old(i, k, j)*temp31b17
22256 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max3*&
22258 mub0 = (0.5*(min4*field_old(i, k, j-1))+0.5*(max3*field_old(&
22259 & i, k, j)))*dy*fqylb(i, k, j)/dt
22260 fqylb(i, k, j) = 0.0
22261 CALL POPCONTROL1B(branch)
22262 IF (branch .EQ. 0) THEN
22263 CALL POPREAL8(max3)
22266 CALL POPREAL8(max3)
22271 CALL POPCONTROL1B(branch)
22272 IF (branch .EQ. 0) THEN
22277 CALL POPCONTROL1B(branch)
22278 IF (branch .EQ. 0) THEN
22279 CALL POPREAL8(min4)
22282 CALL POPREAL8(min4)
22287 CALL POPCONTROL1B(branch)
22288 IF (branch .EQ. 0) THEN
22293 temp31b15 = dt*crb/(dy*mu)
22295 mub0 = mub0 - vel*temp31b15/mu
22297 rvb(i, k, j) = rvb(i, k, j) + velb
22299 mutb(i, j) = mutb(i, j) + 0.5*mub0
22300 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
22306 CALL POPINTEGER4(ad_from21)
22307 CALL POPINTEGER4(ad_to21)
22308 DO i=ad_to21,ad_from21,-1
22309 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
22310 temp31b11 = vel*fqyb(i, k, j)
22311 temp31b12 = 37.*temp31b11/60.
22312 temp31b13 = -(2.*temp31b11/15.)
22313 velb = (37.*((field(i, k, j)+field(i, k, j-1))/60.)-2.*((&
22314 & field(i, k, j+1)+field(i, k, j-2))/15.)+(field(i, k, j+2)+&
22315 & field(i, k, j-3))/60.)*fqyb(i, k, j)
22316 fieldb(i, k, j) = fieldb(i, k, j) + temp31b12
22317 fieldb(i, k, j-1) = fieldb(i, k, j-1) + temp31b12
22318 fieldb(i, k, j+1) = fieldb(i, k, j+1) + temp31b13
22319 fieldb(i, k, j-2) = fieldb(i, k, j-2) + temp31b13
22320 fieldb(i, k, j+2) = fieldb(i, k, j+2) + temp31b11/60.
22321 fieldb(i, k, j-3) = fieldb(i, k, j-3) + temp31b11/60.
22322 fqyb(i, k, j) = 0.0
22323 temp31b14 = dy*mu*fqylb(i, k, j)/dt
22324 min3b = 0.5*field_old(i, k, j-1)*temp31b14
22325 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min3*&
22327 max2b = 0.5*field_old(i, k, j)*temp31b14
22328 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max2*&
22330 mub0 = (0.5*(min3*field_old(i, k, j-1))+0.5*(max2*field_old(&
22331 & i, k, j)))*dy*fqylb(i, k, j)/dt
22332 fqylb(i, k, j) = 0.0
22333 CALL POPCONTROL1B(branch)
22334 IF (branch .EQ. 0) THEN
22335 CALL POPREAL8(max2)
22338 CALL POPREAL8(max2)
22343 CALL POPCONTROL1B(branch)
22344 IF (branch .EQ. 0) THEN
22349 CALL POPCONTROL1B(branch)
22350 IF (branch .EQ. 0) THEN
22351 CALL POPREAL8(min3)
22354 CALL POPREAL8(min3)
22359 CALL POPCONTROL1B(branch)
22360 IF (branch .EQ. 0) THEN
22365 temp31b10 = dt*crb/(dy*mu)
22366 velb = velb + temp31b10
22367 mub0 = mub0 - vel*temp31b10/mu
22369 rvb(i, k, j) = rvb(i, k, j) + velb
22371 mutb(i, j) = mutb(i, j) + 0.5*mub0
22372 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
22379 END SUBROUTINE A_ADVECT_SCALAR_PD
22381 ! Generated by TAPENADE (INRIA, Ecuador team)
22382 ! Tapenade 3.12 (r6213) - 13 Oct 2016 10:54
22384 ! Differentiation of advect_scalar_wenopd in reverse (adjoint) mode:
22385 ! gradient of useful results: rom field tendency ru rv mu_old
22387 ! with respect to varying inputs: rom field tendency ru rv mu_old
22389 ! RW status of diff variables: rom:incr field:incr tendency:in-out
22390 ! ru:incr rv:incr mu_old:incr field_old:incr mut:incr
22391 SUBROUTINE A_ADVECT_SCALAR_WENOPD(field, fieldb, field_old, field_oldb, &
22392 & tendency, tendencyb, ru, rub, rv, rvb, rom, romb, mut, mutb, mub, &
22393 & mu_old, mu_oldb, time_step, config_flags, msfux, msfuy, msfvx, msfvy, &
22394 & msftx, msfty, fzm, fzp, rdx, rdy, rdzw, dt, ids, ide, jds, jde, kds, &
22395 & kde, ims, ime, jms, jme, kms, kme, its, ite, jts, jte, kts, kte)
22398 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
22399 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
22400 & jme, kms, kme, its, ite, jts, jte, kts, kte
22401 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: field, &
22402 & field_old, ru, rv, rom
22403 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: fieldb, field_oldb, rub&
22405 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut, mub, mu_old
22406 REAL, DIMENSION(ims:ime, jms:jme) :: mutb, mu_oldb
22407 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
22408 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendencyb
22409 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
22410 & msfvy, msftx, msfty
22411 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzw
22412 REAL, INTENT(IN) :: rdx, rdy, dt
22413 INTEGER, INTENT(IN) :: time_step
22415 INTEGER :: i, j, k, itf, jtf, ktf
22416 INTEGER :: i_start, i_end, j_start, j_end
22417 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
22418 INTEGER :: jmin, jmax, jp, jm, imin, imax
22419 REAL :: mrdx, mrdy, ub, vb, uw, vw, mu
22420 REAL :: ubb, vbb, mub0
22421 ! storage for high and low order fluxes
22422 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: fqx, fqy, fqz
22423 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: fqxb, fqyb, fqzb
22424 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: fqxl, fqyl, fqzl
22425 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: fqxlb, fqylb, &
22427 INTEGER :: horz_order, vert_order
22428 LOGICAL :: degrade_xs, degrade_ys
22429 LOGICAL :: degrade_xe, degrade_ye
22430 INTEGER :: jp1, jp0, jtmp
22431 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: flux_out, ph_low
22432 REAL, DIMENSION(its-1:ite+2, kts:kte, jts-1:jte+2) :: flux_outb, &
22436 REAL, PARAMETER :: eps=1.e-20
22438 REAL :: ue, vs, vn, wb, wt
22439 REAL, PARAMETER :: f30=7./12., f31=1./12.
22440 REAL, PARAMETER :: f50=37./60., f51=2./15., f52=1./60.
22441 REAL :: qim2, qim1, qi, qip1, qip2
22442 REAL :: qim2b, qim1b, qib, qip1b, qip2b
22443 DOUBLE PRECISION :: beta0, beta1, beta2, f0, f1, f2, wi0, wi1, wi2, &
22445 DOUBLE PRECISION :: beta0b, beta1b, beta2b, f0b, f1b, f2b, wi0b, wi1b&
22447 DOUBLE PRECISION, PARAMETER :: gi0=1.d0/10.d0, gi1=6.d0/10.d0, gi2=&
22448 & 3.d0/10.d0, eps1=1.0d-28
22449 INTEGER, PARAMETER :: pw=2
22450 ! definition of flux operators, 3rd, 4th, 5th or 6th order
22451 REAL :: flux3, flux4, flux5, flux6, flux_upwind
22452 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel, cr
22454 ! flux_upwind(q_im1, q_i, cr ) = 0.5*(1.+sign(1.,cr))*q_im1 &
22455 ! +0.5*(1.-sign(1.,cr))*q_i
22456 ! flux_upwind(q_im1, q_i, cr ) = 0.
22458 LOGICAL, PARAMETER :: pd_limit=.true.
22603 DOUBLE PRECISION :: temp
22604 DOUBLE PRECISION :: temp0
22605 DOUBLE PRECISION :: temp1
22606 DOUBLE PRECISION :: tempb1
22607 DOUBLE PRECISION :: tempb2
22650 DOUBLE PRECISION :: temp10
22651 DOUBLE PRECISION :: temp11
22652 DOUBLE PRECISION :: temp12
22653 DOUBLE PRECISION :: tempb27
22654 DOUBLE PRECISION :: tempb28
22706 DOUBLE PRECISION :: temp21
22707 DOUBLE PRECISION :: temp22
22708 DOUBLE PRECISION :: temp23
22709 DOUBLE PRECISION :: tempb62
22710 DOUBLE PRECISION :: tempb63
22761 INTEGER :: ad_from0
22763 INTEGER :: ad_from1
22765 INTEGER :: ad_from2
22767 INTEGER :: ad_from3
22769 INTEGER :: ad_from4
22771 INTEGER :: ad_from5
22773 INTEGER :: ad_from6
22775 INTEGER :: ad_from7
22777 INTEGER :: ad_from8
22779 INTEGER :: ad_from9
22781 INTEGER :: ad_from10
22783 INTEGER :: ad_from11
22785 INTEGER :: ad_from12
22787 INTEGER :: ad_from13
22789 INTEGER :: ad_from14
22791 INTEGER :: ad_from15
22793 INTEGER :: ad_from16
22795 INTEGER :: ad_from17
22797 INTEGER :: ad_from18
22799 INTEGER :: ad_from19
22801 INTEGER :: ad_from20
22803 INTEGER :: ad_from21
22805 INTEGER :: ad_from22
22807 INTEGER :: ad_from23
22809 INTEGER :: ad_from24
22811 INTEGER :: ad_from25
22813 INTEGER :: ad_from26
22846 ! set order for the advection schemes
22847 ! write(6,*) ' in pd advection routine '
22848 ! Empty arrays just in case:
22849 IF (config_flags%polar) THEN
22857 ! determine boundary mods for flux operators
22858 ! We degrade the flux operators from 3rd/4th order
22859 ! to second order one gridpoint in from the boundaries for
22860 ! all boundary conditions except periodic and symmetry - these
22861 ! conditions have boundary zone data fill for correct application
22862 ! of the higher order flux stencils
22863 degrade_xs = .true.
22864 degrade_xe = .true.
22865 degrade_ys = .true.
22866 degrade_ye = .true.
22867 ! begin with horizontal flux divergence
22868 ! here is the choice of flux operators
22869 ! horizontal_order_test : IF( horz_order == 6 ) THEN
22870 ! ELSE IF( horz_order == 5 ) THEN
22871 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. its &
22872 & .GT. ids + 3) degrade_xs = .false.
22873 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. ite &
22874 & .LT. ide - 4) degrade_xe = .false.
22875 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. jts &
22876 & .GT. jds + 3) degrade_ys = .false.
22877 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. jte &
22878 & .LT. jde - 4) degrade_ye = .false.
22879 IF (kte .GT. kde - 1) THEN
22885 IF (ite .GT. ide - 1) THEN
22892 IF (jte .GT. jde - 1) THEN
22898 j_start_f = j_start
22899 j_end_f = j_end + 1
22900 !-- modify loop bounds if open or specified
22901 ! IF(degrade_xs) i_start = MAX(its-1,ids-1)
22902 ! IF(degrade_xe) i_end = MIN(ite+1,ide-2)
22903 IF (degrade_xs) THEN
22904 IF (its - 1 .LT. ids) THEN
22905 CALL PUSHCONTROL1B(1)
22908 CALL PUSHCONTROL1B(1)
22912 CALL PUSHCONTROL1B(0)
22914 IF (degrade_xe) THEN
22915 IF (ite + 1 .GT. ide - 1) THEN
22916 CALL PUSHCONTROL1B(1)
22919 CALL PUSHCONTROL1B(1)
22923 CALL PUSHCONTROL1B(0)
22925 IF (degrade_ys) THEN
22926 IF (jts - 1 .LT. jds + 1) THEN
22927 CALL PUSHCONTROL1B(0)
22930 CALL PUSHCONTROL1B(0)
22933 j_start_f = jds + 3
22935 CALL PUSHCONTROL1B(1)
22937 IF (degrade_ye) THEN
22938 IF (jte + 1 .GT. jde - 2) THEN
22939 CALL PUSHCONTROL1B(1)
22942 CALL PUSHCONTROL1B(1)
22947 CALL PUSHCONTROL1B(0)
22950 ! compute fluxes, 5th order
22951 j_loop_y_flux_5:DO j=ad_from4,j_end+1
22952 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
22959 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
22961 mu = 0.5*(mut(i, j)+mut(i, j-1))
22962 CALL PUSHREAL8(vel)
22965 IF (cr .GE. 0.) THEN
22967 CALL PUSHCONTROL1B(0)
22970 CALL PUSHCONTROL1B(1)
22973 IF (1.0 .GT. y1) THEN
22974 CALL PUSHREAL8(min3)
22976 CALL PUSHCONTROL1B(0)
22978 CALL PUSHREAL8(min3)
22980 CALL PUSHCONTROL1B(1)
22982 IF (cr .GE. 0.) THEN
22984 CALL PUSHCONTROL1B(0)
22987 CALL PUSHCONTROL1B(1)
22990 IF (-1.0 .LT. y17) THEN
22991 CALL PUSHREAL8(max2)
22993 CALL PUSHCONTROL1B(0)
22995 CALL PUSHREAL8(max2)
22997 CALL PUSHCONTROL1B(1)
22999 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min3*field_old(i, k, j-1)+0.5*&
23000 & max2*field_old(i, k, j))
23001 IF (vel*SIGN(1, time_step) .GE. 0.0) THEN
23002 CALL PUSHREAL8(qip2)
23003 qip2 = field(i, k, j+1)
23004 CALL PUSHREAL8(qip1)
23005 qip1 = field(i, k, j)
23007 qi = field(i, k, j-1)
23008 CALL PUSHREAL8(qim1)
23009 qim1 = field(i, k, j-2)
23010 CALL PUSHREAL8(qim2)
23011 qim2 = field(i, k, j-3)
23012 CALL PUSHCONTROL1B(0)
23014 CALL PUSHREAL8(qip2)
23015 qip2 = field(i, k, j-2)
23016 CALL PUSHREAL8(qip1)
23017 qip1 = field(i, k, j-1)
23019 qi = field(i, k, j)
23020 CALL PUSHREAL8(qim1)
23021 qim1 = field(i, k, j+1)
23022 CALL PUSHREAL8(qim2)
23023 qim2 = field(i, k, j+2)
23024 CALL PUSHCONTROL1B(1)
23027 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
23029 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
23031 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
23032 CALL PUSHREAL8(beta0)
23033 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*&
23035 CALL PUSHREAL8(beta1)
23036 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
23037 CALL PUSHREAL8(beta2)
23038 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*&
23040 wi0 = gi0/(eps1+beta0)**pw
23041 wi1 = gi1/(eps1+beta1)**pw
23042 wi2 = gi2/(eps1+beta2)**pw
23043 sumwk = wi0 + wi1 + wi2
23044 fqy(i, k, j) = vel*(wi0*f0+wi1*f1+wi2*f2)/sumwk
23045 ! fqy( i, k, j ) = vel*flux5( &
23046 ! field(i,k,j-3), field(i,k,j-2), field(i,k,j-1), &
23047 ! field(i,k,j ), field(i,k,j+1), field(i,k,j+2), vel )
23048 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
23050 CALL PUSHINTEGER4(i - 1)
23051 CALL PUSHINTEGER4(ad_from)
23053 CALL PUSHCONTROL3B(5)
23054 ELSE IF (j .EQ. jds + 1) THEN
23055 ! 2nd order flux next to south boundary
23058 DO i=ad_from0,i_end
23061 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
23063 mu = 0.5*(mut(i, j)+mut(i, j-1))
23064 CALL PUSHREAL8(vel)
23067 IF (cr .GE. 0.) THEN
23069 CALL PUSHCONTROL1B(0)
23072 CALL PUSHCONTROL1B(1)
23075 IF (1.0 .GT. y2) THEN
23076 CALL PUSHREAL8(min4)
23078 CALL PUSHCONTROL1B(0)
23080 CALL PUSHREAL8(min4)
23082 CALL PUSHCONTROL1B(1)
23084 IF (cr .GE. 0.) THEN
23086 CALL PUSHCONTROL1B(0)
23089 CALL PUSHCONTROL1B(1)
23092 IF (-1.0 .LT. y18) THEN
23093 CALL PUSHREAL8(max3)
23095 CALL PUSHCONTROL1B(0)
23097 CALL PUSHREAL8(max3)
23099 CALL PUSHCONTROL1B(1)
23101 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min4*field_old(i, k, j-1)+0.5*&
23102 & max3*field_old(i, k, j))
23103 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j-1&
23105 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
23107 CALL PUSHINTEGER4(i - 1)
23108 CALL PUSHINTEGER4(ad_from0)
23110 CALL PUSHCONTROL3B(4)
23111 ELSE IF (j .EQ. jds + 2) THEN
23112 ! third of 4th order flux 2 in from south boundary
23115 DO i=ad_from1,i_end
23118 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
23120 mu = 0.5*(mut(i, j)+mut(i, j-1))
23121 CALL PUSHREAL8(vel)
23124 IF (cr .GE. 0.) THEN
23126 CALL PUSHCONTROL1B(0)
23129 CALL PUSHCONTROL1B(1)
23132 IF (1.0 .GT. y3) THEN
23133 CALL PUSHREAL8(min5)
23135 CALL PUSHCONTROL1B(0)
23137 CALL PUSHREAL8(min5)
23139 CALL PUSHCONTROL1B(1)
23141 IF (cr .GE. 0.) THEN
23143 CALL PUSHCONTROL1B(0)
23146 CALL PUSHCONTROL1B(1)
23149 IF (-1.0 .LT. y19) THEN
23150 CALL PUSHREAL8(max4)
23152 CALL PUSHCONTROL1B(0)
23154 CALL PUSHREAL8(max4)
23156 CALL PUSHCONTROL1B(1)
23158 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min5*field_old(i, k, j-1)+0.5*&
23159 & max4*field_old(i, k, j))
23160 fqy(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k, j-1))-&
23161 & 1./12.*(field(i, k, j+1)+field(i, k, j-2))+SIGN(1, time_step&
23162 & )*SIGN(1., vel)*(1./12.)*(field(i, k, j+1)-field(i, k, j-2)-&
23163 & 3.*(field(i, k, j)-field(i, k, j-1))))
23164 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
23166 CALL PUSHINTEGER4(i - 1)
23167 CALL PUSHINTEGER4(ad_from1)
23169 CALL PUSHCONTROL3B(3)
23170 ELSE IF (j .EQ. jde - 1) THEN
23171 ! 2nd order flux next to north boundary
23174 DO i=ad_from2,i_end
23177 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
23179 mu = 0.5*(mut(i, j)+mut(i, j-1))
23180 CALL PUSHREAL8(vel)
23183 IF (cr .GE. 0.) THEN
23185 CALL PUSHCONTROL1B(0)
23188 CALL PUSHCONTROL1B(1)
23191 IF (1.0 .GT. y4) THEN
23192 CALL PUSHREAL8(min6)
23194 CALL PUSHCONTROL1B(0)
23196 CALL PUSHREAL8(min6)
23198 CALL PUSHCONTROL1B(1)
23200 IF (cr .GE. 0.) THEN
23202 CALL PUSHCONTROL1B(0)
23205 CALL PUSHCONTROL1B(1)
23208 IF (-1.0 .LT. y20) THEN
23209 CALL PUSHREAL8(max5)
23211 CALL PUSHCONTROL1B(0)
23213 CALL PUSHREAL8(max5)
23215 CALL PUSHCONTROL1B(1)
23217 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min6*field_old(i, k, j-1)+0.5*&
23218 & max5*field_old(i, k, j))
23219 fqy(i, k, j) = 0.5*rv(i, k, j)*(field(i, k, j)+field(i, k, j-1&
23221 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
23223 CALL PUSHINTEGER4(i - 1)
23224 CALL PUSHINTEGER4(ad_from2)
23226 CALL PUSHCONTROL3B(2)
23227 ELSE IF (j .EQ. jde - 2) THEN
23228 ! 3rd or 4th order flux 2 in from north boundary
23231 DO i=ad_from3,i_end
23234 dy = 2./(msftx(i, j)+msftx(i, j-1))/rdy
23236 mu = 0.5*(mut(i, j)+mut(i, j-1))
23237 CALL PUSHREAL8(vel)
23240 IF (cr .GE. 0.) THEN
23242 CALL PUSHCONTROL1B(0)
23245 CALL PUSHCONTROL1B(1)
23248 IF (1.0 .GT. y5) THEN
23249 CALL PUSHREAL8(min7)
23251 CALL PUSHCONTROL1B(0)
23253 CALL PUSHREAL8(min7)
23255 CALL PUSHCONTROL1B(1)
23257 IF (cr .GE. 0.) THEN
23259 CALL PUSHCONTROL1B(0)
23262 CALL PUSHCONTROL1B(1)
23265 IF (-1.0 .LT. y21) THEN
23266 CALL PUSHREAL8(max6)
23268 CALL PUSHCONTROL1B(0)
23270 CALL PUSHREAL8(max6)
23272 CALL PUSHCONTROL1B(1)
23274 fqyl(i, k, j) = mu*(dy/dt)*(0.5*min7*field_old(i, k, j-1)+0.5*&
23275 & max6*field_old(i, k, j))
23276 fqy(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k, j-1))-&
23277 & 1./12.*(field(i, k, j+1)+field(i, k, j-2))+SIGN(1, time_step&
23278 & )*SIGN(1., vel)*(1./12.)*(field(i, k, j+1)-field(i, k, j-2)-&
23279 & 3.*(field(i, k, j)-field(i, k, j-1))))
23280 fqy(i, k, j) = fqy(i, k, j) - fqyl(i, k, j)
23282 CALL PUSHINTEGER4(i - 1)
23283 CALL PUSHINTEGER4(ad_from3)
23285 CALL PUSHCONTROL3B(1)
23287 CALL PUSHCONTROL3B(0)
23289 END DO j_loop_y_flux_5
23290 CALL PUSHINTEGER4(j - 1)
23291 CALL PUSHINTEGER4(ad_from4)
23293 !-- these bounds are for periodic and sym conditions
23295 IF (ite .GT. ide - 1) THEN
23301 i_start_f = i_start
23302 i_end_f = i_end + 1
23304 IF (jte .GT. jde - 1) THEN
23310 !-- modify loop bounds for open and specified b.c
23311 ! IF(degrade_ys) j_start = MAX(jts-1,jds+1)
23312 ! IF(degrade_ye) j_end = MIN(jte+1,jde-2)
23313 IF (degrade_ys) THEN
23314 IF (jts - 1 .LT. jds) THEN
23315 CALL PUSHCONTROL1B(1)
23318 CALL PUSHCONTROL1B(1)
23322 CALL PUSHCONTROL1B(0)
23324 IF (degrade_ye) THEN
23325 IF (jte + 1 .GT. jde - 1) THEN
23326 CALL PUSHCONTROL1B(1)
23329 CALL PUSHCONTROL1B(1)
23333 CALL PUSHCONTROL1B(0)
23335 IF (degrade_xs) THEN
23336 IF (ids + 1 .LT. its - 1) THEN
23337 CALL PUSHCONTROL1B(0)
23340 CALL PUSHCONTROL1B(0)
23343 i_start_f = ids + 3
23345 CALL PUSHCONTROL1B(1)
23347 IF (degrade_xe) THEN
23348 IF (ide - 2 .GT. ite + 1) THEN
23349 CALL PUSHCONTROL1B(1)
23352 CALL PUSHCONTROL1B(1)
23357 CALL PUSHCONTROL1B(0)
23361 DO j=ad_from6,j_end
23364 DO i=i_start_f,i_end_f
23367 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
23369 mu = 0.5*(mut(i, j)+mut(i-1, j))
23370 CALL PUSHREAL8(vel)
23373 IF (cr .GE. 0.) THEN
23375 CALL PUSHCONTROL1B(0)
23378 CALL PUSHCONTROL1B(1)
23381 IF (1.0 .GT. y6) THEN
23382 CALL PUSHREAL8(min10)
23384 CALL PUSHCONTROL1B(0)
23386 CALL PUSHREAL8(min10)
23388 CALL PUSHCONTROL1B(1)
23390 IF (cr .GE. 0.) THEN
23392 CALL PUSHCONTROL1B(0)
23395 CALL PUSHCONTROL1B(1)
23398 IF (-1.0 .LT. y22) THEN
23399 CALL PUSHREAL8(max7)
23401 CALL PUSHCONTROL1B(0)
23403 CALL PUSHREAL8(max7)
23405 CALL PUSHCONTROL1B(1)
23407 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min10*field_old(i-1, k, j)+0.5*&
23408 & max7*field_old(i, k, j))
23409 IF (vel*SIGN(1, time_step) .GE. 0.0) THEN
23410 CALL PUSHREAL8(qip2)
23411 qip2 = field(i+1, k, j)
23412 CALL PUSHREAL8(qip1)
23413 qip1 = field(i, k, j)
23415 qi = field(i-1, k, j)
23416 CALL PUSHREAL8(qim1)
23417 qim1 = field(i-2, k, j)
23418 CALL PUSHREAL8(qim2)
23419 qim2 = field(i-3, k, j)
23420 CALL PUSHCONTROL1B(0)
23422 CALL PUSHREAL8(qip2)
23423 qip2 = field(i-2, k, j)
23424 CALL PUSHREAL8(qip1)
23425 qip1 = field(i-1, k, j)
23427 qi = field(i, k, j)
23428 CALL PUSHREAL8(qim1)
23429 qim1 = field(i+1, k, j)
23430 CALL PUSHREAL8(qim2)
23431 qim2 = field(i+2, k, j)
23432 CALL PUSHCONTROL1B(1)
23435 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
23437 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
23439 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
23440 CALL PUSHREAL8(beta0)
23441 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
23443 CALL PUSHREAL8(beta1)
23444 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
23445 CALL PUSHREAL8(beta2)
23446 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
23448 wi0 = gi0/(eps1+beta0)**pw
23449 wi1 = gi1/(eps1+beta1)**pw
23450 wi2 = gi2/(eps1+beta2)**pw
23451 sumwk = wi0 + wi1 + wi2
23452 fqx(i, k, j) = vel*(wi0*f0+wi1*f1+wi2*f2)/sumwk
23453 ! fqx( i,k,j ) = vel*flux5( field(i-3,k,j), field(i-2,k,j), &
23454 ! field(i-1,k,j), field(i ,k,j), &
23455 ! field(i+1,k,j), field(i+2,k,j), &
23457 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
23460 ! lower order fluxes close to boundaries (if not periodic or symmetric)
23461 IF (degrade_xs) THEN
23463 DO i=ad_from5,i_start_f-1
23464 IF (i .EQ. ids + 1) THEN
23469 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
23471 mu = 0.5*(mut(i, j)+mut(i-1, j))
23472 CALL PUSHREAL8(vel)
23473 vel = ru(i, k, j)/mu
23475 IF (cr .GE. 0.) THEN
23477 CALL PUSHCONTROL1B(0)
23480 CALL PUSHCONTROL1B(1)
23483 IF (1.0 .GT. y7) THEN
23484 CALL PUSHREAL8(min11)
23486 CALL PUSHCONTROL1B(0)
23488 CALL PUSHREAL8(min11)
23490 CALL PUSHCONTROL1B(1)
23492 IF (cr .GE. 0.) THEN
23494 CALL PUSHCONTROL1B(0)
23497 CALL PUSHCONTROL1B(1)
23500 IF (-1.0 .LT. y23) THEN
23501 CALL PUSHREAL8(max8)
23503 CALL PUSHCONTROL1B(0)
23505 CALL PUSHREAL8(max8)
23507 CALL PUSHCONTROL1B(1)
23509 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min11*field_old(i-1, k, j)+&
23510 & 0.5*max8*field_old(i, k, j))
23511 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, k&
23513 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
23515 CALL PUSHCONTROL1B(0)
23517 CALL PUSHCONTROL1B(1)
23519 IF (i .EQ. ids + 2) THEN
23524 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
23526 mu = 0.5*(mut(i, j)+mut(i-1, j))
23527 CALL PUSHREAL8(vel)
23530 IF (cr .GE. 0.) THEN
23532 CALL PUSHCONTROL1B(0)
23535 CALL PUSHCONTROL1B(1)
23538 IF (1.0 .GT. y8) THEN
23539 CALL PUSHREAL8(min12)
23541 CALL PUSHCONTROL1B(0)
23543 CALL PUSHREAL8(min12)
23545 CALL PUSHCONTROL1B(1)
23547 IF (cr .GE. 0.) THEN
23549 CALL PUSHCONTROL1B(0)
23552 CALL PUSHCONTROL1B(1)
23555 IF (-1.0 .LT. y24) THEN
23556 CALL PUSHREAL8(max9)
23558 CALL PUSHCONTROL1B(0)
23560 CALL PUSHREAL8(max9)
23562 CALL PUSHCONTROL1B(1)
23564 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min12*field_old(i-1, k, j)+&
23565 & 0.5*max9*field_old(i, k, j))
23566 fqx(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i-1, k, j))&
23567 & -1./12.*(field(i+1, k, j)+field(i-2, k, j))+SIGN(1, &
23568 & time_step)*SIGN(1., vel)*(1./12.)*(field(i+1, k, j)-field(&
23569 & i-2, k, j)-3.*(field(i, k, j)-field(i-1, k, j))))
23570 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
23572 CALL PUSHCONTROL1B(1)
23574 CALL PUSHCONTROL1B(0)
23577 CALL PUSHINTEGER4(ad_from5)
23578 CALL PUSHCONTROL1B(0)
23580 CALL PUSHCONTROL1B(1)
23582 IF (degrade_xe) THEN
23583 DO i=i_end_f+1,i_end+1
23584 IF (i .EQ. ide - 1) THEN
23585 ! second order flux next to the boundary
23589 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
23591 mu = 0.5*(mut(i, j)+mut(i-1, j))
23592 CALL PUSHREAL8(vel)
23595 IF (cr .GE. 0.) THEN
23597 CALL PUSHCONTROL1B(0)
23600 CALL PUSHCONTROL1B(1)
23603 IF (1.0 .GT. y9) THEN
23604 CALL PUSHREAL8(min13)
23606 CALL PUSHCONTROL1B(0)
23608 CALL PUSHREAL8(min13)
23610 CALL PUSHCONTROL1B(1)
23612 IF (cr .GE. 0.) THEN
23614 CALL PUSHCONTROL1B(0)
23617 CALL PUSHCONTROL1B(1)
23620 IF (-1.0 .LT. y25) THEN
23621 CALL PUSHREAL8(max10)
23623 CALL PUSHCONTROL1B(0)
23625 CALL PUSHREAL8(max10)
23627 CALL PUSHCONTROL1B(1)
23629 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min13*field_old(i-1, k, j)+&
23630 & 0.5*max10*field_old(i, k, j))
23631 fqx(i, k, j) = 0.5*ru(i, k, j)*(field(i, k, j)+field(i-1, k&
23633 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
23635 CALL PUSHCONTROL1B(0)
23637 CALL PUSHCONTROL1B(1)
23639 IF (i .EQ. ide - 2) THEN
23640 ! third order flux one in from the boundary
23644 dx = 2./(msfty(i, j)+msfty(i-1, j))/rdx
23646 mu = 0.5*(mut(i, j)+mut(i-1, j))
23647 CALL PUSHREAL8(vel)
23650 IF (cr .GE. 0.) THEN
23652 CALL PUSHCONTROL1B(0)
23655 CALL PUSHCONTROL1B(1)
23658 IF (1.0 .GT. y10) THEN
23659 CALL PUSHREAL8(min14)
23661 CALL PUSHCONTROL1B(0)
23663 CALL PUSHREAL8(min14)
23665 CALL PUSHCONTROL1B(1)
23667 IF (cr .GE. 0.) THEN
23669 CALL PUSHCONTROL1B(0)
23672 CALL PUSHCONTROL1B(1)
23675 IF (-1.0 .LT. y26) THEN
23676 CALL PUSHREAL8(max11)
23678 CALL PUSHCONTROL1B(0)
23680 CALL PUSHREAL8(max11)
23682 CALL PUSHCONTROL1B(1)
23684 fqxl(i, k, j) = mu*(dx/dt)*(0.5*min14*field_old(i-1, k, j)+&
23685 & 0.5*max11*field_old(i, k, j))
23686 fqx(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i-1, k, j))&
23687 & -1./12.*(field(i+1, k, j)+field(i-2, k, j))+SIGN(1, &
23688 & time_step)*SIGN(1., vel)*(1./12.)*(field(i+1, k, j)-field(&
23689 & i-2, k, j)-3.*(field(i, k, j)-field(i-1, k, j))))
23690 fqx(i, k, j) = fqx(i, k, j) - fqxl(i, k, j)
23692 CALL PUSHCONTROL1B(1)
23694 CALL PUSHCONTROL1B(0)
23697 CALL PUSHINTEGER4(i - 1)
23698 CALL PUSHCONTROL1B(1)
23700 CALL PUSHCONTROL1B(0)
23703 CALL PUSHINTEGER4(j - 1)
23704 CALL PUSHINTEGER4(ad_from6)
23705 ! enddo for outer J loop
23706 !--- end of 5th order horizontal flux calculation
23708 ! WRITE ( wrf_err_message , * ) 'module_advect: advect_scalar_pd, h_order not known ',horz_order
23709 ! CALL wrf_error_fatal ( TRIM( wrf_err_message ) )
23710 ! ENDIF horizontal_order_test
23711 ! pick up the rest of the horizontal radiation boundary conditions.
23712 ! (these are the computations that don't require 'cb'.
23713 ! first, set to index ranges
23715 IF (ite .GT. ide - 1) THEN
23721 IF (jte .GT. jde - 1) THEN
23726 ! compute x (u) conditions for v, w, or scalar
23727 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
23729 DO j=ad_from7,j_end
23731 IF (0.5*(ru(its, k, j)+ru(its+1, k, j)) .GT. 0.) THEN
23734 CALL PUSHCONTROL1B(0)
23737 ub = 0.5*(ru(its, k, j)+ru(its+1, k, j))
23738 CALL PUSHCONTROL1B(1)
23742 CALL PUSHINTEGER4(j - 1)
23743 CALL PUSHINTEGER4(ad_from7)
23744 CALL PUSHCONTROL1B(0)
23746 CALL PUSHCONTROL1B(1)
23748 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
23750 DO j=ad_from8,j_end
23752 IF (0.5*(ru(ite-1, k, j)+ru(ite, k, j)) .LT. 0.) THEN
23755 CALL PUSHCONTROL1B(0)
23758 ub = 0.5*(ru(ite-1, k, j)+ru(ite, k, j))
23759 CALL PUSHCONTROL1B(1)
23763 CALL PUSHINTEGER4(j - 1)
23764 CALL PUSHINTEGER4(ad_from8)
23765 CALL PUSHCONTROL1B(0)
23767 CALL PUSHCONTROL1B(1)
23769 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
23771 DO i=ad_from9,i_end
23773 IF (0.5*(rv(i, k, jts)+rv(i, k, jts+1)) .GT. 0.) THEN
23776 CALL PUSHCONTROL1B(0)
23779 vb = 0.5*(rv(i, k, jts)+rv(i, k, jts+1))
23780 CALL PUSHCONTROL1B(1)
23784 CALL PUSHINTEGER4(i - 1)
23785 CALL PUSHINTEGER4(ad_from9)
23786 CALL PUSHCONTROL1B(0)
23788 CALL PUSHCONTROL1B(1)
23790 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
23791 ad_from10 = i_start
23792 DO i=ad_from10,i_end
23794 IF (0.5*(rv(i, k, jte-1)+rv(i, k, jte)) .LT. 0.) THEN
23797 CALL PUSHCONTROL1B(0)
23800 vb = 0.5*(rv(i, k, jte-1)+rv(i, k, jte))
23801 CALL PUSHCONTROL1B(1)
23805 CALL PUSHINTEGER4(i - 1)
23806 CALL PUSHINTEGER4(ad_from10)
23807 CALL PUSHCONTROL1B(0)
23809 CALL PUSHCONTROL1B(1)
23811 IF (config_flags%polar .AND. jts .EQ. jds) THEN
23812 ad_from11 = i_start
23813 ! Assuming rv(i,k,jds) = 0.
23814 DO i=ad_from11,i_end
23816 IF (0.5*rv(i, k, jts+1) .GT. 0.) THEN
23819 CALL PUSHCONTROL1B(0)
23822 vb = 0.5*rv(i, k, jts+1)
23823 CALL PUSHCONTROL1B(1)
23827 CALL PUSHINTEGER4(i - 1)
23828 CALL PUSHINTEGER4(ad_from11)
23829 CALL PUSHCONTROL1B(0)
23831 CALL PUSHCONTROL1B(1)
23833 IF (config_flags%polar .AND. jte .EQ. jde) THEN
23834 ad_from12 = i_start
23835 ! Assuming rv(i,k,jde) = 0.
23836 DO i=ad_from12,i_end
23838 IF (0.5*rv(i, k, jte-1) .LT. 0.) THEN
23841 CALL PUSHCONTROL1B(0)
23844 vb = 0.5*rv(i, k, jte-1)
23845 CALL PUSHCONTROL1B(1)
23849 CALL PUSHINTEGER4(i - 1)
23850 CALL PUSHINTEGER4(ad_from12)
23851 CALL PUSHCONTROL1B(1)
23853 CALL PUSHCONTROL1B(0)
23855 !-------------------- vertical advection
23856 !-- loop bounds for periodic or sym conditions
23858 IF (ite .GT. ide - 1) THEN
23863 CALL PUSHINTEGER4(i_end)
23866 IF (jte .GT. jde - 1) THEN
23871 CALL PUSHINTEGER4(j_end)
23873 !-- loop bounds for open or specified conditions
23874 IF (degrade_xs) THEN
23875 IF (its - 1 .LT. ids) THEN
23876 CALL PUSHCONTROL1B(1)
23879 CALL PUSHCONTROL1B(1)
23883 CALL PUSHCONTROL1B(0)
23885 IF (degrade_xe) THEN
23886 IF (ite + 1 .GT. ide - 1) THEN
23887 CALL PUSHCONTROL1B(1)
23890 CALL PUSHCONTROL1B(1)
23894 CALL PUSHCONTROL1B(0)
23896 IF (degrade_ys) THEN
23897 IF (jts - 1 .LT. jds) THEN
23898 CALL PUSHCONTROL1B(1)
23901 CALL PUSHCONTROL1B(1)
23905 CALL PUSHCONTROL1B(0)
23907 IF (degrade_ye) THEN
23908 IF (jte + 1 .GT. jde - 1) THEN
23909 CALL PUSHCONTROL1B(1)
23912 CALL PUSHCONTROL1B(1)
23916 CALL PUSHCONTROL1B(0)
23918 ad_from16 = j_start
23919 ! vert_order_test : IF (vert_order == 6) THEN
23920 ! ELSE IF (vert_order == 5) THEN
23921 DO j=ad_from16,j_end
23922 ad_from13 = i_start
23923 DO i=ad_from13,i_end
23926 fqz(i, kde, j) = 0.
23927 fqzl(i, kde, j) = 0.
23929 CALL PUSHINTEGER4(i - 1)
23930 CALL PUSHINTEGER4(ad_from13)
23931 CALL PUSHINTEGER4(k)
23933 ad_from14 = i_start
23934 DO i=ad_from14,i_end
23936 dz = 2./(rdzw(k)+rdzw(k-1))
23938 mu = 0.5*(mut(i, j)+mut(i, j))
23939 CALL PUSHREAL8(vel)
23942 IF (cr .GE. 0.) THEN
23944 CALL PUSHCONTROL1B(0)
23947 CALL PUSHCONTROL1B(1)
23950 IF (1.0 .GT. y11) THEN
23951 CALL PUSHREAL8(min17)
23953 CALL PUSHCONTROL1B(0)
23955 CALL PUSHREAL8(min17)
23957 CALL PUSHCONTROL1B(1)
23959 IF (cr .GE. 0.) THEN
23961 CALL PUSHCONTROL1B(0)
23964 CALL PUSHCONTROL1B(1)
23967 IF (-1.0 .LT. y27) THEN
23968 CALL PUSHREAL8(max12)
23970 CALL PUSHCONTROL1B(0)
23972 CALL PUSHREAL8(max12)
23974 CALL PUSHCONTROL1B(1)
23976 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min17*field_old(i, k-1, j)+0.5*&
23977 & max12*field_old(i, k, j))
23978 IF (-(vel*SIGN(1, time_step)) .GE. 0.0) THEN
23979 CALL PUSHREAL8(qip2)
23980 qip2 = field(i, k+1, j)
23981 CALL PUSHREAL8(qip1)
23982 qip1 = field(i, k, j)
23984 qi = field(i, k-1, j)
23985 CALL PUSHREAL8(qim1)
23986 qim1 = field(i, k-2, j)
23987 CALL PUSHREAL8(qim2)
23988 qim2 = field(i, k-3, j)
23989 CALL PUSHCONTROL1B(0)
23991 CALL PUSHREAL8(qip2)
23992 qip2 = field(i, k-2, j)
23993 CALL PUSHREAL8(qip1)
23994 qip1 = field(i, k-1, j)
23996 qi = field(i, k, j)
23997 CALL PUSHREAL8(qim1)
23998 qim1 = field(i, k+1, j)
23999 CALL PUSHREAL8(qim2)
24000 qim2 = field(i, k+2, j)
24001 CALL PUSHCONTROL1B(1)
24004 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
24006 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
24008 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
24009 CALL PUSHREAL8(beta0)
24010 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
24012 CALL PUSHREAL8(beta1)
24013 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
24014 CALL PUSHREAL8(beta2)
24015 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
24017 wi0 = gi0/(eps1+beta0)**pw
24018 wi1 = gi1/(eps1+beta1)**pw
24019 wi2 = gi2/(eps1+beta2)**pw
24020 sumwk = wi0 + wi1 + wi2
24021 fqz(i, k, j) = vel*(wi0*f0+wi1*f1+wi2*f2)/sumwk
24022 ! fqz(i,k,j) = vel*flux5( field(i,k-3,j), field(i,k-2,j), field(i,k-1,j), &
24023 ! field(i,k ,j), field(i,k+1,j), field(i,k+2,j), -vel )
24024 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
24026 CALL PUSHINTEGER4(i - 1)
24027 CALL PUSHINTEGER4(ad_from14)
24029 ad_from15 = i_start
24030 DO i=ad_from15,i_end
24031 CALL PUSHINTEGER4(k)
24034 dz = 2./(rdzw(k)+rdzw(k-1))
24036 mu = 0.5*(mut(i, j)+mut(i, j))
24037 CALL PUSHREAL8(vel)
24040 IF (cr .GE. 0.) THEN
24042 CALL PUSHCONTROL1B(0)
24045 CALL PUSHCONTROL1B(1)
24048 IF (1.0 .GT. y12) THEN
24049 CALL PUSHREAL8(min18)
24051 CALL PUSHCONTROL1B(0)
24053 CALL PUSHREAL8(min18)
24055 CALL PUSHCONTROL1B(1)
24057 IF (cr .GE. 0.) THEN
24059 CALL PUSHCONTROL1B(0)
24062 CALL PUSHCONTROL1B(1)
24065 IF (-1.0 .LT. y28) THEN
24066 CALL PUSHREAL8(max13)
24068 CALL PUSHCONTROL1B(0)
24070 CALL PUSHREAL8(max13)
24072 CALL PUSHCONTROL1B(1)
24074 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min18*field_old(i, k-1, j)+0.5*&
24075 & max13*field_old(i, k, j))
24076 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(i&
24078 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
24081 dz = 2./(rdzw(k)+rdzw(k-1))
24082 mu = 0.5*(mut(i, j)+mut(i, j))
24083 CALL PUSHREAL8(vel)
24086 IF (cr .GE. 0.) THEN
24088 CALL PUSHCONTROL1B(0)
24091 CALL PUSHCONTROL1B(1)
24094 IF (1.0 .GT. y13) THEN
24095 CALL PUSHREAL8(min19)
24097 CALL PUSHCONTROL1B(0)
24099 CALL PUSHREAL8(min19)
24101 CALL PUSHCONTROL1B(1)
24103 IF (cr .GE. 0.) THEN
24105 CALL PUSHCONTROL1B(0)
24108 CALL PUSHCONTROL1B(1)
24111 IF (-1.0 .LT. y29) THEN
24112 CALL PUSHREAL8(max14)
24114 CALL PUSHCONTROL1B(0)
24116 CALL PUSHREAL8(max14)
24118 CALL PUSHCONTROL1B(1)
24120 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min19*field_old(i, k-1, j)+0.5*&
24121 & max14*field_old(i, k, j))
24122 fqz(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k-1, j))-1./&
24123 & 12.*(field(i, k+1, j)+field(i, k-2, j))+SIGN(1, time_step)*SIGN(&
24124 & 1., -vel)*(1./12.)*(field(i, k+1, j)-field(i, k-2, j)-3.*(field(&
24125 & i, k, j)-field(i, k-1, j))))
24126 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
24129 dz = 2./(rdzw(k)+rdzw(k-1))
24130 mu = 0.5*(mut(i, j)+mut(i, j))
24131 CALL PUSHREAL8(vel)
24134 IF (cr .GE. 0.) THEN
24136 CALL PUSHCONTROL1B(0)
24139 CALL PUSHCONTROL1B(1)
24142 IF (1.0 .GT. y14) THEN
24143 CALL PUSHREAL8(min20)
24145 CALL PUSHCONTROL1B(0)
24147 CALL PUSHREAL8(min20)
24149 CALL PUSHCONTROL1B(1)
24151 IF (cr .GE. 0.) THEN
24153 CALL PUSHCONTROL1B(0)
24156 CALL PUSHCONTROL1B(1)
24159 IF (-1.0 .LT. y30) THEN
24160 CALL PUSHREAL8(max15)
24162 CALL PUSHCONTROL1B(0)
24164 CALL PUSHREAL8(max15)
24166 CALL PUSHCONTROL1B(1)
24168 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min20*field_old(i, k-1, j)+0.5*&
24169 & max15*field_old(i, k, j))
24170 fqz(i, k, j) = vel*(7./12.*(field(i, k, j)+field(i, k-1, j))-1./&
24171 & 12.*(field(i, k+1, j)+field(i, k-2, j))+SIGN(1, time_step)*SIGN(&
24172 & 1., -vel)*(1./12.)*(field(i, k+1, j)-field(i, k-2, j)-3.*(field(&
24173 & i, k, j)-field(i, k-1, j))))
24174 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
24177 dz = 2./(rdzw(k)+rdzw(k-1))
24178 mu = 0.5*(mut(i, j)+mut(i, j))
24179 CALL PUSHREAL8(vel)
24182 IF (cr .GE. 0.) THEN
24184 CALL PUSHCONTROL1B(0)
24187 CALL PUSHCONTROL1B(1)
24190 IF (1.0 .GT. y15) THEN
24191 CALL PUSHREAL8(min21)
24193 CALL PUSHCONTROL1B(0)
24195 CALL PUSHREAL8(min21)
24197 CALL PUSHCONTROL1B(1)
24199 IF (cr .GE. 0.) THEN
24201 CALL PUSHCONTROL1B(0)
24204 CALL PUSHCONTROL1B(1)
24207 IF (-1.0 .LT. y31) THEN
24208 CALL PUSHREAL8(max16)
24210 CALL PUSHCONTROL1B(0)
24212 CALL PUSHREAL8(max16)
24214 CALL PUSHCONTROL1B(1)
24216 fqzl(i, k, j) = mu*(dz/dt)*(0.5*min21*field_old(i, k-1, j)+0.5*&
24217 & max16*field_old(i, k, j))
24218 fqz(i, k, j) = rom(i, k, j)*(fzm(k)*field(i, k, j)+fzp(k)*field(i&
24220 fqz(i, k, j) = fqz(i, k, j) - fqzl(i, k, j)
24222 CALL PUSHINTEGER4(i - 1)
24223 CALL PUSHINTEGER4(ad_from15)
24225 CALL PUSHINTEGER4(j - 1)
24226 CALL PUSHINTEGER4(ad_from16)
24228 ! WRITE (wrf_err_message,*) ' advect_scalar_pd, v_order not known ',vert_order
24229 ! CALL wrf_error_fatal ( wrf_err_message )
24230 ! ENDIF vert_order_test
24232 ! positive definite filter
24234 IF (ite .GT. ide - 1) THEN
24241 IF (jte .GT. jde - 1) THEN
24247 !-- loop bounds for open or specified conditions
24248 IF (degrade_xs) THEN
24249 IF (its - 1 .LT. ids) THEN
24250 CALL PUSHCONTROL1B(1)
24253 CALL PUSHCONTROL1B(1)
24257 CALL PUSHCONTROL1B(0)
24259 IF (degrade_xe) THEN
24260 IF (ite + 1 .GT. ide - 1) THEN
24261 CALL PUSHCONTROL1B(1)
24264 CALL PUSHCONTROL1B(1)
24268 CALL PUSHCONTROL1B(0)
24270 IF (degrade_ys) THEN
24271 IF (jts - 1 .LT. jds) THEN
24272 CALL PUSHCONTROL1B(1)
24275 CALL PUSHCONTROL1B(1)
24279 CALL PUSHCONTROL1B(0)
24281 IF (degrade_ye) THEN
24282 IF (jte + 1 .GT. jde - 1) THEN
24283 CALL PUSHCONTROL1B(1)
24286 CALL PUSHCONTROL1B(1)
24290 CALL PUSHCONTROL1B(0)
24292 IF (config_flags%specified .OR. config_flags%nested) THEN
24293 IF (degrade_xs) THEN
24294 IF (its - 1 .LT. ids + 1) THEN
24295 CALL PUSHCONTROL1B(1)
24298 CALL PUSHCONTROL1B(1)
24302 CALL PUSHCONTROL1B(0)
24304 IF (degrade_xe) THEN
24305 IF (ite + 1 .GT. ide - 2) THEN
24306 CALL PUSHCONTROL1B(1)
24309 CALL PUSHCONTROL1B(1)
24313 CALL PUSHCONTROL1B(0)
24315 IF (degrade_ys) THEN
24316 IF (jts - 1 .LT. jds + 1) THEN
24317 CALL PUSHCONTROL1B(1)
24320 CALL PUSHCONTROL1B(1)
24324 CALL PUSHCONTROL1B(0)
24326 IF (degrade_ye) THEN
24327 IF (jte + 1 .GT. jde - 2) THEN
24328 CALL PUSHCONTROL2B(2)
24331 CALL PUSHCONTROL2B(2)
24335 CALL PUSHCONTROL2B(0)
24338 CALL PUSHCONTROL2B(1)
24340 IF (config_flags%open_xs) THEN
24341 IF (degrade_xs) THEN
24342 IF (its - 1 .LT. ids + 1) THEN
24343 CALL PUSHCONTROL2B(2)
24346 CALL PUSHCONTROL2B(2)
24350 CALL PUSHCONTROL2B(0)
24353 CALL PUSHCONTROL2B(1)
24355 IF (config_flags%open_xe) THEN
24356 IF (degrade_xe) THEN
24357 IF (ite + 1 .GT. ide - 2) THEN
24358 CALL PUSHCONTROL2B(2)
24361 CALL PUSHCONTROL2B(2)
24365 CALL PUSHCONTROL2B(0)
24368 CALL PUSHCONTROL2B(1)
24370 IF (config_flags%open_ys) THEN
24371 IF (degrade_ys) THEN
24372 IF (jts - 1 .LT. jds + 1) THEN
24373 CALL PUSHCONTROL2B(2)
24376 CALL PUSHCONTROL2B(2)
24380 CALL PUSHCONTROL2B(0)
24383 CALL PUSHCONTROL2B(1)
24385 IF (config_flags%open_ye) THEN
24386 IF (degrade_ye) THEN
24387 IF (jte + 1 .GT. jde - 2) THEN
24388 CALL PUSHCONTROL2B(2)
24391 CALL PUSHCONTROL2B(2)
24395 CALL PUSHCONTROL2B(1)
24398 CALL PUSHCONTROL2B(0)
24400 ad_from18 = j_start
24402 ! We don't want to change j_start and j_end
24403 ! for polar BC's since we want to calculate
24404 ! fluxes for directions other than y at the
24406 !-- here is the limiter...
24407 DO j=ad_from18,j_end
24408 CALL PUSHINTEGER4(k)
24410 ad_from17 = i_start
24411 DO i=ad_from17,i_end
24412 ph_low(i, k, j) = (mub(i, j)+mu_old(i, j))*field_old(i, k, j) &
24413 & - dt*(msftx(i, j)*msfty(i, j)*(rdx*(fqxl(i+1, k, j)-fqxl(i, &
24414 & k, j))+rdy*(fqyl(i, k, j+1)-fqyl(i, k, j)))+msfty(i, j)*rdzw&
24415 & (k)*(fqzl(i, k+1, j)-fqzl(i, k, j)))
24417 CALL PUSHINTEGER4(i - 1)
24418 CALL PUSHINTEGER4(ad_from17)
24421 CALL PUSHINTEGER4(j - 1)
24422 CALL PUSHINTEGER4(ad_from18)
24423 ad_from20 = j_start
24424 DO j=ad_from20,j_end
24425 CALL PUSHINTEGER4(k)
24427 ad_from19 = i_start
24428 !DIR$ vector always
24429 DO i=ad_from19,i_end
24430 IF (0. .LT. fqx(i+1, k, j)) THEN
24431 max1 = fqx(i+1, k, j)
24432 CALL PUSHCONTROL1B(1)
24434 CALL PUSHCONTROL1B(0)
24437 IF (0. .GT. fqx(i, k, j)) THEN
24438 min24 = fqx(i, k, j)
24439 CALL PUSHCONTROL1B(1)
24441 CALL PUSHCONTROL1B(0)
24444 IF (0. .LT. fqy(i, k, j+1)) THEN
24445 max17 = fqy(i, k, j+1)
24446 CALL PUSHCONTROL1B(1)
24448 CALL PUSHCONTROL1B(0)
24451 IF (0. .GT. fqy(i, k, j)) THEN
24452 min25 = fqy(i, k, j)
24453 CALL PUSHCONTROL1B(1)
24455 CALL PUSHCONTROL1B(0)
24458 IF (0. .GT. fqz(i, k+1, j)) THEN
24459 min26 = fqz(i, k+1, j)
24460 CALL PUSHCONTROL1B(1)
24462 CALL PUSHCONTROL1B(0)
24465 IF (0. .LT. fqz(i, k, j)) THEN
24466 max18 = fqz(i, k, j)
24467 CALL PUSHCONTROL1B(0)
24469 CALL PUSHCONTROL1B(1)
24472 flux_out(i, k, j) = dt*(msftx(i, j)*msfty(i, j)*(rdx*(max1-&
24473 & min24)+rdy*(max17-min25))+msfty(i, j)*rdzw(k)*(min26-max18))
24475 CALL PUSHINTEGER4(i - 1)
24476 CALL PUSHINTEGER4(ad_from19)
24479 CALL PUSHINTEGER4(j - 1)
24480 CALL PUSHINTEGER4(ad_from20)
24481 ad_from22 = j_start
24482 DO j=ad_from22,j_end
24483 CALL PUSHINTEGER4(k)
24485 ad_from21 = i_start
24486 !DIR$ vector always
24487 DO i=ad_from21,i_end
24488 IF (flux_out(i, k, j) .GT. ph_low(i, k, j)) THEN
24489 y16 = ph_low(i, k, j)/(flux_out(i, k, j)+eps)
24490 IF (0. .LT. y16) THEN
24491 CALL PUSHREAL8(scale)
24493 CALL PUSHCONTROL1B(0)
24495 CALL PUSHREAL8(scale)
24497 CALL PUSHCONTROL1B(1)
24499 IF (fqx(i+1, k, j) .GT. 0.) THEN
24500 CALL PUSHREAL8(fqx(i+1, k, j))
24501 fqx(i+1, k, j) = scale*fqx(i+1, k, j)
24502 CALL PUSHCONTROL1B(0)
24504 CALL PUSHCONTROL1B(1)
24506 IF (fqx(i, k, j) .LT. 0.) THEN
24507 CALL PUSHREAL8(fqx(i, k, j))
24508 fqx(i, k, j) = scale*fqx(i, k, j)
24509 CALL PUSHCONTROL1B(0)
24511 CALL PUSHCONTROL1B(1)
24513 IF (fqy(i, k, j+1) .GT. 0.) THEN
24514 CALL PUSHREAL8(fqy(i, k, j+1))
24515 fqy(i, k, j+1) = scale*fqy(i, k, j+1)
24516 CALL PUSHCONTROL1B(0)
24518 CALL PUSHCONTROL1B(1)
24520 IF (fqy(i, k, j) .LT. 0.) THEN
24521 CALL PUSHREAL8(fqy(i, k, j))
24522 fqy(i, k, j) = scale*fqy(i, k, j)
24523 CALL PUSHCONTROL1B(0)
24525 CALL PUSHCONTROL1B(1)
24527 ! note: z flux is opposite sign in mass coordinate because
24528 ! vertical coordinate decreases with increasing k
24529 IF (fqz(i, k+1, j) .LT. 0.) THEN
24530 CALL PUSHREAL8(fqz(i, k+1, j))
24531 fqz(i, k+1, j) = scale*fqz(i, k+1, j)
24532 CALL PUSHCONTROL1B(0)
24534 CALL PUSHCONTROL1B(1)
24536 IF (fqz(i, k, j) .GT. 0.) THEN
24537 CALL PUSHREAL8(fqz(i, k, j))
24538 fqz(i, k, j) = scale*fqz(i, k, j)
24539 CALL PUSHCONTROL2B(2)
24541 CALL PUSHCONTROL2B(1)
24544 CALL PUSHCONTROL2B(0)
24547 CALL PUSHINTEGER4(i - 1)
24548 CALL PUSHINTEGER4(ad_from21)
24551 CALL PUSHINTEGER4(j - 1)
24552 CALL PUSHINTEGER4(ad_from22)
24553 CALL PUSHCONTROL1B(1)
24555 CALL PUSHCONTROL1B(0)
24557 ! add in the pd-limited flux divergence
24559 IF (ite .GT. ide - 1) THEN
24565 IF (jte .GT. jde - 1) THEN
24570 ad_from24 = j_start
24571 DO j=ad_from24,j_end
24572 CALL PUSHINTEGER4(k)
24574 ad_from23 = i_start
24576 CALL PUSHINTEGER4(i - 1)
24577 CALL PUSHINTEGER4(ad_from23)
24580 CALL PUSHINTEGER4(j - 1)
24581 CALL PUSHINTEGER4(ad_from24)
24582 ! x flux divergence
24584 IF (degrade_xs) THEN
24585 IF (its .LT. ids + 1) THEN
24586 CALL PUSHCONTROL1B(1)
24589 CALL PUSHCONTROL1B(1)
24593 CALL PUSHCONTROL1B(0)
24595 IF (degrade_xe) THEN
24596 IF (ite .GT. ide - 2) THEN
24597 CALL PUSHCONTROL1B(1)
24600 CALL PUSHCONTROL1B(1)
24604 CALL PUSHCONTROL1B(0)
24606 ad_from26 = j_start
24607 DO j=ad_from26,j_end
24608 CALL PUSHINTEGER4(k)
24610 ad_from25 = i_start
24612 CALL PUSHINTEGER4(i - 1)
24613 CALL PUSHINTEGER4(ad_from25)
24616 CALL PUSHINTEGER4(j - 1)
24617 CALL PUSHINTEGER4(ad_from26)
24618 ! y flux divergence
24621 IF (ite .GT. ide - 1) THEN
24626 IF (degrade_ys) THEN
24627 IF (jts .LT. jds + 1) THEN
24628 CALL PUSHCONTROL1B(1)
24631 CALL PUSHCONTROL1B(1)
24635 CALL PUSHCONTROL1B(0)
24637 IF (degrade_ye) THEN
24638 IF (jte .GT. jde - 2) THEN
24639 CALL PUSHCONTROL1B(1)
24642 CALL PUSHCONTROL1B(1)
24646 CALL PUSHCONTROL1B(0)
24649 CALL PUSHINTEGER4(k)
24653 DO j=j_end,j_start,-1
24655 DO i=i_end,i_start,-1
24656 tempb92 = -(msftx(i, j)*rdy*tendencyb(i, k, j))
24657 fqyb(i, k, j+1) = fqyb(i, k, j+1) + tempb92
24658 fqyb(i, k, j) = fqyb(i, k, j) - tempb92
24659 fqylb(i, k, j+1) = fqylb(i, k, j+1) + tempb92
24660 fqylb(i, k, j) = fqylb(i, k, j) - tempb92
24663 CALL POPINTEGER4(k)
24665 CALL POPCONTROL1B(branch)
24666 CALL POPCONTROL1B(branch)
24669 CALL POPINTEGER4(ad_from26)
24670 CALL POPINTEGER4(ad_to26)
24671 DO j=ad_to26,ad_from26,-1
24673 CALL POPINTEGER4(ad_from25)
24674 CALL POPINTEGER4(ad_to25)
24675 DO i=ad_to25,ad_from25,-1
24676 tempb91 = -(msftx(i, j)*rdx*tendencyb(i, k, j))
24677 fqxb(i+1, k, j) = fqxb(i+1, k, j) + tempb91
24678 fqxb(i, k, j) = fqxb(i, k, j) - tempb91
24679 fqxlb(i+1, k, j) = fqxlb(i+1, k, j) + tempb91
24680 fqxlb(i, k, j) = fqxlb(i, k, j) - tempb91
24683 CALL POPINTEGER4(k)
24685 CALL POPCONTROL1B(branch)
24686 CALL POPCONTROL1B(branch)
24689 CALL POPINTEGER4(ad_from24)
24690 CALL POPINTEGER4(ad_to24)
24691 DO j=ad_to24,ad_from24,-1
24693 CALL POPINTEGER4(ad_from23)
24694 CALL POPINTEGER4(ad_to23)
24695 DO i=ad_to23,ad_from23,-1
24696 tempb90 = -(rdzw(k)*tendencyb(i, k, j))
24697 fqzb(i, k+1, j) = fqzb(i, k+1, j) + tempb90
24698 fqzb(i, k, j) = fqzb(i, k, j) - tempb90
24699 fqzlb(i, k+1, j) = fqzlb(i, k+1, j) + tempb90
24700 fqzlb(i, k, j) = fqzlb(i, k, j) - tempb90
24703 CALL POPINTEGER4(k)
24705 CALL POPCONTROL1B(branch)
24706 IF (branch .NE. 0) THEN
24709 CALL POPINTEGER4(ad_from22)
24710 CALL POPINTEGER4(ad_to22)
24711 DO j=ad_to22,ad_from22,-1
24713 CALL POPINTEGER4(ad_from21)
24714 CALL POPINTEGER4(ad_to21)
24715 DO i=ad_to21,ad_from21,-1
24716 CALL POPCONTROL2B(branch)
24717 IF (branch .NE. 0) THEN
24718 IF (branch .EQ. 1) THEN
24721 CALL POPREAL8(fqz(i, k, j))
24722 scaleb = fqz(i, k, j)*fqzb(i, k, j)
24723 fqzb(i, k, j) = scale*fqzb(i, k, j)
24725 CALL POPCONTROL1B(branch)
24726 IF (branch .EQ. 0) THEN
24727 CALL POPREAL8(fqz(i, k+1, j))
24728 scaleb = scaleb + fqz(i, k+1, j)*fqzb(i, k+1, j)
24729 fqzb(i, k+1, j) = scale*fqzb(i, k+1, j)
24731 CALL POPCONTROL1B(branch)
24732 IF (branch .EQ. 0) THEN
24733 CALL POPREAL8(fqy(i, k, j))
24734 scaleb = scaleb + fqy(i, k, j)*fqyb(i, k, j)
24735 fqyb(i, k, j) = scale*fqyb(i, k, j)
24737 CALL POPCONTROL1B(branch)
24738 IF (branch .EQ. 0) THEN
24739 CALL POPREAL8(fqy(i, k, j+1))
24740 scaleb = scaleb + fqy(i, k, j+1)*fqyb(i, k, j+1)
24741 fqyb(i, k, j+1) = scale*fqyb(i, k, j+1)
24743 CALL POPCONTROL1B(branch)
24744 IF (branch .EQ. 0) THEN
24745 CALL POPREAL8(fqx(i, k, j))
24746 scaleb = scaleb + fqx(i, k, j)*fqxb(i, k, j)
24747 fqxb(i, k, j) = scale*fqxb(i, k, j)
24749 CALL POPCONTROL1B(branch)
24750 IF (branch .EQ. 0) THEN
24751 CALL POPREAL8(fqx(i+1, k, j))
24752 scaleb = scaleb + fqx(i+1, k, j)*fqxb(i+1, k, j)
24753 fqxb(i+1, k, j) = scale*fqxb(i+1, k, j)
24755 CALL POPCONTROL1B(branch)
24756 IF (branch .EQ. 0) THEN
24757 CALL POPREAL8(scale)
24760 CALL POPREAL8(scale)
24763 temp32 = eps + flux_out(i, k, j)
24764 ph_lowb(i, k, j) = ph_lowb(i, k, j) + y16b/temp32
24765 flux_outb(i, k, j) = flux_outb(i, k, j) - ph_low(i, k, j)*&
24770 CALL POPINTEGER4(k)
24772 CALL POPINTEGER4(ad_from20)
24773 CALL POPINTEGER4(ad_to20)
24774 DO j=ad_to20,ad_from20,-1
24776 CALL POPINTEGER4(ad_from19)
24777 CALL POPINTEGER4(ad_to19)
24778 DO i=ad_to19,ad_from19,-1
24779 tempb88 = dt*msftx(i, j)*msfty(i, j)*flux_outb(i, k, j)
24780 tempb89 = msfty(i, j)*dt*rdzw(k)*flux_outb(i, k, j)
24781 max1b = rdx*tempb88
24782 min24b = -(rdx*tempb88)
24783 max17b = rdy*tempb88
24784 min25b = -(rdy*tempb88)
24787 flux_outb(i, k, j) = 0.0
24788 CALL POPCONTROL1B(branch)
24789 IF (branch .EQ. 0) fqzb(i, k, j) = fqzb(i, k, j) + max18b
24790 CALL POPCONTROL1B(branch)
24791 IF (branch .NE. 0) fqzb(i, k+1, j) = fqzb(i, k+1, j) + min26b
24792 CALL POPCONTROL1B(branch)
24793 IF (branch .NE. 0) fqyb(i, k, j) = fqyb(i, k, j) + min25b
24794 CALL POPCONTROL1B(branch)
24795 IF (branch .NE. 0) fqyb(i, k, j+1) = fqyb(i, k, j+1) + max17b
24796 CALL POPCONTROL1B(branch)
24797 IF (branch .NE. 0) fqxb(i, k, j) = fqxb(i, k, j) + min24b
24798 CALL POPCONTROL1B(branch)
24799 IF (branch .NE. 0) fqxb(i+1, k, j) = fqxb(i+1, k, j) + max1b
24802 CALL POPINTEGER4(k)
24804 CALL POPINTEGER4(ad_from18)
24805 CALL POPINTEGER4(ad_to18)
24806 DO j=ad_to18,ad_from18,-1
24808 CALL POPINTEGER4(ad_from17)
24809 CALL POPINTEGER4(ad_to17)
24810 DO i=ad_to17,ad_from17,-1
24811 tempb86 = -(dt*msftx(i, j)*msfty(i, j)*ph_lowb(i, k, j))
24812 tempb87 = -(dt*msfty(i, j)*rdzw(k)*ph_lowb(i, k, j))
24813 mu_oldb(i, j) = mu_oldb(i, j) + field_old(i, k, j)*ph_lowb(i, &
24815 field_oldb(i, k, j) = field_oldb(i, k, j) + (mub(i, j)+mu_old(&
24816 & i, j))*ph_lowb(i, k, j)
24817 fqxlb(i+1, k, j) = fqxlb(i+1, k, j) + rdx*tempb86
24818 fqxlb(i, k, j) = fqxlb(i, k, j) - rdx*tempb86
24819 fqylb(i, k, j+1) = fqylb(i, k, j+1) + rdy*tempb86
24820 fqylb(i, k, j) = fqylb(i, k, j) - rdy*tempb86
24821 fqzlb(i, k+1, j) = fqzlb(i, k+1, j) + tempb87
24822 fqzlb(i, k, j) = fqzlb(i, k, j) - tempb87
24823 ph_lowb(i, k, j) = 0.0
24826 CALL POPINTEGER4(k)
24828 CALL POPCONTROL2B(branch)
24829 CALL POPCONTROL2B(branch)
24830 CALL POPCONTROL2B(branch)
24831 CALL POPCONTROL2B(branch)
24832 CALL POPCONTROL2B(branch)
24833 IF (branch .NE. 0) THEN
24834 IF (branch .EQ. 1) GOTO 100
24836 CALL POPCONTROL1B(branch)
24837 CALL POPCONTROL1B(branch)
24838 CALL POPCONTROL1B(branch)
24839 100 CALL POPCONTROL1B(branch)
24840 CALL POPCONTROL1B(branch)
24841 CALL POPCONTROL1B(branch)
24842 CALL POPCONTROL1B(branch)
24844 CALL POPINTEGER4(ad_from16)
24845 CALL POPINTEGER4(ad_to16)
24846 DO j=ad_to16,ad_from16,-1
24847 CALL POPINTEGER4(ad_from15)
24848 CALL POPINTEGER4(ad_to15)
24849 DO i=ad_to15,ad_from15,-1
24850 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
24851 tempb84 = rom(i, k, j)*fqzb(i, k, j)
24852 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
24853 & field(i, k-1, j))*fqzb(i, k, j)
24854 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*tempb84
24855 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*tempb84
24856 fqzb(i, k, j) = 0.0
24857 tempb85 = dz*mu*fqzlb(i, k, j)/dt
24858 min21b = 0.5*field_old(i, k-1, j)*tempb85
24859 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min21*tempb85
24860 max16b = 0.5*field_old(i, k, j)*tempb85
24861 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max16*tempb85
24862 mub0 = (0.5*(min21*field_old(i, k-1, j))+0.5*(max16*field_old(i, k&
24863 & , j)))*dz*fqzlb(i, k, j)/dt
24864 fqzlb(i, k, j) = 0.0
24865 CALL POPCONTROL1B(branch)
24866 IF (branch .EQ. 0) THEN
24867 CALL POPREAL8(max16)
24870 CALL POPREAL8(max16)
24875 CALL POPCONTROL1B(branch)
24876 IF (branch .EQ. 0) THEN
24881 CALL POPCONTROL1B(branch)
24882 IF (branch .EQ. 0) THEN
24883 CALL POPREAL8(min21)
24886 CALL POPREAL8(min21)
24891 CALL POPCONTROL1B(branch)
24892 IF (branch .EQ. 0) THEN
24897 tempb79 = dt*crb/(dz*mu)
24899 mub0 = mub0 - vel*tempb79/mu
24901 romb(i, k, j) = romb(i, k, j) + velb
24902 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
24903 mu = 0.5*(mut(i, j)+mut(i, j))
24906 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
24907 temp28 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k, j)-&
24908 & field(i, k-1, j))
24909 temp31 = SIGN(1., -vel)
24910 temp30 = temp31/12.
24911 temp29 = SIGN(1, time_step)
24912 tempb80 = vel*fqzb(i, k, j)
24913 tempb81 = 7.*tempb80/12.
24914 tempb82 = temp29*temp30*tempb80
24915 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i, k+1, &
24916 & j)+field(i, k-2, j))/12.+temp29*(temp30*temp28))*fqzb(i, k, j)
24917 fieldb(i, k, j) = fieldb(i, k, j) + tempb81 - 3.*tempb82
24918 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*tempb82 + tempb81
24919 fieldb(i, k+1, j) = fieldb(i, k+1, j) + tempb82 - tempb80/12.
24920 fieldb(i, k-2, j) = fieldb(i, k-2, j) - tempb82 - tempb80/12.
24921 fqzb(i, k, j) = 0.0
24922 tempb83 = dz*mu*fqzlb(i, k, j)/dt
24923 min20b = 0.5*field_old(i, k-1, j)*tempb83
24924 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min20*tempb83
24925 max15b = 0.5*field_old(i, k, j)*tempb83
24926 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max15*tempb83
24927 mub0 = (0.5*(min20*field_old(i, k-1, j))+0.5*(max15*field_old(i, k&
24928 & , j)))*dz*fqzlb(i, k, j)/dt
24929 fqzlb(i, k, j) = 0.0
24930 CALL POPCONTROL1B(branch)
24931 IF (branch .EQ. 0) THEN
24932 CALL POPREAL8(max15)
24935 CALL POPREAL8(max15)
24940 CALL POPCONTROL1B(branch)
24941 IF (branch .EQ. 0) THEN
24946 CALL POPCONTROL1B(branch)
24947 IF (branch .EQ. 0) THEN
24948 CALL POPREAL8(min20)
24951 CALL POPREAL8(min20)
24956 CALL POPCONTROL1B(branch)
24957 IF (branch .EQ. 0) THEN
24962 tempb74 = dt*crb/(dz*mu)
24963 velb = velb + tempb74
24964 mub0 = mub0 - vel*tempb74/mu
24966 romb(i, k, j) = romb(i, k, j) + velb
24967 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
24968 mu = 0.5*(mut(i, j)+mut(i, j))
24971 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
24972 temp24 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k, j)-&
24973 & field(i, k-1, j))
24974 temp27 = SIGN(1., -vel)
24975 temp26 = temp27/12.
24976 temp25 = SIGN(1, time_step)
24977 tempb75 = vel*fqzb(i, k, j)
24978 tempb76 = 7.*tempb75/12.
24979 tempb77 = temp25*temp26*tempb75
24980 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i, k+1, &
24981 & j)+field(i, k-2, j))/12.+temp25*(temp26*temp24))*fqzb(i, k, j)
24982 fieldb(i, k, j) = fieldb(i, k, j) + tempb76 - 3.*tempb77
24983 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*tempb77 + tempb76
24984 fieldb(i, k+1, j) = fieldb(i, k+1, j) + tempb77 - tempb75/12.
24985 fieldb(i, k-2, j) = fieldb(i, k-2, j) - tempb77 - tempb75/12.
24986 fqzb(i, k, j) = 0.0
24987 tempb78 = dz*mu*fqzlb(i, k, j)/dt
24988 min19b = 0.5*field_old(i, k-1, j)*tempb78
24989 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min19*tempb78
24990 max14b = 0.5*field_old(i, k, j)*tempb78
24991 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max14*tempb78
24992 mub0 = (0.5*(min19*field_old(i, k-1, j))+0.5*(max14*field_old(i, k&
24993 & , j)))*dz*fqzlb(i, k, j)/dt
24994 fqzlb(i, k, j) = 0.0
24995 CALL POPCONTROL1B(branch)
24996 IF (branch .EQ. 0) THEN
24997 CALL POPREAL8(max14)
25000 CALL POPREAL8(max14)
25005 CALL POPCONTROL1B(branch)
25006 IF (branch .EQ. 0) THEN
25011 CALL POPCONTROL1B(branch)
25012 IF (branch .EQ. 0) THEN
25013 CALL POPREAL8(min19)
25016 CALL POPREAL8(min19)
25021 CALL POPCONTROL1B(branch)
25022 IF (branch .EQ. 0) THEN
25027 tempb71 = dt*crb/(dz*mu)
25028 velb = velb + tempb71
25029 mub0 = mub0 - vel*tempb71/mu
25031 romb(i, k, j) = romb(i, k, j) + velb
25032 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
25033 mu = 0.5*(mut(i, j)+mut(i, j))
25036 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
25037 tempb72 = rom(i, k, j)*fqzb(i, k, j)
25038 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
25039 & field(i, k-1, j))*fqzb(i, k, j)
25040 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*tempb72
25041 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*tempb72
25042 fqzb(i, k, j) = 0.0
25043 tempb73 = dz*mu*fqzlb(i, k, j)/dt
25044 min18b = 0.5*field_old(i, k-1, j)*tempb73
25045 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min18*tempb73
25046 max13b = 0.5*field_old(i, k, j)*tempb73
25047 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max13*tempb73
25048 mub0 = (0.5*(min18*field_old(i, k-1, j))+0.5*(max13*field_old(i, k&
25049 & , j)))*dz*fqzlb(i, k, j)/dt
25050 fqzlb(i, k, j) = 0.0
25051 CALL POPCONTROL1B(branch)
25052 IF (branch .EQ. 0) THEN
25053 CALL POPREAL8(max13)
25056 CALL POPREAL8(max13)
25061 CALL POPCONTROL1B(branch)
25062 IF (branch .EQ. 0) THEN
25067 CALL POPCONTROL1B(branch)
25068 IF (branch .EQ. 0) THEN
25069 CALL POPREAL8(min18)
25072 CALL POPREAL8(min18)
25077 CALL POPCONTROL1B(branch)
25078 IF (branch .EQ. 0) THEN
25083 tempb70 = dt*crb/(dz*mu)
25085 mub0 = mub0 - vel*tempb70/mu
25087 romb(i, k, j) = romb(i, k, j) + velb
25089 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
25091 CALL POPINTEGER4(k)
25093 DO k=ktf-2,kts+3,-1
25094 CALL POPINTEGER4(ad_from14)
25095 CALL POPINTEGER4(ad_to14)
25096 DO i=ad_to14,ad_from14,-1
25097 fqzlb(i, k, j) = fqzlb(i, k, j) - fqzb(i, k, j)
25098 wi0 = gi0/(eps1+beta0)**pw
25099 wi1 = gi1/(eps1+beta1)**pw
25100 wi2 = gi2/(eps1+beta2)**pw
25101 sumwk = wi0 + wi1 + wi2
25102 tempb62 = vel*fqzb(i, k, j)/sumwk
25103 tempb63 = (wi0*f0+wi1*f1+wi2*f2)*fqzb(i, k, j)/sumwk
25108 sumwkb = -(vel*tempb63/sumwk)
25109 wi0b = sumwkb + f0*tempb62
25110 wi1b = sumwkb + f1*tempb62
25111 wi2b = sumwkb + f2*tempb62
25112 fqzb(i, k, j) = 0.0
25113 temp23 = (eps1+beta2)**pw
25114 IF (eps1 + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw&
25118 beta2b = -(gi2*pw*(eps1+beta2)**(pw-1)*wi2b/temp23**2)
25120 temp22 = (eps1+beta1)**pw
25121 IF (eps1 + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw&
25125 beta1b = -(gi1*pw*(eps1+beta1)**(pw-1)*wi1b/temp22**2)
25127 temp21 = (eps1+beta0)**pw
25128 IF (eps1 + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw&
25132 beta0b = -(gi0*pw*(eps1+beta0)**(pw-1)*wi0b/temp21**2)
25134 CALL POPREAL8(beta2)
25135 tempb64 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
25136 tempb65 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
25137 qip2b = tempb65 - f2b/6. + tempb64
25138 CALL POPREAL8(beta1)
25139 tempb66 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
25140 tempb69 = 2*(qim1-qip1)*beta1b/4.
25141 qip1b = tempb66 - tempb69 + f1b/3. + 5.*f2b/6. - 4.*tempb65 - 2.&
25143 CALL POPREAL8(beta0)
25144 tempb68 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
25145 tempb67 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
25146 qib = f2b/3. - 2.*tempb66 + 11.*f0b/6. + 5.*f1b/6. + 3.*tempb67 &
25147 & + tempb68 + 3.*tempb65 + tempb64
25148 qim1b = tempb69 - 4.*tempb67 - 7.*f0b/6. - f1b/6. - 2.*tempb68 +&
25150 qim2b = f0b/3. + tempb67 + tempb68
25154 CALL POPCONTROL1B(branch)
25155 IF (branch .EQ. 0) THEN
25156 CALL POPREAL8(qim2)
25157 fieldb(i, k-3, j) = fieldb(i, k-3, j) + qim2b
25158 CALL POPREAL8(qim1)
25159 fieldb(i, k-2, j) = fieldb(i, k-2, j) + qim1b
25161 fieldb(i, k-1, j) = fieldb(i, k-1, j) + qib
25162 CALL POPREAL8(qip1)
25163 fieldb(i, k, j) = fieldb(i, k, j) + qip1b
25164 CALL POPREAL8(qip2)
25165 fieldb(i, k+1, j) = fieldb(i, k+1, j) + qip2b
25167 CALL POPREAL8(qim2)
25168 fieldb(i, k+2, j) = fieldb(i, k+2, j) + qim2b
25169 CALL POPREAL8(qim1)
25170 fieldb(i, k+1, j) = fieldb(i, k+1, j) + qim1b
25172 fieldb(i, k, j) = fieldb(i, k, j) + qib
25173 CALL POPREAL8(qip1)
25174 fieldb(i, k-1, j) = fieldb(i, k-1, j) + qip1b
25175 CALL POPREAL8(qip2)
25176 fieldb(i, k-2, j) = fieldb(i, k-2, j) + qip2b
25178 tempb61 = dz*mu*fqzlb(i, k, j)/dt
25179 min17b = 0.5*field_old(i, k-1, j)*tempb61
25180 field_oldb(i, k-1, j) = field_oldb(i, k-1, j) + 0.5*min17*&
25182 max12b = 0.5*field_old(i, k, j)*tempb61
25183 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max12*tempb61
25184 mub0 = (0.5*(min17*field_old(i, k-1, j))+0.5*(max12*field_old(i&
25185 & , k, j)))*dz*fqzlb(i, k, j)/dt
25186 fqzlb(i, k, j) = 0.0
25187 CALL POPCONTROL1B(branch)
25188 IF (branch .EQ. 0) THEN
25189 CALL POPREAL8(max12)
25192 CALL POPREAL8(max12)
25197 CALL POPCONTROL1B(branch)
25198 IF (branch .EQ. 0) THEN
25203 CALL POPCONTROL1B(branch)
25204 IF (branch .EQ. 0) THEN
25205 CALL POPREAL8(min17)
25208 CALL POPREAL8(min17)
25213 CALL POPCONTROL1B(branch)
25214 IF (branch .EQ. 0) THEN
25219 tempb60 = dt*crb/(dz*mu)
25220 velb = velb + tempb60
25221 mub0 = mub0 - vel*tempb60/mu
25223 romb(i, k, j) = romb(i, k, j) + velb
25225 mutb(i, j) = mutb(i, j) + 0.5*2*mub0
25229 CALL POPINTEGER4(k)
25230 CALL POPINTEGER4(ad_from13)
25231 CALL POPINTEGER4(ad_to13)
25232 DO i=ad_to13,ad_from13,-1
25233 fqzlb(i, kde, j) = 0.0
25234 fqzb(i, kde, j) = 0.0
25235 fqzlb(i, 1, j) = 0.0
25236 fqzb(i, 1, j) = 0.0
25239 CALL POPCONTROL1B(branch)
25240 CALL POPCONTROL1B(branch)
25241 CALL POPCONTROL1B(branch)
25242 CALL POPCONTROL1B(branch)
25243 CALL POPINTEGER4(j_end)
25244 CALL POPINTEGER4(i_end)
25245 CALL POPCONTROL1B(branch)
25246 IF (branch .NE. 0) THEN
25247 CALL POPINTEGER4(ad_from12)
25248 CALL POPINTEGER4(ad_to12)
25249 DO i=ad_to12,ad_from12,-1
25251 tempb59 = -(rdy*tendencyb(i, k, j_end))
25252 vbb = (field_old(i, k, j_end)-field_old(i, k, j_end-1))*tempb59
25253 field_oldb(i, k, j_end) = field_oldb(i, k, j_end) + vb*tempb59
25254 field_oldb(i, k, j_end-1) = field_oldb(i, k, j_end-1) - vb*&
25256 fieldb(i, k, j_end) = fieldb(i, k, j_end) - rv(i, k, jte-1)*&
25258 rvb(i, k, jte-1) = rvb(i, k, jte-1) - field(i, k, j_end)*tempb59
25259 CALL POPCONTROL1B(branch)
25260 IF (branch .EQ. 0) THEN
25264 rvb(i, k, jte-1) = rvb(i, k, jte-1) + 0.5*vbb
25269 CALL POPCONTROL1B(branch)
25270 IF (branch .EQ. 0) THEN
25271 CALL POPINTEGER4(ad_from11)
25272 CALL POPINTEGER4(ad_to11)
25273 DO i=ad_to11,ad_from11,-1
25275 tempb58 = -(rdy*tendencyb(i, k, jts))
25276 vbb = (field_old(i, k, jts+1)-field_old(i, k, jts))*tempb58
25277 field_oldb(i, k, jts+1) = field_oldb(i, k, jts+1) + vb*tempb58
25278 field_oldb(i, k, jts) = field_oldb(i, k, jts) - vb*tempb58
25279 fieldb(i, k, jts) = fieldb(i, k, jts) + rv(i, k, jts+1)*tempb58
25280 rvb(i, k, jts+1) = rvb(i, k, jts+1) + field(i, k, jts)*tempb58
25281 CALL POPCONTROL1B(branch)
25282 IF (branch .EQ. 0) THEN
25286 rvb(i, k, jts+1) = rvb(i, k, jts+1) + 0.5*vbb
25291 CALL POPCONTROL1B(branch)
25292 IF (branch .EQ. 0) THEN
25293 CALL POPINTEGER4(ad_from10)
25294 CALL POPINTEGER4(ad_to10)
25295 DO i=ad_to10,ad_from10,-1
25297 tempb56 = -(rdy*tendencyb(i, k, j_end))
25298 tempb57 = field(i, k, j_end)*tempb56
25299 vbb = (field_old(i, k, j_end)-field_old(i, k, j_end-1))*tempb56
25300 field_oldb(i, k, j_end) = field_oldb(i, k, j_end) + vb*tempb56
25301 field_oldb(i, k, j_end-1) = field_oldb(i, k, j_end-1) - vb*&
25303 fieldb(i, k, j_end) = fieldb(i, k, j_end) + (rv(i, k, jte)-rv(i&
25304 & , k, jte-1))*tempb56
25305 rvb(i, k, jte) = rvb(i, k, jte) + tempb57
25306 rvb(i, k, jte-1) = rvb(i, k, jte-1) - tempb57
25307 CALL POPCONTROL1B(branch)
25308 IF (branch .EQ. 0) THEN
25312 rvb(i, k, jte-1) = rvb(i, k, jte-1) + 0.5*vbb
25313 rvb(i, k, jte) = rvb(i, k, jte) + 0.5*vbb
25318 CALL POPCONTROL1B(branch)
25319 IF (branch .EQ. 0) THEN
25320 CALL POPINTEGER4(ad_from9)
25321 CALL POPINTEGER4(ad_to9)
25322 DO i=ad_to9,ad_from9,-1
25324 tempb54 = -(rdy*tendencyb(i, k, jts))
25325 tempb55 = field(i, k, jts)*tempb54
25326 vbb = (field_old(i, k, jts+1)-field_old(i, k, jts))*tempb54
25327 field_oldb(i, k, jts+1) = field_oldb(i, k, jts+1) + vb*tempb54
25328 field_oldb(i, k, jts) = field_oldb(i, k, jts) - vb*tempb54
25329 fieldb(i, k, jts) = fieldb(i, k, jts) + (rv(i, k, jts+1)-rv(i, k&
25331 rvb(i, k, jts+1) = rvb(i, k, jts+1) + tempb55
25332 rvb(i, k, jts) = rvb(i, k, jts) - tempb55
25333 CALL POPCONTROL1B(branch)
25334 IF (branch .EQ. 0) THEN
25338 rvb(i, k, jts) = rvb(i, k, jts) + 0.5*vbb
25339 rvb(i, k, jts+1) = rvb(i, k, jts+1) + 0.5*vbb
25344 CALL POPCONTROL1B(branch)
25345 IF (branch .EQ. 0) THEN
25346 CALL POPINTEGER4(ad_from8)
25347 CALL POPINTEGER4(ad_to8)
25348 DO j=ad_to8,ad_from8,-1
25350 tempb52 = -(rdx*tendencyb(i_end, k, j))
25351 tempb53 = field(i_end, k, j)*tempb52
25352 ubb = (field_old(i_end, k, j)-field_old(i_end-1, k, j))*tempb52
25353 field_oldb(i_end, k, j) = field_oldb(i_end, k, j) + ub*tempb52
25354 field_oldb(i_end-1, k, j) = field_oldb(i_end-1, k, j) - ub*&
25356 fieldb(i_end, k, j) = fieldb(i_end, k, j) + (ru(ite, k, j)-ru(&
25357 & ite-1, k, j))*tempb52
25358 rub(ite, k, j) = rub(ite, k, j) + tempb53
25359 rub(ite-1, k, j) = rub(ite-1, k, j) - tempb53
25360 CALL POPCONTROL1B(branch)
25361 IF (branch .EQ. 0) THEN
25365 rub(ite-1, k, j) = rub(ite-1, k, j) + 0.5*ubb
25366 rub(ite, k, j) = rub(ite, k, j) + 0.5*ubb
25371 CALL POPCONTROL1B(branch)
25372 IF (branch .EQ. 0) THEN
25373 CALL POPINTEGER4(ad_from7)
25374 CALL POPINTEGER4(ad_to7)
25375 DO j=ad_to7,ad_from7,-1
25377 tempb50 = -(rdx*tendencyb(its, k, j))
25378 tempb51 = field(its, k, j)*tempb50
25379 ubb = (field_old(its+1, k, j)-field_old(its, k, j))*tempb50
25380 field_oldb(its+1, k, j) = field_oldb(its+1, k, j) + ub*tempb50
25381 field_oldb(its, k, j) = field_oldb(its, k, j) - ub*tempb50
25382 fieldb(its, k, j) = fieldb(its, k, j) + (ru(its+1, k, j)-ru(its&
25384 rub(its+1, k, j) = rub(its+1, k, j) + tempb51
25385 rub(its, k, j) = rub(its, k, j) - tempb51
25386 CALL POPCONTROL1B(branch)
25387 IF (branch .EQ. 0) THEN
25391 rub(its, k, j) = rub(its, k, j) + 0.5*ubb
25392 rub(its+1, k, j) = rub(its+1, k, j) + 0.5*ubb
25397 CALL POPINTEGER4(ad_from6)
25398 CALL POPINTEGER4(ad_to6)
25399 DO j=ad_to6,ad_from6,-1
25400 CALL POPCONTROL1B(branch)
25401 IF (branch .NE. 0) THEN
25402 CALL POPINTEGER4(ad_to5)
25403 DO i=ad_to5,i_end_f+1,-1
25404 CALL POPCONTROL1B(branch)
25405 IF (branch .NE. 0) THEN
25407 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
25408 temp17 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i, &
25409 & k, j)-field(i-1, k, j))
25410 temp20 = SIGN(1., vel)
25411 temp19 = temp20/12.
25412 temp18 = SIGN(1, time_step)
25413 tempb46 = vel*fqxb(i, k, j)
25414 tempb47 = 7.*tempb46/12.
25415 tempb48 = temp18*temp19*tempb46
25416 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(i+&
25417 & 1, k, j)+field(i-2, k, j))/12.+temp18*(temp19*temp17))*&
25419 fieldb(i, k, j) = fieldb(i, k, j) + tempb47 - 3.*tempb48
25420 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*tempb48 + tempb47
25421 fieldb(i+1, k, j) = fieldb(i+1, k, j) + tempb48 - tempb46/&
25423 fieldb(i-2, k, j) = fieldb(i-2, k, j) - tempb48 - tempb46/&
25425 fqxb(i, k, j) = 0.0
25426 tempb49 = dx*mu*fqxlb(i, k, j)/dt
25427 min14b = 0.5*field_old(i-1, k, j)*tempb49
25428 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min14*&
25430 max11b = 0.5*field_old(i, k, j)*tempb49
25431 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max11*&
25433 mub0 = (0.5*(min14*field_old(i-1, k, j))+0.5*(max11*&
25434 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
25435 fqxlb(i, k, j) = 0.0
25436 CALL POPCONTROL1B(branch)
25437 IF (branch .EQ. 0) THEN
25438 CALL POPREAL8(max11)
25441 CALL POPREAL8(max11)
25446 CALL POPCONTROL1B(branch)
25447 IF (branch .EQ. 0) THEN
25452 CALL POPCONTROL1B(branch)
25453 IF (branch .EQ. 0) THEN
25454 CALL POPREAL8(min14)
25457 CALL POPREAL8(min14)
25462 CALL POPCONTROL1B(branch)
25463 IF (branch .EQ. 0) THEN
25468 tempb45 = dt*crb/(dx*mu)
25469 velb = velb + tempb45
25470 mub0 = mub0 - vel*tempb45/mu
25472 rub(i, k, j) = rub(i, k, j) + velb
25474 mutb(i, j) = mutb(i, j) + 0.5*mub0
25475 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
25479 CALL POPCONTROL1B(branch)
25480 IF (branch .EQ. 0) THEN
25482 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
25483 tempb43 = 0.5*ru(i, k, j)*fqxb(i, k, j)
25484 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-1&
25485 & , k, j))*fqxb(i, k, j)
25486 fieldb(i, k, j) = fieldb(i, k, j) + tempb43
25487 fieldb(i-1, k, j) = fieldb(i-1, k, j) + tempb43
25488 fqxb(i, k, j) = 0.0
25489 tempb44 = dx*mu*fqxlb(i, k, j)/dt
25490 min13b = 0.5*field_old(i-1, k, j)*tempb44
25491 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min13*&
25493 max10b = 0.5*field_old(i, k, j)*tempb44
25494 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max10*&
25496 mub0 = (0.5*(min13*field_old(i-1, k, j))+0.5*(max10*&
25497 & field_old(i, k, j)))*dx*fqxlb(i, k, j)/dt
25498 fqxlb(i, k, j) = 0.0
25499 CALL POPCONTROL1B(branch)
25500 IF (branch .EQ. 0) THEN
25501 CALL POPREAL8(max10)
25504 CALL POPREAL8(max10)
25509 CALL POPCONTROL1B(branch)
25510 IF (branch .EQ. 0) THEN
25515 CALL POPCONTROL1B(branch)
25516 IF (branch .EQ. 0) THEN
25517 CALL POPREAL8(min13)
25520 CALL POPREAL8(min13)
25525 CALL POPCONTROL1B(branch)
25526 IF (branch .EQ. 0) THEN
25531 tempb42 = dt*crb/(dx*mu)
25533 mub0 = mub0 - vel*tempb42/mu
25535 rub(i, k, j) = rub(i, k, j) + velb
25537 mutb(i, j) = mutb(i, j) + 0.5*mub0
25538 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
25544 CALL POPCONTROL1B(branch)
25545 IF (branch .EQ. 0) THEN
25546 CALL POPINTEGER4(ad_from5)
25547 DO i=i_start_f-1,ad_from5,-1
25548 CALL POPCONTROL1B(branch)
25549 IF (branch .NE. 0) THEN
25551 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
25552 temp13 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i, &
25553 & k, j)-field(i-1, k, j))
25554 temp16 = SIGN(1., vel)
25555 temp15 = temp16/12.
25556 temp14 = SIGN(1, time_step)
25557 tempb38 = vel*fqxb(i, k, j)
25558 tempb39 = 7.*tempb38/12.
25559 tempb40 = temp14*temp15*tempb38
25560 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(i+&
25561 & 1, k, j)+field(i-2, k, j))/12.+temp14*(temp15*temp13))*&
25563 fieldb(i, k, j) = fieldb(i, k, j) + tempb39 - 3.*tempb40
25564 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*tempb40 + tempb39
25565 fieldb(i+1, k, j) = fieldb(i+1, k, j) + tempb40 - tempb38/&
25567 fieldb(i-2, k, j) = fieldb(i-2, k, j) - tempb40 - tempb38/&
25569 fqxb(i, k, j) = 0.0
25570 tempb41 = dx*mu*fqxlb(i, k, j)/dt
25571 min12b = 0.5*field_old(i-1, k, j)*tempb41
25572 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min12*&
25574 max9b = 0.5*field_old(i, k, j)*tempb41
25575 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max9*tempb41
25576 mub0 = (0.5*(min12*field_old(i-1, k, j))+0.5*(max9*field_old&
25577 & (i, k, j)))*dx*fqxlb(i, k, j)/dt
25578 fqxlb(i, k, j) = 0.0
25579 CALL POPCONTROL1B(branch)
25580 IF (branch .EQ. 0) THEN
25581 CALL POPREAL8(max9)
25584 CALL POPREAL8(max9)
25589 CALL POPCONTROL1B(branch)
25590 IF (branch .EQ. 0) THEN
25595 CALL POPCONTROL1B(branch)
25596 IF (branch .EQ. 0) THEN
25597 CALL POPREAL8(min12)
25600 CALL POPREAL8(min12)
25605 CALL POPCONTROL1B(branch)
25606 IF (branch .EQ. 0) THEN
25611 tempb37 = dt*crb/(dx*mu)
25612 velb = velb + tempb37
25613 mub0 = mub0 - vel*tempb37/mu
25615 rub(i, k, j) = rub(i, k, j) + velb
25617 mutb(i, j) = mutb(i, j) + 0.5*mub0
25618 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
25622 CALL POPCONTROL1B(branch)
25623 IF (branch .EQ. 0) THEN
25625 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
25626 tempb35 = 0.5*ru(i, k, j)*fqxb(i, k, j)
25627 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-1&
25628 & , k, j))*fqxb(i, k, j)
25629 fieldb(i, k, j) = fieldb(i, k, j) + tempb35
25630 fieldb(i-1, k, j) = fieldb(i-1, k, j) + tempb35
25631 fqxb(i, k, j) = 0.0
25632 tempb36 = dx*mu*fqxlb(i, k, j)/dt
25633 min11b = 0.5*field_old(i-1, k, j)*tempb36
25634 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min11*&
25636 max8b = 0.5*field_old(i, k, j)*tempb36
25637 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max8*tempb36
25638 mub0 = (0.5*(min11*field_old(i-1, k, j))+0.5*(max8*field_old&
25639 & (i, k, j)))*dx*fqxlb(i, k, j)/dt
25640 fqxlb(i, k, j) = 0.0
25641 CALL POPCONTROL1B(branch)
25642 IF (branch .EQ. 0) THEN
25643 CALL POPREAL8(max8)
25646 CALL POPREAL8(max8)
25651 CALL POPCONTROL1B(branch)
25652 IF (branch .EQ. 0) THEN
25657 CALL POPCONTROL1B(branch)
25658 IF (branch .EQ. 0) THEN
25659 CALL POPREAL8(min11)
25662 CALL POPREAL8(min11)
25667 CALL POPCONTROL1B(branch)
25668 IF (branch .EQ. 0) THEN
25675 rub(i, k, j) = rub(i, k, j) + velb/mu
25676 mub0 = mub0 - ru(i, k, j)*velb/mu**2
25678 mutb(i, j) = mutb(i, j) + 0.5*mub0
25679 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
25686 DO i=i_end_f,i_start_f,-1
25687 fqxlb(i, k, j) = fqxlb(i, k, j) - fqxb(i, k, j)
25688 wi0 = gi0/(eps1+beta0)**pw
25689 wi1 = gi1/(eps1+beta1)**pw
25690 wi2 = gi2/(eps1+beta2)**pw
25691 sumwk = wi0 + wi1 + wi2
25692 tempb27 = vel*fqxb(i, k, j)/sumwk
25693 tempb28 = (wi0*f0+wi1*f1+wi2*f2)*fqxb(i, k, j)/sumwk
25698 sumwkb = -(vel*tempb28/sumwk)
25699 wi0b = sumwkb + f0*tempb27
25700 wi1b = sumwkb + f1*tempb27
25701 wi2b = sumwkb + f2*tempb27
25702 fqxb(i, k, j) = 0.0
25703 temp12 = (eps1+beta2)**pw
25704 IF (eps1 + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw&
25708 beta2b = -(gi2*pw*(eps1+beta2)**(pw-1)*wi2b/temp12**2)
25710 temp11 = (eps1+beta1)**pw
25711 IF (eps1 + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw&
25715 beta1b = -(gi1*pw*(eps1+beta1)**(pw-1)*wi1b/temp11**2)
25717 temp10 = (eps1+beta0)**pw
25718 IF (eps1 + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw&
25722 beta0b = -(gi0*pw*(eps1+beta0)**(pw-1)*wi0b/temp10**2)
25724 CALL POPREAL8(beta2)
25725 tempb29 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
25726 tempb30 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
25727 qip2b = tempb30 - f2b/6. + tempb29
25728 CALL POPREAL8(beta1)
25729 tempb31 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
25730 tempb34 = 2*(qim1-qip1)*beta1b/4.
25731 qip1b = tempb31 - tempb34 + f1b/3. + 5.*f2b/6. - 4.*tempb30 - 2.&
25733 CALL POPREAL8(beta0)
25734 tempb33 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
25735 tempb32 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
25736 qib = f2b/3. - 2.*tempb31 + 11.*f0b/6. + 5.*f1b/6. + 3.*tempb32 &
25737 & + tempb33 + 3.*tempb30 + tempb29
25738 qim1b = tempb34 - 4.*tempb32 - 7.*f0b/6. - f1b/6. - 2.*tempb33 +&
25740 qim2b = f0b/3. + tempb32 + tempb33
25744 CALL POPCONTROL1B(branch)
25745 IF (branch .EQ. 0) THEN
25746 CALL POPREAL8(qim2)
25747 fieldb(i-3, k, j) = fieldb(i-3, k, j) + qim2b
25748 CALL POPREAL8(qim1)
25749 fieldb(i-2, k, j) = fieldb(i-2, k, j) + qim1b
25751 fieldb(i-1, k, j) = fieldb(i-1, k, j) + qib
25752 CALL POPREAL8(qip1)
25753 fieldb(i, k, j) = fieldb(i, k, j) + qip1b
25754 CALL POPREAL8(qip2)
25755 fieldb(i+1, k, j) = fieldb(i+1, k, j) + qip2b
25757 CALL POPREAL8(qim2)
25758 fieldb(i+2, k, j) = fieldb(i+2, k, j) + qim2b
25759 CALL POPREAL8(qim1)
25760 fieldb(i+1, k, j) = fieldb(i+1, k, j) + qim1b
25762 fieldb(i, k, j) = fieldb(i, k, j) + qib
25763 CALL POPREAL8(qip1)
25764 fieldb(i-1, k, j) = fieldb(i-1, k, j) + qip1b
25765 CALL POPREAL8(qip2)
25766 fieldb(i-2, k, j) = fieldb(i-2, k, j) + qip2b
25768 tempb26 = dx*mu*fqxlb(i, k, j)/dt
25769 min10b = 0.5*field_old(i-1, k, j)*tempb26
25770 field_oldb(i-1, k, j) = field_oldb(i-1, k, j) + 0.5*min10*&
25772 max7b = 0.5*field_old(i, k, j)*tempb26
25773 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max7*tempb26
25774 mub0 = (0.5*(min10*field_old(i-1, k, j))+0.5*(max7*field_old(i, &
25775 & k, j)))*dx*fqxlb(i, k, j)/dt
25776 fqxlb(i, k, j) = 0.0
25777 CALL POPCONTROL1B(branch)
25778 IF (branch .EQ. 0) THEN
25779 CALL POPREAL8(max7)
25782 CALL POPREAL8(max7)
25787 CALL POPCONTROL1B(branch)
25788 IF (branch .EQ. 0) THEN
25793 CALL POPCONTROL1B(branch)
25794 IF (branch .EQ. 0) THEN
25795 CALL POPREAL8(min10)
25798 CALL POPREAL8(min10)
25803 CALL POPCONTROL1B(branch)
25804 IF (branch .EQ. 0) THEN
25809 tempb25 = dt*crb/(dx*mu)
25810 velb = velb + tempb25
25811 mub0 = mub0 - vel*tempb25/mu
25813 rub(i, k, j) = rub(i, k, j) + velb
25815 mutb(i, j) = mutb(i, j) + 0.5*mub0
25816 mutb(i-1, j) = mutb(i-1, j) + 0.5*mub0
25821 CALL POPCONTROL1B(branch)
25822 CALL POPCONTROL1B(branch)
25823 CALL POPCONTROL1B(branch)
25824 CALL POPCONTROL1B(branch)
25825 CALL POPINTEGER4(ad_from4)
25826 CALL POPINTEGER4(ad_to4)
25827 DO j=ad_to4,ad_from4,-1
25828 CALL POPCONTROL3B(branch)
25829 IF (branch .LT. 3) THEN
25830 IF (branch .NE. 0) THEN
25831 IF (branch .EQ. 1) THEN
25833 CALL POPINTEGER4(ad_from3)
25834 CALL POPINTEGER4(ad_to3)
25835 DO i=ad_to3,ad_from3,-1
25836 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
25837 temp6 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field(i&
25838 & , k, j)-field(i, k, j-1))
25839 temp9 = SIGN(1., vel)
25841 temp7 = SIGN(1, time_step)
25842 tempb21 = vel*fqyb(i, k, j)
25843 tempb22 = 7.*tempb21/12.
25844 tempb23 = temp7*temp8*tempb21
25845 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(field(&
25846 & i, k, j+1)+field(i, k, j-2))/12.+temp7*(temp8*temp6))*&
25848 fieldb(i, k, j) = fieldb(i, k, j) + tempb22 - 3.*tempb23
25849 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*tempb23 + &
25851 fieldb(i, k, j+1) = fieldb(i, k, j+1) + tempb23 - tempb21/&
25853 fieldb(i, k, j-2) = fieldb(i, k, j-2) - tempb23 - tempb21/&
25855 fqyb(i, k, j) = 0.0
25856 tempb24 = dy*mu*fqylb(i, k, j)/dt
25857 min7b = 0.5*field_old(i, k, j-1)*tempb24
25858 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min7*&
25860 max6b = 0.5*field_old(i, k, j)*tempb24
25861 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max6*&
25863 mub0 = (0.5*(min7*field_old(i, k, j-1))+0.5*(max6*&
25864 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
25865 fqylb(i, k, j) = 0.0
25866 CALL POPCONTROL1B(branch)
25867 IF (branch .EQ. 0) THEN
25868 CALL POPREAL8(max6)
25871 CALL POPREAL8(max6)
25876 CALL POPCONTROL1B(branch)
25877 IF (branch .EQ. 0) THEN
25882 CALL POPCONTROL1B(branch)
25883 IF (branch .EQ. 0) THEN
25884 CALL POPREAL8(min7)
25887 CALL POPREAL8(min7)
25892 CALL POPCONTROL1B(branch)
25893 IF (branch .EQ. 0) THEN
25898 tempb20 = dt*crb/(dy*mu)
25899 velb = velb + tempb20
25900 mub0 = mub0 - vel*tempb20/mu
25902 rvb(i, k, j) = rvb(i, k, j) + velb
25904 mutb(i, j) = mutb(i, j) + 0.5*mub0
25905 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
25911 CALL POPINTEGER4(ad_from2)
25912 CALL POPINTEGER4(ad_to2)
25913 DO i=ad_to2,ad_from2,-1
25914 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
25915 tempb18 = 0.5*rv(i, k, j)*fqyb(i, k, j)
25916 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i&
25917 & , k, j-1))*fqyb(i, k, j)
25918 fieldb(i, k, j) = fieldb(i, k, j) + tempb18
25919 fieldb(i, k, j-1) = fieldb(i, k, j-1) + tempb18
25920 fqyb(i, k, j) = 0.0
25921 tempb19 = dy*mu*fqylb(i, k, j)/dt
25922 min6b = 0.5*field_old(i, k, j-1)*tempb19
25923 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min6*&
25925 max5b = 0.5*field_old(i, k, j)*tempb19
25926 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max5*&
25928 mub0 = (0.5*(min6*field_old(i, k, j-1))+0.5*(max5*&
25929 & field_old(i, k, j)))*dy*fqylb(i, k, j)/dt
25930 fqylb(i, k, j) = 0.0
25931 CALL POPCONTROL1B(branch)
25932 IF (branch .EQ. 0) THEN
25933 CALL POPREAL8(max5)
25936 CALL POPREAL8(max5)
25941 CALL POPCONTROL1B(branch)
25942 IF (branch .EQ. 0) THEN
25947 CALL POPCONTROL1B(branch)
25948 IF (branch .EQ. 0) THEN
25949 CALL POPREAL8(min6)
25952 CALL POPREAL8(min6)
25957 CALL POPCONTROL1B(branch)
25958 IF (branch .EQ. 0) THEN
25963 tempb17 = dt*crb/(dy*mu)
25965 mub0 = mub0 - vel*tempb17/mu
25967 rvb(i, k, j) = rvb(i, k, j) + velb
25969 mutb(i, j) = mutb(i, j) + 0.5*mub0
25970 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
25976 ELSE IF (branch .EQ. 3) THEN
25978 CALL POPINTEGER4(ad_from1)
25979 CALL POPINTEGER4(ad_to1)
25980 DO i=ad_to1,ad_from1,-1
25981 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
25982 temp2 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field(i, k, &
25983 & j)-field(i, k, j-1))
25984 temp5 = SIGN(1., vel)
25986 temp3 = SIGN(1, time_step)
25987 tempb13 = vel*fqyb(i, k, j)
25988 tempb14 = 7.*tempb13/12.
25989 tempb15 = temp3*temp4*tempb13
25990 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(field(i, k&
25991 & , j+1)+field(i, k, j-2))/12.+temp3*(temp4*temp2))*fqyb(i, k&
25993 fieldb(i, k, j) = fieldb(i, k, j) + tempb14 - 3.*tempb15
25994 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*tempb15 + tempb14
25995 fieldb(i, k, j+1) = fieldb(i, k, j+1) + tempb15 - tempb13/12.
25996 fieldb(i, k, j-2) = fieldb(i, k, j-2) - tempb15 - tempb13/12.
25997 fqyb(i, k, j) = 0.0
25998 tempb16 = dy*mu*fqylb(i, k, j)/dt
25999 min5b = 0.5*field_old(i, k, j-1)*tempb16
26000 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min5*&
26002 max4b = 0.5*field_old(i, k, j)*tempb16
26003 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max4*tempb16
26004 mub0 = (0.5*(min5*field_old(i, k, j-1))+0.5*(max4*field_old(i&
26005 & , k, j)))*dy*fqylb(i, k, j)/dt
26006 fqylb(i, k, j) = 0.0
26007 CALL POPCONTROL1B(branch)
26008 IF (branch .EQ. 0) THEN
26009 CALL POPREAL8(max4)
26012 CALL POPREAL8(max4)
26017 CALL POPCONTROL1B(branch)
26018 IF (branch .EQ. 0) THEN
26023 CALL POPCONTROL1B(branch)
26024 IF (branch .EQ. 0) THEN
26025 CALL POPREAL8(min5)
26028 CALL POPREAL8(min5)
26033 CALL POPCONTROL1B(branch)
26034 IF (branch .EQ. 0) THEN
26039 tempb12 = dt*crb/(dy*mu)
26040 velb = velb + tempb12
26041 mub0 = mub0 - vel*tempb12/mu
26043 rvb(i, k, j) = rvb(i, k, j) + velb
26045 mutb(i, j) = mutb(i, j) + 0.5*mub0
26046 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
26050 ELSE IF (branch .EQ. 4) THEN
26052 CALL POPINTEGER4(ad_from0)
26053 CALL POPINTEGER4(ad_to0)
26054 DO i=ad_to0,ad_from0,-1
26055 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
26056 tempb10 = 0.5*rv(i, k, j)*fqyb(i, k, j)
26057 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i, k, &
26058 & j-1))*fqyb(i, k, j)
26059 fieldb(i, k, j) = fieldb(i, k, j) + tempb10
26060 fieldb(i, k, j-1) = fieldb(i, k, j-1) + tempb10
26061 fqyb(i, k, j) = 0.0
26062 tempb11 = dy*mu*fqylb(i, k, j)/dt
26063 min4b = 0.5*field_old(i, k, j-1)*tempb11
26064 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min4*&
26066 max3b = 0.5*field_old(i, k, j)*tempb11
26067 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max3*tempb11
26068 mub0 = (0.5*(min4*field_old(i, k, j-1))+0.5*(max3*field_old(i&
26069 & , k, j)))*dy*fqylb(i, k, j)/dt
26070 fqylb(i, k, j) = 0.0
26071 CALL POPCONTROL1B(branch)
26072 IF (branch .EQ. 0) THEN
26073 CALL POPREAL8(max3)
26076 CALL POPREAL8(max3)
26081 CALL POPCONTROL1B(branch)
26082 IF (branch .EQ. 0) THEN
26087 CALL POPCONTROL1B(branch)
26088 IF (branch .EQ. 0) THEN
26089 CALL POPREAL8(min4)
26092 CALL POPREAL8(min4)
26097 CALL POPCONTROL1B(branch)
26098 IF (branch .EQ. 0) THEN
26103 tempb9 = dt*crb/(dy*mu)
26105 mub0 = mub0 - vel*tempb9/mu
26107 rvb(i, k, j) = rvb(i, k, j) + velb
26109 mutb(i, j) = mutb(i, j) + 0.5*mub0
26110 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
26116 CALL POPINTEGER4(ad_from)
26117 CALL POPINTEGER4(ad_to)
26118 DO i=ad_to,ad_from,-1
26119 fqylb(i, k, j) = fqylb(i, k, j) - fqyb(i, k, j)
26120 wi0 = gi0/(eps1+beta0)**pw
26121 wi1 = gi1/(eps1+beta1)**pw
26122 wi2 = gi2/(eps1+beta2)**pw
26123 sumwk = wi0 + wi1 + wi2
26124 tempb1 = vel*fqyb(i, k, j)/sumwk
26125 tempb2 = (wi0*f0+wi1*f1+wi2*f2)*fqyb(i, k, j)/sumwk
26130 sumwkb = -(vel*tempb2/sumwk)
26131 wi0b = sumwkb + f0*tempb1
26132 wi1b = sumwkb + f1*tempb1
26133 wi2b = sumwkb + f2*tempb1
26134 fqyb(i, k, j) = 0.0
26135 temp1 = (eps1+beta2)**pw
26136 IF (eps1 + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(&
26140 beta2b = -(gi2*pw*(eps1+beta2)**(pw-1)*wi2b/temp1**2)
26142 temp0 = (eps1+beta1)**pw
26143 IF (eps1 + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(&
26147 beta1b = -(gi1*pw*(eps1+beta1)**(pw-1)*wi1b/temp0**2)
26149 temp = (eps1+beta0)**pw
26150 IF (eps1 + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(&
26154 beta0b = -(gi0*pw*(eps1+beta0)**(pw-1)*wi0b/temp**2)
26156 CALL POPREAL8(beta2)
26157 tempb3 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
26158 tempb4 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
26159 qip2b = tempb4 - f2b/6. + tempb3
26160 CALL POPREAL8(beta1)
26161 tempb5 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
26162 tempb8 = 2*(qim1-qip1)*beta1b/4.
26163 qip1b = tempb5 - tempb8 + f1b/3. + 5.*f2b/6. - 4.*tempb4 - 2.*&
26165 CALL POPREAL8(beta0)
26166 tempb7 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
26167 tempb6 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
26168 qib = f2b/3. - 2.*tempb5 + 11.*f0b/6. + 5.*f1b/6. + 3.*tempb6 &
26169 & + tempb7 + 3.*tempb4 + tempb3
26170 qim1b = tempb8 - 4.*tempb6 - 7.*f0b/6. - f1b/6. - 2.*tempb7 + &
26172 qim2b = f0b/3. + tempb6 + tempb7
26176 CALL POPCONTROL1B(branch)
26177 IF (branch .EQ. 0) THEN
26178 CALL POPREAL8(qim2)
26179 fieldb(i, k, j-3) = fieldb(i, k, j-3) + qim2b
26180 CALL POPREAL8(qim1)
26181 fieldb(i, k, j-2) = fieldb(i, k, j-2) + qim1b
26183 fieldb(i, k, j-1) = fieldb(i, k, j-1) + qib
26184 CALL POPREAL8(qip1)
26185 fieldb(i, k, j) = fieldb(i, k, j) + qip1b
26186 CALL POPREAL8(qip2)
26187 fieldb(i, k, j+1) = fieldb(i, k, j+1) + qip2b
26189 CALL POPREAL8(qim2)
26190 fieldb(i, k, j+2) = fieldb(i, k, j+2) + qim2b
26191 CALL POPREAL8(qim1)
26192 fieldb(i, k, j+1) = fieldb(i, k, j+1) + qim1b
26194 fieldb(i, k, j) = fieldb(i, k, j) + qib
26195 CALL POPREAL8(qip1)
26196 fieldb(i, k, j-1) = fieldb(i, k, j-1) + qip1b
26197 CALL POPREAL8(qip2)
26198 fieldb(i, k, j-2) = fieldb(i, k, j-2) + qip2b
26200 tempb0 = dy*mu*fqylb(i, k, j)/dt
26201 min3b = 0.5*field_old(i, k, j-1)*tempb0
26202 field_oldb(i, k, j-1) = field_oldb(i, k, j-1) + 0.5*min3*&
26204 max2b = 0.5*field_old(i, k, j)*tempb0
26205 field_oldb(i, k, j) = field_oldb(i, k, j) + 0.5*max2*tempb0
26206 mub0 = (0.5*(min3*field_old(i, k, j-1))+0.5*(max2*field_old(i&
26207 & , k, j)))*dy*fqylb(i, k, j)/dt
26208 fqylb(i, k, j) = 0.0
26209 CALL POPCONTROL1B(branch)
26210 IF (branch .EQ. 0) THEN
26211 CALL POPREAL8(max2)
26214 CALL POPREAL8(max2)
26219 CALL POPCONTROL1B(branch)
26220 IF (branch .EQ. 0) THEN
26225 CALL POPCONTROL1B(branch)
26226 IF (branch .EQ. 0) THEN
26227 CALL POPREAL8(min3)
26230 CALL POPREAL8(min3)
26235 CALL POPCONTROL1B(branch)
26236 IF (branch .EQ. 0) THEN
26241 tempb = dt*crb/(dy*mu)
26242 velb = velb + tempb
26243 mub0 = mub0 - vel*tempb/mu
26245 rvb(i, k, j) = rvb(i, k, j) + velb
26247 mutb(i, j) = mutb(i, j) + 0.5*mub0
26248 mutb(i, j-1) = mutb(i, j-1) + 0.5*mub0
26254 CALL POPCONTROL1B(branch)
26255 CALL POPCONTROL1B(branch)
26256 CALL POPCONTROL1B(branch)
26257 CALL POPCONTROL1B(branch)
26258 END SUBROUTINE A_ADVECT_SCALAR_WENOPD
26260 SUBROUTINE a_advect_scalar_mono(field,a_field,field_old,a_field_old,tendency, &
26261 a_tendency,h_tendency,a_h_tendency,z_tendency,a_z_tendency,ru,a_ru,rv,a_rv,rom,a_rom,mut,a_mut,mub,mu_old,a_mu_old, &
26262 config_flags,tenddec,msfux,msfuy,msfvx,msfvy,msftx,msfty,fzm,fzp,rdx,rdy,rdzw,dt,ids,ide,jds, &
26263 jde,kds,kde,ims,ime,jms,jme,kms,kme,its,ite,jts,jte,kts,kte)
26265 !PART I: DECLARATION OF VARIABLES
26269 INTEGER :: K0_ADJ,K1_ADJ,K2_ADJ,K3_ADJ
26270 TYPE(grid_config_rec_type) :: config_flags
26272 INTEGER :: ids,ide,jds,jde,kds,kde,ims,ime,jms,jme,kms,kme,its,ite,jts,jte,kts,kte
26273 REAL,DIMENSION(ims:ime,kms:kme,jms:jme) :: field,a_field,field_old,a_field_old, &
26274 ru,a_ru,rv,a_rv,rom,a_rom
26275 REAL,DIMENSION(ims:ime,jms:jme) :: mut,a_mut,mub,mu_old,a_mu_old
26276 REAL,DIMENSION(ims:ime,kms:kme,jms:jme) :: tendency,a_tendency
26277 REAL,DIMENSION(ims:ime,kms:kme,jms:jme) :: h_tendency, z_tendency
26278 REAL,DIMENSION(ims:ime,kms:kme,jms:jme) :: a_h_tendency, a_z_tendency
26279 REAL,DIMENSION(ims:ime,jms:jme) :: msfux,msfuy,msfvx,msfvy,msftx,msfty
26280 REAL,DIMENSION(kms:kme) :: fzm,fzp,rdzw
26282 INTEGER :: i,j,k,itf,jtf,ktf
26283 INTEGER :: i_start,i_end,j_start,j_end
26284 INTEGER :: i_start_f,i_end_f,j_start_f,j_end_f
26285 INTEGER :: jmin,jmax,jp,jm,imin,imax
26286 REAL :: ub,a_ub,vb,a_vb
26287 REAL,DIMENSION(its-2:ite+2,kts:kte,jts-2:jte+2) :: fqx,a_fqx,fqy,a_fqy,fqz,a_fqz
26288 REAL,DIMENSION(its-2:ite+2,kts:kte,jts-2:jte+2) :: fqxl,a_fqxl,fqyl,a_fqyl,fqzl,a_fqzl
26289 REAL,DIMENSION(its-2:ite+2,kts:kte,jts-2:jte+2) :: qmin,a_qmin,qmax,a_qmax
26290 REAL,DIMENSION(its-2:ite+2,kts:kte,jts-2:jte+2) :: scale_in,a_scale_in,scale_out,a_scale_out
26291 REAL :: ph_upwind,a_ph_upwind
26292 INTEGER :: horz_order,vert_order
26293 LOGICAL :: degrade_xs,degrade_ys
26294 LOGICAL :: degrade_xe,degrade_ye
26295 INTEGER :: jp1,jp0,jtmp
26296 REAL :: flux_out,a_flux_out,ph_low,a_ph_low,flux_in,a_flux_in,ph_hi,a_ph_hi,scale,a_scale
26297 REAL,PARAMETER :: eps =1.e-20
26298 REAL :: flux3,Diff_flux3,flux4,Diff_flux4,flux5,Diff_flux5,flux6,Diff_flux6,flux_upwind, &
26300 REAL :: q_im3,Diff_q_im3,q_im2,Diff_q_im2,q_im1,Diff_q_im1,q_i,Diff_q_i,q_ip1,Diff_q_ip1, &
26301 q_ip2,Diff_q_ip2,ua,Diff_ua,vel,a_vel,cr,Diff_cr,a_cr
26303 Diff_flux4(q_im2, Diff_q_im2,q_im1, Diff_q_im1,q_i, Diff_q_i,q_ip1, Diff_q_ip1, &
26304 ua, Diff_ua) =(7./12.)*(Diff_q_i +Diff_q_im1) -(1./12.)*(Diff_q_ip1 +Diff_q_im2)
26305 flux4(q_im2,q_im1,q_i,q_ip1,ua) =(7./12.)*(q_i +q_im1) -(1./12.)*(q_ip1 +q_im2)
26307 Diff_flux3(q_im2, Diff_q_im2,q_im1, Diff_q_im1,q_i, Diff_q_i,q_ip1, Diff_q_ip1, &
26308 ua, Diff_ua) =Diff_flux4(q_im2,Diff_q_im2,q_im1,Diff_q_im1,q_i,Diff_q_i,q_ip1, &
26309 Diff_q_ip1,ua,Diff_ua) +sign(1., ua) *(1./12.)*((Diff_q_ip1 -Diff_q_im2) &
26310 -3.*(Diff_q_i -Diff_q_im1))
26311 flux3(q_im2,q_im1,q_i,q_ip1,ua) =flux4(q_im2,q_im1,q_i,q_ip1,ua) +sign(1., ua) &
26312 *(1./12.)*((q_ip1 -q_im2) -3.*(q_i -q_im1))
26314 Diff_flux6(q_im3, Diff_q_im3,q_im2, Diff_q_im2,q_im1, Diff_q_im1,q_i, Diff_q_i, &
26315 q_ip1, Diff_q_ip1,q_ip2, Diff_q_ip2,ua, Diff_ua) =(37./60.)*(Diff_q_i +Diff_q_im1) &
26316 -(2./15.)*(Diff_q_ip1 +Diff_q_im2) +(1./60.)*(Diff_q_ip2 +Diff_q_im3)
26317 flux6(q_im3,q_im2,q_im1,q_i,q_ip1,q_ip2,ua) =(37./60.)*(q_i +q_im1) -(2./15.) &
26318 *(q_ip1 +q_im2) +(1./60.)*(q_ip2 +q_im3)
26320 Diff_flux5(q_im3, Diff_q_im3,q_im2, Diff_q_im2,q_im1, Diff_q_im1,q_i, Diff_q_i, &
26321 q_ip1, Diff_q_ip1,q_ip2, Diff_q_ip2,ua, Diff_ua) =Diff_flux6(q_im3,Diff_q_im3,q_im2, &
26322 Diff_q_im2,q_im1,Diff_q_im1,q_i,Diff_q_i,q_ip1,Diff_q_ip1,q_ip2,Diff_q_ip2,ua, &
26323 Diff_ua) -sign(1., ua) *(1./60.)*((Diff_q_ip2 -Diff_q_im3) -5.*(Diff_q_ip1 - &
26324 Diff_q_im2) +10.*(Diff_q_i -Diff_q_im1))
26325 flux5(q_im3,q_im2,q_im1,q_i,q_ip1,q_ip2,ua) =flux6(q_im3,q_im2,q_im1,q_i,q_ip1,q_ip2, &
26326 ua) -sign(1., ua) *(1./60.)*((q_ip2 -q_im3) -5.*(q_ip1 -q_im2) +10.*(q_i -q_im1))
26328 Diff_flux_upwind(q_im1, Diff_q_im1,q_i, Diff_q_i,cr, Diff_cr) =0.5 *(1.+sign(1., cr)) &
26329 *Diff_q_im1 +0.5 *(1.-sign(1., cr))*Diff_q_i
26330 flux_upwind(q_im1,q_i,cr) =0.5 *(1.+sign(1., cr))*q_im1 +0.5 *(1.-sign(1., cr))*q_i
26332 LOGICAL,PARAMETER :: mono_limit =.true.
26334 REAL :: Keep_Lpb3_cr
26335 REAL :: Keep_Lpb7_ub
26336 REAL :: Keep_Lpb11_vb
26337 REAL :: Keep_Lpb21_vel
26338 REAL :: Keep_Lpb21_cr
26339 INTEGER :: IX1,IX2,IX3
26341 REAL :: a_Tmpv1,Tmpv001,a_Tmpv2,Tmpv002,a_Tmpv3,Tmpv003,a_Tmpv4,Tmpv004, &
26342 a_Tmpv5,Tmpv005,a_Tmpv6,Tmpv006,a_Tmpv7,Tmpv007,a_Tmpv8,Tmpv008,a_Tmpv9, &
26343 Tmpv009,a_Tmpv10,Tmpv010,a_Tmpv11,Tmpv011,a_Tmpv12,Tmpv012,gwalls
26345 REAL,DIMENSION(its-2:ite+2,kts:kte,jts-2:jte+2) :: Tmpv2400,Tmpv2401,Tmpv2402,Tmpv2403,Tmpv2404,Tmpv2405
26346 REAL,DIMENSION(its-2:ite+2,kts:kte,jts-2:jte+2) :: Tmpv600,Tmpv601,Tmpv602,Tmpv603
26347 REAL,DIMENSION(its-2:ite+2,kts:kte) :: Tmpv604,Tmpv605,Tmpv606,Tmpv607,Tmpv608, &
26348 Tmpv609,Tmpv6010,Tmpv6011,Tmpv6012,Tmpv6013,Tmpv6014,Tmpv6015,Tmpv6016, &
26349 Tmpv6017,Tmpv6018,Tmpv6019
26350 REAL,DIMENSION(its-2:ite+2,kts:kte,jts-2:jte+2) :: Tmpv700,Tmpv701,Tmpv702,Tmpv703
26351 REAL,DIMENSION(kts:kte,jts-2:jte+2) :: Tmpv704,Tmpv705,Tmpv706,Tmpv707,Tmpv708, &
26352 Tmpv709,Tmpv710,Tmpv711,Tmpv712,Tmpv713,Tmpv714,Tmpv715,Tmpv716, &
26353 Tmpv717,Tmpv718,Tmpv719
26354 REAL,DIMENSION(its-2:ite+2,kts:kte,jts-2:jte+2) :: Tmpv800,Tmpv801,Tmpv802,Tmpv803
26355 REAL,DIMENSION(its-2:ite+2,jts-2:jte+2) :: Tmpv804,Tmpv805,Tmpv806,Tmpv807,Tmpv808, &
26356 Tmpv809,Tmpv810,Tmpv811
26358 !PART II: CALCULATIONS OF B. S. TRAJECTORY
26362 horz_order = config_flags%h_sca_adv_order
26363 vert_order = config_flags%v_sca_adv_order
26365 degrade_xs = .true.
26366 degrade_xe = .true.
26367 degrade_ys = .true.
26368 degrade_ye = .true.
26370 IF( config_flags%periodic_x .or. &
26371 config_flags%symmetric_xs .or. &
26372 (its > ids+3) ) degrade_xs = .false.
26373 IF( config_flags%periodic_x .or. &
26374 config_flags%symmetric_xe .or. &
26375 (ite < ide-4) ) degrade_xe = .false.
26376 IF( config_flags%periodic_y .or. &
26377 config_flags%symmetric_ys .or. &
26378 (jts > jds+3) ) degrade_ys = .false.
26379 IF( config_flags%periodic_y .or. &
26380 config_flags%symmetric_ye .or. &
26381 (jte < jde-4) ) degrade_ye = .false.
26383 !PART III: INITIALIZATION OF LOCAL ADJOINT PERTURBATIONS
26388 Do K2_ADJ =jts-2, jte+2
26389 Do K1_ADJ =kts, kte
26390 Do K0_ADJ =its-2, ite+2
26391 a_fqx(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26396 Do K2_ADJ =jts-2, jte+2
26397 Do K1_ADJ =kts, kte
26398 Do K0_ADJ =its-2, ite+2
26399 a_fqy(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26404 Do K2_ADJ =jts-2, jte+2
26405 Do K1_ADJ =kts, kte
26406 Do K0_ADJ =its-2, ite+2
26407 a_fqz(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26412 Do K2_ADJ =jts-2, jte+2
26413 Do K1_ADJ =kts, kte
26414 Do K0_ADJ =its-2, ite+2
26415 a_fqxl(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26420 Do K2_ADJ =jts-2, jte+2
26421 Do K1_ADJ =kts, kte
26422 Do K0_ADJ =its-2, ite+2
26423 a_fqyl(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26428 Do K2_ADJ =jts-2, jte+2
26429 Do K1_ADJ =kts, kte
26430 Do K0_ADJ =its-2, ite+2
26431 a_fqzl(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26436 Do K2_ADJ =jts-2, jte+2
26437 Do K1_ADJ =kts, kte
26438 Do K0_ADJ =its-2, ite+2
26439 a_qmin(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26444 Do K2_ADJ =jts-2, jte+2
26445 Do K1_ADJ =kts, kte
26446 Do K0_ADJ =its-2, ite+2
26447 a_qmax(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26452 Do K2_ADJ =jts-2, jte+2
26453 Do K1_ADJ =kts, kte
26454 Do K0_ADJ =its-2, ite+2
26455 a_scale_in(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26460 Do K2_ADJ =jts-2, jte+2
26461 Do K1_ADJ =kts, kte
26462 Do K0_ADJ =its-2, ite+2
26463 a_scale_out(K0_ADJ,K1_ADJ,K2_ADJ) =0.0
26477 !PART IV: REVERSE/BACKWARD ACCUMULATIONS
26481 i_end = MIN(ite,ide-1)
26483 j_end = MIN(jte,jde-1)
26485 IF(degrade_ys) j_start = MAX(jts,jds+1)
26486 IF(degrade_ye) j_end = MIN(jte,jde-2)
26489 DO j =j_end, j_start, -1
26491 DO i =i_end, i_start, -1
26492 a_Tmpv1 =-rdy*msftx(i,j)*a_h_tendency(i,k,j)
26493 a_fqyl(i,k,j) =a_fqyl(i,k,j) -a_Tmpv1
26494 a_fqyl(i,k,j+1) =a_fqyl(i,k,j+1) +a_Tmpv1
26495 a_fqy(i,k,j+1) =a_fqy(i,k,j+1) +a_Tmpv1
26496 a_fqy(i,k,j) =a_fqy(i,k,j) -a_Tmpv1
26502 DO j =j_end, j_start, -1
26504 DO i =i_end, i_start, -1
26505 a_Tmpv1 =-rdy*msftx(i,j)*a_tendency(i,k,j)
26506 a_fqyl(i,k,j) =a_fqyl(i,k,j) -a_Tmpv1
26507 a_fqyl(i,k,j+1) =a_fqyl(i,k,j+1) +a_Tmpv1
26508 a_fqy(i,k,j+1) =a_fqy(i,k,j+1) +a_Tmpv1
26509 a_fqy(i,k,j) =a_fqy(i,k,j) -a_Tmpv1
26516 i_end = MIN(ite,ide-1)
26518 j_end = MIN(jte,jde-1)
26519 IF(degrade_xs) i_start = MAX(its,ids+1)
26520 IF(degrade_xe) i_end = MIN(ite,ide-2)
26523 DO j =j_end, j_start, -1
26525 DO i =i_end, i_start, -1
26526 a_Tmpv1 =-rdx*msftx(i,j)*a_h_tendency(i,k,j)
26527 a_fqxl(i,k,j) =a_fqxl(i,k,j) -a_Tmpv1
26528 a_fqxl(i+1,k,j) =a_fqxl(i+1,k,j) +a_Tmpv1
26529 a_fqx(i+1,k,j) =a_fqx(i+1,k,j) +a_Tmpv1
26530 a_fqx(i,k,j) =a_fqx(i,k,j) -a_Tmpv1
26531 a_h_tendency(i,k,j) = 0.0
26537 DO j =j_end, j_start, -1
26539 DO i =i_end, i_start, -1
26540 a_Tmpv1 =-rdx*msftx(i,j)*a_tendency(i,k,j)
26541 a_fqxl(i,k,j) =a_fqxl(i,k,j) -a_Tmpv1
26542 a_fqxl(i+1,k,j) =a_fqxl(i+1,k,j) +a_Tmpv1
26543 a_fqx(i+1,k,j) =a_fqx(i+1,k,j) +a_Tmpv1
26544 a_fqx(i,k,j) =a_fqx(i,k,j) -a_Tmpv1
26551 i_end = MIN(ite,ide-1)
26553 j_end = MIN(jte,jde-1)
26556 DO j =j_end, j_start, -1
26559 DO i =i_end, i_start, -1
26560 a_Tmpv1 =gwalls*a_z_tendency(i,k,j)
26561 a_fqzl(i,k,j) =a_fqzl(i,k,j) -a_Tmpv1
26562 a_fqzl(i,k+1,j) =a_fqzl(i,k+1,j) +a_Tmpv1
26563 a_fqz(i,k+1,j) =a_fqz(i,k+1,j) +a_Tmpv1
26564 a_fqz(i,k,j) =a_fqz(i,k,j) -a_Tmpv1
26565 a_z_tendency(i,k,j) = 0.0
26571 DO j =j_end, j_start, -1
26574 DO i =i_end, i_start, -1
26575 a_Tmpv1 =gwalls*a_tendency(i,k,j)
26576 a_fqzl(i,k,j) =a_fqzl(i,k,j) -a_Tmpv1
26577 a_fqzl(i,k+1,j) =a_fqzl(i,k+1,j) +a_Tmpv1
26578 a_fqz(i,k+1,j) =a_fqz(i,k+1,j) +a_Tmpv1
26579 a_fqz(i,k,j) =a_fqz(i,k,j) -a_Tmpv1
26585 qmin(its-2:ite+2,kts:kte,jts-2:jte+2) =field_old(its-2:ite+2,kts:kte,jts-2:jte+2)
26586 qmax(its-2:ite+2,kts:kte,jts-2:jte+2) =field_old(its-2:ite+2,kts:kte,jts-2:jte+2)
26587 scale_in(its-2:ite+2,kts:kte,jts-2:jte+2) =1.
26588 scale_out(its-2:ite+2,kts:kte,jts-2:jte+2) =1.
26589 fqx(its-2:ite+2,kts:kte,jts-2:jte+2) =0.
26590 fqy(its-2:ite+2,kts:kte,jts-2:jte+2) =0.
26591 fqz(its-2:ite+2,kts:kte,jts-2:jte+2) =0.
26592 fqxl(its-2:ite+2,kts:kte,jts-2:jte+2) =0.
26593 fqyl(its-2:ite+2,kts:kte,jts-2:jte+2) =0.
26594 fqzl(its-2:ite+2,kts:kte,jts-2:jte+2) =0.
26597 IF( horz_order == 5 ) THEN
26598 ktf =min(kte, kde-1)
26600 i_end =min(ite, ide-1) +1
26602 j_end =min(jte, jde-1) +1
26605 IF(degrade_xs) i_start =max(its-1, ids)
26606 IF(degrade_xe) i_end =min(ite+1, ide-1)
26607 IF(degrade_ys) THEN
26608 j_start =max(jts-1, jds+1)
26611 IF(degrade_ye) THEN
26612 j_end =min(jte+1, jde-2)
26616 DO j =j_start, j_end+1
26617 IF( (j >= j_start_f ) .and. (j <= j_end_f) ) THEN
26620 DO i =i_start, i_end
26624 fqyl(i,k,j) =vel*flux_upwind(field_old(i,k,j-1),field_old(i,k,j),vel)
26625 fqy(i,k,j) =vel*flux5(field(i,k,j-3),field(i,k,j-2),field(i,k,j-1),field(i,k,j) &
26626 ,field(i,k,j+1),field(i,k,j+2),vel)
26628 fqy(i,k,j) =fqy(i,k,j) -fqyl(i,k,j)
26631 Tmpv600(i,k,j) = qmax(i,k,j)
26632 qmax(i,k,j) =amax1(qmax(i,k,j), field_old(i,k,j-1))
26634 Tmpv601(i,k,j) = qmin(i,k,j)
26635 qmin(i,k,j) =amin1(qmin(i,k,j), field_old(i,k,j-1))
26639 Tmpv602(i,k,j-1) = qmax(i,k,j-1)
26640 qmax(i,k,j-1) =amax1(qmax(i,k,j-1), field_old(i,k,j))
26642 Tmpv603(i,k,j-1) = qmin(i,k,j-1)
26643 qmin(i,k,j-1) =amin1(qmin(i,k,j-1), field_old(i,k,j))
26649 ELSE IF( j == jds+1 ) THEN
26652 DO i =i_start, i_end
26656 fqyl(i,k,j) =vel*flux_upwind(field_old(i,k,j-1),field_old(i,k,j),cr)
26657 fqy(i,k,j) =0.5*rv(i,k,j)*(field(i,k,j) +field(i,k,j-1))
26658 fqy(i,k,j) =fqy(i,k,j) -fqyl(i,k,j)
26661 Tmpv604(i,k) = qmax(i,k,j)
26662 qmax(i,k,j) =amax1(qmax(i,k,j), field_old(i,k,j-1))
26664 Tmpv605(i,k) = qmin(i,k,j)
26665 qmin(i,k,j) =amin1(qmin(i,k,j), field_old(i,k,j-1))
26669 Tmpv606(i,k) = qmax(i,k,j-1)
26670 qmax(i,k,j-1) =amax1(qmax(i,k,j-1), field_old(i,k,j))
26672 Tmpv607(i,k) = qmin(i,k,j-1)
26673 qmin(i,k,j-1) =amin1(qmin(i,k,j-1), field_old(i,k,j))
26679 ELSE IF( j == jds+2 ) THEN
26682 DO i =i_start, i_end
26686 fqyl(i,k,j) =vel*flux_upwind(field_old(i,k,j-1),field_old(i,k,j),cr)
26687 fqy(i,k,j) =vel*flux3(field(i,k,j-2),field(i,k,j-1),field(i,k,j),field(i,k,j+1),vel)
26688 fqy(i,k,j) =fqy(i,k,j) -fqyl(i,k,j)
26691 Tmpv608(i,k) = qmax(i,k,j)
26692 qmax(i,k,j) =max(qmax(i,k,j), field_old(i,k,j-1))
26694 Tmpv609(i,k) = qmin(i,k,j)
26695 qmin(i,k,j) =min(qmin(i,k,j), field_old(i,k,j-1))
26699 Tmpv6010(i,k) = qmax(i,k,j-1)
26700 qmax(i,k,j-1) =max(qmax(i,k,j-1), field_old(i,k,j))
26702 Tmpv6011(i,k) = qmin(i,k,j-1)
26703 qmin(i,k,j-1) =min(qmin(i,k,j-1), field_old(i,k,j))
26709 ELSE IF( j == jde-1 ) THEN
26712 DO i =i_start, i_end
26716 fqyl(i,k,j) =vel*flux_upwind(field_old(i,k,j-1),field_old(i,k,j),cr)
26717 fqy(i,k,j) =0.5*rv(i,k,j)*(field(i,k,j) +field(i,k,j-1))
26718 fqy(i,k,j) =fqy(i,k,j) -fqyl(i,k,j)
26721 Tmpv6012(i,k) = qmax(i,k,j)
26722 qmax(i,k,j) =max(qmax(i,k,j), field_old(i,k,j-1))
26724 Tmpv6013(i,k) = qmin(i,k,j)
26725 qmin(i,k,j) =min(qmin(i,k,j), field_old(i,k,j-1))
26729 Tmpv6014(i,k) = qmax(i,k,j-1)
26730 qmax(i,k,j-1) =max(qmax(i,k,j-1), field_old(i,k,j))
26732 Tmpv6015(i,k) = qmin(i,k,j-1)
26733 qmin(i,k,j-1) =min(qmin(i,k,j-1), field_old(i,k,j))
26738 ELSE IF( j == jde-2 ) THEN
26741 DO i =i_start, i_end
26745 fqyl(i,k,j) =vel*flux_upwind(field_old(i,k,j-1),field_old(i,k,j),cr)
26746 fqy(i,k,j) =vel*flux3(field(i,k,j-2),field(i,k,j-1),field(i,k,j),field(i,k,j+1),vel)
26747 fqy(i,k,j) =fqy(i,k,j) -fqyl(i,k,j)
26750 Tmpv6016(i,k) = qmax(i,k,j)
26751 Tmpv001 =max(qmax(i,k,j), field_old(i,k,j-1))
26752 qmax(i,k,j) =Tmpv001
26754 Tmpv6017(i,k) = qmin(i,k,j)
26755 Tmpv001 =min(qmin(i,k,j), field_old(i,k,j-1))
26756 qmin(i,k,j) =Tmpv001
26760 Tmpv6018(i,k) = qmax(i,k,j-1)
26761 qmax(i,k,j-1) =max(qmax(i,k,j-1), field_old(i,k,j))
26763 Tmpv6019(i,k) = qmin(i,k,j-1)
26764 qmin(i,k,j-1) =min(qmin(i,k,j-1), field_old(i,k,j))
26773 i_end =min(ite, ide-1) +1
26777 j_end =min(jte, jde-1) +1
26778 IF(degrade_ys) j_start =max(jts-1, jds)
26779 IF(degrade_ye) j_end =min(jte+1, jde-1)
26780 IF(degrade_xs) THEN
26781 i_start =max(ids+1, its-1)
26784 IF(degrade_xe) THEN
26785 i_end =min(ide-2, ite+1)
26789 DO j =j_start, j_end
26792 DO i =i_start_f, i_end_f
26796 fqxl(i,k,j) =vel*flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)
26798 fqx(i,k,j) =vel*flux5(field(i-3,k,j),field(i-2,k,j),field(i-1,k,j),field(i,k,j) &
26799 ,field(i+1,k,j),field(i+2,k,j),vel)
26801 fqx(i,k,j) =fqx(i,k,j) -fqxl(i,k,j)
26804 Tmpv700(i,k,j) = qmax(i,k,j)
26805 qmax(i,k,j) =max(qmax(i,k,j), field_old(i-1,k,j))
26807 Tmpv701(i,k,j) = qmin(i,k,j)
26808 qmin(i,k,j) =min(qmin(i,k,j), field_old(i-1,k,j))
26811 Tmpv702(i-1,k,j) = qmax(i-1,k,j)
26812 qmax(i-1,k,j) =max(qmax(i-1,k,j), field_old(i,k,j))
26814 Tmpv703(i-1,k,j) = qmin(i-1,k,j)
26815 qmin(i-1,k,j) =min(qmin(i-1,k,j), field_old(i,k,j))
26821 IF( degrade_xs ) THEN
26823 DO i =i_start, i_start_f-1
26824 IF(i == ids+1) THEN
26830 fqxl(i,k,j) =vel*flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)
26831 fqx(i,k,j) =0.5*(ru(i,k,j))*(field(i,k,j) +field(i-1,k,j))
26833 Tmpv001 =fqx(i,k,j) -fqxl(i,k,j)
26834 fqx(i,k,j) =Tmpv001
26837 Tmpv704(k,j) = qmax(i,k,j)
26838 Tmpv001 =max(qmax(i,k,j), field_old(i-1,k,j))
26839 qmax(i,k,j) =Tmpv001
26841 Tmpv705(k,j) = qmin(i,k,j)
26842 Tmpv001 =min(qmin(i,k,j), field_old(i-1,k,j))
26843 qmin(i,k,j) =Tmpv001
26846 Tmpv706(k,j) = qmax(i-1,k,j)
26847 Tmpv001 =max(qmax(i-1,k,j), field_old(i,k,j))
26848 qmax(i-1,k,j) =Tmpv001
26850 Tmpv707(k,j) = qmin(i-1,k,j)
26851 Tmpv001 =min(qmin(i-1,k,j), field_old(i,k,j))
26852 qmin(i-1,k,j) =Tmpv001
26857 IF(i == ids+2) THEN
26863 fqxl(i,k,j) =vel*flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)
26864 fqx(i,k,j) =vel*flux3(field(i-2,k,j),field(i-1,k,j),field(i,k,j),field(i+1,k,j),vel)
26865 fqx(i,k,j) =fqx(i,k,j) -fqxl(i,k,j)
26868 Tmpv708(k,j) = qmax(i,k,j)
26869 Tmpv001 =max(qmax(i,k,j), field_old(i-1,k,j))
26870 qmax(i,k,j) =Tmpv001
26872 Tmpv709(k,j) = qmin(i,k,j)
26873 Tmpv001 =min(qmin(i,k,j), field_old(i-1,k,j))
26874 qmin(i,k,j) =Tmpv001
26877 Tmpv710(k,j) = qmax(i-1,k,j)
26878 Tmpv001 =max(qmax(i-1,k,j), field_old(i,k,j))
26879 qmax(i-1,k,j) =Tmpv001
26881 Tmpv711(k,j) = qmin(i-1,k,j)
26882 Tmpv001 =min(qmin(i-1,k,j), field_old(i,k,j))
26883 qmin(i-1,k,j) =Tmpv001
26891 IF( degrade_xe ) THEN
26892 DO i =i_end_f+1, i_end+1
26893 IF( i == ide-1 ) THEN
26899 fqxl(i,k,j) =vel*flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)
26900 fqx(i,k,j) =0.5*(ru(i,k,j))*(field(i,k,j) +field(i-1,k,j))
26901 fqx(i,k,j) =fqx(i,k,j) -fqxl(i,k,j)
26904 Tmpv712(k,j) = qmax(i,k,j)
26905 Tmpv001 =max(qmax(i,k,j), field_old(i-1,k,j))
26906 qmax(i,k,j) =Tmpv001
26908 Tmpv713(k,j) = qmin(i,k,j)
26909 Tmpv001 =min(qmin(i,k,j), field_old(i-1,k,j))
26910 qmin(i,k,j) =Tmpv001
26913 Tmpv714(k,j) = qmax(i-1,k,j)
26914 Tmpv001 =max(qmax(i-1,k,j), field_old(i,k,j))
26915 qmax(i-1,k,j) =Tmpv001
26917 Tmpv715(k,j) = qmin(i-1,k,j)
26918 Tmpv001 =min(qmin(i-1,k,j), field_old(i,k,j))
26919 qmin(i-1,k,j) =Tmpv001
26924 IF( i == ide-2 ) THEN
26930 Tmpv001 =flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)
26931 Tmpv002 =vel*Tmpv001
26932 fqxl(i,k,j) =Tmpv002
26934 Tmpv001 =flux3(field(i-2,k,j),field(i-1,k,j),field(i,k,j),field(i+1,k,j),vel)
26935 Tmpv002 =vel*Tmpv001
26936 fqx(i,k,j) =Tmpv002
26938 Tmpv001 =fqx(i,k,j) -fqxl(i,k,j)
26939 fqx(i,k,j) =Tmpv001
26942 Tmpv716(k,j) = qmax(i,k,j)
26943 Tmpv001 =max(qmax(i,k,j), field_old(i-1,k,j))
26944 qmax(i,k,j) =Tmpv001
26946 Tmpv717(k,j) = qmin(i,k,j)
26947 Tmpv001 =min(qmin(i,k,j), field_old(i-1,k,j))
26948 qmin(i,k,j) =Tmpv001
26951 Tmpv718(k,j) = qmax(i-1,k,j)
26952 Tmpv001 =max(qmax(i-1,k,j), field_old(i,k,j))
26953 qmax(i-1,k,j) =Tmpv001
26955 Tmpv719(k,j) = qmin(i-1,k,j)
26956 Tmpv001 =min(qmin(i-1,k,j), field_old(i,k,j))
26957 qmin(i-1,k,j) =Tmpv001
26971 i_end = MIN(ite,ide-1)+1
26973 j_end = MIN(jte,jde-1)+1
26974 IF(degrade_xs) i_start = MAX(its-1,ids)
26975 IF(degrade_xe) i_end = MIN(ite+1,ide-1)
26976 IF(degrade_ys) j_start = MAX(jts-1,jds)
26977 IF(degrade_ye) j_end = MIN(jte+1,jde-1)
26981 IF(vert_order == 3) THEN
26982 DO j =j_start, j_end
26983 DO i =i_start, i_end
26991 DO i =i_start, i_end
26995 fqzl(i,k,j) =vel*flux_upwind(field_old(i,k-1,j),field_old(i,k,j),cr)
26996 fqz(i,k,j) =vel*flux3(field(i,k-2,j),field(i,k-1,j),field(i,k,j),field(i,k+1,j),-vel)
26997 fqz(i,k,j) =fqz(i,k,j) -fqzl(i,k,j)
27000 Tmpv800(i,k,j) = qmax(i,k,j)
27001 qmax(i,k,j) =max(qmax(i,k,j), field_old(i,k-1,j))
27003 Tmpv801(i,k,j) = qmin(i,k,j)
27004 qmin(i,k,j) =min(qmin(i,k,j), field_old(i,k-1,j))
27008 Tmpv802(i,k-1,j) = qmax(i,k-1,j)
27009 qmax(i,k-1,j) =max(qmax(i,k-1,j), field_old(i,k,j))
27011 Tmpv803(i,k-1,j) = qmin(i,k-1,j)
27012 qmin(i,k-1,j) =min(qmin(i,k-1,j), field_old(i,k,j))
27017 DO i =i_start, i_end
27022 fqzl(i,k,j) =vel*flux_upwind(field_old(i,k-1,j),field_old(i,k,j),cr)
27023 fqz(i,k,j) =rom(i,k,j)*(fzm(k)*field(i,k,j) +fzp(k)*field(i,k-1,j))
27025 Tmpv001 =fqz(i,k,j) -fqzl(i,k,j)
27026 fqz(i,k,j) =Tmpv001
27029 Tmpv804(i,j) = qmax(i,k,j)
27030 Tmpv001 =max(qmax(i,k,j), field_old(i,k-1,j))
27031 qmax(i,k,j) =Tmpv001
27033 Tmpv805(i,j) = qmin(i,k,j)
27034 Tmpv001 =min(qmin(i,k,j), field_old(i,k-1,j))
27035 qmin(i,k,j) =Tmpv001
27038 Tmpv806(i,j) = qmax(i,k-1,j)
27039 Tmpv001 =max(qmax(i,k-1,j), field_old(i,k,j))
27040 qmax(i,k-1,j) =Tmpv001
27042 Tmpv807(i,j) = qmin(i,k-1,j)
27043 Tmpv001 =min(qmin(i,k-1,j), field_old(i,k,j))
27044 qmin(i,k-1,j) =Tmpv001
27051 fqzl(i,k,j) =vel*flux_upwind(field_old(i,k-1,j),field_old(i,k,j),cr)
27052 fqz(i,k,j) =rom(i,k,j)*(fzm(k)*field(i,k,j) +fzp(k)*field(i,k-1,j))
27053 fqz(i,k,j) =fqz(i,k,j) -fqzl(i,k,j)
27056 Tmpv808(i,j) = qmax(i,k,j)
27057 Tmpv001 =max(qmax(i,k,j), field_old(i,k-1,j))
27058 qmax(i,k,j) =Tmpv001
27060 Tmpv809(i,j) = qmin(i,k,j)
27061 Tmpv001 =min(qmin(i,k,j), field_old(i,k-1,j))
27062 qmin(i,k,j) =Tmpv001
27066 Tmpv810(i,j) = qmax(i,k-1,j)
27067 qmax(i,k-1,j) =max(qmax(i,k-1,j), field_old(i,k,j))
27069 Tmpv811(i,j) = qmin(i,k-1,j)
27070 qmin(i,k-1,j) =min(qmin(i,k-1,j), field_old(i,k,j))
27081 IF(mono_limit) THEN
27083 Tmpv001 =min(ite, ide-1) +1
27086 Tmpv001 =min(jte, jde-1) +1
27088 IF(degrade_xs) THEN
27089 i_start =max(its-1, ids)
27091 IF(degrade_xe) THEN
27092 i_end =min(ite+1, ide-1)
27094 IF(degrade_ys) THEN
27095 j_start =max(jts-1, jds)
27097 IF(degrade_ye) THEN
27098 j_end =min(jte+1, jde-1)
27100 IF(config_flags%specified .or. config_flags%nested) THEN
27101 IF(degrade_xs) THEN
27102 i_start =max(its-1, ids+1)
27104 IF(degrade_xe) THEN
27105 i_end =min(ite+1, ide-2)
27107 IF(degrade_ys) THEN
27108 j_start =max(jts-1, jds+1)
27110 IF(degrade_ye) THEN
27111 j_end =min(jte+1, jde-2)
27114 IF(config_flags%open_xs) THEN
27115 IF(degrade_xs) THEN
27116 i_start =max(its-1, ids+1)
27119 IF(config_flags%open_xe) THEN
27120 IF(degrade_xe) THEN
27121 i_end =min(ite+1, ide-2)
27124 IF(config_flags%open_ys) THEN
27125 IF(degrade_ys) THEN
27126 j_start =max(jts-1, jds+1)
27129 IF(config_flags%open_ye) THEN
27130 IF(degrade_ye) THEN
27131 j_end =min(jte+1, jde-2)
27135 DO j =j_start, j_end
27137 DO i =i_start, i_end
27138 Tmpv001 =(mub(i,j) +mu_old(i,j))*field_old(i,k,j)
27139 Tmpv002 =fqxl(i+1,k,j) -fqxl(i,k,j)
27140 Tmpv003 =rdx*Tmpv002
27141 Tmpv004 =fqyl(i,k,j+1) -fqyl(i,k,j)
27142 Tmpv005 =rdy*Tmpv004
27143 Tmpv006 =Tmpv003 +Tmpv005
27144 Tmpv007 =msftx(i,j)*msfty(i,j)*Tmpv006
27145 Tmpv008 =fqzl(i,k+1,j) -fqzl(i,k,j)
27146 Tmpv009 =msfty(i,j)*rdzw(k)*Tmpv008
27147 ph_upwind =Tmpv001 -dt*(Tmpv007 +Tmpv009)
27149 Tmpv001 =min(0., fqx(i+1,k,j)) -max(0., fqx(i,k,j))
27150 Tmpv002 =rdx*Tmpv001
27151 Tmpv003 =min(0., fqy(i,k,j+1)) -max(0., fqy(i,k,j))
27152 Tmpv004 =rdy*Tmpv003
27153 Tmpv005 =Tmpv002 +Tmpv004
27154 Tmpv006 =(msftx(i,j)*msfty(i,j))*Tmpv005
27155 Tmpv007 =max(0., fqz(i,k+1,j)) -min(0., fqz(i,k,j))
27156 Tmpv008 =msfty(i,j)*rdzw(k)*Tmpv007
27157 Tmpv009 =Tmpv006 +Tmpv008
27158 Tmpv010 =-dt*Tmpv009
27160 Tmpv2400(i,k,j) =flux_in
27162 Tmpv001 =mut(i,j)*qmax(i,k,j)
27163 Tmpv002 =Tmpv001 -ph_upwind
27165 Tmpv2401(i,k,j) =ph_hi
27167 IF( flux_in .gt. ph_hi ) THEN
27168 Tmpv001 =ph_hi/(flux_in +eps)
27169 Tmpv2402(i,k,j) =Tmpv001
27170 scale_in(i,k,j) =max(0., Tmpv2402(i,k,j))
27173 Tmpv001 =max(0., fqx(i+1,k,j)) -min(0., fqx(i,k,j))
27174 Tmpv002 =rdx*Tmpv001
27175 Tmpv003 =max(0., fqy(i,k,j+1)) -min(0., fqy(i,k,j))
27176 Tmpv004 =rdy*Tmpv003
27177 Tmpv005 =Tmpv002 +Tmpv004
27178 Tmpv006 =(msftx(i,j)*msfty(i,j))*Tmpv005
27179 Tmpv007 =min(0., fqz(i,k+1,j)) -max(0., fqz(i,k,j))
27180 Tmpv008 =msfty(i,j)*rdzw(k)*Tmpv007
27181 Tmpv009 =Tmpv006 +Tmpv008
27182 Tmpv010 =dt*Tmpv009
27184 Tmpv2403(i,k,j) =flux_out
27186 Tmpv001 =mut(i,j)*qmin(i,k,j)
27187 Tmpv002 =ph_upwind -Tmpv001
27189 Tmpv2404(i,k,j) =ph_low
27191 IF( flux_out .gt. ph_low ) THEN
27192 Tmpv001 =ph_low/(flux_out +eps)
27193 Tmpv2405(i,k,j) =Tmpv001
27194 scale_out(i,k,j) =max(0., Tmpv2405(i,k,j))
27201 DO j =j_end, j_start, -1
27202 DO k =ktf, kts+1, -1
27203 DO i =i_end, i_start, -1
27205 IF( fqz (i,k,j) .lt. 0.) THEN
27207 a_Tmpv2 =a_fqz(i,k,j)
27209 a_Tmpv1 =fqz(i,k,j)*a_Tmpv2
27210 a_fqz(i,k,j) =a_fqz(i,k,j) +min(scale_in(i,k,j), scale_out(i,k-1,j))*a_Tmpv2
27211 a_scale_in(i,k,j) =a_scale_in(i,k,j) +(1.0 -sign(1.0, scale_in(i,k,j) &
27212 -scale_out(i,k-1,j)))*0.5*1.0*a_Tmpv1
27213 a_scale_out(i,k-1,j) =a_scale_out(i,k-1,j) +(1.0 +sign(1.0, scale_in(i,k,j) &
27214 -scale_out(i,k-1,j)))*0.5*1.0*a_Tmpv1
27218 a_Tmpv2 =a_fqz(i,k,j)
27220 a_Tmpv1 =fqz(i,k,j)*a_Tmpv2
27221 a_fqz(i,k,j) =a_fqz(i,k,j) +min(scale_out(i,k,j), scale_in(i,k-1,j))*a_Tmpv2
27222 a_scale_out(i,k,j) =a_scale_out(i,k,j) +(1.0 -sign(1.0, scale_out(i,k,j) &
27223 -scale_in(i,k-1,j)))*0.5*1.0*a_Tmpv1
27224 a_scale_in(i,k-1,j) =a_scale_in(i,k-1,j) +(1.0 +sign(1.0, scale_out(i,k,j) &
27225 -scale_in(i,k-1,j)))*0.5*1.0*a_Tmpv1
27232 DO j =j_end+1, j_start, -1
27234 DO i =i_end, i_start, -1
27236 IF( fqy (i,k,j) .gt. 0.) THEN
27238 a_Tmpv2 =a_fqy(i,k,j)
27240 a_Tmpv1 =fqy(i,k,j)*a_Tmpv2
27241 a_fqy(i,k,j) =a_fqy(i,k,j) +min(scale_in(i,k,j), scale_out(i,k,j-1))*a_Tmpv2
27242 a_scale_in(i,k,j) =a_scale_in(i,k,j) +(1.0 -sign(1.0, scale_in(i,k,j) &
27243 -scale_out(i,k,j-1)))*0.5*1.0*a_Tmpv1
27244 a_scale_out(i,k,j-1) =a_scale_out(i,k,j-1) +(1.0 +sign(1.0, scale_in(i,k,j) &
27245 -scale_out(i,k,j-1)))*0.5*1.0*a_Tmpv1
27249 a_Tmpv2 =a_fqy(i,k,j)
27251 a_Tmpv1 =fqy(i,k,j)*a_Tmpv2
27252 a_fqy(i,k,j) =a_fqy(i,k,j) +min(scale_out(i,k,j), scale_in(i,k,j-1))*a_Tmpv2
27253 a_scale_out(i,k,j) =a_scale_out(i,k,j) +(1.0 -sign(1.0, scale_out(i,k,j) &
27254 -scale_in(i,k,j-1)))*0.5*1.0*a_Tmpv1
27255 a_scale_in(i,k,j-1) =a_scale_in(i,k,j-1) +(1.0 +sign(1.0, scale_out(i,k,j) &
27256 -scale_in(i,k,j-1)))*0.5*1.0*a_Tmpv1
27263 DO j =j_end, j_start, -1
27265 DO i =i_end+1, i_start, -1
27267 IF( fqx (i,k,j) .gt. 0.) THEN
27269 a_Tmpv2 =a_fqx(i,k,j)
27271 a_Tmpv1 =fqx(i,k,j)*a_Tmpv2
27272 a_fqx(i,k,j) =a_fqx(i,k,j) +min(scale_in(i,k,j), scale_out(i-1,k,j))*a_Tmpv2
27273 a_scale_in(i,k,j) =a_scale_in(i,k,j) +(1.0 -sign(1.0, scale_in(i,k,j) &
27274 -scale_out(i-1,k,j)))*0.5*1.0*a_Tmpv1
27275 a_scale_out(i-1,k,j) =a_scale_out(i-1,k,j) +(1.0 +sign(1.0, scale_in(i,k,j) &
27276 -scale_out(i-1,k,j)))*0.5*1.0*a_Tmpv1
27280 a_Tmpv2 =a_fqx(i,k,j)
27282 a_Tmpv1 =fqx(i,k,j)*a_Tmpv2
27283 a_fqx(i,k,j) =a_fqx(i,k,j) +min(scale_out(i,k,j), scale_in(i-1,k,j))*a_Tmpv2
27284 a_scale_out(i,k,j) =a_scale_out(i,k,j) +(1.0 -sign(1.0, scale_out(i,k,j) &
27285 -scale_in(i-1,k,j)))*0.5*1.0*a_Tmpv1
27286 a_scale_in(i-1,k,j) =a_scale_in(i-1,k,j) +(1.0 +sign(1.0, scale_out(i,k,j) &
27287 -scale_in(i-1,k,j)))*0.5*1.0*a_Tmpv1
27295 DO j =j_end, j_start, -1
27297 DO i =i_end, i_start, -1
27298 flux_out = Tmpv2403(i,k,j)
27299 ph_low = Tmpv2404(i,k,j)
27301 IF( flux_out .gt. ph_low ) THEN
27302 a_Tmpv1 = (1.0 +(-1.0)*sign(1.0, 0. -Tmpv2405(i,k,j)))*0.5*a_scale_out(i,k,j)
27303 a_scale_out(i,k,j) =0.0
27304 a_ph_low =a_ph_low +a_Tmpv1/(flux_out +eps)
27305 a_flux_out =a_flux_out -ph_low/((flux_out +eps)*(flux_out +eps))*a_Tmpv1
27310 a_ph_upwind =a_ph_upwind +a_Tmpv2
27312 a_mut(i,j) =a_mut(i,j) +qmin(i,k,j)*a_Tmpv1
27313 a_qmin(i,k,j) =a_qmin(i,k,j) +mut(i,j)*a_Tmpv1
27315 a_Tmpv10 =a_flux_out
27317 a_Tmpv9 =dt*a_Tmpv10
27320 a_Tmpv7 =msfty(i,j)*rdzw(k)*a_Tmpv8
27321 a_fqz(i,k+1,j) =a_fqz(i,k+1,j) +(1.0 -(-1.0)*sign(1.0, 0. -fqz(i,k+1,j)))*0.5*a_Tmpv7
27322 a_fqz(i,k,j) =a_fqz(i,k,j) -(1.0 +(-1.0)*sign(1.0, 0. -fqz(i,k,j)))*0.5*a_Tmpv7
27323 a_Tmpv5 =(msftx(i,j)*msfty(i,j))*a_Tmpv6
27326 a_Tmpv3 =rdy*a_Tmpv4
27327 a_fqy(i,k,j+1) =a_fqy(i,k,j+1) +(1.0 +(-1.0)*sign(1.0, 0. -fqy(i,k,j+1)))*0.5*a_Tmpv3
27328 a_fqy(i,k,j) =a_fqy(i,k,j) -(1.0 -(-1.0)*sign(1.0, 0. -fqy(i,k,j)))*0.5*a_Tmpv3
27329 a_Tmpv1 =rdx*a_Tmpv2
27330 a_fqx(i+1,k,j) =a_fqx(i+1,k,j) +(1.0 +(-1.0)*sign(1.0, 0. -fqx(i+1,k,j)))*0.5*a_Tmpv1
27331 a_fqx(i,k,j) =a_fqx(i,k,j) -(1.0 -(-1.0)*sign(1.0, 0. -fqx(i,k,j)))*0.5*a_Tmpv1
27333 flux_in =Tmpv2400(i,k,j)
27334 ph_hi =Tmpv2401(i,k,j)
27336 IF( flux_in .gt. ph_hi ) THEN
27338 a_Tmpv1 = (1.0 +(-1.0)*sign(1.0, 0. -Tmpv2402(i,k,j)))*0.5*a_scale_in(i,k,j)
27339 a_scale_in(i,k,j) =0.0
27340 a_ph_hi =a_ph_hi +a_Tmpv1/(flux_in +eps)
27341 a_flux_in =a_flux_in -ph_hi/((flux_in +eps)*(flux_in +eps))*a_Tmpv1
27347 a_ph_upwind =a_ph_upwind -a_Tmpv2
27348 a_mut(i,j) =a_mut(i,j) +qmax(i,k,j)*a_Tmpv1
27349 a_qmax(i,k,j) =a_qmax(i,k,j) +mut(i,j)*a_Tmpv1
27351 a_Tmpv10 =a_flux_in
27353 a_Tmpv9 =-dt*a_Tmpv10
27356 a_Tmpv7 =msfty(i,j)*rdzw(k)*a_Tmpv8
27357 a_fqz(i,k+1,j) =a_fqz(i,k+1,j) +(1.0 +(-1.0)*sign(1.0, 0. -fqz(i,k+1,j)))*0.5*a_Tmpv7
27358 a_fqz(i,k,j) =a_fqz(i,k,j) -(1.0 -(-1.0)*sign(1.0, 0. -fqz(i,k,j)))*0.5*a_Tmpv7
27359 a_Tmpv5 =(msftx(i,j)*msfty(i,j))*a_Tmpv6
27362 a_Tmpv3 =rdy*a_Tmpv4
27363 a_fqy(i,k,j+1) =a_fqy(i,k,j+1) +(1.0 -(-1.0)*sign(1.0, 0. -fqy(i,k,j+1)))*0.5*a_Tmpv3
27364 a_fqy(i,k,j) =a_fqy(i,k,j) -(1.0 +(-1.0)*sign(1.0, 0. -fqy(i,k,j)))*0.5*a_Tmpv3
27365 a_Tmpv1 =rdx*a_Tmpv2
27366 a_fqx(i+1,k,j) =a_fqx(i+1,k,j) +(1.0 -(-1.0)*sign(1.0, 0. -fqx(i+1,k,j)))*0.5*a_Tmpv1
27367 a_fqx(i,k,j) =a_fqx(i,k,j) -(1.0 +(-1.0)*sign(1.0, 0. -fqx(i,k,j)))*0.5*a_Tmpv1
27368 a_Tmpv12 =a_ph_upwind
27371 a_Tmpv11 =-a_Tmpv12
27372 a_Tmpv10 =dt*a_Tmpv11
27375 a_Tmpv8 =msfty(i,j)*rdzw(k)*a_Tmpv9
27376 a_fqzl(i,k+1,j) =a_fqzl(i,k+1,j) +a_Tmpv8
27377 a_fqzl(i,k,j) =a_fqzl(i,k,j) -a_Tmpv8
27378 a_Tmpv6 =msftx(i,j)*msfty(i,j)*a_Tmpv7
27381 a_Tmpv4 =rdy*a_Tmpv5
27382 a_fqyl(i,k,j+1) =a_fqyl(i,k,j+1) +a_Tmpv4
27383 a_fqyl(i,k,j) =a_fqyl(i,k,j) -a_Tmpv4
27384 a_Tmpv2 =rdx*a_Tmpv3
27385 a_fqxl(i+1,k,j) =a_fqxl(i+1,k,j) +a_Tmpv2
27386 a_fqxl(i,k,j) =a_fqxl(i,k,j) -a_Tmpv2
27387 a_mu_old(i,j) =a_mu_old(i,j) +field_old(i,k,j)*a_Tmpv1
27388 a_field_old(i,k,j) =a_field_old(i,k,j) +(mub(i,j) +mu_old(i,j))*a_Tmpv1
27398 i_end = MIN(ite,ide-1)+1
27400 j_end = MIN(jte,jde-1)+1
27401 IF(degrade_xs) i_start = MAX(its-1,ids)
27402 IF(degrade_xe) i_end = MIN(ite+1,ide-1)
27403 IF(degrade_ys) j_start = MAX(jts-1,jds)
27404 IF(degrade_ye) j_end = MIN(jte+1,jde-1)
27406 IF(vert_order == 3) THEN
27408 DO j =j_end, j_start, -1
27409 DO i =i_end, i_start, -1
27416 qmax(i,k,j) = Tmpv808(i,j)
27417 qmin(i,k,j) = Tmpv809(i,j)
27419 a_Tmpv1 =a_qmin(i,k,j)
27421 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i,k-1,j) &
27423 a_field_old(i,k-1,j) =a_field_old(i,k-1,j) +(1.0 +sign(1.0, qmin(i,k,j) &
27424 -field_old(i,k-1,j)))*0.5*1.0*a_Tmpv1
27426 a_Tmpv1 =a_qmax(i,k,j)
27428 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i,k-1,j) &
27430 a_field_old(i,k-1,j) =a_field_old(i,k-1,j) +(1.0 -sign(1.0, qmax(i,k,j) &
27431 -field_old(i,k-1,j)))*0.5*1.0*a_Tmpv1
27433 qmax(i,k-1,j) = Tmpv810(i,j)
27434 qmin(i,k-1,j) = Tmpv811(i,j)
27436 a_Tmpv1 =a_qmin(i,k-1,j)
27437 a_qmin(i,k-1,j) =0.0
27438 a_qmin(i,k-1,j) =a_qmin(i,k-1,j) +(1.0 -sign(1.0, qmin(i,k-1,j) &
27439 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27440 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i,k-1,j) &
27441 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27442 a_Tmpv1 =a_qmax(i,k-1,j)
27443 a_qmax(i,k-1,j) =0.0
27444 a_qmax(i,k-1,j) =a_qmax(i,k-1,j) +(1.0 +sign(1.0, qmax(i,k-1,j) &
27445 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27446 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i,k-1,j) &
27447 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27451 a_Tmpv1 =a_fqz(i,k,j)
27453 a_fqz(i,k,j) =a_fqz(i,k,j) +a_Tmpv1
27454 a_fqzl(i,k,j) =a_fqzl(i,k,j) -a_Tmpv1
27455 a_Tmpv2 =a_fqz(i,k,j)
27457 a_rom(i,k,j) =a_rom(i,k,j) +(fzm(k)*field(i,k,j) +fzp(k)*field(i,k-1,j))*a_Tmpv2
27458 a_Tmpv1 =rom(i,k,j)*a_Tmpv2
27459 a_field(i,k,j) =a_field(i,k,j) +fzm(k)*a_Tmpv1
27460 a_field(i,k-1,j) =a_field(i,k-1,j) +fzp(k)*a_Tmpv1
27461 a_Tmpv2 =a_fqzl(i,k,j)
27463 a_vel =a_vel +flux_upwind(field_old(i,k-1,j),field_old(i,k,j),cr)*a_Tmpv2
27464 a_Tmpv1 =vel*a_Tmpv2
27465 a_cr =a_cr +Diff_flux_upwind(field_old(i,k-1,j),0.0,field_old(i,k,j) &
27466 ,0.0,cr,1.0)*a_Tmpv1
27467 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i,k-1,j) &
27468 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
27469 a_field_old(i,k-1,j) =a_field_old(i,k-1,j) +Diff_flux_upwind(field_old(i,k-1,j) &
27470 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
27475 a_rom(i,k,j) =a_rom(i,k,j) +a_vel
27484 qmax(i,k,j) = Tmpv804(i,j)
27485 qmin(i,k,j) = Tmpv805(i,j)
27487 a_Tmpv1 =a_qmax(i,k,j)
27489 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i,k-1,j) &
27491 a_field_old(i,k-1,j) =a_field_old(i,k-1,j) +(1.0 -sign(1.0, qmax(i,k,j) &
27492 -field_old(i,k-1,j)))*0.5*1.0*a_Tmpv1
27493 a_Tmpv1 =a_qmin(i,k,j)
27495 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i,k-1,j) &
27497 a_field_old(i,k-1,j) =a_field_old(i,k-1,j) +(1.0 +sign(1.0, qmin(i,k,j) &
27498 -field_old(i,k-1,j)))*0.5*1.0*a_Tmpv1
27502 qmax(i,k-1,j) = Tmpv806(i,j)
27503 qmin(i,k-1,j) = Tmpv807(i,j)
27505 a_Tmpv1 =a_qmin(i,k-1,j)
27506 a_qmin(i,k-1,j) =0.0
27507 a_qmin(i,k-1,j) =a_qmin(i,k-1,j) +(1.0 -sign(1.0, qmin(i,k-1,j) &
27508 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27509 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i,k-1,j) &
27510 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27511 a_Tmpv1 =a_qmax(i,k-1,j)
27512 a_qmax(i,k-1,j) =0.0
27513 a_qmax(i,k-1,j) =a_qmax(i,k-1,j) +(1.0 +sign(1.0, qmax(i,k-1,j) &
27514 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27515 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i,k-1,j) &
27516 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27519 a_Tmpv1 =a_fqz(i,k,j)
27521 a_fqz(i,k,j) =a_fqz(i,k,j) +a_Tmpv1
27522 a_fqzl(i,k,j) =a_fqzl(i,k,j) -a_Tmpv1
27523 a_Tmpv2 =a_fqz(i,k,j)
27525 a_rom(i,k,j) =a_rom(i,k,j) +(fzm(k)*field(i,k,j)+fzp(k)*field(i,k-1,j))*a_Tmpv2
27526 a_Tmpv1 =rom(i,k,j)*a_Tmpv2
27527 a_field(i,k,j) =a_field(i,k,j) +fzm(k)*a_Tmpv1
27528 a_field(i,k-1,j) =a_field(i,k-1,j) +fzp(k)*a_Tmpv1
27529 a_Tmpv2 =a_fqzl(i,k,j)
27531 a_vel =a_vel +flux_upwind(field_old(i,k-1,j),field_old(i,k,j),cr)*a_Tmpv2
27532 a_Tmpv1 =vel*a_Tmpv2
27533 a_cr =a_cr +Diff_flux_upwind(field_old(i,k-1,j),0.0,field_old(i,k,j) &
27534 ,0.0,cr,1.0)*a_Tmpv1
27535 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i,k-1,j) &
27536 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
27537 a_field_old(i,k-1,j) =a_field_old(i,k-1,j) +Diff_flux_upwind(field_old(i,k-1,j) &
27538 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
27543 a_rom(i,k,j) =a_rom(i,k,j) +a_vel
27547 DO k =ktf-1, kts+2, -1
27548 DO i =i_end, i_start, -1
27553 qmax(i,k,j) = Tmpv800(i,k,j)
27554 qmin(i,k,j) = Tmpv801(i,k,j)
27556 a_Tmpv1 =a_qmax(i,k,j)
27558 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i,k-1,j) &
27560 a_field_old(i,k-1,j) =a_field_old(i,k-1,j) +(1.0 -sign(1.0, qmax(i,k,j) &
27561 -field_old(i,k-1,j)))*0.5*1.0*a_Tmpv1
27562 a_Tmpv1 =a_qmin(i,k,j)
27564 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i,k-1,j) &
27566 a_field_old(i,k-1,j) =a_field_old(i,k-1,j) +(1.0 +sign(1.0, qmin(i,k,j) &
27567 -field_old(i,k-1,j)))*0.5*1.0*a_Tmpv1
27571 qmax(i,k-1,j) = Tmpv802(i,k-1,j)
27572 qmin(i,k-1,j) = Tmpv803(i,k-1,j)
27574 a_Tmpv1 =a_qmin(i,k-1,j)
27575 a_qmin(i,k-1,j) =0.0
27576 a_qmin(i,k-1,j) =a_qmin(i,k-1,j) +(1.0 -sign(1.0, qmin(i,k-1,j) &
27577 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27578 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i,k-1,j) &
27579 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27580 a_Tmpv1 =a_qmax(i,k-1,j)
27581 a_qmax(i,k-1,j) =0.0
27582 a_qmax(i,k-1,j) =a_qmax(i,k-1,j) +(1.0 +sign(1.0, qmax(i,k-1,j) &
27583 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27584 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i,k-1,j) &
27585 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27589 a_fqzl(i,k,j) =a_fqzl(i,k,j) -a_fqz(i,k,j)
27590 a_Tmpv2 =a_fqz(i,k,j)
27592 a_vel =a_vel +flux3(field(i,k-2,j),field(i,k-1,j),field(i,k,j),field(i,k+1,j),-vel)*a_Tmpv2
27593 a_Tmpv1 =vel*a_Tmpv2
27594 a_vel =a_vel -Diff_flux3(field(i,k-2,j),0.0,field(i,k-1,j),0.0,field(i,k,j) &
27595 ,0.0,field(i,k+1,j),0.0,-vel,1.0)*a_Tmpv1
27596 a_field(i,k+1,j) =a_field(i,k+1,j) +Diff_flux3(field(i,k-2,j),0.0,field(i,k-1, &
27597 j),0.0,field(i,k,j),0.0,field(i,k+1,j),1.0,-vel,0.0)*a_Tmpv1
27598 a_field(i,k,j) =a_field(i,k,j) +Diff_flux3(field(i,k-2,j),0.0,field(i,k-1,j) &
27599 ,0.0,field(i,k,j),1.0,field(i,k+1,j),0.0,-vel,0.0)*a_Tmpv1
27600 a_field(i,k-1,j) =a_field(i,k-1,j) +Diff_flux3(field(i,k-2,j),0.0,field(i,k-1, &
27601 j),1.0,field(i,k,j),0.0,field(i,k+1,j),0.0,-vel,0.0)*a_Tmpv1
27602 a_field(i,k-2,j) =a_field(i,k-2,j) +Diff_flux3(field(i,k-2,j),1.0,field(i,k-1, &
27603 j),0.0,field(i,k,j),0.0,field(i,k+1,j),0.0,-vel,0.0)*a_Tmpv1
27605 a_Tmpv2 =a_fqzl(i,k,j)
27607 a_vel =a_vel +flux_upwind(field_old(i,k-1,j),field_old(i,k,j),cr)*a_Tmpv2
27608 a_Tmpv1 =vel*a_Tmpv2
27609 a_cr =a_cr +Diff_flux_upwind(field_old(i,k-1,j),0.0,field_old(i,k,j) &
27610 ,0.0,cr,1.0)*a_Tmpv1
27611 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i,k-1,j) &
27612 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
27613 a_field_old(i,k-1,j) =a_field_old(i,k-1,j) +Diff_flux_upwind(field_old(i,k-1,j) &
27614 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
27619 a_rom(i,k,j) =a_rom(i,k,j) +a_vel
27624 DO i =i_end, i_start, -1
27625 a_fqzl(i,kde,j) =0.0
27626 a_fqz(i,kde,j) =0.0
27639 i_end =min(ite, ide-1)
27641 j_end =min(jte, jde-1)
27645 IF( (config_flags%open_ye) .and. (jte == jde)) THEN
27647 DO i =i_end, i_start, -1
27649 gwalls =0.5*(rv(i,k,jte-1) +rv(i,k,jte))
27650 vb =max(gwalls, 0.)
27651 a_Tmpv7 =a_tendency(i,k,j_end)
27652 a_tendency(i,k,j_end) =0.0
27653 a_tendency(i,k,j_end) =a_tendency(i,k,j_end) +a_Tmpv7
27655 a_Tmpv5 =rdy*a_Tmpv6
27656 a_field(i,k,j_end) =a_field(i,k,j_end) +(rv(i,k,jte) -rv(i,k,jte-1))*a_Tmpv5
27657 a_Tmpv3 =field(i,k,j_end)*a_Tmpv5
27658 a_rv(i,k,jte) =a_rv(i,k,jte) +a_Tmpv3
27659 a_rv(i,k,jte-1) =a_rv(i,k,jte-1) -a_Tmpv3
27660 a_vb =a_vb +(field_old(i,k,j_end) -field_old(i,k,j_end-1))*a_Tmpv5
27661 a_Tmpv1 =vb*a_Tmpv5
27662 a_field_old(i,k,j_end) =a_field_old(i,k,j_end) +a_Tmpv1
27663 a_field_old(i,k,j_end-1) =a_field_old(i,k,j_end-1) -a_Tmpv1
27665 a_Tmpv2 = (1.0 +(1.0)*sign(1.0, gwalls-0.))*0.5*a_vb
27667 a_Tmpv1 =0.5*a_Tmpv2
27668 a_rv(i,k,jte-1) =a_rv(i,k,jte-1) +a_Tmpv1
27669 a_rv(i,k,jte) =a_rv(i,k,jte) +a_Tmpv1
27677 IF( (config_flags%open_ys) .and. (jts == jds) ) THEN
27679 DO i =i_end, i_start, -1
27681 gwalls =0.5*(rv(i,k,jts) +rv(i,k,jts+1))
27682 vb =min(gwalls, 0.)
27683 a_Tmpv7 =a_tendency(i,k,jts)
27684 a_tendency(i,k,jts) =0.0
27685 a_tendency(i,k,jts) =a_tendency(i,k,jts) +a_Tmpv7
27686 a_Tmpv5 =-rdy*a_Tmpv7
27687 a_field(i,k,jts) =a_field(i,k,jts) +(rv(i,k,jts+1) -rv(i,k,jts))*a_Tmpv5
27688 a_Tmpv3 =field(i,k,jts)*a_Tmpv5
27689 a_rv(i,k,jts+1) =a_rv(i,k,jts+1) +a_Tmpv3
27690 a_rv(i,k,jts) =a_rv(i,k,jts) -a_Tmpv3
27691 a_vb =a_vb +(field_old(i,k,jts+1) -field_old(i,k,jts))*a_Tmpv5
27692 a_Tmpv1 =vb*a_Tmpv5
27693 a_field_old(i,k,jts+1) =a_field_old(i,k,jts+1) +a_Tmpv1
27694 a_field_old(i,k,jts) =a_field_old(i,k,jts) -a_Tmpv1
27696 a_Tmpv2 = (1.0 -(1.0)*sign(1.0, gwalls-0.))*0.5*a_vb
27698 a_Tmpv1 =0.5*a_Tmpv2
27699 a_rv(i,k,jts) =a_rv(i,k,jts) +a_Tmpv1
27700 a_rv(i,k,jts+1) =a_rv(i,k,jts+1) +a_Tmpv1
27708 IF( (config_flags%open_xe) .and. (ite == ide) ) THEN
27710 DO j =j_end, j_start, -1
27712 gwalls=0.5*(ru(ite-1,k,j) +ru(ite,k,j))
27713 ub =max(gwalls, 0.)
27714 a_Tmpv7 =a_tendency(i_end,k,j)
27715 a_tendency(i_end,k,j) =0.0
27716 a_tendency(i_end,k,j) =a_tendency(i_end,k,j) +a_Tmpv7
27718 a_Tmpv5 =rdx*a_Tmpv6
27721 a_field(i_end,k,j) =a_field(i_end,k,j) +(ru(ite,k,j) -ru(ite-1,k,j))*a_Tmpv4
27722 a_Tmpv3 =field(i_end,k,j)*a_Tmpv4
27723 a_ru(ite,k,j) =a_ru(ite,k,j) +a_Tmpv3
27724 a_ru(ite-1,k,j) =a_ru(ite-1,k,j) -a_Tmpv3
27725 a_ub =a_ub +(field_old(i_end,k,j) -field_old(i_end-1,k,j))*a_Tmpv2
27726 a_Tmpv1 =ub*a_Tmpv2
27727 a_field_old(i_end,k,j) =a_field_old(i_end,k,j) +a_Tmpv1
27728 a_field_old(i_end-1,k,j) =a_field_old(i_end-1,k,j) -a_Tmpv1
27730 a_Tmpv2 = (1.0 +(1.0)*sign(1.0, gwalls-0.))*0.5*a_ub
27732 a_Tmpv1 =0.5*a_Tmpv2
27733 a_ru(ite-1,k,j) =a_ru(ite-1,k,j) +a_Tmpv1
27734 a_ru(ite,k,j) =a_ru(ite,k,j) +a_Tmpv1
27742 IF( (config_flags%open_xs) .and. (its == ids) ) THEN
27744 DO j =j_end, j_start, -1
27746 gwalls =0.5*(ru(its,k,j) +ru(its+1,k,j))
27747 ub =min(gwalls, 0.)
27748 a_Tmpv7 =a_tendency(its,k,j)
27749 a_tendency(its,k,j) =0.0
27750 a_tendency(its,k,j) =a_tendency(its,k,j) +a_Tmpv7
27752 a_Tmpv5 =rdx*a_Tmpv6
27755 a_field(its,k,j) =a_field(its,k,j) +(ru(its+1,k,j) -ru(its,k,j))*a_Tmpv4
27756 a_Tmpv3 =field(its,k,j)*a_Tmpv4
27757 a_ru(its+1,k,j) =a_ru(its+1,k,j) +a_Tmpv3
27758 a_ru(its,k,j) =a_ru(its,k,j) -a_Tmpv3
27759 a_ub =a_ub +(field_old(its+1,k,j) -field_old(its,k,j))*a_Tmpv2
27760 a_Tmpv1 =ub*a_Tmpv2
27761 a_field_old(its+1,k,j) =a_field_old(its+1,k,j) +a_Tmpv1
27762 a_field_old(its,k,j) =a_field_old(its,k,j) -a_Tmpv1
27764 a_Tmpv2 = (1.0 -(1.0)*sign(1.0, gwalls -0.))*0.5*a_ub
27766 a_Tmpv1 =0.5*a_Tmpv2
27767 a_ru(its,k,j) =a_ru(its,k,j) +a_Tmpv1
27768 a_ru(its+1,k,j) =a_ru(its+1,k,j) +a_Tmpv1
27776 IF( horz_order == 5 ) THEN
27780 i_end = MIN(ite,ide-1)+1
27781 i_start_f = i_start
27784 j_end = MIN(jte,jde-1)+1
27785 IF(degrade_ys) j_start = MAX(jts-1,jds)
27786 IF(degrade_ye) j_end = MIN(jte+1,jde-1)
27787 IF(degrade_xs) then
27788 i_start = MAX(ids+1,its-1)
27791 IF(degrade_xe) then
27792 i_end = MIN(ide-2,ite+1)
27796 DO j =j_end, j_start, -1
27798 IF( degrade_xe ) THEN
27800 DO i =i_end+1, i_end_f+1, -1
27802 IF( i == ide-2 ) THEN
27809 qmax(i,k,j) = Tmpv716(k,j)
27810 qmin(i,k,j) = Tmpv717(k,j)
27812 a_Tmpv1 =a_qmax(i,k,j)
27814 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i-1,k,j) &
27816 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 -sign(1.0, qmax(i,k,j) &
27817 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
27818 a_Tmpv1 =a_qmin(i,k,j)
27820 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i-1,k,j) &
27822 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 +sign(1.0, qmin(i,k,j) &
27823 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
27827 qmax(i-1,k,j) = Tmpv718(k,j)
27828 qmin(i-1,k,j) = Tmpv719(k,j)
27830 a_Tmpv1 =a_qmin(i-1,k,j)
27831 a_qmin(i-1,k,j) =0.0
27832 a_qmin(i-1,k,j) =a_qmin(i-1,k,j) +(1.0 -sign(1.0, qmin(i-1,k,j) &
27833 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27834 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i-1,k,j) &
27835 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27836 a_Tmpv1 =a_qmax(i-1,k,j)
27837 a_qmax(i-1,k,j) =0.0
27838 a_qmax(i-1,k,j) =a_qmax(i-1,k,j) +(1.0 +sign(1.0, qmax(i-1,k,j) &
27839 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27840 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i-1,k,j) &
27841 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27844 a_fqxl(i,k,j) =a_fqxl(i,k,j) -a_fqx(i,k,j)
27845 a_Tmpv2 =a_fqx(i,k,j)
27847 a_vel =a_vel +flux3(field(i-2,k,j),field(i-1,k,j),field(i,k,j),field(i+1,k,j),vel)*a_Tmpv2
27848 a_Tmpv1 =vel*a_Tmpv2
27849 a_vel =a_vel +Diff_flux3(field(i-2,k,j),0.0,field(i-1,k,j),0.0,field(i,k,j) &
27850 ,0.0,field(i+1,k,j),0.0,vel,1.0)*a_Tmpv1
27851 a_field(i+1,k,j) =a_field(i+1,k,j) +Diff_flux3(field(i-2,k,j),0.0,field(i-1,k, &
27852 j),0.0,field(i,k,j),0.0,field(i+1,k,j),1.0,vel,0.0)*a_Tmpv1
27853 a_field(i,k,j) =a_field(i,k,j) +Diff_flux3(field(i-2,k,j),0.0,field(i-1,k,j) &
27854 ,0.0,field(i,k,j),1.0,field(i+1,k,j),0.0,vel,0.0)*a_Tmpv1
27855 a_field(i-1,k,j) =a_field(i-1,k,j) +Diff_flux3(field(i-2,k,j),0.0,field(i-1,k, &
27856 j),1.0,field(i,k,j),0.0,field(i+1,k,j),0.0,vel,0.0)*a_Tmpv1
27857 a_field(i-2,k,j) =a_field(i-2,k,j) +Diff_flux3(field(i-2,k,j),1.0,field(i-1,k, &
27858 j),0.0,field(i,k,j),0.0,field(i+1,k,j),0.0,vel,0.0)*a_Tmpv1
27860 a_Tmpv2 =a_fqxl(i,k,j)
27862 a_vel =a_vel +flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)*a_Tmpv2
27863 a_Tmpv1 =vel*a_Tmpv2
27864 a_cr =a_cr +Diff_flux_upwind(field_old(i-1,k,j),0.0,field_old(i,k,j) &
27865 ,0.0,cr,1.0)*a_Tmpv1
27866 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
27867 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
27868 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
27869 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
27874 a_ru(i,k,j) =a_ru(i,k,j) +a_vel
27880 IF( i == ide-1 ) THEN
27887 qmax(i,k,j) = Tmpv712(k,j)
27888 qmin(i,k,j) = Tmpv713(k,j)
27890 a_Tmpv1 =a_qmax(i,k,j)
27892 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i-1,k,j) &
27894 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 -sign(1.0, qmax(i,k,j) &
27895 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
27896 a_Tmpv1 =a_qmin(i,k,j)
27898 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i-1,k,j) &
27900 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 +sign(1.0, qmin(i,k,j) &
27901 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
27905 qmax(i-1,k,j) = Tmpv714(k,j)
27906 qmin(i-1,k,j) = Tmpv715(k,j)
27908 a_Tmpv1 =a_qmin(i-1,k,j)
27909 a_qmin(i-1,k,j) =0.0
27910 a_qmin(i-1,k,j) =a_qmin(i-1,k,j) +(1.0 -sign(1.0, qmin(i-1,k,j) &
27911 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27912 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i-1,k,j) &
27913 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27914 a_Tmpv1 =a_qmax(i-1,k,j)
27915 a_qmax(i-1,k,j) =0.0
27916 a_qmax(i-1,k,j) =a_qmax(i-1,k,j) +(1.0 +sign(1.0, qmax(i-1,k,j) &
27917 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27918 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i-1,k,j) &
27919 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27923 a_fqxl(i,k,j) =a_fqxl(i,k,j) -a_fqx(i,k,j)
27924 a_Tmpv2 =a_fqx(i,k,j)
27926 a_ru(i,k,j) =a_ru(i,k,j) +0.5*(field(i,k,j) +field(i-1,k,j))*a_Tmpv2
27927 a_Tmpv1 =0.5*(ru(i,k,j))*a_Tmpv2
27928 a_field(i,k,j) =a_field(i,k,j) +a_Tmpv1
27929 a_field(i-1,k,j) =a_field(i-1,k,j) +a_Tmpv1
27930 a_Tmpv2 =a_fqxl(i,k,j)
27932 a_vel =a_vel +flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)*a_Tmpv2
27933 a_Tmpv1 =vel*a_Tmpv2
27934 a_cr =a_cr +Diff_flux_upwind(field_old(i-1,k,j),0.0,field_old(i,k,j) &
27935 ,0.0,cr,1.0)*a_Tmpv1
27936 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
27937 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
27938 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
27939 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
27944 a_ru(i,k,j) =a_ru(i,k,j) +a_vel
27953 IF( degrade_xs ) THEN
27955 DO i =i_start_f-1, i_start, -1
27957 IF(i == ids+2) THEN
27964 qmax(i,k,j) = Tmpv708(k,j)
27965 qmin(i,k,j) = Tmpv709(k,j)
27967 a_Tmpv1 =a_qmax(i,k,j)
27969 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i-1,k,j) &
27971 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 -sign(1.0, qmax(i,k,j) &
27972 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
27973 a_Tmpv1 =a_qmin(i,k,j)
27975 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i-1,k,j) &
27977 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 +sign(1.0, qmin(i,k,j) &
27978 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
27982 qmax(i-1,k,j) = Tmpv710(k,j)
27983 qmin(i-1,k,j) = Tmpv711(k,j)
27985 a_Tmpv1 =a_qmin(i-1,k,j)
27986 a_qmin(i-1,k,j) =0.0
27987 a_qmin(i-1,k,j) =a_qmin(i-1,k,j) +(1.0 -sign(1.0, qmin(i-1,k,j) &
27988 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27989 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i-1,k,j) &
27990 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27991 a_Tmpv1 =a_qmax(i-1,k,j)
27992 a_qmax(i-1,k,j) =0.0
27993 a_qmax(i-1,k,j) =a_qmax(i-1,k,j) +(1.0 +sign(1.0, qmax(i-1,k,j) &
27994 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
27995 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i-1,k,j) &
27996 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28000 a_fqxl(i,k,j) =a_fqxl(i,k,j) -a_fqx(i,k,j)
28001 a_Tmpv2 =a_fqx(i,k,j)
28003 a_vel =a_vel +flux3(field(i-2,k,j),field(i-1,k,j),field(i,k,j),field(i+1,k,j),vel)*a_Tmpv2
28004 a_Tmpv1 =vel*a_Tmpv2
28005 a_vel =a_vel +Diff_flux3(field(i-2,k,j),0.0,field(i-1,k,j),0.0,field(i,k,j) &
28006 ,0.0,field(i+1,k,j),0.0,vel,1.0)*a_Tmpv1
28007 a_field(i+1,k,j) =a_field(i+1,k,j) +Diff_flux3(field(i-2,k,j),0.0,field(i-1,k, &
28008 j),0.0,field(i,k,j),0.0,field(i+1,k,j),1.0,vel,0.0)*a_Tmpv1
28009 a_field(i,k,j) =a_field(i,k,j) +Diff_flux3(field(i-2,k,j),0.0,field(i-1,k,j) &
28010 ,0.0,field(i,k,j),1.0,field(i+1,k,j),0.0,vel,0.0)*a_Tmpv1
28011 a_field(i-1,k,j) =a_field(i-1,k,j) +Diff_flux3(field(i-2,k,j),0.0,field(i-1,k, &
28012 j),1.0,field(i,k,j),0.0,field(i+1,k,j),0.0,vel,0.0)*a_Tmpv1
28013 a_field(i-2,k,j) =a_field(i-2,k,j) +Diff_flux3(field(i-2,k,j),1.0,field(i-1,k, &
28014 j),0.0,field(i,k,j),0.0,field(i+1,k,j),0.0,vel,0.0)*a_Tmpv1
28016 a_Tmpv2 =a_fqxl(i,k,j)
28018 a_vel =a_vel +flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)*a_Tmpv2
28019 a_Tmpv1 =vel*a_Tmpv2
28020 a_cr =a_cr +Diff_flux_upwind(field_old(i-1,k,j),0.0,field_old(i,k,j) &
28021 ,0.0,cr,1.0)*a_Tmpv1
28022 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
28023 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
28024 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
28025 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
28030 a_ru(i,k,j) =a_ru(i,k,j) +a_vel
28036 IF(i == ids+1) THEN
28043 qmax(i,k,j) = Tmpv704(k,j)
28044 qmin(i,k,j) = Tmpv705(k,j)
28046 a_Tmpv1 =a_qmax(i,k,j)
28048 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i-1,k,j) &
28050 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 -sign(1.0, qmax(i,k,j) &
28051 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
28052 a_Tmpv1 =a_qmin(i,k,j)
28054 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i-1,k,j) &
28056 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 +sign(1.0, qmin(i,k,j) &
28057 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
28061 qmax(i-1,k,j) = Tmpv706(k,j)
28062 qmin(i-1,k,j) = Tmpv707(k,j)
28064 a_Tmpv1 =a_qmin(i-1,k,j)
28065 a_qmin(i-1,k,j) =0.0
28066 a_qmin(i-1,k,j) =a_qmin(i-1,k,j) +(1.0 -sign(1.0, qmin(i-1,k,j) &
28067 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28068 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i-1,k,j) &
28069 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28070 a_Tmpv1 =a_qmax(i-1,k,j)
28071 a_qmax(i-1,k,j) =0.0
28072 a_qmax(i-1,k,j) =a_qmax(i-1,k,j) +(1.0 +sign(1.0, qmax(i-1,k,j) &
28073 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28074 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i-1,k,j) &
28075 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28079 a_fqxl(i,k,j) =a_fqxl(i,k,j) -a_fqx(i,k,j)
28080 a_Tmpv2 =a_fqx(i,k,j)
28082 a_ru(i,k,j) =a_ru(i,k,j) +0.5*(field(i,k,j)+field(i-1,k,j))*a_Tmpv2
28083 a_Tmpv1 =0.5*(ru(i,k,j))*a_Tmpv2
28084 a_field(i,k,j) =a_field(i,k,j) +a_Tmpv1
28085 a_field(i-1,k,j) =a_field(i-1,k,j) +a_Tmpv1
28086 a_Tmpv2 =a_fqxl(i,k,j)
28088 a_vel =a_vel +flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)*a_Tmpv2
28089 a_Tmpv1 =vel*a_Tmpv2
28090 a_cr =a_cr +Diff_flux_upwind(field_old(i-1,k,j),0.0,field_old(i,k,j) &
28091 ,0.0,cr,1.0)*a_Tmpv1
28092 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
28093 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
28094 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
28095 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
28100 a_ru(i,k,j) =a_ru(i,k,j) +a_vel
28110 DO i =i_end_f, i_start_f, -1
28115 qmax(i,k,j) = Tmpv700(i,k,j)
28116 qmin(i,k,j) = Tmpv701(i,k,j)
28118 a_Tmpv1 =a_qmax(i,k,j)
28120 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i-1,k,j) &
28122 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 -sign(1.0, qmax(i,k,j) &
28123 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
28124 a_Tmpv1 =a_qmin(i,k,j)
28126 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i-1,k,j) &
28128 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +(1.0 +sign(1.0, qmin(i,k,j) &
28129 -field_old(i-1,k,j)))*0.5*1.0*a_Tmpv1
28133 qmax(i-1,k,j) = Tmpv702(i-1,k,j)
28134 qmin(i-1,k,j) = Tmpv703(i-1,k,j)
28136 a_Tmpv1 =a_qmin(i-1,k,j)
28137 a_qmin(i-1,k,j) =0.0
28138 a_qmin(i-1,k,j) =a_qmin(i-1,k,j) +(1.0 -sign(1.0, qmin(i-1,k,j) &
28139 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28140 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i-1,k,j) &
28141 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28142 a_Tmpv1 =a_qmax(i-1,k,j)
28143 a_qmax(i-1,k,j) =0.0
28144 a_qmax(i-1,k,j) =a_qmax(i-1,k,j) +(1.0 +sign(1.0, qmax(i-1,k,j) &
28145 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28146 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i-1,k,j) &
28147 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28151 a_fqxl(i,k,j) =a_fqxl(i,k,j) -a_fqx(i,k,j)
28152 a_Tmpv2 =a_fqx(i,k,j)
28154 a_vel =a_vel +flux5(field(i-3,k,j),field(i-2,k,j),field(i-1,k,j),field(i,k,j) &
28155 ,field(i+1,k,j),field(i+2,k,j),vel)*a_Tmpv2
28156 a_Tmpv1 =vel*a_Tmpv2
28157 a_vel =a_vel +Diff_flux5(field(i-3,k,j),0.0,field(i-2,k,j),0.0,field(i-1,k,j) &
28158 ,0.0,field(i,k,j),0.0,field(i+1,k,j),0.0,field(i+2,k,j),0.0,vel,1.0)*a_Tmpv1
28159 a_field(i+2,k,j) =a_field(i+2,k,j) +Diff_flux5(field(i-3,k,j),0.0,field(i-2,k, &
28160 j),0.0,field(i-1,k,j),0.0,field(i,k,j),0.0,field(i+1,k,j),0.0,field(i+2,k,j) &
28161 ,1.0,vel,0.0)*a_Tmpv1
28162 a_field(i+1,k,j) =a_field(i+1,k,j) +Diff_flux5(field(i-3,k,j),0.0,field(i-2,k, &
28163 j),0.0,field(i-1,k,j),0.0,field(i,k,j),0.0,field(i+1,k,j),1.0,field(i+2,k,j) &
28164 ,0.0,vel,0.0)*a_Tmpv1
28165 a_field(i,k,j) =a_field(i,k,j) +Diff_flux5(field(i-3,k,j),0.0,field(i-2,k,j) &
28166 ,0.0,field(i-1,k,j),0.0,field(i,k,j),1.0,field(i+1,k,j),0.0,field(i+2,k,j) &
28167 ,0.0,vel,0.0)*a_Tmpv1
28168 a_field(i-1,k,j) =a_field(i-1,k,j) +Diff_flux5(field(i-3,k,j),0.0,field(i-2,k, &
28169 j),0.0,field(i-1,k,j),1.0,field(i,k,j),0.0,field(i+1,k,j),0.0,field(i+2,k,j) &
28170 ,0.0,vel,0.0)*a_Tmpv1
28171 a_field(i-2,k,j) =a_field(i-2,k,j) +Diff_flux5(field(i-3,k,j),0.0,field(i-2,k, &
28172 j),1.0,field(i-1,k,j),0.0,field(i,k,j),0.0,field(i+1,k,j),0.0,field(i+2,k,j) &
28173 ,0.0,vel,0.0)*a_Tmpv1
28174 a_field(i-3,k,j) =a_field(i-3,k,j) +Diff_flux5(field(i-3,k,j),1.0,field(i-2,k, &
28175 j),0.0,field(i-1,k,j),0.0,field(i,k,j),0.0,field(i+1,k,j),0.0,field(i+2,k,j) &
28176 ,0.0,vel,0.0)*a_Tmpv1
28178 a_Tmpv2 =a_fqxl(i,k,j)
28180 a_vel =a_vel +flux_upwind(field_old(i-1,k,j),field_old(i,k,j),cr)*a_Tmpv2
28181 a_Tmpv1 =vel*a_Tmpv2
28182 a_cr =a_cr +Diff_flux_upwind(field_old(i-1,k,j),0.0,field_old(i,k,j) &
28183 ,0.0,cr,1.0)*a_Tmpv1
28184 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
28185 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
28186 a_field_old(i-1,k,j) =a_field_old(i-1,k,j) +Diff_flux_upwind(field_old(i-1,k,j) &
28187 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
28192 a_ru(i,k,j) =a_ru(i,k,j) +a_vel
28201 i_end = MIN(ite,ide-1)+1
28203 j_end = MIN(jte,jde-1)+1
28204 j_start_f = j_start
28206 IF(degrade_xs) i_start = MAX(its-1,ids)
28207 IF(degrade_xe) i_end = MIN(ite+1,ide-1)
28208 IF(degrade_ys) then
28209 j_start = MAX(jts-1,jds+1)
28212 IF(degrade_ye) then
28213 j_end = MIN(jte+1,jde-2)
28217 DO j =j_end+1, j_start, -1
28219 IF( (j >= j_start_f ) .and. (j <= j_end_f) ) THEN
28222 DO i =i_end, i_start, -1
28227 qmax(i,k,j) = Tmpv600(i,k,j)
28228 qmin(i,k,j) = Tmpv601(i,k,j)
28230 a_Tmpv1 =a_qmax(i,k,j)
28232 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i,k,j-1) &
28234 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 -sign(1.0, qmax(i,k,j) &
28235 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28236 a_Tmpv1 =a_qmin(i,k,j)
28238 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i,k,j-1) &
28240 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 +sign(1.0, qmin(i,k,j) &
28241 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28245 qmax(i,k,j-1) = Tmpv602(i,k,j-1)
28246 qmin(i,k,j-1) = Tmpv603(i,k,j-1)
28248 a_Tmpv1 =a_qmin(i,k,j-1)
28249 a_qmin(i,k,j-1) =0.0
28250 a_qmin(i,k,j-1) =a_qmin(i,k,j-1) +(1.0 -sign(1.0, qmin(i,k,j-1) &
28251 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28252 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i,k,j-1) &
28253 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28254 a_Tmpv1 =a_qmax(i,k,j-1)
28255 a_qmax(i,k,j-1) =0.0
28256 a_qmax(i,k,j-1) =a_qmax(i,k,j-1) +(1.0 +sign(1.0, qmax(i,k,j-1) &
28257 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28258 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i,k,j-1) &
28259 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28263 a_fqyl(i,k,j) =a_fqyl(i,k,j) -a_fqy(i,k,j)
28264 a_Tmpv2 =a_fqy(i,k,j)
28266 a_vel =a_vel +flux5(field(i,k,j-3),field(i,k,j-2),field(i,k,j-1),field(i,k,j) &
28267 ,field(i,k,j+1),field(i,k,j+2),vel)*a_Tmpv2
28268 a_Tmpv1 =vel*a_Tmpv2
28269 a_vel =a_vel +Diff_flux5(field(i,k,j-3),0.0,field(i,k,j-2),0.0,field(i,k,j-1) &
28270 ,0.0,field(i,k,j),0.0,field(i,k,j+1),0.0,field(i,k,j+2),0.0,vel,1.0)*a_Tmpv1
28271 a_field(i,k,j+2) =a_field(i,k,j+2) +Diff_flux5(field(i,k,j-3),0.0,field(i,k,j- &
28272 2),0.0,field(i,k,j-1),0.0,field(i,k,j),0.0,field(i,k,j+1),0.0,field(i,k,j+2) &
28273 ,1.0,vel,0.0)*a_Tmpv1
28274 a_field(i,k,j+1) =a_field(i,k,j+1) +Diff_flux5(field(i,k,j-3),0.0,field(i,k,j- &
28275 2),0.0,field(i,k,j-1),0.0,field(i,k,j),0.0,field(i,k,j+1),1.0,field(i,k,j+2) &
28276 ,0.0,vel,0.0)*a_Tmpv1
28277 a_field(i,k,j) =a_field(i,k,j) +Diff_flux5(field(i,k,j-3),0.0,field(i,k,j-2) &
28278 ,0.0,field(i,k,j-1),0.0,field(i,k,j),1.0,field(i,k,j+1),0.0,field(i,k,j+2) &
28279 ,0.0,vel,0.0)*a_Tmpv1
28280 a_field(i,k,j-1) =a_field(i,k,j-1) +Diff_flux5(field(i,k,j-3),0.0,field(i,k,j- &
28281 2),0.0,field(i,k,j-1),1.0,field(i,k,j),0.0,field(i,k,j+1),0.0,field(i,k,j+2) &
28282 ,0.0,vel,0.0)*a_Tmpv1
28283 a_field(i,k,j-2) =a_field(i,k,j-2) +Diff_flux5(field(i,k,j-3),0.0,field(i,k,j- &
28284 2),1.0,field(i,k,j-1),0.0,field(i,k,j),0.0,field(i,k,j+1),0.0,field(i,k,j+2) &
28285 ,0.0,vel,0.0)*a_Tmpv1
28286 a_field(i,k,j-3) =a_field(i,k,j-3) +Diff_flux5(field(i,k,j-3),1.0,field(i,k,j- &
28287 2),0.0,field(i,k,j-1),0.0,field(i,k,j),0.0,field(i,k,j+1),0.0,field(i,k,j+2) &
28288 ,0.0,vel,0.0)*a_Tmpv1
28290 a_Tmpv2 =a_fqyl(i,k,j)
28292 a_vel =a_vel +flux_upwind(field_old(i,k,j-1),field_old(i,k,j),vel)*a_Tmpv2
28293 a_Tmpv1 =vel*a_Tmpv2
28294 a_vel =a_vel +Diff_flux_upwind(field_old(i,k,j-1),0.0,field_old(i,k,j) &
28295 ,0.0,vel,1.0)*a_Tmpv1
28296 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i,k,j-1) &
28297 ,0.0,field_old(i,k,j),1.0,vel,0.0)*a_Tmpv1
28298 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +Diff_flux_upwind(field_old(i,k,j-1) &
28299 ,1.0,field_old(i,k,j),0.0,vel,0.0)*a_Tmpv1
28304 a_rv(i,k,j) =a_rv(i,k,j) +a_vel
28309 ELSE IF( j == jds+1 ) THEN
28312 DO i =i_end, i_start, -1
28317 qmax(i,k,j) = Tmpv604(i,k)
28318 qmin(i,k,j) = Tmpv605(i,k)
28320 a_Tmpv1 =a_qmax(i,k,j)
28322 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i,k,j-1) &
28324 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 -sign(1.0, qmax(i,k,j) &
28325 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28326 a_Tmpv1 =a_qmin(i,k,j)
28328 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i,k,j-1) &
28330 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 +sign(1.0, qmin(i,k,j) &
28331 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28335 qmax(i,k,j-1) = Tmpv606(i,k)
28336 qmin(i,k,j-1) = Tmpv607(i,k)
28338 a_Tmpv1 =a_qmin(i,k,j-1)
28339 a_qmin(i,k,j-1) =0.0
28340 a_qmin(i,k,j-1) =a_qmin(i,k,j-1) +(1.0 -sign(1.0, qmin(i,k,j-1) &
28341 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28342 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i,k,j-1) &
28343 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28344 a_Tmpv1 =a_qmax(i,k,j-1)
28345 a_qmax(i,k,j-1) =0.0
28346 a_qmax(i,k,j-1) =a_qmax(i,k,j-1) +(1.0 +sign(1.0, qmax(i,k,j-1) &
28347 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28348 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i,k,j-1) &
28349 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28353 a_fqyl(i,k,j) =a_fqyl(i,k,j) -a_fqy(i,k,j)
28354 a_Tmpv2 =a_fqy(i,k,j)
28356 a_rv(i,k,j) =a_rv(i,k,j) +0.5*(field(i,k,j) +field(i,k,j-1))*a_Tmpv2
28357 a_Tmpv1 =0.5*rv(i,k,j)*a_Tmpv2
28358 a_field(i,k,j) =a_field(i,k,j) +a_Tmpv1
28359 a_field(i,k,j-1) =a_field(i,k,j-1) +a_Tmpv1
28360 a_Tmpv2 =a_fqyl(i,k,j)
28362 a_vel =a_vel +flux_upwind(field_old(i,k,j-1),field_old(i,k,j),cr)*a_Tmpv2
28363 a_Tmpv1 =vel*a_Tmpv2
28364 a_cr =a_cr +Diff_flux_upwind(field_old(i,k,j-1),0.0,field_old(i,k,j) &
28365 ,0.0,cr,1.0)*a_Tmpv1
28366 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i,k,j-1) &
28367 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
28368 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +Diff_flux_upwind(field_old(i,k,j-1) &
28369 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
28374 a_rv(i,k,j) =a_rv(i,k,j) +a_vel
28379 ELSE IF( j == jds+2 ) THEN
28382 DO i =i_end, i_start, -1
28387 qmax(i,k,j) = Tmpv608(i,k)
28388 qmin(i,k,j) = Tmpv609(i,k)
28390 a_Tmpv1 =a_qmax(i,k,j)
28392 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i,k,j-1) &
28394 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 -sign(1.0, qmax(i,k,j) &
28395 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28396 a_Tmpv1 =a_qmin(i,k,j)
28398 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i,k,j-1) &
28400 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 +sign(1.0, qmin(i,k,j) &
28401 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28405 qmax(i,k,j-1) = Tmpv6010(i,k)
28406 qmin(i,k,j-1) = Tmpv6011(i,k)
28408 a_Tmpv1 =a_qmin(i,k,j-1)
28409 a_qmin(i,k,j-1) =0.0
28410 a_qmin(i,k,j-1) =a_qmin(i,k,j-1) +(1.0 -sign(1.0, qmin(i,k,j-1) &
28411 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28412 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i,k,j-1) &
28413 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28414 a_Tmpv1 =a_qmax(i,k,j-1)
28415 a_qmax(i,k,j-1) =0.0
28416 a_qmax(i,k,j-1) =a_qmax(i,k,j-1) +(1.0 +sign(1.0, qmax(i,k,j-1) &
28417 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28418 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i,k,j-1) &
28419 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28423 a_fqyl(i,k,j) =a_fqyl(i,k,j) -a_fqy(i,k,j)
28424 a_Tmpv2 =a_fqy(i,k,j)
28426 a_vel =a_vel +flux3(field(i,k,j-2),field(i,k,j-1),field(i,k,j),field(i,k,j+1),vel)*a_Tmpv2
28427 a_Tmpv1 =vel*a_Tmpv2
28428 a_vel =a_vel +Diff_flux3(field(i,k,j-2),0.0,field(i,k,j-1),0.0,field(i,k,j) &
28429 ,0.0,field(i,k,j+1),0.0,vel,1.0)*a_Tmpv1
28430 a_field(i,k,j+1) =a_field(i,k,j+1) +Diff_flux3(field(i,k,j-2),0.0,field(i,k,j- &
28431 1),0.0,field(i,k,j),0.0,field(i,k,j+1),1.0,vel,0.0)*a_Tmpv1
28432 a_field(i,k,j) =a_field(i,k,j) +Diff_flux3(field(i,k,j-2),0.0,field(i,k,j-1) &
28433 ,0.0,field(i,k,j),1.0,field(i,k,j+1),0.0,vel,0.0)*a_Tmpv1
28434 a_field(i,k,j-1) =a_field(i,k,j-1) +Diff_flux3(field(i,k,j-2),0.0,field(i,k,j- &
28435 1),1.0,field(i,k,j),0.0,field(i,k,j+1),0.0,vel,0.0)*a_Tmpv1
28436 a_field(i,k,j-2) =a_field(i,k,j-2) +Diff_flux3(field(i,k,j-2),1.0,field(i,k,j- &
28437 1),0.0,field(i,k,j),0.0,field(i,k,j+1),0.0,vel,0.0)*a_Tmpv1
28439 a_Tmpv2 =a_fqyl(i,k,j)
28441 a_vel =a_vel +flux_upwind(field_old(i,k,j-1),field_old(i,k,j),cr)*a_Tmpv2
28442 a_Tmpv1 =vel*a_Tmpv2
28443 a_cr =a_cr +Diff_flux_upwind(field_old(i,k,j-1),0.0,field_old(i,k,j) &
28444 ,0.0,cr,1.0)*a_Tmpv1
28445 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i,k,j-1) &
28446 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
28447 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +Diff_flux_upwind(field_old(i,k,j-1) &
28448 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
28453 a_rv(i,k,j) =a_rv(i,k,j) +a_vel
28458 ELSE IF( j == jde-1 ) THEN
28461 DO i =i_end, i_start, -1
28466 qmax(i,k,j) = Tmpv6012(i,k)
28467 qmin(i,k,j) = Tmpv6013(i,k)
28469 a_Tmpv1 =a_qmax(i,k,j)
28471 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i,k,j-1) &
28473 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 -sign(1.0, qmax(i,k,j) &
28474 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28475 a_Tmpv1 =a_qmin(i,k,j)
28477 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i,k,j-1) &
28479 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 +sign(1.0, qmin(i,k,j) &
28480 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28484 qmax(i,k,j-1) = Tmpv6014(i,k)
28485 qmin(i,k,j-1) = Tmpv6015(i,k)
28487 a_Tmpv1 =a_qmin(i,k,j-1)
28488 a_qmin(i,k,j-1) =0.0
28489 a_qmin(i,k,j-1) =a_qmin(i,k,j-1) +(1.0 -sign(1.0, qmin(i,k,j-1) &
28490 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28491 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i,k,j-1) &
28492 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28493 a_Tmpv1 =a_qmax(i,k,j-1)
28494 a_qmax(i,k,j-1) =0.0
28495 a_qmax(i,k,j-1) =a_qmax(i,k,j-1) +(1.0 +sign(1.0, qmax(i,k,j-1) &
28496 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28497 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i,k,j-1) &
28498 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28502 a_fqyl(i,k,j) =a_fqyl(i,k,j) -a_fqy(i,k,j)
28503 a_Tmpv2 =a_fqy(i,k,j)
28505 a_rv(i,k,j) =a_rv(i,k,j) +0.5*(field(i,k,j) +field(i,k,j-1))*a_Tmpv2
28506 a_Tmpv1 =0.5*rv(i,k,j)*a_Tmpv2
28507 a_field(i,k,j) =a_field(i,k,j) +a_Tmpv1
28508 a_field(i,k,j-1) =a_field(i,k,j-1) +a_Tmpv1
28509 a_Tmpv2 =a_fqyl(i,k,j)
28511 a_vel =a_vel +flux_upwind(field_old(i,k,j-1),field_old(i,k,j),cr)*a_Tmpv2
28512 a_Tmpv1 =vel*a_Tmpv2
28513 a_cr =a_cr +Diff_flux_upwind(field_old(i,k,j-1),0.0,field_old(i,k,j) &
28514 ,0.0,cr,1.0)*a_Tmpv1
28515 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i,k,j-1) &
28516 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
28517 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +Diff_flux_upwind(field_old(i,k,j-1) &
28518 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
28523 a_rv(i,k,j) =a_rv(i,k,j) +a_vel
28529 ELSE IF( j == jde-2 ) THEN
28532 DO i =i_end, i_start, -1
28537 qmax(i,k,j) = Tmpv6016(i,k)
28538 qmin(i,k,j) = Tmpv6017(i,k)
28540 a_Tmpv1 =a_qmax(i,k,j)
28542 a_qmax(i,k,j) =a_qmax(i,k,j) +(1.0 +sign(1.0, qmax(i,k,j) -field_old(i,k,j-1) &
28544 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 -sign(1.0, qmax(i,k,j) &
28545 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28546 a_Tmpv1 =a_qmin(i,k,j)
28548 a_qmin(i,k,j) =a_qmin(i,k,j) +(1.0 -sign(1.0, qmin(i,k,j) -field_old(i,k,j-1) &
28550 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +(1.0 +sign(1.0, qmin(i,k,j) &
28551 -field_old(i,k,j-1)))*0.5*1.0*a_Tmpv1
28555 qmax(i,k,j-1) = Tmpv6018(i,k)
28556 qmin(i,k,j-1) = Tmpv6019(i,k)
28558 a_Tmpv1 =a_qmin(i,k,j-1)
28559 a_qmin(i,k,j-1) =0.0
28560 a_qmin(i,k,j-1) =a_qmin(i,k,j-1) +(1.0 -sign(1.0, qmin(i,k,j-1) &
28561 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28562 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 +sign(1.0, qmin(i,k,j-1) &
28563 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28564 a_Tmpv1 =a_qmax(i,k,j-1)
28565 a_qmax(i,k,j-1) =0.0
28566 a_qmax(i,k,j-1) =a_qmax(i,k,j-1) +(1.0 +sign(1.0, qmax(i,k,j-1) &
28567 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28568 a_field_old(i,k,j) =a_field_old(i,k,j) +(1.0 -sign(1.0, qmax(i,k,j-1) &
28569 -field_old(i,k,j)))*0.5*1.0*a_Tmpv1
28573 a_fqyl(i,k,j) =a_fqyl(i,k,j) -a_fqy(i,k,j)
28574 a_Tmpv2 =a_fqy(i,k,j)
28576 a_vel =a_vel +flux3(field(i,k,j-2),field(i,k,j-1),field(i,k,j),field(i,k,j+1),vel)*a_Tmpv2
28577 a_Tmpv1 =vel*a_Tmpv2
28578 a_vel =a_vel +Diff_flux3(field(i,k,j-2),0.0,field(i,k,j-1),0.0,field(i,k,j) &
28579 ,0.0,field(i,k,j+1),0.0,vel,1.0)*a_Tmpv1
28580 a_field(i,k,j+1) =a_field(i,k,j+1) +Diff_flux3(field(i,k,j-2),0.0,field(i,k,j- &
28581 1),0.0,field(i,k,j),0.0,field(i,k,j+1),1.0,vel,0.0)*a_Tmpv1
28582 a_field(i,k,j) =a_field(i,k,j) +Diff_flux3(field(i,k,j-2),0.0,field(i,k,j-1) &
28583 ,0.0,field(i,k,j),1.0,field(i,k,j+1),0.0,vel,0.0)*a_Tmpv1
28584 a_field(i,k,j-1) =a_field(i,k,j-1) +Diff_flux3(field(i,k,j-2),0.0,field(i,k,j- &
28585 1),1.0,field(i,k,j),0.0,field(i,k,j+1),0.0,vel,0.0)*a_Tmpv1
28586 a_field(i,k,j-2) =a_field(i,k,j-2) +Diff_flux3(field(i,k,j-2),1.0,field(i,k,j- &
28587 1),0.0,field(i,k,j),0.0,field(i,k,j+1),0.0,vel,0.0)*a_Tmpv1
28589 a_Tmpv2 =a_fqyl(i,k,j)
28591 a_vel =a_vel +flux_upwind(field_old(i,k,j-1),field_old(i,k,j),cr)*a_Tmpv2
28592 a_Tmpv1 =vel*a_Tmpv2
28593 a_cr =a_cr +Diff_flux_upwind(field_old(i,k,j-1),0.0,field_old(i,k,j) &
28594 ,0.0,cr,1.0)*a_Tmpv1
28595 a_field_old(i,k,j) =a_field_old(i,k,j) +Diff_flux_upwind(field_old(i,k,j-1) &
28596 ,0.0,field_old(i,k,j),1.0,cr,0.0)*a_Tmpv1
28597 a_field_old(i,k,j-1) =a_field_old(i,k,j-1) +Diff_flux_upwind(field_old(i,k,j-1) &
28598 ,1.0,field_old(i,k,j),0.0,cr,0.0)*a_Tmpv1
28603 a_rv(i,k,j) =a_rv(i,k,j) +a_vel
28615 DO j =jte+2, jts-2, -1
28617 DO i =ite+2, its-2, -1
28618 a_field_old(i,k,j) =a_field_old(i,k,j) +a_qmax(i,k,j)
28619 a_field_old(i,k,j) =a_field_old(i,k,j) +a_qmin(i,k,j)
28624 END SUBROUTINE a_advect_scalar_mono
28626 ! Generated by TAPENADE (INRIA, Ecuador team)
28627 ! Tapenade 3.12 (r6213) - 13 Oct 2016 10:54
28629 ! Differentiation of advect_scalar_weno in reverse (adjoint) mode:
28630 ! gradient of useful results: rom field tendency ru rv field_old
28631 ! with respect to varying inputs: rom field tendency ru rv field_old
28632 ! RW status of diff variables: rom:incr field:incr tendency:in-out
28633 ! ru:incr rv:incr field_old:incr
28634 SUBROUTINE A_ADVECT_SCALAR_WENO(field, fieldb, field_old, field_oldb, &
28635 & tendency, tendencyb, ru, rub, rv, rvb, rom, romb, mut, time_step, &
28636 & config_flags, msfux, msfuy, msfvx, msfvy, msftx, msfty, fzm, fzp, rdx&
28637 & , rdy, rdzw, ids, ide, jds, jde, kds, kde, ims, ime, jms, jme, kms, &
28638 & kme, its, ite, jts, jte, kts, kte)
28641 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
28642 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
28643 & jme, kms, kme, its, ite, jts, jte, kts, kte
28644 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: field, &
28645 & field_old, ru, rv, rom
28646 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: fieldb, field_oldb, rub&
28648 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut
28649 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
28650 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendencyb
28651 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
28652 & msfvy, msftx, msfty
28653 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzw
28654 REAL, INTENT(IN) :: rdx, rdy
28655 INTEGER, INTENT(IN) :: time_step
28657 INTEGER :: i, j, k, itf, jtf, ktf
28658 INTEGER :: i_start, i_end, j_start, j_end
28659 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
28660 INTEGER :: jmin, jmax, jp, jm, imin, imax
28661 INTEGER, PARAMETER :: is=0, js=0, ks=0
28662 REAL :: mrdx, mrdy, ub, vb, vw
28664 REAL, DIMENSION(its:ite, kts:kte) :: vflux
28665 REAL, DIMENSION(its:ite, kts:kte) :: vfluxb
28666 REAL, DIMENSION(its-is:ite+1, kts:kte) :: fqx
28667 REAL, DIMENSION(its-is:ite+1, kts:kte) :: fqxb
28668 ! REAL, DIMENSION( its:ite+1, kts:kte ) :: fqx
28669 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqy
28670 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqyb
28671 INTEGER :: horz_order, vert_order
28672 LOGICAL :: degrade_xs, degrade_ys
28673 LOGICAL :: degrade_xe, degrade_ye
28674 INTEGER :: jp1, jp0, jtmp
28676 REAL :: ue, uw, vs, vn, wb, wt
28677 REAL, PARAMETER :: f30=7./12., f31=1./12.
28678 REAL, PARAMETER :: f50=37./60., f51=2./15., f52=1./60.
28680 REAL :: qim2, qim1, qi, qip1, qip2
28681 REAL :: qim2b, qim1b, qib, qip1b, qip2b
28682 DOUBLE PRECISION :: beta0, beta1, beta2, f0, f1, f2, wi0, wi1, wi2, &
28684 DOUBLE PRECISION :: beta0b, beta1b, beta2b, f0b, f1b, f2b, wi0b, wi1b&
28686 DOUBLE PRECISION, PARAMETER :: gi0=1.d0/10.d0, gi1=6.d0/10.d0, gi2=&
28687 & 3.d0/10.d0, eps=1.0d-28
28688 INTEGER, PARAMETER :: pw=2
28689 ! definition of flux operators, 3rd, 4th, 5th or 6th order
28690 REAL :: flux3, flux4, flux5, flux6
28691 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel
28693 LOGICAL :: specified
28694 DOUBLE PRECISION :: temp
28695 DOUBLE PRECISION :: temp0
28696 DOUBLE PRECISION :: temp1
28697 DOUBLE PRECISION :: tempb
28698 DOUBLE PRECISION :: tempb0
28719 DOUBLE PRECISION :: temp8
28720 DOUBLE PRECISION :: temp9
28721 DOUBLE PRECISION :: temp10
28722 DOUBLE PRECISION :: tempb15
28723 DOUBLE PRECISION :: tempb16
28752 DOUBLE PRECISION :: temp17
28753 DOUBLE PRECISION :: temp18
28754 DOUBLE PRECISION :: temp19
28755 DOUBLE PRECISION :: tempb39
28756 DOUBLE PRECISION :: tempb40
28780 INTEGER :: ad_from0
28782 INTEGER :: ad_from1
28784 INTEGER :: ad_from2
28786 INTEGER :: ad_from3
28788 INTEGER :: ad_from4
28790 INTEGER :: ad_from5
28792 INTEGER :: ad_from6
28794 INTEGER :: ad_from7
28796 INTEGER :: ad_from8
28798 INTEGER :: ad_from9
28800 INTEGER :: ad_from10
28802 INTEGER :: ad_from11
28804 INTEGER :: ad_from12
28806 INTEGER :: ad_from13
28808 INTEGER :: ad_from14
28810 INTEGER :: ad_from15
28812 INTEGER :: ad_from16
28814 INTEGER :: ad_from17
28816 INTEGER :: ad_from18
28818 specified = .false.
28819 IF (config_flags%specified .OR. config_flags%nested) specified = &
28821 IF (kte .GT. kde - 1) THEN
28826 ! config_flags%h_sca_adv_order
28828 ! config_flags%v_sca_adv_order
28829 ! begin with horizontal flux divergence
28830 ! here is the choice of flux operators
28831 IF (horz_order .EQ. 5) THEN
28832 ! determine boundary mods for flux operators
28833 ! We degrade the flux operators from 3rd/4th order
28834 ! to second order one gridpoint in from the boundaries for
28835 ! all boundary conditions except periodic and symmetry - these
28836 ! conditions have boundary zone data fill for correct application
28837 ! of the higher order flux stencils
28838 degrade_xs = .true.
28839 degrade_xe = .true.
28840 degrade_ys = .true.
28841 degrade_ye = .true.
28842 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. &
28843 & its .GT. ids + 3) degrade_xs = .false.
28844 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. &
28845 & ite .LT. ide - 3) degrade_xe = .false.
28846 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. &
28847 & jts .GT. jds + 3) degrade_ys = .false.
28848 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. &
28849 & jte .LT. jde - 4) degrade_ye = .false.
28850 IF (kte .GT. kde - 1) THEN
28856 IF (ite .GT. ide - 1) THEN
28862 IF (is .EQ. 1) THEN
28865 IF (config_flags%open_xs .OR. specified) THEN
28866 IF (ids + 1 .LT. its) THEN
28867 CALL PUSHCONTROL1B(1)
28870 CALL PUSHCONTROL1B(1)
28874 CALL PUSHCONTROL1B(0)
28876 IF (config_flags%open_xe .OR. specified) THEN
28877 IF (ide - 1 .GT. ite) THEN
28878 CALL PUSHCONTROL1B(1)
28881 CALL PUSHCONTROL1B(1)
28885 CALL PUSHCONTROL1B(0)
28887 IF (config_flags%periodic_x) i_start = its
28888 IF (config_flags%periodic_x) THEN
28889 CALL PUSHCONTROL1B(1)
28892 CALL PUSHCONTROL1B(1)
28895 CALL PUSHCONTROL1B(0)
28898 IF (jte .GT. jde - 1) THEN
28903 ! higher order flux has a 5 or 7 point stencil, so compute
28904 ! bounds so we can switch to second order flux close to the boundary
28905 j_start_f = j_start
28906 j_end_f = j_end + 1
28907 IF (degrade_ys) THEN
28908 IF (jts .LT. jds + 1) THEN
28909 CALL PUSHCONTROL1B(0)
28912 CALL PUSHCONTROL1B(0)
28915 j_start_f = jds + 3
28917 CALL PUSHCONTROL1B(1)
28919 IF (degrade_ye) THEN
28920 IF (jte .GT. jde - 2) THEN
28921 CALL PUSHCONTROL1B(0)
28924 CALL PUSHCONTROL1B(0)
28929 CALL PUSHCONTROL1B(1)
28931 IF (config_flags%polar) THEN
28932 IF (jte .GT. jde - 1) THEN
28933 CALL PUSHCONTROL1B(1)
28936 CALL PUSHCONTROL1B(1)
28940 CALL PUSHCONTROL1B(0)
28942 ! compute fluxes, 5th or 6th order
28945 ad_from10 = j_start
28946 j_loop_y_flux_5:DO j=ad_from10,j_end+1
28947 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
28953 vel = 0.5*(rv(i, k, j)+rv(i-is, k-ks, j-js))
28954 IF (vel*SIGN(1, time_step) .GE. 0.0) THEN
28955 CALL PUSHREAL8(qip2)
28956 qip2 = field(i, k, j+1)
28957 CALL PUSHREAL8(qip1)
28958 qip1 = field(i, k, j)
28960 qi = field(i, k, j-1)
28961 CALL PUSHREAL8(qim1)
28962 qim1 = field(i, k, j-2)
28963 CALL PUSHREAL8(qim2)
28964 qim2 = field(i, k, j-3)
28965 CALL PUSHCONTROL1B(0)
28967 CALL PUSHREAL8(qip2)
28968 qip2 = field(i, k, j-2)
28969 CALL PUSHREAL8(qip1)
28970 qip1 = field(i, k, j-1)
28972 qi = field(i, k, j)
28973 CALL PUSHREAL8(qim1)
28974 qim1 = field(i, k, j+1)
28975 CALL PUSHREAL8(qim2)
28976 qim2 = field(i, k, j+2)
28977 CALL PUSHCONTROL1B(1)
28980 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
28982 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
28984 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
28985 CALL PUSHREAL8(beta0)
28986 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+&
28988 CALL PUSHREAL8(beta1)
28989 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
28990 CALL PUSHREAL8(beta2)
28991 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+&
28994 CALL PUSHINTEGER4(i - 1)
28995 CALL PUSHINTEGER4(ad_from)
28997 CALL PUSHCONTROL3B(0)
28998 ELSE IF (j .EQ. jds + 1) THEN
28999 ! fqy( i, k, jp1 ) = vel*flux5( &
29000 ! field(i,k,j-3), field(i,k,j-2), field(i,k,j-1), &
29001 ! field(i,k,j ), field(i,k,j+1), field(i,k,j+2), vel )
29002 ! 2nd order flux next to south boundary
29006 CALL PUSHINTEGER4(i - 1)
29007 CALL PUSHINTEGER4(ad_from0)
29009 CALL PUSHCONTROL3B(1)
29010 ELSE IF (j .EQ. jds + 2) THEN
29011 ! third of 4th order flux 2 in from south boundary
29015 CALL PUSHINTEGER4(i - 1)
29016 CALL PUSHINTEGER4(ad_from1)
29018 CALL PUSHCONTROL3B(2)
29019 ELSE IF (j .EQ. jde - 1) THEN
29020 ! 2nd order flux next to north boundary
29024 CALL PUSHINTEGER4(i - 1)
29025 CALL PUSHINTEGER4(ad_from2)
29027 CALL PUSHCONTROL3B(3)
29028 ELSE IF (j .EQ. jde - 2) THEN
29029 ! 3rd or 4th order flux 2 in from north boundary
29033 CALL PUSHINTEGER4(i - 1)
29034 CALL PUSHINTEGER4(ad_from3)
29036 CALL PUSHCONTROL3B(4)
29038 CALL PUSHCONTROL3B(5)
29040 ! y flux-divergence into tendency
29041 IF (is .EQ. 0) THEN
29042 ! Comments on polar boundary conditions
29043 ! Same process as for advect_u - tendencies run from jds to jde-1
29044 ! (latitudes are as for u grid, longitudes are displaced)
29045 ! Therefore: flow is only from one side for points next to poles
29046 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
29050 CALL PUSHINTEGER4(i - 1)
29051 CALL PUSHINTEGER4(ad_from4)
29053 CALL PUSHCONTROL4B(0)
29054 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
29058 CALL PUSHINTEGER4(i - 1)
29059 CALL PUSHINTEGER4(ad_from5)
29061 CALL PUSHCONTROL4B(1)
29062 ELSE IF (j .GT. j_start) THEN
29067 CALL PUSHINTEGER4(i - 1)
29068 CALL PUSHINTEGER4(ad_from6)
29070 CALL PUSHCONTROL4B(2)
29072 CALL PUSHCONTROL4B(3)
29074 ELSE IF (is .EQ. 1) THEN
29075 ! (j > j_start) will miss the u(,,jds) tendency
29076 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
29080 CALL PUSHINTEGER4(i - 1)
29081 CALL PUSHINTEGER4(ad_from7)
29083 CALL PUSHCONTROL4B(4)
29084 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
29085 ! This would be seen by (j > j_start) but we need to zero out the NP tendency
29089 CALL PUSHINTEGER4(i - 1)
29090 CALL PUSHINTEGER4(ad_from8)
29092 CALL PUSHCONTROL4B(5)
29093 ELSE IF (j .GT. j_start) THEN
29098 CALL PUSHINTEGER4(i - 1)
29099 CALL PUSHINTEGER4(ad_from9)
29101 CALL PUSHCONTROL4B(6)
29103 CALL PUSHCONTROL4B(7)
29106 CALL PUSHCONTROL4B(8)
29109 CALL PUSHINTEGER4(jp1)
29111 CALL PUSHINTEGER4(jp0)
29113 END DO j_loop_y_flux_5
29114 CALL PUSHINTEGER4(j - 1)
29115 CALL PUSHINTEGER4(ad_from10)
29116 ! next, x - flux divergence
29118 IF (ite .GT. ide - 1) THEN
29124 IF (jte .GT. jde - 1) THEN
29129 ! higher order flux has a 5 or 7 point stencil, so compute
29130 ! bounds so we can switch to second order flux close to the boundary
29131 i_start_f = i_start
29132 i_end_f = i_end + 1
29133 IF (degrade_xs) THEN
29134 IF (ids + 1 .LT. its) THEN
29139 IF (i_start + 2 .GT. ids + 3) THEN
29140 CALL PUSHCONTROL1B(1)
29141 i_start_f = ids + 3
29143 CALL PUSHCONTROL1B(1)
29144 i_start_f = i_start + 2
29147 CALL PUSHCONTROL1B(0)
29149 IF (degrade_xe) THEN
29150 IF (ide - 2 .GT. ite) THEN
29151 CALL PUSHCONTROL1B(1)
29154 CALL PUSHCONTROL1B(1)
29159 CALL PUSHCONTROL1B(0)
29161 ad_from14 = j_start
29163 DO j=ad_from14,j_end
29164 ! 5th or 6th order flux
29166 DO i=i_start_f,i_end_f
29168 vel = 0.5*(ru(i, k, j)+ru(i-is, k-ks, j-js))
29169 IF (vel*SIGN(1, time_step) .GE. 0.0) THEN
29170 CALL PUSHREAL8(qip2)
29171 qip2 = field(i+1, k, j)
29172 CALL PUSHREAL8(qip1)
29173 qip1 = field(i, k, j)
29175 qi = field(i-1, k, j)
29176 CALL PUSHREAL8(qim1)
29177 qim1 = field(i-2, k, j)
29178 CALL PUSHREAL8(qim2)
29179 qim2 = field(i-3, k, j)
29180 CALL PUSHCONTROL1B(0)
29182 CALL PUSHREAL8(qip2)
29183 qip2 = field(i-2, k, j)
29184 CALL PUSHREAL8(qip1)
29185 qip1 = field(i-1, k, j)
29187 qi = field(i, k, j)
29188 CALL PUSHREAL8(qim1)
29189 qim1 = field(i+1, k, j)
29190 CALL PUSHREAL8(qim2)
29191 qim2 = field(i+2, k, j)
29192 CALL PUSHCONTROL1B(1)
29195 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
29197 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
29199 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
29200 CALL PUSHREAL8(beta0)
29201 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*&
29203 CALL PUSHREAL8(beta1)
29204 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
29205 CALL PUSHREAL8(beta2)
29206 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*&
29210 ! fqx( i,k ) = vel*flux5( field(i-3,k,j), field(i-2,k,j), &
29211 ! field(i-1,k,j), field(i ,k,j), &
29212 ! field(i+1,k,j), field(i+2,k,j), &
29214 ! lower order fluxes close to boundaries (if not periodic or symmetric)
29215 IF (degrade_xs) THEN
29216 ad_from11 = i_start
29217 DO i=ad_from11,i_start_f-1
29218 IF (i .EQ. ids + 1) THEN
29219 CALL PUSHCONTROL1B(0)
29221 CALL PUSHCONTROL1B(1)
29223 IF (i .EQ. ids + 2) THEN
29224 CALL PUSHCONTROL1B(1)
29226 CALL PUSHCONTROL1B(0)
29229 CALL PUSHINTEGER4(ad_from11)
29230 CALL PUSHCONTROL1B(0)
29232 CALL PUSHCONTROL1B(1)
29234 IF (degrade_xe) THEN
29235 DO i=i_end_f+1,i_end+1
29236 IF (i .EQ. ide - 1) THEN
29237 CALL PUSHCONTROL1B(0)
29239 CALL PUSHCONTROL1B(1)
29241 IF (i .EQ. ide - 2) THEN
29242 CALL PUSHCONTROL1B(1)
29244 CALL PUSHCONTROL1B(0)
29247 CALL PUSHINTEGER4(i - 1)
29248 CALL PUSHCONTROL1B(0)
29250 CALL PUSHCONTROL1B(1)
29252 ! x flux-divergence into tendency
29253 IF (is .EQ. 0) THEN
29255 ad_from12 = i_start
29257 CALL PUSHINTEGER4(i - 1)
29258 CALL PUSHINTEGER4(ad_from12)
29260 CALL PUSHCONTROL2B(2)
29261 ELSE IF (is .EQ. 1) THEN
29263 ad_from13 = i_start
29265 CALL PUSHINTEGER4(i - 1)
29266 CALL PUSHINTEGER4(ad_from13)
29268 CALL PUSHCONTROL2B(1)
29270 CALL PUSHCONTROL2B(0)
29273 CALL PUSHINTEGER4(j - 1)
29274 CALL PUSHINTEGER4(ad_from14)
29275 CALL PUSHCONTROL1B(1)
29277 CALL PUSHCONTROL1B(0)
29279 ! pick up the rest of the horizontal radiation boundary conditions.
29280 ! (these are the computations that don't require 'cb'.
29281 ! first, set to index ranges
29283 IF (ite .GT. ide - 1) THEN
29289 IF (jte .GT. jde - 1) THEN
29294 ! compute x (u) conditions for v, w, or scalar
29295 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
29296 ad_from15 = j_start
29297 DO j=ad_from15,j_end
29299 IF (0.5*(ru(its, k, j)+ru(its+1, k, j)) .GT. 0.) THEN
29302 CALL PUSHCONTROL1B(0)
29305 ub = 0.5*(ru(its, k, j)+ru(its+1, k, j))
29306 CALL PUSHCONTROL1B(1)
29310 CALL PUSHINTEGER4(j - 1)
29311 CALL PUSHINTEGER4(ad_from15)
29312 CALL PUSHCONTROL1B(0)
29314 CALL PUSHCONTROL1B(1)
29316 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
29317 ad_from16 = j_start
29318 DO j=ad_from16,j_end
29320 IF (0.5*(ru(ite-1, k, j)+ru(ite, k, j)) .LT. 0.) THEN
29323 CALL PUSHCONTROL1B(0)
29326 ub = 0.5*(ru(ite-1, k, j)+ru(ite, k, j))
29327 CALL PUSHCONTROL1B(1)
29331 CALL PUSHINTEGER4(j - 1)
29332 CALL PUSHINTEGER4(ad_from16)
29333 CALL PUSHCONTROL1B(0)
29335 CALL PUSHCONTROL1B(1)
29337 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
29338 ad_from17 = i_start
29339 DO i=ad_from17,i_end
29341 IF (0.5*(rv(i, k, jts)+rv(i, k, jts+1)) .GT. 0.) THEN
29344 CALL PUSHCONTROL1B(0)
29347 vb = 0.5*(rv(i, k, jts)+rv(i, k, jts+1))
29348 CALL PUSHCONTROL1B(1)
29352 CALL PUSHINTEGER4(i - 1)
29353 CALL PUSHINTEGER4(ad_from17)
29354 CALL PUSHCONTROL1B(0)
29356 CALL PUSHCONTROL1B(1)
29358 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
29359 ad_from18 = i_start
29360 DO i=ad_from18,i_end
29362 IF (0.5*(rv(i, k, jte-1)+rv(i, k, jte)) .LT. 0.) THEN
29365 CALL PUSHCONTROL1B(0)
29368 vb = 0.5*(rv(i, k, jte-1)+rv(i, k, jte))
29369 CALL PUSHCONTROL1B(1)
29373 CALL PUSHINTEGER4(i - 1)
29374 CALL PUSHINTEGER4(ad_from18)
29375 CALL PUSHCONTROL1B(1)
29377 CALL PUSHCONTROL1B(0)
29379 !-------------------- vertical advection
29380 ! Scalar equation has 3rd term on RHS = - partial d/dz (q rho w /my)
29381 ! Here we have: - partial d/dz (q*rom) = - partial d/dz (q rho w / my)
29382 ! So we don't need to make a correction for advect_scalar
29384 IF (ite .GT. ide - 1) THEN
29385 CALL PUSHINTEGER4(i_end)
29387 CALL PUSHCONTROL1B(0)
29389 CALL PUSHINTEGER4(i_end)
29391 CALL PUSHCONTROL1B(1)
29394 IF (jte .GT. jde - 1) THEN
29395 CALL PUSHINTEGER4(j_end)
29397 CALL PUSHCONTROL1B(0)
29399 CALL PUSHINTEGER4(j_end)
29401 CALL PUSHCONTROL1B(1)
29407 vel = 0.5*(rom(i, k, j)+rom(i-is, k-ks, j-js))
29408 IF (-(vel*SIGN(1, time_step)) .GE. 0.0) THEN
29409 CALL PUSHREAL8(qip2)
29410 qip2 = field(i, k+1, j)
29411 CALL PUSHREAL8(qip1)
29412 qip1 = field(i, k, j)
29414 qi = field(i, k-1, j)
29415 CALL PUSHREAL8(qim1)
29416 qim1 = field(i, k-2, j)
29417 CALL PUSHREAL8(qim2)
29418 qim2 = field(i, k-3, j)
29419 CALL PUSHCONTROL1B(0)
29421 CALL PUSHREAL8(qip2)
29422 qip2 = field(i, k-2, j)
29423 CALL PUSHREAL8(qip1)
29424 qip1 = field(i, k-1, j)
29426 qi = field(i, k, j)
29427 CALL PUSHREAL8(qim1)
29428 qim1 = field(i, k+1, j)
29429 CALL PUSHREAL8(qim2)
29430 qim2 = field(i, k+2, j)
29431 CALL PUSHCONTROL1B(1)
29434 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
29436 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
29438 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
29439 CALL PUSHREAL8(beta0)
29440 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
29442 CALL PUSHREAL8(beta1)
29443 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
29444 CALL PUSHREAL8(beta2)
29445 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
29449 CALL PUSHINTEGER4(k)
29452 DO j=j_end,j_start,-1
29454 DO i=i_end,i_start,-1
29455 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
29456 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
29459 CALL POPINTEGER4(k)
29460 DO i=i_end,i_start,-1
29462 tempb47 = rom(i, k, j)*vfluxb(i, k)
29463 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
29464 & field(i, k-1, j))*vfluxb(i, k)
29465 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*tempb47
29466 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*tempb47
29470 temp23 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k, j)-&
29471 & field(i, k-1, j))
29472 temp25 = SIGN(1., -vel)
29473 temp24 = temp25/12.
29474 tempb48 = vel*vfluxb(i, k)
29475 tempb49 = 7.*tempb48/12.
29476 tempb50 = temp24*tempb48
29477 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i, k+1, &
29478 & j)+field(i, k-2, j))/12.+temp24*temp23)*vfluxb(i, k)
29479 fieldb(i, k, j) = fieldb(i, k, j) + tempb49 - 3.*tempb50
29480 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*tempb50 + tempb49
29481 fieldb(i, k+1, j) = fieldb(i, k+1, j) + tempb50 - tempb48/12.
29482 fieldb(i, k-2, j) = fieldb(i, k-2, j) - tempb50 - tempb48/12.
29484 romb(i, k, j) = romb(i, k, j) + velb
29487 temp20 = field(i, k+1, j) - field(i, k-2, j) - 3.*(field(i, k, j)-&
29488 & field(i, k-1, j))
29489 temp22 = SIGN(1., -vel)
29490 temp21 = temp22/12.
29491 tempb51 = vel*vfluxb(i, k)
29492 tempb52 = 7.*tempb51/12.
29493 tempb53 = temp21*tempb51
29494 velb = (7.*((field(i, k, j)+field(i, k-1, j))/12.)-(field(i, k+1, &
29495 & j)+field(i, k-2, j))/12.+temp21*temp20)*vfluxb(i, k)
29496 fieldb(i, k, j) = fieldb(i, k, j) + tempb52 - 3.*tempb53
29497 fieldb(i, k-1, j) = fieldb(i, k-1, j) + 3.*tempb53 + tempb52
29498 fieldb(i, k+1, j) = fieldb(i, k+1, j) + tempb53 - tempb51/12.
29499 fieldb(i, k-2, j) = fieldb(i, k-2, j) - tempb53 - tempb51/12.
29501 romb(i, k, j) = romb(i, k, j) + velb
29503 tempb54 = rom(i, k, j)*vfluxb(i, k)
29504 romb(i, k, j) = romb(i, k, j) + (fzm(k)*field(i, k, j)+fzp(k)*&
29505 & field(i, k-1, j))*vfluxb(i, k)
29506 fieldb(i, k, j) = fieldb(i, k, j) + fzm(k)*tempb54
29507 fieldb(i, k-1, j) = fieldb(i, k-1, j) + fzp(k)*tempb54
29510 DO k=ktf-2,kts+3,-1
29511 DO i=i_end,i_start,-1
29512 wi0 = gi0/(eps+beta0)**pw
29513 wi1 = gi1/(eps+beta1)**pw
29514 wi2 = gi2/(eps+beta2)**pw
29515 sumwk = wi0 + wi1 + wi2
29516 vel = 0.5*(rom(i, k, j)+rom(i-is, k-ks, j-js))
29517 tempb39 = vel*vfluxb(i, k)/sumwk
29518 tempb40 = (wi0*f0+wi1*f1+wi2*f2)*vfluxb(i, k)/sumwk
29523 sumwkb = -(vel*tempb40/sumwk)
29524 wi0b = sumwkb + f0*tempb39
29525 wi1b = sumwkb + f1*tempb39
29526 wi2b = sumwkb + f2*tempb39
29528 temp19 = (eps+beta2)**pw
29529 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
29533 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp19**2)
29535 temp18 = (eps+beta1)**pw
29536 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
29540 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp18**2)
29542 temp17 = (eps+beta0)**pw
29543 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
29547 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp17**2)
29549 CALL POPREAL8(beta2)
29550 tempb41 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
29551 tempb42 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
29552 qip2b = tempb42 - f2b/6. + tempb41
29553 CALL POPREAL8(beta1)
29554 tempb43 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
29555 tempb46 = 2*(qim1-qip1)*beta1b/4.
29556 qip1b = tempb43 - tempb46 + f1b/3. + 5.*f2b/6. - 4.*tempb42 - 2.&
29558 CALL POPREAL8(beta0)
29559 tempb45 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
29560 tempb44 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
29561 qib = f2b/3. - 2.*tempb43 + 11.*f0b/6. + 5.*f1b/6. + 3.*tempb44 &
29562 & + tempb45 + 3.*tempb42 + tempb41
29563 qim1b = tempb46 - 4.*tempb44 - 7.*f0b/6. - f1b/6. - 2.*tempb45 +&
29565 qim2b = f0b/3. + tempb44 + tempb45
29569 CALL POPCONTROL1B(branch)
29570 IF (branch .EQ. 0) THEN
29571 CALL POPREAL8(qim2)
29572 fieldb(i, k-3, j) = fieldb(i, k-3, j) + qim2b
29573 CALL POPREAL8(qim1)
29574 fieldb(i, k-2, j) = fieldb(i, k-2, j) + qim1b
29576 fieldb(i, k-1, j) = fieldb(i, k-1, j) + qib
29577 CALL POPREAL8(qip1)
29578 fieldb(i, k, j) = fieldb(i, k, j) + qip1b
29579 CALL POPREAL8(qip2)
29580 fieldb(i, k+1, j) = fieldb(i, k+1, j) + qip2b
29582 CALL POPREAL8(qim2)
29583 fieldb(i, k+2, j) = fieldb(i, k+2, j) + qim2b
29584 CALL POPREAL8(qim1)
29585 fieldb(i, k+1, j) = fieldb(i, k+1, j) + qim1b
29587 fieldb(i, k, j) = fieldb(i, k, j) + qib
29588 CALL POPREAL8(qip1)
29589 fieldb(i, k-1, j) = fieldb(i, k-1, j) + qip1b
29590 CALL POPREAL8(qip2)
29591 fieldb(i, k-2, j) = fieldb(i, k-2, j) + qip2b
29593 romb(i, k, j) = romb(i, k, j) + 0.5*velb
29594 romb(i-is, k-ks, j-js) = romb(i-is, k-ks, j-js) + 0.5*velb
29598 CALL POPCONTROL1B(branch)
29599 IF (branch .EQ. 0) THEN
29600 CALL POPINTEGER4(j_end)
29602 CALL POPINTEGER4(j_end)
29604 CALL POPCONTROL1B(branch)
29605 IF (branch .EQ. 0) THEN
29606 CALL POPINTEGER4(i_end)
29608 CALL POPINTEGER4(i_end)
29610 CALL POPCONTROL1B(branch)
29611 IF (branch .NE. 0) THEN
29612 CALL POPINTEGER4(ad_from18)
29613 CALL POPINTEGER4(ad_to18)
29614 DO i=ad_to18,ad_from18,-1
29616 tempb37 = -(rdy*tendencyb(i, k, j_end))
29617 tempb38 = field(i, k, j_end)*tempb37
29618 vbb = (field_old(i, k, j_end)-field_old(i, k, j_end-1))*tempb37
29619 field_oldb(i, k, j_end) = field_oldb(i, k, j_end) + vb*tempb37
29620 field_oldb(i, k, j_end-1) = field_oldb(i, k, j_end-1) - vb*&
29622 fieldb(i, k, j_end) = fieldb(i, k, j_end) + (rv(i, k, jte)-rv(i&
29623 & , k, jte-1))*tempb37
29624 rvb(i, k, jte) = rvb(i, k, jte) + tempb38
29625 rvb(i, k, jte-1) = rvb(i, k, jte-1) - tempb38
29626 CALL POPCONTROL1B(branch)
29627 IF (branch .EQ. 0) THEN
29631 rvb(i, k, jte-1) = rvb(i, k, jte-1) + 0.5*vbb
29632 rvb(i, k, jte) = rvb(i, k, jte) + 0.5*vbb
29637 CALL POPCONTROL1B(branch)
29638 IF (branch .EQ. 0) THEN
29639 CALL POPINTEGER4(ad_from17)
29640 CALL POPINTEGER4(ad_to17)
29641 DO i=ad_to17,ad_from17,-1
29643 tempb35 = -(rdy*tendencyb(i, k, jts))
29644 tempb36 = field(i, k, jts)*tempb35
29645 vbb = (field_old(i, k, jts+1)-field_old(i, k, jts))*tempb35
29646 field_oldb(i, k, jts+1) = field_oldb(i, k, jts+1) + vb*tempb35
29647 field_oldb(i, k, jts) = field_oldb(i, k, jts) - vb*tempb35
29648 fieldb(i, k, jts) = fieldb(i, k, jts) + (rv(i, k, jts+1)-rv(i, k&
29650 rvb(i, k, jts+1) = rvb(i, k, jts+1) + tempb36
29651 rvb(i, k, jts) = rvb(i, k, jts) - tempb36
29652 CALL POPCONTROL1B(branch)
29653 IF (branch .EQ. 0) THEN
29657 rvb(i, k, jts) = rvb(i, k, jts) + 0.5*vbb
29658 rvb(i, k, jts+1) = rvb(i, k, jts+1) + 0.5*vbb
29663 CALL POPCONTROL1B(branch)
29664 IF (branch .EQ. 0) THEN
29665 CALL POPINTEGER4(ad_from16)
29666 CALL POPINTEGER4(ad_to16)
29667 DO j=ad_to16,ad_from16,-1
29669 tempb33 = -(rdx*tendencyb(i_end, k, j))
29670 tempb34 = field(i_end, k, j)*tempb33
29671 ubb = (field_old(i_end, k, j)-field_old(i_end-1, k, j))*tempb33
29672 field_oldb(i_end, k, j) = field_oldb(i_end, k, j) + ub*tempb33
29673 field_oldb(i_end-1, k, j) = field_oldb(i_end-1, k, j) - ub*&
29675 fieldb(i_end, k, j) = fieldb(i_end, k, j) + (ru(ite, k, j)-ru(&
29676 & ite-1, k, j))*tempb33
29677 rub(ite, k, j) = rub(ite, k, j) + tempb34
29678 rub(ite-1, k, j) = rub(ite-1, k, j) - tempb34
29679 CALL POPCONTROL1B(branch)
29680 IF (branch .EQ. 0) THEN
29684 rub(ite-1, k, j) = rub(ite-1, k, j) + 0.5*ubb
29685 rub(ite, k, j) = rub(ite, k, j) + 0.5*ubb
29690 CALL POPCONTROL1B(branch)
29691 IF (branch .EQ. 0) THEN
29692 CALL POPINTEGER4(ad_from15)
29693 CALL POPINTEGER4(ad_to15)
29694 DO j=ad_to15,ad_from15,-1
29696 tempb31 = -(rdx*tendencyb(its, k, j))
29697 tempb32 = field(its, k, j)*tempb31
29698 ubb = (field_old(its+1, k, j)-field_old(its, k, j))*tempb31
29699 field_oldb(its+1, k, j) = field_oldb(its+1, k, j) + ub*tempb31
29700 field_oldb(its, k, j) = field_oldb(its, k, j) - ub*tempb31
29701 fieldb(its, k, j) = fieldb(its, k, j) + (ru(its+1, k, j)-ru(its&
29703 rub(its+1, k, j) = rub(its+1, k, j) + tempb32
29704 rub(its, k, j) = rub(its, k, j) - tempb32
29705 CALL POPCONTROL1B(branch)
29706 IF (branch .EQ. 0) THEN
29710 rub(its, k, j) = rub(its, k, j) + 0.5*ubb
29711 rub(its+1, k, j) = rub(its+1, k, j) + 0.5*ubb
29716 CALL POPCONTROL1B(branch)
29717 IF (branch .NE. 0) THEN
29719 CALL POPINTEGER4(ad_from14)
29720 CALL POPINTEGER4(ad_to14)
29721 DO j=ad_to14,ad_from14,-1
29722 CALL POPCONTROL2B(branch)
29723 IF (branch .NE. 0) THEN
29724 IF (branch .EQ. 1) THEN
29726 CALL POPINTEGER4(ad_from13)
29727 CALL POPINTEGER4(ad_to13)
29728 DO i=ad_to13,ad_from13,-1
29729 mrdx = msfux(i, j)*rdx
29730 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
29731 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
29736 CALL POPINTEGER4(ad_from12)
29737 CALL POPINTEGER4(ad_to12)
29738 DO i=ad_to12,ad_from12,-1
29739 mrdx = msftx(i, j)*rdx
29740 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
29741 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
29746 CALL POPCONTROL1B(branch)
29747 IF (branch .EQ. 0) THEN
29748 CALL POPINTEGER4(ad_to11)
29749 DO i=ad_to11,i_end_f+1,-1
29750 CALL POPCONTROL1B(branch)
29751 IF (branch .NE. 0) THEN
29754 temp14 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i&
29755 & , k, j)-field(i-1, k, j))
29756 temp16 = SIGN(1., vel)
29757 temp15 = temp16/12.
29758 tempb28 = vel*fqxb(i, k)
29759 tempb29 = 7.*tempb28/12.
29760 tempb30 = temp15*tempb28
29761 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(&
29762 & i+1, k, j)+field(i-2, k, j))/12.+temp15*temp14)*fqxb(i, &
29764 fieldb(i, k, j) = fieldb(i, k, j) + tempb29 - 3.*tempb30
29765 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*tempb30 + &
29767 fieldb(i+1, k, j) = fieldb(i+1, k, j) + tempb30 - tempb28/&
29769 fieldb(i-2, k, j) = fieldb(i-2, k, j) - tempb30 - tempb28/&
29772 rub(i, k, j) = rub(i, k, j) + velb
29775 CALL POPCONTROL1B(branch)
29776 IF (branch .EQ. 0) THEN
29778 tempb27 = 0.5*ru(i, k, j)*fqxb(i, k)
29779 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
29780 & 1, k, j))*fqxb(i, k)
29781 fieldb(i, k, j) = fieldb(i, k, j) + tempb27
29782 fieldb(i-1, k, j) = fieldb(i-1, k, j) + tempb27
29788 CALL POPCONTROL1B(branch)
29789 IF (branch .EQ. 0) THEN
29790 CALL POPINTEGER4(ad_from11)
29791 DO i=i_start_f-1,ad_from11,-1
29792 CALL POPCONTROL1B(branch)
29793 IF (branch .NE. 0) THEN
29796 temp11 = field(i+1, k, j) - field(i-2, k, j) - 3.*(field(i&
29797 & , k, j)-field(i-1, k, j))
29798 temp13 = SIGN(1., vel)
29799 temp12 = temp13/12.
29800 tempb24 = vel*fqxb(i, k)
29801 tempb25 = 7.*tempb24/12.
29802 tempb26 = temp12*tempb24
29803 velb = (7.*((field(i, k, j)+field(i-1, k, j))/12.)-(field(&
29804 & i+1, k, j)+field(i-2, k, j))/12.+temp12*temp11)*fqxb(i, &
29806 fieldb(i, k, j) = fieldb(i, k, j) + tempb25 - 3.*tempb26
29807 fieldb(i-1, k, j) = fieldb(i-1, k, j) + 3.*tempb26 + &
29809 fieldb(i+1, k, j) = fieldb(i+1, k, j) + tempb26 - tempb24/&
29811 fieldb(i-2, k, j) = fieldb(i-2, k, j) - tempb26 - tempb24/&
29814 rub(i, k, j) = rub(i, k, j) + velb
29817 CALL POPCONTROL1B(branch)
29818 IF (branch .EQ. 0) THEN
29820 tempb23 = 0.5*ru(i, k, j)*fqxb(i, k)
29821 rub(i, k, j) = rub(i, k, j) + 0.5*(field(i, k, j)+field(i-&
29822 & 1, k, j))*fqxb(i, k)
29823 fieldb(i, k, j) = fieldb(i, k, j) + tempb23
29824 fieldb(i-1, k, j) = fieldb(i-1, k, j) + tempb23
29831 DO i=i_end_f,i_start_f,-1
29832 wi0 = gi0/(eps+beta0)**pw
29833 wi1 = gi1/(eps+beta1)**pw
29834 wi2 = gi2/(eps+beta2)**pw
29835 sumwk = wi0 + wi1 + wi2
29836 vel = 0.5*(ru(i, k, j)+ru(i-is, k-ks, j-js))
29837 tempb15 = vel*fqxb(i, k)/sumwk
29838 tempb16 = (wi0*f0+wi1*f1+wi2*f2)*fqxb(i, k)/sumwk
29843 sumwkb = -(vel*tempb16/sumwk)
29844 wi0b = sumwkb + f0*tempb15
29845 wi1b = sumwkb + f1*tempb15
29846 wi2b = sumwkb + f2*tempb15
29848 temp10 = (eps+beta2)**pw
29849 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(&
29853 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp10**2)
29855 temp9 = (eps+beta1)**pw
29856 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(&
29860 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp9**2)
29862 temp8 = (eps+beta0)**pw
29863 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(&
29867 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp8**2)
29869 CALL POPREAL8(beta2)
29870 tempb17 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
29871 tempb18 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
29872 qip2b = tempb18 - f2b/6. + tempb17
29873 CALL POPREAL8(beta1)
29874 tempb19 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
29875 tempb22 = 2*(qim1-qip1)*beta1b/4.
29876 qip1b = tempb19 - tempb22 + f1b/3. + 5.*f2b/6. - 4.*tempb18 - &
29878 CALL POPREAL8(beta0)
29879 tempb21 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
29880 tempb20 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
29881 qib = f2b/3. - 2.*tempb19 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
29882 & tempb20 + tempb21 + 3.*tempb18 + tempb17
29883 qim1b = tempb22 - 4.*tempb20 - 7.*f0b/6. - f1b/6. - 2.*tempb21&
29885 qim2b = f0b/3. + tempb20 + tempb21
29889 CALL POPCONTROL1B(branch)
29890 IF (branch .EQ. 0) THEN
29891 CALL POPREAL8(qim2)
29892 fieldb(i-3, k, j) = fieldb(i-3, k, j) + qim2b
29893 CALL POPREAL8(qim1)
29894 fieldb(i-2, k, j) = fieldb(i-2, k, j) + qim1b
29896 fieldb(i-1, k, j) = fieldb(i-1, k, j) + qib
29897 CALL POPREAL8(qip1)
29898 fieldb(i, k, j) = fieldb(i, k, j) + qip1b
29899 CALL POPREAL8(qip2)
29900 fieldb(i+1, k, j) = fieldb(i+1, k, j) + qip2b
29902 CALL POPREAL8(qim2)
29903 fieldb(i+2, k, j) = fieldb(i+2, k, j) + qim2b
29904 CALL POPREAL8(qim1)
29905 fieldb(i+1, k, j) = fieldb(i+1, k, j) + qim1b
29907 fieldb(i, k, j) = fieldb(i, k, j) + qib
29908 CALL POPREAL8(qip1)
29909 fieldb(i-1, k, j) = fieldb(i-1, k, j) + qip1b
29910 CALL POPREAL8(qip2)
29911 fieldb(i-2, k, j) = fieldb(i-2, k, j) + qip2b
29913 rub(i, k, j) = rub(i, k, j) + 0.5*velb
29914 rub(i-is, k-ks, j-js) = rub(i-is, k-ks, j-js) + 0.5*velb
29918 CALL POPCONTROL1B(branch)
29919 CALL POPCONTROL1B(branch)
29921 CALL POPINTEGER4(ad_from10)
29922 CALL POPINTEGER4(ad_to10)
29923 DO j=ad_to10,ad_from10,-1
29924 CALL POPINTEGER4(jp0)
29925 CALL POPINTEGER4(jp1)
29926 CALL POPCONTROL4B(branch)
29927 IF (branch .LT. 4) THEN
29928 IF (branch .LT. 2) THEN
29929 IF (branch .EQ. 0) THEN
29931 CALL POPINTEGER4(ad_from4)
29932 CALL POPINTEGER4(ad_to4)
29933 DO i=ad_to4,ad_from4,-1
29934 mrdy = msftx(i, j-1)*rdy
29935 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k&
29941 CALL POPINTEGER4(ad_from5)
29942 CALL POPINTEGER4(ad_to5)
29943 DO i=ad_to5,ad_from5,-1
29944 mrdy = msftx(i, j-1)*rdy
29945 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k&
29950 ELSE IF (branch .EQ. 2) THEN
29952 CALL POPINTEGER4(ad_from6)
29953 CALL POPINTEGER4(ad_to6)
29954 DO i=ad_to6,ad_from6,-1
29955 mrdy = msftx(i, j-1)*rdy
29956 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
29958 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
29963 ELSE IF (branch .LT. 6) THEN
29964 IF (branch .EQ. 4) THEN
29966 CALL POPINTEGER4(ad_from7)
29967 CALL POPINTEGER4(ad_to7)
29968 DO i=ad_to7,ad_from7,-1
29969 mrdy = msfux(i, j-1)*rdy
29970 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j&
29976 CALL POPINTEGER4(ad_from8)
29977 CALL POPINTEGER4(ad_to8)
29978 DO i=ad_to8,ad_from8,-1
29979 mrdy = msfux(i, j-1)*rdy
29980 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j&
29985 ELSE IF (branch .EQ. 6) THEN
29987 CALL POPINTEGER4(ad_from9)
29988 CALL POPINTEGER4(ad_to9)
29989 DO i=ad_to9,ad_from9,-1
29990 mrdy = msfux(i, j-1)*rdy
29991 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1&
29993 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1&
29998 CALL POPCONTROL3B(branch)
29999 IF (branch .LT. 3) THEN
30000 IF (branch .EQ. 0) THEN
30002 CALL POPINTEGER4(ad_from)
30003 CALL POPINTEGER4(ad_to)
30004 DO i=ad_to,ad_from,-1
30005 wi0 = gi0/(eps+beta0)**pw
30006 wi1 = gi1/(eps+beta1)**pw
30007 wi2 = gi2/(eps+beta2)**pw
30008 sumwk = wi0 + wi1 + wi2
30009 vel = 0.5*(rv(i, k, j)+rv(i-is, k-ks, j-js))
30010 tempb = vel*fqyb(i, k, jp1)/sumwk
30011 tempb0 = (wi0*f0+wi1*f1+wi2*f2)*fqyb(i, k, jp1)/sumwk
30016 sumwkb = -(vel*tempb0/sumwk)
30017 wi0b = sumwkb + f0*tempb
30018 wi1b = sumwkb + f1*tempb
30019 wi2b = sumwkb + f2*tempb
30020 fqyb(i, k, jp1) = 0.0
30021 temp1 = (eps+beta2)**pw
30022 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. &
30026 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp1**2)
30028 temp0 = (eps+beta1)**pw
30029 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. &
30033 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp0**2)
30035 temp = (eps+beta0)**pw
30036 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. &
30040 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp**2)
30042 CALL POPREAL8(beta2)
30043 tempb1 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
30044 tempb2 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
30045 qip2b = tempb2 - f2b/6. + tempb1
30046 CALL POPREAL8(beta1)
30047 tempb3 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
30048 tempb6 = 2*(qim1-qip1)*beta1b/4.
30049 qip1b = tempb3 - tempb6 + f1b/3. + 5.*f2b/6. - 4.*tempb2 -&
30051 CALL POPREAL8(beta0)
30052 tempb5 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
30053 tempb4 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
30054 qib = f2b/3. - 2.*tempb3 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
30055 & tempb4 + tempb5 + 3.*tempb2 + tempb1
30056 qim1b = tempb6 - 4.*tempb4 - 7.*f0b/6. - f1b/6. - 2.*&
30058 qim2b = f0b/3. + tempb4 + tempb5
30062 CALL POPCONTROL1B(branch)
30063 IF (branch .EQ. 0) THEN
30064 CALL POPREAL8(qim2)
30065 fieldb(i, k, j-3) = fieldb(i, k, j-3) + qim2b
30066 CALL POPREAL8(qim1)
30067 fieldb(i, k, j-2) = fieldb(i, k, j-2) + qim1b
30069 fieldb(i, k, j-1) = fieldb(i, k, j-1) + qib
30070 CALL POPREAL8(qip1)
30071 fieldb(i, k, j) = fieldb(i, k, j) + qip1b
30072 CALL POPREAL8(qip2)
30073 fieldb(i, k, j+1) = fieldb(i, k, j+1) + qip2b
30075 CALL POPREAL8(qim2)
30076 fieldb(i, k, j+2) = fieldb(i, k, j+2) + qim2b
30077 CALL POPREAL8(qim1)
30078 fieldb(i, k, j+1) = fieldb(i, k, j+1) + qim1b
30080 fieldb(i, k, j) = fieldb(i, k, j) + qib
30081 CALL POPREAL8(qip1)
30082 fieldb(i, k, j-1) = fieldb(i, k, j-1) + qip1b
30083 CALL POPREAL8(qip2)
30084 fieldb(i, k, j-2) = fieldb(i, k, j-2) + qip2b
30086 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
30087 rvb(i-is, k-ks, j-js) = rvb(i-is, k-ks, j-js) + 0.5*velb
30090 ELSE IF (branch .EQ. 1) THEN
30092 CALL POPINTEGER4(ad_from0)
30093 CALL POPINTEGER4(ad_to0)
30094 DO i=ad_to0,ad_from0,-1
30095 tempb7 = 0.5*rv(i, k, j)*fqyb(i, k, jp1)
30096 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i&
30097 & , k, j-1))*fqyb(i, k, jp1)
30098 fieldb(i, k, j) = fieldb(i, k, j) + tempb7
30099 fieldb(i, k, j-1) = fieldb(i, k, j-1) + tempb7
30100 fqyb(i, k, jp1) = 0.0
30105 CALL POPINTEGER4(ad_from1)
30106 CALL POPINTEGER4(ad_to1)
30107 DO i=ad_to1,ad_from1,-1
30109 temp2 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field(i&
30110 & , k, j)-field(i, k, j-1))
30111 temp4 = SIGN(1., vel)
30113 tempb8 = vel*fqyb(i, k, jp1)
30114 tempb9 = 7.*tempb8/12.
30115 tempb10 = temp3*tempb8
30116 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(field(&
30117 & i, k, j+1)+field(i, k, j-2))/12.+temp3*temp2)*fqyb(i, k&
30119 fieldb(i, k, j) = fieldb(i, k, j) + tempb9 - 3.*tempb10
30120 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*tempb10 + &
30122 fieldb(i, k, j+1) = fieldb(i, k, j+1) + tempb10 - tempb8/&
30124 fieldb(i, k, j-2) = fieldb(i, k, j-2) - tempb10 - tempb8/&
30126 fqyb(i, k, jp1) = 0.0
30127 rvb(i, k, j) = rvb(i, k, j) + velb
30131 ELSE IF (branch .EQ. 3) THEN
30133 CALL POPINTEGER4(ad_from2)
30134 CALL POPINTEGER4(ad_to2)
30135 DO i=ad_to2,ad_from2,-1
30136 tempb11 = 0.5*rv(i, k, j)*fqyb(i, k, jp1)
30137 rvb(i, k, j) = rvb(i, k, j) + 0.5*(field(i, k, j)+field(i, k&
30138 & , j-1))*fqyb(i, k, jp1)
30139 fieldb(i, k, j) = fieldb(i, k, j) + tempb11
30140 fieldb(i, k, j-1) = fieldb(i, k, j-1) + tempb11
30141 fqyb(i, k, jp1) = 0.0
30144 ELSE IF (branch .EQ. 4) THEN
30146 CALL POPINTEGER4(ad_from3)
30147 CALL POPINTEGER4(ad_to3)
30148 DO i=ad_to3,ad_from3,-1
30150 temp5 = field(i, k, j+1) - field(i, k, j-2) - 3.*(field(i, k&
30151 & , j)-field(i, k, j-1))
30152 temp7 = SIGN(1., vel)
30154 tempb12 = vel*fqyb(i, k, jp1)
30155 tempb13 = 7.*tempb12/12.
30156 tempb14 = temp6*tempb12
30157 velb = (7.*((field(i, k, j)+field(i, k, j-1))/12.)-(field(i&
30158 & , k, j+1)+field(i, k, j-2))/12.+temp6*temp5)*fqyb(i, k, &
30160 fieldb(i, k, j) = fieldb(i, k, j) + tempb13 - 3.*tempb14
30161 fieldb(i, k, j-1) = fieldb(i, k, j-1) + 3.*tempb14 + tempb13
30162 fieldb(i, k, j+1) = fieldb(i, k, j+1) + tempb14 - tempb12/&
30164 fieldb(i, k, j-2) = fieldb(i, k, j-2) - tempb14 - tempb12/&
30166 fqyb(i, k, jp1) = 0.0
30167 rvb(i, k, j) = rvb(i, k, j) + velb
30172 CALL POPCONTROL1B(branch)
30173 CALL POPCONTROL1B(branch)
30174 CALL POPCONTROL1B(branch)
30175 CALL POPCONTROL1B(branch)
30176 IF (branch .NE. 0) THEN
30177 CALL POPCONTROL1B(branch)
30178 CALL POPCONTROL1B(branch)
30181 END SUBROUTINE A_ADVECT_SCALAR_WENO
30183 ! Generated by TAPENADE (INRIA, Tropics team)
30184 ! Tapenade 3.6 (r4165) - 21 sep 2011 20:54
30186 ! Differentiation of advect_weno_u in reverse (adjoint) mode:
30187 ! gradient of useful results: rom u tendency u_old ru rv
30189 ! with respect to varying inputs: rom u tendency u_old ru rv
30191 ! RW status of diff variables: rom:incr u:incr tendency:in-out
30192 ! u_old:incr ru:incr rv:incr mut:incr
30193 SUBROUTINE A_ADVECT_WENO_U(u, ub0, u_old, u_oldb, tendency, tendencyb, &
30194 & ru, rub, rv, rvb, rom, romb, mut, mutb, time_step, config_flags, msfux&
30195 & , msfuy, msfvx, msfvy, msftx, msfty, fzm, fzp, rdx, rdy, rdzw, ids, &
30196 & ide, jds, jde, kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, &
30200 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
30201 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
30202 & jme, kms, kme, its, ite, jts, jte, kts, kte
30203 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: u, u_old, ru&
30205 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: ub0, u_oldb, rub, rvb, &
30207 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut
30208 REAL, DIMENSION(ims:ime, jms:jme) :: mutb
30209 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
30210 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendencyb
30211 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
30212 & msfvy, msftx, msfty
30213 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzw
30214 REAL, INTENT(IN) :: rdx, rdy
30215 INTEGER, INTENT(IN) :: time_step
30217 INTEGER :: i, j, k, itf, jtf, ktf
30218 INTEGER :: i_start, i_end, j_start, j_end
30219 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
30220 INTEGER :: jmin, jmax, jp, jm, imin, imax, im, ip
30221 INTEGER :: jp1, jp0, jtmp
30223 REAL :: ue, vs, vn, wb, wt
30224 REAL, PARAMETER :: f30=7./12., f31=1./12.
30225 REAL, PARAMETER :: f50=37./60., f51=2./15., f52=1./60.
30227 REAL :: qim2, qim1, qi, qip1, qip2
30228 REAL :: qim2b, qim1b, qib, qip1b, qip2b
30229 DOUBLE PRECISION :: beta0, beta1, beta2, f0, f1, f2, wi0, wi1, wi2, &
30231 DOUBLE PRECISION :: beta0b, beta1b, beta2b, f0b, f1b, f2b, wi0b, wi1b&
30233 DOUBLE PRECISION, PARAMETER :: gi0=1.d0/10.d0, gi1=6.d0/10.d0, gi2=&
30234 & 3.d0/10.d0, eps=1.0d-18
30235 INTEGER, PARAMETER :: pw=2
30236 INTEGER :: horz_order, vert_order
30237 REAL :: mrdx, mrdy, ub, vb, uw, vw, dvm, dvp
30238 REAL :: ubb, vbb, vwb, dvmb, dvpb
30239 REAL, DIMENSION(its:ite, kts:kte) :: vflux
30240 REAL, DIMENSION(its:ite, kts:kte) :: vfluxb
30241 REAL, DIMENSION(its - 1:ite + 1, kts:kte) :: fqx
30242 REAL, DIMENSION(its-1:ite+1, kts:kte) :: fqxb
30243 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqy
30244 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqyb
30245 LOGICAL :: degrade_xs, degrade_ys
30246 LOGICAL :: degrade_xe, degrade_ye
30247 ! definition of flux operators, 3rd, 4th, 5th or 6th order
30248 REAL :: flux3, flux4, flux5, flux6
30249 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel
30251 LOGICAL :: specified
30255 INTEGER :: ad_from0
30257 INTEGER :: ad_from1
30259 INTEGER :: ad_from2
30261 INTEGER :: ad_from3
30263 INTEGER :: ad_from4
30265 INTEGER :: ad_from5
30267 INTEGER :: ad_from6
30269 INTEGER :: ad_from7
30271 INTEGER :: ad_from8
30273 INTEGER :: ad_from9
30275 INTEGER :: ad_from10
30277 INTEGER :: ad_from11
30279 INTEGER :: ad_from12
30281 INTEGER :: ad_from13
30287 DOUBLE PRECISION :: temp1
30289 DOUBLE PRECISION :: temp0
30290 DOUBLE PRECISION :: temp13b
30295 DOUBLE PRECISION :: temp23
30296 DOUBLE PRECISION :: temp22
30297 DOUBLE PRECISION :: temp21
30301 DOUBLE PRECISION :: temp24b
30306 DOUBLE PRECISION :: temp13b0
30326 DOUBLE PRECISION :: temp2b0
30332 DOUBLE PRECISION :: temp12
30334 DOUBLE PRECISION :: temp11
30336 DOUBLE PRECISION :: temp10
30346 DOUBLE PRECISION :: temp2b
30351 DOUBLE PRECISION :: temp24b0
30364 DOUBLE PRECISION :: temp
30379 specified = .false.
30380 IF (config_flags%specified .OR. config_flags%nested) specified = &
30382 ! set order for vertical and horzontal flux operators
30383 IF (kte .GT. kde - 1) THEN
30388 ! begin with horizontal flux divergence
30389 ! horizontal_order_test : IF( horz_order == 6 ) THEN
30390 ! ELSE IF( horz_order == 5 ) THEN
30391 ! 5th order horizontal flux calculation
30392 ! This code is EXACTLY the same as the 6th order code
30393 ! EXCEPT the 5th order and 3rd operators are used in
30394 ! place of the 6th and 4th order operators
30395 ! determine boundary mods for flux operators
30396 ! We degrade the flux operators from 3rd/4th order
30397 ! to second order one gridpoint in from the boundaries for
30398 ! all boundary conditions except periodic and symmetry - these
30399 ! conditions have boundary zone data fill for correct application
30400 ! of the higher order flux stencils
30401 degrade_xs = .true.
30402 degrade_xe = .true.
30403 degrade_ys = .true.
30404 degrade_ye = .true.
30405 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. its &
30406 & .GT. ids + 3) degrade_xs = .false.
30407 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. ite &
30408 & .LT. ide - 2) degrade_xe = .false.
30409 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. jts &
30410 & .GT. jds + 3) degrade_ys = .false.
30411 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. jte &
30412 & .LT. jde - 4) degrade_ye = .false.
30413 !--------------- y - advection first
30416 IF (config_flags%open_xs .OR. specified) THEN
30417 IF (ids + 1 .LT. its) THEN
30423 IF (config_flags%open_xe .OR. specified) THEN
30424 IF (ide - 1 .GT. ite) THEN
30430 IF (config_flags%periodic_x) i_start = its
30431 IF (config_flags%periodic_x) i_end = ite
30433 IF (jte .GT. jde - 1) THEN
30438 ! higher order flux has a 5 or 7 point stencil, so compute
30439 ! bounds so we can switch to second order flux close to the boundary
30440 j_start_f = j_start
30441 j_end_f = j_end + 1
30442 IF (degrade_ys) THEN
30443 IF (jts .LT. jds + 1) THEN
30448 j_start_f = jds + 3
30450 IF (degrade_ye) THEN
30451 IF (jte .GT. jde - 2) THEN
30458 IF (config_flags%polar) THEN
30459 IF (jte .GT. jde - 1) THEN
30465 ! compute fluxes, 5th or 6th order
30469 j_loop_y_flux_5:DO j=ad_from7,j_end+1
30470 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
30475 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
30476 IF (vel*sign(1,time_step) .GE. 0.0) THEN
30477 CALL PUSHREAL8(qip2)
30478 qip2 = u(i, k, j+1)
30479 CALL PUSHREAL8(qip1)
30483 CALL PUSHREAL8(qim1)
30484 qim1 = u(i, k, j-2)
30485 CALL PUSHREAL8(qim2)
30486 qim2 = u(i, k, j-3)
30487 CALL PUSHCONTROL1B(0)
30489 CALL PUSHREAL8(qip2)
30490 qip2 = u(i, k, j-2)
30491 CALL PUSHREAL8(qip1)
30492 qip1 = u(i, k, j-1)
30495 CALL PUSHREAL8(qim1)
30496 qim1 = u(i, k, j+1)
30497 CALL PUSHREAL8(qim2)
30498 qim2 = u(i, k, j+2)
30499 CALL PUSHCONTROL1B(1)
30502 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
30504 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
30506 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
30507 CALL PUSHREAL8(beta0)
30508 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*&
30510 CALL PUSHREAL8(beta1)
30511 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
30512 CALL PUSHREAL8(beta2)
30513 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*&
30516 CALL PUSHINTEGER4(i - 1)
30517 CALL PUSHINTEGER4(ad_from)
30519 CALL PUSHCONTROL3B(0)
30520 ELSE IF (j .EQ. jds + 1) THEN
30521 ! fqy( i, k, jp1 ) = vel*flux5( &
30522 ! u(i,k,j-3), u(i,k,j-2), u(i,k,j-1), &
30523 ! u(i,k,j ), u(i,k,j+1), u(i,k,j+2), vel )
30524 ! we must be close to some boundary where we need to reduce the order of the stencil
30525 ! 2nd order flux next to south boundary
30529 CALL PUSHINTEGER4(i - 1)
30530 CALL PUSHINTEGER4(ad_from0)
30532 CALL PUSHCONTROL3B(1)
30533 ELSE IF (j .EQ. jds + 2) THEN
30534 ! third of 4th order flux 2 in from south boundary
30538 CALL PUSHINTEGER4(i - 1)
30539 CALL PUSHINTEGER4(ad_from1)
30541 CALL PUSHCONTROL3B(2)
30542 ELSE IF (j .EQ. jde - 1) THEN
30543 ! 2nd order flux next to north boundary
30547 CALL PUSHINTEGER4(i - 1)
30548 CALL PUSHINTEGER4(ad_from2)
30550 CALL PUSHCONTROL3B(3)
30551 ELSE IF (j .EQ. jde - 2) THEN
30552 ! 3rd order flux 2 in from north boundary
30556 CALL PUSHINTEGER4(i - 1)
30557 CALL PUSHINTEGER4(ad_from3)
30559 CALL PUSHCONTROL3B(4)
30561 CALL PUSHCONTROL3B(5)
30563 ! y flux-divergence into tendency
30564 ! (j > j_start) will miss the u(,,jds) tendency
30565 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
30569 CALL PUSHINTEGER4(i - 1)
30570 CALL PUSHINTEGER4(ad_from4)
30572 CALL PUSHCONTROL2B(0)
30573 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
30574 ! This would be seen by (j > j_start) but we need to zero out the NP tendency
30578 CALL PUSHINTEGER4(i - 1)
30579 CALL PUSHINTEGER4(ad_from5)
30581 CALL PUSHCONTROL2B(1)
30582 ELSE IF (j .GT. j_start) THEN
30587 CALL PUSHINTEGER4(i - 1)
30588 CALL PUSHINTEGER4(ad_from6)
30590 CALL PUSHCONTROL2B(2)
30592 CALL PUSHCONTROL2B(3)
30595 CALL PUSHINTEGER4(jp1)
30597 CALL PUSHINTEGER4(jp0)
30599 END DO j_loop_y_flux_5
30600 CALL PUSHINTEGER4(j - 1)
30601 CALL PUSHINTEGER4(ad_from7)
30602 ! next, x - flux divergence
30606 IF (jte .GT. jde - 1) THEN
30611 ! higher order flux has a 5 or 7 point stencil, so compute
30612 ! bounds so we can switch to second order flux close to the boundary
30613 i_start_f = i_start
30614 i_end_f = i_end + 1
30615 IF (degrade_xs) THEN
30616 IF (ids + 1 .LT. its) THEN
30621 i_start_f = ids + 3
30623 IF (degrade_xe) THEN
30624 IF (ide - 1 .GT. ite) THEN
30633 DO j=ad_from9,j_end
30634 ! 5th or 6th order flux
30636 CALL PUSHINTEGER4(i)
30637 DO i=i_start_f,i_end_f
30638 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
30639 IF (vel*sign(1,time_step) .GE. 0.0) THEN
30640 CALL PUSHREAL8(qip2)
30641 qip2 = u(i+1, k, j)
30642 CALL PUSHREAL8(qip1)
30646 CALL PUSHREAL8(qim1)
30647 qim1 = u(i-2, k, j)
30648 CALL PUSHREAL8(qim2)
30649 qim2 = u(i-3, k, j)
30650 CALL PUSHCONTROL1B(0)
30652 CALL PUSHREAL8(qip2)
30653 qip2 = u(i-2, k, j)
30654 CALL PUSHREAL8(qip1)
30655 qip1 = u(i-1, k, j)
30658 CALL PUSHREAL8(qim1)
30659 qim1 = u(i+1, k, j)
30660 CALL PUSHREAL8(qim2)
30661 qim2 = u(i+2, k, j)
30662 CALL PUSHCONTROL1B(1)
30665 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
30667 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
30669 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
30670 CALL PUSHREAL8(beta0)
30671 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
30673 CALL PUSHREAL8(beta1)
30674 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
30675 CALL PUSHREAL8(beta2)
30676 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
30680 ! fqx( i,k ) = vel*flux5( u(i-3,k,j), u(i-2,k,j), &
30681 ! u(i-1,k,j), u(i ,k,j), &
30682 ! u(i+1,k,j), u(i+2,k,j), &
30684 ! lower order fluxes close to boundaries (if not periodic or symmetric)
30685 ! specified uses upstream normal wind at boundaries
30686 IF (degrade_xs) THEN
30687 IF (i_start .EQ. ids + 1) THEN
30688 CALL PUSHINTEGER4(i)
30689 ! second order flux next to the boundary
30694 IF (specified .AND. u(i, k, j) .LT. 0.) THEN
30696 CALL PUSHCONTROL1B(0)
30698 CALL PUSHCONTROL1B(1)
30701 CALL PUSHCONTROL1B(0)
30703 CALL PUSHCONTROL1B(1)
30705 CALL PUSHINTEGER4(i)
30707 CALL PUSHCONTROL1B(0)
30709 CALL PUSHCONTROL1B(1)
30711 IF (degrade_xe) THEN
30712 IF (i_end .EQ. ide - 1) THEN
30713 CALL PUSHINTEGER4(i)
30714 ! second order flux next to the boundary
30719 IF (specified .AND. u(i-1, k, j) .GT. 0.) THEN
30721 CALL PUSHCONTROL1B(0)
30723 CALL PUSHCONTROL1B(1)
30726 CALL PUSHCONTROL1B(1)
30728 CALL PUSHCONTROL1B(0)
30731 CALL PUSHINTEGER4(i)
30733 CALL PUSHCONTROL1B(1)
30735 CALL PUSHCONTROL1B(0)
30737 ! x flux-divergence into tendency
30740 CALL PUSHINTEGER4(i)
30742 CALL PUSHINTEGER4(i - 1)
30743 CALL PUSHINTEGER4(ad_from8)
30746 CALL PUSHINTEGER4(j - 1)
30747 CALL PUSHINTEGER4(ad_from9)
30748 ! radiative lateral boundary condition in x for normal velocity (u)
30749 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
30751 IF (jte .GT. jde - 1) THEN
30756 ad_from10 = j_start
30757 DO j=ad_from10,j_end
30759 IF (ru(its, k, j) - cb*mut(its, j) .GT. 0.) THEN
30762 CALL PUSHCONTROL1B(0)
30765 ub = ru(its, k, j) - cb*mut(its, j)
30766 CALL PUSHCONTROL1B(1)
30770 CALL PUSHINTEGER4(j - 1)
30771 CALL PUSHINTEGER4(ad_from10)
30772 CALL PUSHCONTROL1B(0)
30774 CALL PUSHCONTROL1B(1)
30776 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
30778 IF (jte .GT. jde - 1) THEN
30783 ad_from11 = j_start
30784 DO j=ad_from11,j_end
30786 IF (ru(ite, k, j) + cb*mut(ite-1, j) .LT. 0.) THEN
30789 CALL PUSHCONTROL1B(0)
30792 ub = ru(ite, k, j) + cb*mut(ite-1, j)
30793 CALL PUSHCONTROL1B(1)
30797 CALL PUSHINTEGER4(j - 1)
30798 CALL PUSHINTEGER4(ad_from11)
30799 CALL PUSHCONTROL1B(1)
30801 CALL PUSHCONTROL1B(0)
30803 ! pick up the rest of the horizontal radiation boundary conditions.
30804 ! (these are the computations that don't require 'cb')
30805 ! first, set to index ranges
30807 IF (ite .GT. ide) THEN
30814 IF (config_flags%open_xs) THEN
30815 IF (ids + 1 .LT. its) THEN
30822 IF (config_flags%open_xe) THEN
30823 IF (ite .GT. ide - 1) THEN
30830 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
30831 ad_from12 = i_start
30832 CALL PUSHINTEGER4(i)
30833 DO i=ad_from12,i_end
30834 CALL PUSHREAL8(mrdy)
30835 ! ADT eqn 44, 2nd term on RHS
30836 mrdy = msfux(i, jts)*rdy
30837 IF (imax .GT. i) THEN
30838 CALL PUSHINTEGER4(ip)
30840 CALL PUSHCONTROL1B(0)
30842 CALL PUSHINTEGER4(ip)
30844 CALL PUSHCONTROL1B(1)
30846 IF (imin .LT. i - 1) THEN
30847 CALL PUSHINTEGER4(im)
30849 CALL PUSHCONTROL1B(0)
30851 CALL PUSHINTEGER4(im)
30853 CALL PUSHCONTROL1B(1)
30856 vw = 0.5*(rv(ip, k, jts)+rv(im, k, jts))
30857 IF (vw .GT. 0.) THEN
30860 CALL PUSHCONTROL1B(0)
30864 CALL PUSHCONTROL1B(1)
30868 CALL PUSHINTEGER4(i - 1)
30869 CALL PUSHINTEGER4(ad_from12)
30870 CALL PUSHCONTROL1B(0)
30872 CALL PUSHCONTROL1B(1)
30874 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
30875 ad_from13 = i_start
30876 CALL PUSHINTEGER4(i)
30877 DO i=ad_from13,i_end
30878 CALL PUSHREAL8(mrdy)
30879 ! ADT eqn 44, 2nd term on RHS
30880 mrdy = msfux(i, jte-1)*rdy
30881 IF (imax .GT. i) THEN
30882 CALL PUSHINTEGER4(ip)
30884 CALL PUSHCONTROL1B(0)
30886 CALL PUSHINTEGER4(ip)
30888 CALL PUSHCONTROL1B(1)
30890 IF (imin .LT. i - 1) THEN
30891 CALL PUSHINTEGER4(im)
30893 CALL PUSHCONTROL1B(0)
30895 CALL PUSHINTEGER4(im)
30897 CALL PUSHCONTROL1B(1)
30900 vw = 0.5*(rv(ip, k, jte)+rv(im, k, jte))
30901 IF (vw .LT. 0.) THEN
30904 CALL PUSHCONTROL1B(0)
30908 CALL PUSHCONTROL1B(1)
30912 CALL PUSHINTEGER4(i - 1)
30913 CALL PUSHINTEGER4(ad_from13)
30914 CALL PUSHCONTROL1B(1)
30916 CALL PUSHCONTROL1B(0)
30918 !-------------------- vertical advection
30919 ! ADT eqn 44 has 3rd term on RHS = -(1/my) partial d/dz (rho u w)
30920 ! Here we have: - partial d/dz (u*rom) = - partial d/dz (u rho w / my)
30921 ! Since 'my' (map scale factor in y-direction) isn't a function of z,
30922 ! this is what we need, so leave unchanged in advect_u
30926 IF (jte .GT. jde - 1) THEN
30931 ! IF ( config_flags%open_xs ) i_start = MAX(ids+1,its)
30932 ! IF ( config_flags%open_xe ) i_end = MIN(ide-1,ite)
30933 IF (config_flags%open_ys .OR. specified) THEN
30934 IF (ids + 1 .LT. its) THEN
30940 IF (config_flags%open_ye .OR. specified) THEN
30941 IF (ide - 1 .GT. ite) THEN
30947 IF (config_flags%periodic_x) i_start = its
30948 IF (config_flags%periodic_x) i_end = ite
30949 ! vert_order_test : IF (vert_order == 6) THEN
30950 ! ELSE IF (vert_order == 5) THEN
30953 CALL PUSHINTEGER4(i)
30955 vel = 0.5*(rom(i-1, k, j)+rom(i, k, j))
30956 IF (-vel*sign(1,time_step) .GE. 0.0) THEN
30957 CALL PUSHREAL8(qip2)
30958 qip2 = u(i, k+1, j)
30959 CALL PUSHREAL8(qip1)
30963 CALL PUSHREAL8(qim1)
30964 qim1 = u(i, k-2, j)
30965 CALL PUSHREAL8(qim2)
30966 qim2 = u(i, k-3, j)
30967 CALL PUSHCONTROL1B(0)
30969 CALL PUSHREAL8(qip2)
30970 qip2 = u(i, k-2, j)
30971 CALL PUSHREAL8(qip1)
30972 qip1 = u(i, k-1, j)
30975 CALL PUSHREAL8(qim1)
30976 qim1 = u(i, k+1, j)
30977 CALL PUSHREAL8(qim2)
30978 qim2 = u(i, k+2, j)
30979 CALL PUSHCONTROL1B(1)
30982 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
30984 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
30986 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
30987 CALL PUSHREAL8(beta0)
30988 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
30990 CALL PUSHREAL8(beta1)
30991 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
30992 CALL PUSHREAL8(beta2)
30993 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
30997 CALL PUSHINTEGER4(i)
30998 CALL PUSHINTEGER4(k)
31001 DO j=j_end,j_start,-1
31003 DO i=i_end,i_start,-1
31004 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzw(k)*tendencyb(i, k, j)
31005 vfluxb(i, k) = vfluxb(i, k) + rdzw(k)*tendencyb(i, k, j)
31008 CALL POPINTEGER4(k)
31009 DO i=i_end,i_start,-1
31011 temp32b = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i, k)
31012 temp32b0 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
31013 romb(i, k, j) = romb(i, k, j) + temp32b
31014 romb(i-1, k, j) = romb(i-1, k, j) + temp32b
31015 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp32b0
31016 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp32b0
31019 vel = 0.5*(rom(i, k, j)+rom(i-1, k, j))
31020 temp28 = u(i, k+1, j) - u(i, k-2, j) - 3.*(u(i, k, j)-u(i, k-1, j)&
31022 temp31 = SIGN(1., -vel)
31023 temp30 = temp31/12.0
31024 temp29 = SIGN(1, time_step)
31025 temp28b = vel*vfluxb(i, k)
31026 temp28b0 = temp28b/12.0
31027 temp28b1 = temp29*temp30*temp28b
31028 velb = ((7.*(u(i, k, j)+u(i, k-1, j))-u(i, k+1, j)-u(i, k-2, j))/&
31029 & 12.0+temp29*(temp30*temp28))*vfluxb(i, k)
31030 ub0(i, k, j) = ub0(i, k, j) + 7.*temp28b0 - 3.*temp28b1
31031 ub0(i, k-1, j) = ub0(i, k-1, j) + 3.*temp28b1 + 7.*temp28b0
31032 ub0(i, k+1, j) = ub0(i, k+1, j) + temp28b1 - temp28b0
31033 ub0(i, k-2, j) = ub0(i, k-2, j) - temp28b1 - temp28b0
31035 romb(i, k, j) = romb(i, k, j) + 0.5*velb
31036 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
31038 vel = 0.5*(rom(i, k, j)+rom(i-1, k, j))
31039 temp24 = u(i, k+1, j) - u(i, k-2, j) - 3.*(u(i, k, j)-u(i, k-1, j)&
31041 temp27 = SIGN(1., -vel)
31042 temp26 = temp27/12.0
31043 temp25 = SIGN(1, time_step)
31044 temp24b1 = vel*vfluxb(i, k)
31045 temp24b2 = temp24b1/12.0
31046 temp24b3 = temp25*temp26*temp24b1
31047 velb = ((7.*(u(i, k, j)+u(i, k-1, j))-u(i, k+1, j)-u(i, k-2, j))/&
31048 & 12.0+temp25*(temp26*temp24))*vfluxb(i, k)
31049 ub0(i, k, j) = ub0(i, k, j) + 7.*temp24b2 - 3.*temp24b3
31050 ub0(i, k-1, j) = ub0(i, k-1, j) + 3.*temp24b3 + 7.*temp24b2
31051 ub0(i, k+1, j) = ub0(i, k+1, j) + temp24b3 - temp24b2
31052 ub0(i, k-2, j) = ub0(i, k-2, j) - temp24b3 - temp24b2
31054 romb(i, k, j) = romb(i, k, j) + 0.5*velb
31055 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
31057 temp24b4 = 0.5*(fzm(k)*u(i, k, j)+fzp(k)*u(i, k-1, j))*vfluxb(i, k&
31059 temp24b5 = 0.5*(rom(i, k, j)+rom(i-1, k, j))*vfluxb(i, k)
31060 romb(i, k, j) = romb(i, k, j) + temp24b4
31061 romb(i-1, k, j) = romb(i-1, k, j) + temp24b4
31062 ub0(i, k, j) = ub0(i, k, j) + fzm(k)*temp24b5
31063 ub0(i, k-1, j) = ub0(i, k-1, j) + fzp(k)*temp24b5
31066 CALL POPINTEGER4(i)
31067 DO k=ktf-2,kts+3,-1
31068 DO i=i_end,i_start,-1
31069 wi0 = gi0/(eps+beta0)**pw
31070 wi1 = gi1/(eps+beta1)**pw
31071 wi2 = gi2/(eps+beta2)**pw
31072 sumwk = wi0 + wi1 + wi2
31073 vel = 0.5*(rom(i-1, k, j)+rom(i, k, j))
31074 temp24b = vel*vfluxb(i, k)/sumwk
31075 temp24b0 = (wi0*f0+wi1*f1+wi2*f2)*vfluxb(i, k)/sumwk
31080 sumwkb = -(vel*temp24b0/sumwk)
31081 wi0b = sumwkb + f0*temp24b
31082 wi1b = sumwkb + f1*temp24b
31083 wi2b = sumwkb + f2*temp24b
31085 temp23 = (eps+beta2)**pw
31086 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
31090 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp23**2)
31092 temp22 = (eps+beta1)**pw
31093 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
31097 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp22**2)
31099 temp21 = (eps+beta0)**pw
31100 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
31104 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp21**2)
31106 CALL POPREAL8(beta2)
31107 temp21b5 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
31108 temp21b6 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
31109 qip2b = temp21b6 - f2b/6. + temp21b5
31110 CALL POPREAL8(beta1)
31111 temp21b7 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
31112 temp21b10 = 2*(qim1-qip1)*beta1b/4.
31113 qip1b = temp21b7 - temp21b10 + f1b/3. + 5.*f2b/6. - 4.*temp21b6 &
31115 CALL POPREAL8(beta0)
31116 temp21b9 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
31117 temp21b8 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
31118 qib = f2b/3. - 2.*temp21b7 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
31119 & temp21b8 + temp21b9 + 3.*temp21b6 + temp21b5
31120 qim1b = temp21b10 - 4.*temp21b8 - 7.*f0b/6. - f1b/6. - 2.*&
31121 & temp21b9 + temp21b7
31122 qim2b = f0b/3. + temp21b8 + temp21b9
31126 CALL POPCONTROL1B(branch)
31127 IF (branch .EQ. 0) THEN
31128 CALL POPREAL8(qim2)
31129 ub0(i, k-3, j) = ub0(i, k-3, j) + qim2b
31130 CALL POPREAL8(qim1)
31131 ub0(i, k-2, j) = ub0(i, k-2, j) + qim1b
31133 ub0(i, k-1, j) = ub0(i, k-1, j) + qib
31134 CALL POPREAL8(qip1)
31135 ub0(i, k, j) = ub0(i, k, j) + qip1b
31136 CALL POPREAL8(qip2)
31137 ub0(i, k+1, j) = ub0(i, k+1, j) + qip2b
31139 CALL POPREAL8(qim2)
31140 ub0(i, k+2, j) = ub0(i, k+2, j) + qim2b
31141 CALL POPREAL8(qim1)
31142 ub0(i, k+1, j) = ub0(i, k+1, j) + qim1b
31144 ub0(i, k, j) = ub0(i, k, j) + qib
31145 CALL POPREAL8(qip1)
31146 ub0(i, k-1, j) = ub0(i, k-1, j) + qip1b
31147 CALL POPREAL8(qip2)
31148 ub0(i, k-2, j) = ub0(i, k-2, j) + qip2b
31150 romb(i-1, k, j) = romb(i-1, k, j) + 0.5*velb
31151 romb(i, k, j) = romb(i, k, j) + 0.5*velb
31153 CALL POPINTEGER4(i)
31156 CALL POPCONTROL1B(branch)
31157 IF (branch .NE. 0) THEN
31158 CALL POPINTEGER4(ad_from13)
31159 CALL POPINTEGER4(ad_to13)
31160 DO i=ad_to13,ad_from13,-1
31162 dvm = rv(ip, k, jte) - rv(ip, k, jte-1)
31163 dvp = rv(im, k, jte) - rv(im, k, jte-1)
31164 temp21b3 = -(mrdy*tendencyb(i, k, jte-1))
31165 temp21b4 = 0.5*u(i, k, jte-1)*temp21b3
31166 vbb = (u_old(i, k, jte-1)-u_old(i, k, jte-2))*temp21b3
31167 u_oldb(i, k, jte-1) = u_oldb(i, k, jte-1) + vb*temp21b3
31168 u_oldb(i, k, jte-2) = u_oldb(i, k, jte-2) - vb*temp21b3
31169 ub0(i, k, jte-1) = ub0(i, k, jte-1) + 0.5*(dvm+dvp)*temp21b3
31172 rvb(im, k, jte) = rvb(im, k, jte) + dvpb
31173 rvb(im, k, jte-1) = rvb(im, k, jte-1) - dvpb
31174 rvb(ip, k, jte) = rvb(ip, k, jte) + dvmb
31175 rvb(ip, k, jte-1) = rvb(ip, k, jte-1) - dvmb
31176 CALL POPCONTROL1B(branch)
31177 IF (branch .EQ. 0) THEN
31184 rvb(ip, k, jte) = rvb(ip, k, jte) + 0.5*vwb
31185 rvb(im, k, jte) = rvb(im, k, jte) + 0.5*vwb
31187 CALL POPCONTROL1B(branch)
31188 IF (branch .EQ. 0) THEN
31189 CALL POPINTEGER4(im)
31191 CALL POPINTEGER4(im)
31193 CALL POPCONTROL1B(branch)
31194 IF (branch .EQ. 0) THEN
31195 CALL POPINTEGER4(ip)
31197 CALL POPINTEGER4(ip)
31199 CALL POPREAL8(mrdy)
31201 CALL POPINTEGER4(i)
31203 CALL POPCONTROL1B(branch)
31204 IF (branch .EQ. 0) THEN
31205 CALL POPINTEGER4(ad_from12)
31206 CALL POPINTEGER4(ad_to12)
31207 DO i=ad_to12,ad_from12,-1
31209 dvm = rv(ip, k, jts+1) - rv(ip, k, jts)
31210 dvp = rv(im, k, jts+1) - rv(im, k, jts)
31211 temp21b1 = -(mrdy*tendencyb(i, k, jts))
31212 temp21b2 = 0.5*u(i, k, jts)*temp21b1
31213 vbb = (u_old(i, k, jts+1)-u_old(i, k, jts))*temp21b1
31214 u_oldb(i, k, jts+1) = u_oldb(i, k, jts+1) + vb*temp21b1
31215 u_oldb(i, k, jts) = u_oldb(i, k, jts) - vb*temp21b1
31216 ub0(i, k, jts) = ub0(i, k, jts) + 0.5*(dvm+dvp)*temp21b1
31219 rvb(im, k, jts+1) = rvb(im, k, jts+1) + dvpb
31220 rvb(im, k, jts) = rvb(im, k, jts) - dvpb
31221 rvb(ip, k, jts+1) = rvb(ip, k, jts+1) + dvmb
31222 rvb(ip, k, jts) = rvb(ip, k, jts) - dvmb
31223 CALL POPCONTROL1B(branch)
31224 IF (branch .EQ. 0) THEN
31231 rvb(ip, k, jts) = rvb(ip, k, jts) + 0.5*vwb
31232 rvb(im, k, jts) = rvb(im, k, jts) + 0.5*vwb
31234 CALL POPCONTROL1B(branch)
31235 IF (branch .EQ. 0) THEN
31236 CALL POPINTEGER4(im)
31238 CALL POPINTEGER4(im)
31240 CALL POPCONTROL1B(branch)
31241 IF (branch .EQ. 0) THEN
31242 CALL POPINTEGER4(ip)
31244 CALL POPINTEGER4(ip)
31246 CALL POPREAL8(mrdy)
31248 CALL POPINTEGER4(i)
31250 CALL POPCONTROL1B(branch)
31251 IF (branch .NE. 0) THEN
31252 CALL POPINTEGER4(ad_from11)
31253 CALL POPINTEGER4(ad_to11)
31254 DO j=ad_to11,ad_from11,-1
31256 temp21b0 = -(rdx*tendencyb(ite, k, j))
31257 ubb = (u_old(ite, k, j)-u_old(ite-1, k, j))*temp21b0
31258 u_oldb(ite, k, j) = u_oldb(ite, k, j) + ub*temp21b0
31259 u_oldb(ite-1, k, j) = u_oldb(ite-1, k, j) - ub*temp21b0
31260 CALL POPCONTROL1B(branch)
31261 IF (branch .EQ. 0) THEN
31265 rub(ite, k, j) = rub(ite, k, j) + ubb
31266 mutb(ite-1, j) = mutb(ite-1, j) + cb*ubb
31271 CALL POPCONTROL1B(branch)
31272 IF (branch .EQ. 0) THEN
31273 CALL POPINTEGER4(ad_from10)
31274 CALL POPINTEGER4(ad_to10)
31275 DO j=ad_to10,ad_from10,-1
31277 temp21b = -(rdx*tendencyb(its, k, j))
31278 ubb = (u_old(its+1, k, j)-u_old(its, k, j))*temp21b
31279 u_oldb(its+1, k, j) = u_oldb(its+1, k, j) + ub*temp21b
31280 u_oldb(its, k, j) = u_oldb(its, k, j) - ub*temp21b
31281 CALL POPCONTROL1B(branch)
31282 IF (branch .EQ. 0) THEN
31286 rub(its, k, j) = rub(its, k, j) + ubb
31287 mutb(its, j) = mutb(its, j) - cb*ubb
31293 CALL POPINTEGER4(ad_from9)
31294 CALL POPINTEGER4(ad_to9)
31295 DO j=ad_to9,ad_from9,-1
31297 CALL POPINTEGER4(ad_from8)
31298 CALL POPINTEGER4(ad_to8)
31299 DO i=ad_to8,ad_from8,-1
31300 mrdx = msfux(i, j)*rdx
31301 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
31302 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
31304 CALL POPINTEGER4(i)
31306 CALL POPCONTROL1B(branch)
31307 IF (branch .NE. 0) THEN
31310 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
31311 temp17 = u(i+1, k, j) - u(i-2, k, j) - 3.*(u(i, k, j)-u(i-1, k, &
31313 temp20 = SIGN(1., vel)
31314 temp19 = temp20/12.0
31315 temp18 = SIGN(1, time_step)
31316 temp17b1 = vel*fqxb(i, k)
31317 temp17b2 = temp17b1/12.0
31318 temp17b3 = temp18*temp19*temp17b1
31319 velb = ((7.*(u(i, k, j)+u(i-1, k, j))-u(i+1, k, j)-u(i-2, k, j))&
31320 & /12.0+temp18*(temp19*temp17))*fqxb(i, k)
31321 ub0(i, k, j) = ub0(i, k, j) + 7.*temp17b2 - 3.*temp17b3
31322 ub0(i-1, k, j) = ub0(i-1, k, j) + 3.*temp17b3 + 7.*temp17b2
31323 ub0(i+1, k, j) = ub0(i+1, k, j) + temp17b3 - temp17b2
31324 ub0(i-2, k, j) = ub0(i-2, k, j) - temp17b3 - temp17b2
31326 rub(i, k, j) = rub(i, k, j) + 0.5*velb
31327 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
31328 CALL POPINTEGER4(i)
31330 CALL POPCONTROL1B(branch)
31331 IF (branch .NE. 0) THEN
31333 temp17b = 0.25*(u(i-1, k, j)+ub)*fqxb(i, k)
31334 temp17b0 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
31335 rub(i, k, j) = rub(i, k, j) + temp17b
31336 rub(i-1, k, j) = rub(i-1, k, j) + temp17b
31337 ub0(i-1, k, j) = ub0(i-1, k, j) + temp17b0
31340 CALL POPCONTROL1B(branch)
31341 IF (branch .EQ. 0) THEN
31342 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
31346 ub0(i, k, j) = ub0(i, k, j) + ubb
31348 CALL POPINTEGER4(i)
31351 CALL POPCONTROL1B(branch)
31352 IF (branch .EQ. 0) THEN
31354 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
31355 temp13 = u(i+1, k, j) - u(i-2, k, j) - 3.*(u(i, k, j)-u(i-1, k, &
31357 temp16 = SIGN(1., vel)
31358 temp15 = temp16/12.0
31359 temp14 = SIGN(1, time_step)
31360 temp13b3 = vel*fqxb(i, k)
31361 temp13b4 = temp13b3/12.0
31362 temp13b5 = temp14*temp15*temp13b3
31363 velb = ((7.*(u(i, k, j)+u(i-1, k, j))-u(i+1, k, j)-u(i-2, k, j))&
31364 & /12.0+temp14*(temp15*temp13))*fqxb(i, k)
31365 ub0(i, k, j) = ub0(i, k, j) + 7.*temp13b4 - 3.*temp13b5
31366 ub0(i-1, k, j) = ub0(i-1, k, j) + 3.*temp13b5 + 7.*temp13b4
31367 ub0(i+1, k, j) = ub0(i+1, k, j) + temp13b5 - temp13b4
31368 ub0(i-2, k, j) = ub0(i-2, k, j) - temp13b5 - temp13b4
31370 rub(i, k, j) = rub(i, k, j) + 0.5*velb
31371 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
31373 CALL POPINTEGER4(i)
31374 CALL POPCONTROL1B(branch)
31375 IF (branch .EQ. 0) THEN
31377 temp13b1 = 0.25*(u(i, k, j)+ub)*fqxb(i, k)
31378 temp13b2 = 0.25*(ru(i, k, j)+ru(i-1, k, j))*fqxb(i, k)
31379 rub(i, k, j) = rub(i, k, j) + temp13b1
31380 rub(i-1, k, j) = rub(i-1, k, j) + temp13b1
31381 ub0(i, k, j) = ub0(i, k, j) + temp13b2
31384 CALL POPCONTROL1B(branch)
31385 IF (branch .EQ. 0) THEN
31386 ub0(i, k, j) = ub0(i, k, j) + ubb
31390 ub0(i-1, k, j) = ub0(i-1, k, j) + ubb
31392 CALL POPINTEGER4(i)
31396 DO i=i_end_f,i_start_f,-1
31397 wi0 = gi0/(eps+beta0)**pw
31398 wi1 = gi1/(eps+beta1)**pw
31399 wi2 = gi2/(eps+beta2)**pw
31400 sumwk = wi0 + wi1 + wi2
31401 vel = 0.5*(ru(i, k, j)+ru(i-1, k, j))
31402 temp13b = vel*fqxb(i, k)/sumwk
31403 temp13b0 = (wi0*f0+wi1*f1+wi2*f2)*fqxb(i, k)/sumwk
31408 sumwkb = -(vel*temp13b0/sumwk)
31409 wi0b = sumwkb + f0*temp13b
31410 wi1b = sumwkb + f1*temp13b
31411 wi2b = sumwkb + f2*temp13b
31413 temp12 = (eps+beta2)**pw
31414 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
31418 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp12**2)
31420 temp11 = (eps+beta1)**pw
31421 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
31425 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp11**2)
31427 temp10 = (eps+beta0)**pw
31428 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
31432 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp10**2)
31434 CALL POPREAL8(beta2)
31435 temp10b = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
31436 temp10b0 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
31437 qip2b = temp10b0 - f2b/6. + temp10b
31438 CALL POPREAL8(beta1)
31439 temp10b1 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
31440 temp10b4 = 2*(qim1-qip1)*beta1b/4.
31441 qip1b = temp10b1 - temp10b4 + f1b/3. + 5.*f2b/6. - 4.*temp10b0 -&
31443 CALL POPREAL8(beta0)
31444 temp10b3 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
31445 temp10b2 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
31446 qib = f2b/3. - 2.*temp10b1 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
31447 & temp10b2 + temp10b3 + 3.*temp10b0 + temp10b
31448 qim1b = temp10b4 - 4.*temp10b2 - 7.*f0b/6. - f1b/6. - 2.*&
31449 & temp10b3 + temp10b1
31450 qim2b = f0b/3. + temp10b2 + temp10b3
31454 CALL POPCONTROL1B(branch)
31455 IF (branch .EQ. 0) THEN
31456 CALL POPREAL8(qim2)
31457 ub0(i-3, k, j) = ub0(i-3, k, j) + qim2b
31458 CALL POPREAL8(qim1)
31459 ub0(i-2, k, j) = ub0(i-2, k, j) + qim1b
31461 ub0(i-1, k, j) = ub0(i-1, k, j) + qib
31462 CALL POPREAL8(qip1)
31463 ub0(i, k, j) = ub0(i, k, j) + qip1b
31464 CALL POPREAL8(qip2)
31465 ub0(i+1, k, j) = ub0(i+1, k, j) + qip2b
31467 CALL POPREAL8(qim2)
31468 ub0(i+2, k, j) = ub0(i+2, k, j) + qim2b
31469 CALL POPREAL8(qim1)
31470 ub0(i+1, k, j) = ub0(i+1, k, j) + qim1b
31472 ub0(i, k, j) = ub0(i, k, j) + qib
31473 CALL POPREAL8(qip1)
31474 ub0(i-1, k, j) = ub0(i-1, k, j) + qip1b
31475 CALL POPREAL8(qip2)
31476 ub0(i-2, k, j) = ub0(i-2, k, j) + qip2b
31478 rub(i, k, j) = rub(i, k, j) + 0.5*velb
31479 rub(i-1, k, j) = rub(i-1, k, j) + 0.5*velb
31481 CALL POPINTEGER4(i)
31485 CALL POPINTEGER4(ad_from7)
31486 CALL POPINTEGER4(ad_to7)
31487 DO j=ad_to7,ad_from7,-1
31488 CALL POPINTEGER4(jp0)
31489 CALL POPINTEGER4(jp1)
31490 CALL POPCONTROL2B(branch)
31491 IF (branch .LT. 2) THEN
31492 IF (branch .EQ. 0) THEN
31494 CALL POPINTEGER4(ad_from4)
31495 CALL POPINTEGER4(ad_to4)
31496 DO i=ad_to4,ad_from4,-1
31497 mrdy = msfux(i, j-1)*rdy
31498 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1&
31504 CALL POPINTEGER4(ad_from5)
31505 CALL POPINTEGER4(ad_to5)
31506 DO i=ad_to5,ad_from5,-1
31507 mrdy = msfux(i, j-1)*rdy
31508 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1&
31513 ELSE IF (branch .EQ. 2) THEN
31515 CALL POPINTEGER4(ad_from6)
31516 CALL POPINTEGER4(ad_to6)
31517 DO i=ad_to6,ad_from6,-1
31518 mrdy = msfux(i, j-1)*rdy
31519 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1)
31520 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1)
31524 CALL POPCONTROL3B(branch)
31525 IF (branch .LT. 3) THEN
31526 IF (branch .EQ. 0) THEN
31528 CALL POPINTEGER4(ad_from)
31529 CALL POPINTEGER4(ad_to)
31530 DO i=ad_to,ad_from,-1
31531 wi0 = gi0/(eps+beta0)**pw
31532 wi1 = gi1/(eps+beta1)**pw
31533 wi2 = gi2/(eps+beta2)**pw
31534 sumwk = wi0 + wi1 + wi2
31535 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
31536 temp2b = vel*fqyb(i, k, jp1)/sumwk
31537 temp2b0 = (wi0*f0+wi1*f1+wi2*f2)*fqyb(i, k, jp1)/sumwk
31542 sumwkb = -(vel*temp2b0/sumwk)
31543 wi0b = sumwkb + f0*temp2b
31544 wi1b = sumwkb + f1*temp2b
31545 wi2b = sumwkb + f2*temp2b
31546 fqyb(i, k, jp1) = 0.0
31547 temp1 = (eps+beta2)**pw
31548 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT&
31552 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp1**2)
31554 temp0 = (eps+beta1)**pw
31555 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT&
31559 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp0**2)
31561 temp = (eps+beta0)**pw
31562 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT&
31566 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp**2)
31568 CALL POPREAL8(beta2)
31569 tempb = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
31570 tempb0 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
31571 qip2b = tempb0 - f2b/6. + tempb
31572 CALL POPREAL8(beta1)
31573 tempb1 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
31574 tempb4 = 2*(qim1-qip1)*beta1b/4.
31575 qip1b = tempb1 - tempb4 + f1b/3. + 5.*f2b/6. - 4.*tempb0 - &
31577 CALL POPREAL8(beta0)
31578 tempb3 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
31579 tempb2 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
31580 qib = f2b/3. - 2.*tempb1 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
31581 & tempb2 + tempb3 + 3.*tempb0 + tempb
31582 qim1b = tempb4 - 4.*tempb2 - 7.*f0b/6. - f1b/6. - 2.*tempb3 &
31584 qim2b = f0b/3. + tempb2 + tempb3
31588 CALL POPCONTROL1B(branch)
31589 IF (branch .EQ. 0) THEN
31590 CALL POPREAL8(qim2)
31591 ub0(i, k, j-3) = ub0(i, k, j-3) + qim2b
31592 CALL POPREAL8(qim1)
31593 ub0(i, k, j-2) = ub0(i, k, j-2) + qim1b
31595 ub0(i, k, j-1) = ub0(i, k, j-1) + qib
31596 CALL POPREAL8(qip1)
31597 ub0(i, k, j) = ub0(i, k, j) + qip1b
31598 CALL POPREAL8(qip2)
31599 ub0(i, k, j+1) = ub0(i, k, j+1) + qip2b
31601 CALL POPREAL8(qim2)
31602 ub0(i, k, j+2) = ub0(i, k, j+2) + qim2b
31603 CALL POPREAL8(qim1)
31604 ub0(i, k, j+1) = ub0(i, k, j+1) + qim1b
31606 ub0(i, k, j) = ub0(i, k, j) + qib
31607 CALL POPREAL8(qip1)
31608 ub0(i, k, j-1) = ub0(i, k, j-1) + qip1b
31609 CALL POPREAL8(qip2)
31610 ub0(i, k, j-2) = ub0(i, k, j-2) + qip2b
31612 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
31613 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
31616 ELSE IF (branch .EQ. 1) THEN
31618 CALL POPINTEGER4(ad_from0)
31619 CALL POPINTEGER4(ad_to0)
31620 DO i=ad_to0,ad_from0,-1
31621 temp2b1 = 0.25*(u(i, k, j)+u(i, k, j-1))*fqyb(i, k, jp1)
31622 temp2b2 = 0.25*(rv(i, k, j)+rv(i-1, k, j))*fqyb(i, k, jp1)
31623 rvb(i, k, j) = rvb(i, k, j) + temp2b1
31624 rvb(i-1, k, j) = rvb(i-1, k, j) + temp2b1
31625 ub0(i, k, j) = ub0(i, k, j) + temp2b2
31626 ub0(i, k, j-1) = ub0(i, k, j-1) + temp2b2
31627 fqyb(i, k, jp1) = 0.0
31632 CALL POPINTEGER4(ad_from1)
31633 CALL POPINTEGER4(ad_to1)
31634 DO i=ad_to1,ad_from1,-1
31635 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
31636 temp2 = u(i, k, j+1) - u(i, k, j-2) - 3.*(u(i, k, j)-u(i, k&
31638 temp5 = SIGN(1., vel)
31640 temp3 = SIGN(1, time_step)
31641 temp2b3 = vel*fqyb(i, k, jp1)
31642 temp2b4 = temp2b3/12.0
31643 temp2b5 = temp3*temp4*temp2b3
31644 velb = ((7.*(u(i, k, j)+u(i, k, j-1))-u(i, k, j+1)-u(i, k, j&
31645 & -2))/12.0+temp3*(temp4*temp2))*fqyb(i, k, jp1)
31646 ub0(i, k, j) = ub0(i, k, j) + 7.*temp2b4 - 3.*temp2b5
31647 ub0(i, k, j-1) = ub0(i, k, j-1) + 3.*temp2b5 + 7.*temp2b4
31648 ub0(i, k, j+1) = ub0(i, k, j+1) + temp2b5 - temp2b4
31649 ub0(i, k, j-2) = ub0(i, k, j-2) - temp2b5 - temp2b4
31650 fqyb(i, k, jp1) = 0.0
31651 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
31652 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
31656 ELSE IF (branch .EQ. 3) THEN
31658 CALL POPINTEGER4(ad_from2)
31659 CALL POPINTEGER4(ad_to2)
31660 DO i=ad_to2,ad_from2,-1
31661 temp6b = 0.25*(u(i, k, j)+u(i, k, j-1))*fqyb(i, k, jp1)
31662 temp6b0 = 0.25*(rv(i, k, j)+rv(i-1, k, j))*fqyb(i, k, jp1)
31663 rvb(i, k, j) = rvb(i, k, j) + temp6b
31664 rvb(i-1, k, j) = rvb(i-1, k, j) + temp6b
31665 ub0(i, k, j) = ub0(i, k, j) + temp6b0
31666 ub0(i, k, j-1) = ub0(i, k, j-1) + temp6b0
31667 fqyb(i, k, jp1) = 0.0
31670 ELSE IF (branch .EQ. 4) THEN
31672 CALL POPINTEGER4(ad_from3)
31673 CALL POPINTEGER4(ad_to3)
31674 DO i=ad_to3,ad_from3,-1
31675 vel = 0.5*(rv(i, k, j)+rv(i-1, k, j))
31676 temp6 = u(i, k, j+1) - u(i, k, j-2) - 3.*(u(i, k, j)-u(i, k, j&
31678 temp9 = SIGN(1., vel)
31680 temp7 = SIGN(1, time_step)
31681 temp6b1 = vel*fqyb(i, k, jp1)
31682 temp6b2 = temp6b1/12.0
31683 temp6b3 = temp7*temp8*temp6b1
31684 velb = ((7.*(u(i, k, j)+u(i, k, j-1))-u(i, k, j+1)-u(i, k, j-2&
31685 & ))/12.0+temp7*(temp8*temp6))*fqyb(i, k, jp1)
31686 ub0(i, k, j) = ub0(i, k, j) + 7.*temp6b2 - 3.*temp6b3
31687 ub0(i, k, j-1) = ub0(i, k, j-1) + 3.*temp6b3 + 7.*temp6b2
31688 ub0(i, k, j+1) = ub0(i, k, j+1) + temp6b3 - temp6b2
31689 ub0(i, k, j-2) = ub0(i, k, j-2) - temp6b3 - temp6b2
31690 fqyb(i, k, jp1) = 0.0
31691 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
31692 rvb(i-1, k, j) = rvb(i-1, k, j) + 0.5*velb
31697 END SUBROUTINE A_ADVECT_WENO_U
31699 ! Generated by TAPENADE (INRIA, Tropics team)
31700 ! Tapenade 3.6 (r4165) - 21 sep 2011 20:54
31702 ! Differentiation of advect_weno_v in reverse (adjoint) mode:
31703 ! gradient of useful results: rom tendency v v_old ru rv
31705 ! with respect to varying inputs: rom tendency v v_old ru rv
31707 ! RW status of diff variables: rom:incr tendency:in-out v:incr
31708 ! v_old:incr ru:incr rv:incr mut:incr
31709 SUBROUTINE A_ADVECT_WENO_V(v, vb0, v_old, v_oldb, tendency, tendencyb, &
31710 & ru, rub, rv, rvb, rom, romb, mut, mutb, time_step, config_flags, msfux&
31711 & , msfuy, msfvx, msfvy, msftx, msfty, fzm, fzp, rdx, rdy, rdzw, ids, &
31712 & ide, jds, jde, kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, &
31716 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
31717 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
31718 & jme, kms, kme, its, ite, jts, jte, kts, kte
31719 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: v, v_old, ru&
31721 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: vb0, v_oldb, rub, rvb, &
31723 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut
31724 REAL, DIMENSION(ims:ime, jms:jme) :: mutb
31725 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
31726 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendencyb
31727 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
31728 & msfvy, msftx, msfty
31729 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzw
31730 REAL, INTENT(IN) :: rdx, rdy
31731 INTEGER, INTENT(IN) :: time_step
31733 INTEGER :: i, j, k, itf, jtf, ktf
31734 INTEGER :: i_start, i_end, j_start, j_end
31735 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
31736 INTEGER :: jmin, jmax, jp, jm, imin, imax
31738 REAL :: ue, vs, vn, wb, wt
31739 REAL, PARAMETER :: f30=7./12., f31=1./12.
31740 REAL, PARAMETER :: f50=37./60., f51=2./15., f52=1./60.
31742 REAL :: qim2, qim1, qi, qip1, qip2
31743 REAL :: qim2b, qim1b, qib, qip1b, qip2b
31744 DOUBLE PRECISION :: beta0, beta1, beta2, f0, f1, f2, wi0, wi1, wi2, &
31746 DOUBLE PRECISION :: beta0b, beta1b, beta2b, f0b, f1b, f2b, wi0b, wi1b&
31748 DOUBLE PRECISION, PARAMETER :: gi0=1.d0/10.d0, gi1=6.d0/10.d0, gi2=&
31749 & 3.d0/10.d0, eps=1.0d-18
31750 INTEGER, PARAMETER :: pw=2
31751 REAL :: mrdx, mrdy, ub, vb, uw, vw, dup, dum
31752 REAL :: ubb, vbb, uwb, dupb, dumb
31753 REAL, DIMENSION(its:ite, kts:kte) :: vflux
31754 REAL, DIMENSION(its:ite, kts:kte) :: vfluxb
31755 REAL, DIMENSION(its:ite + 1, kts:kte) :: fqx
31756 REAL, DIMENSION(its:ite+1, kts:kte) :: fqxb
31757 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqy
31758 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqyb
31759 INTEGER :: horz_order
31760 INTEGER :: vert_order
31761 LOGICAL :: degrade_xs, degrade_ys
31762 LOGICAL :: degrade_xe, degrade_ye
31763 INTEGER :: jp1, jp0, jtmp
31764 ! definition of flux operators, 3rd, 4th, 5th or 6th order
31765 REAL :: flux3, flux4, flux5, flux6
31766 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel
31768 LOGICAL :: specified
31772 INTEGER :: ad_from0
31774 INTEGER :: ad_from1
31776 INTEGER :: ad_from2
31778 INTEGER :: ad_from3
31780 INTEGER :: ad_from4
31782 INTEGER :: ad_from5
31784 INTEGER :: ad_from6
31786 INTEGER :: ad_from7
31788 INTEGER :: ad_from8
31790 INTEGER :: ad_from9
31792 INTEGER :: ad_from10
31794 INTEGER :: ad_from11
31796 INTEGER :: ad_from12
31798 INTEGER :: ad_from13
31800 INTEGER :: ad_from14
31806 DOUBLE PRECISION :: temp1
31808 DOUBLE PRECISION :: temp0
31809 DOUBLE PRECISION :: temp13b
31814 DOUBLE PRECISION :: temp23
31815 DOUBLE PRECISION :: temp22
31816 DOUBLE PRECISION :: temp21
31820 DOUBLE PRECISION :: temp24b
31825 DOUBLE PRECISION :: temp13b0
31845 DOUBLE PRECISION :: temp2b0
31851 DOUBLE PRECISION :: temp12
31853 DOUBLE PRECISION :: temp11
31855 DOUBLE PRECISION :: temp10
31865 DOUBLE PRECISION :: temp2b
31870 DOUBLE PRECISION :: temp24b0
31883 DOUBLE PRECISION :: temp
31899 specified = .false.
31900 IF (config_flags%specified .OR. config_flags%nested) specified = &
31902 IF (kte .GT. kde - 1) THEN
31907 ! here is the choice of flux operators
31908 ! horizontal_order_test : IF( horz_order == 6 ) THEN
31909 ! ELSE IF( horz_order == 5 ) THEN
31910 ! 5th order horizontal flux calculation
31911 ! This code is EXACTLY the same as the 6th order code
31912 ! EXCEPT the 5th order and 3rd operators are used in
31913 ! place of the 6th and 4th order operators
31914 ! determine boundary mods for flux operators
31915 ! We degrade the flux operators from 3rd/4th order
31916 ! to second order one gridpoint in from the boundaries for
31917 ! all boundary conditions except periodic and symmetry - these
31918 ! conditions have boundary zone data fill for correct application
31919 ! of the higher order flux stencils
31920 degrade_xs = .true.
31921 degrade_xe = .true.
31922 degrade_ys = .true.
31923 degrade_ye = .true.
31924 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. its &
31925 & .GT. ids + 3) degrade_xs = .false.
31926 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. ite &
31927 & .LT. ide - 3) degrade_xe = .false.
31928 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. jts &
31929 & .GT. jds + 3) degrade_ys = .false.
31930 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. jte &
31931 & .LT. jde - 3) degrade_ye = .false.
31932 !--------------- y - advection first
31934 IF (ite .GT. ide - 1) THEN
31941 ! higher order flux has a 5 or 7 point stencil, so compute
31942 ! bounds so we can switch to second order flux close to the boundary
31943 j_start_f = j_start
31944 j_end_f = j_end + 1
31945 IF (degrade_ys) THEN
31946 IF (jts .LT. jds + 1) THEN
31951 j_start_f = jds + 3
31953 IF (degrade_ye) THEN
31954 IF (jte .GT. jde - 1) THEN
31961 ! compute fluxes, 5th or 6th order
31965 j_loop_y_flux_5:DO j=ad_from7,j_end+1
31966 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
31970 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
31971 IF (vel*sign(1,time_step) .GE. 0.0) THEN
31972 CALL PUSHREAL8(qip2)
31973 qip2 = v(i, k, j+1)
31974 CALL PUSHREAL8(qip1)
31978 CALL PUSHREAL8(qim1)
31979 qim1 = v(i, k, j-2)
31980 CALL PUSHREAL8(qim2)
31981 qim2 = v(i, k, j-3)
31982 CALL PUSHCONTROL1B(0)
31984 CALL PUSHREAL8(qip2)
31985 qip2 = v(i, k, j-2)
31986 CALL PUSHREAL8(qip1)
31987 qip1 = v(i, k, j-1)
31990 CALL PUSHREAL8(qim1)
31991 qim1 = v(i, k, j+1)
31992 CALL PUSHREAL8(qim2)
31993 qim2 = v(i, k, j+2)
31994 CALL PUSHCONTROL1B(1)
31997 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
31999 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
32001 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
32002 CALL PUSHREAL8(beta0)
32003 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*&
32005 CALL PUSHREAL8(beta1)
32006 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
32007 CALL PUSHREAL8(beta2)
32008 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*&
32011 CALL PUSHINTEGER4(i - 1)
32012 CALL PUSHINTEGER4(ad_from)
32014 CALL PUSHCONTROL3B(0)
32015 ELSE IF (j .EQ. jds + 1) THEN
32016 ! fqy( i, k, jp1 ) = vel*flux5( &
32017 ! v(i,k,j-3), v(i,k,j-2), v(i,k,j-1), &
32018 ! v(i,k,j ), v(i,k,j+1), v(i,k,j+2), vel )
32019 ! we must be close to some boundary where we need to reduce the order of the stencil
32020 ! specified uses upstream normal wind at boundaries
32021 ! 2nd order flux next to south boundary
32024 DO i=ad_from0,i_end
32027 IF (specified .AND. v(i, k, j) .LT. 0.) THEN
32029 CALL PUSHCONTROL1B(0)
32031 CALL PUSHCONTROL1B(1)
32034 CALL PUSHINTEGER4(i - 1)
32035 CALL PUSHINTEGER4(ad_from0)
32037 CALL PUSHCONTROL3B(1)
32038 ELSE IF (j .EQ. jds + 2) THEN
32039 ! third of 4th order flux 2 in from south boundary
32043 CALL PUSHINTEGER4(i - 1)
32044 CALL PUSHINTEGER4(ad_from1)
32046 CALL PUSHCONTROL3B(2)
32047 ELSE IF (j .EQ. jde) THEN
32048 ! 2nd order flux next to north boundary
32051 DO i=ad_from2,i_end
32054 IF (specified .AND. v(i, k, j-1) .GT. 0.) THEN
32056 CALL PUSHCONTROL1B(0)
32058 CALL PUSHCONTROL1B(1)
32061 CALL PUSHINTEGER4(i - 1)
32062 CALL PUSHINTEGER4(ad_from2)
32064 CALL PUSHCONTROL3B(3)
32065 ELSE IF (j .EQ. jde - 1) THEN
32066 ! 3rd or 4th order flux 2 in from north boundary
32070 CALL PUSHINTEGER4(i - 1)
32071 CALL PUSHINTEGER4(ad_from3)
32073 CALL PUSHCONTROL3B(4)
32075 CALL PUSHCONTROL3B(5)
32077 ! y flux-divergence into tendency
32078 ! Comments on polar boundary conditions
32079 ! No advection over the poles means tendencies (held from jds [S. pole]
32080 ! to jde [N pole], i.e., on v grid) must be zero at poles
32081 ! [tendency(jds) and tendency(jde)=0]
32082 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
32086 CALL PUSHINTEGER4(i - 1)
32087 CALL PUSHINTEGER4(ad_from4)
32089 CALL PUSHCONTROL2B(0)
32090 ELSE IF (config_flags%polar .AND. j .EQ. jde + 1) THEN
32091 ! If j_end were set to jde in a special if statement apart from
32092 ! degrade_ye, then we would hit the next conditional. But since
32093 ! we want the tendency to be zero anyway, not looping to jde+1
32094 ! will produce the same effect.
32098 CALL PUSHINTEGER4(i - 1)
32099 CALL PUSHINTEGER4(ad_from5)
32101 CALL PUSHCONTROL2B(1)
32102 ELSE IF (j .GT. j_start) THEN
32107 CALL PUSHINTEGER4(i - 1)
32108 CALL PUSHINTEGER4(ad_from6)
32110 CALL PUSHCONTROL2B(2)
32112 CALL PUSHCONTROL2B(3)
32115 CALL PUSHINTEGER4(jp1)
32117 CALL PUSHINTEGER4(jp0)
32119 END DO j_loop_y_flux_5
32120 CALL PUSHINTEGER4(j - 1)
32121 CALL PUSHINTEGER4(ad_from7)
32122 ! next, x - flux divergence
32124 IF (ite .GT. ide - 1) THEN
32131 ! Polar boundary conditions are like open or specified
32132 IF ((config_flags%open_ys .OR. specified) .OR. config_flags%polar) &
32134 IF (jds + 1 .LT. jts) THEN
32140 IF ((config_flags%open_ye .OR. specified) .OR. config_flags%polar) &
32142 IF (jde - 1 .GT. jte) THEN
32148 ! higher order flux has a 5 or 7 point stencil, so compute
32149 ! bounds so we can switch to second order flux close to the boundary
32150 i_start_f = i_start
32151 i_end_f = i_end + 1
32152 IF (degrade_xs) THEN
32153 IF (ids + 1 .LT. its) THEN
32158 IF (i_start + 2 .GT. ids + 3) THEN
32159 i_start_f = ids + 3
32161 i_start_f = i_start + 2
32164 IF (degrade_xe) THEN
32165 IF (ide - 2 .GT. ite) THEN
32172 ad_from10 = j_start
32174 DO j=ad_from10,j_end
32175 ! 5th or 6th order flux
32177 DO i=i_start_f,i_end_f
32178 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
32179 IF (vel*sign(1,time_step) .GE. 0.0) THEN
32180 CALL PUSHREAL8(qip2)
32181 qip2 = v(i+1, k, j)
32182 CALL PUSHREAL8(qip1)
32186 CALL PUSHREAL8(qim1)
32187 qim1 = v(i-2, k, j)
32188 CALL PUSHREAL8(qim2)
32189 qim2 = v(i-3, k, j)
32190 CALL PUSHCONTROL1B(0)
32192 CALL PUSHREAL8(qip2)
32193 qip2 = v(i-2, k, j)
32194 CALL PUSHREAL8(qip1)
32195 qip1 = v(i-1, k, j)
32198 CALL PUSHREAL8(qim1)
32199 qim1 = v(i+1, k, j)
32200 CALL PUSHREAL8(qim2)
32201 qim2 = v(i+2, k, j)
32202 CALL PUSHCONTROL1B(1)
32205 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
32207 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
32209 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
32210 CALL PUSHREAL8(beta0)
32211 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
32213 CALL PUSHREAL8(beta1)
32214 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
32215 CALL PUSHREAL8(beta2)
32216 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
32220 ! fqx( i, k ) = vel*flux5( v(i-3,k,j), v(i-2,k,j), &
32221 ! v(i-1,k,j), v(i ,k,j), &
32222 ! v(i+1,k,j), v(i+2,k,j), &
32224 ! lower order fluxes close to boundaries (if not periodic or symmetric)
32225 IF (degrade_xs) THEN
32227 DO i=ad_from8,i_start_f-1
32228 IF (i .EQ. ids + 1) THEN
32229 CALL PUSHCONTROL1B(0)
32231 CALL PUSHCONTROL1B(1)
32233 IF (i .EQ. ids + 2) THEN
32234 CALL PUSHCONTROL1B(1)
32236 CALL PUSHCONTROL1B(0)
32239 CALL PUSHINTEGER4(ad_from8)
32240 CALL PUSHCONTROL1B(0)
32242 CALL PUSHCONTROL1B(1)
32244 IF (degrade_xe) THEN
32245 DO i=i_end_f+1,i_end+1
32246 IF (i .EQ. ide - 1) THEN
32247 CALL PUSHCONTROL1B(0)
32249 CALL PUSHCONTROL1B(1)
32251 IF (i .EQ. ide - 2) THEN
32252 CALL PUSHCONTROL1B(1)
32254 CALL PUSHCONTROL1B(0)
32257 CALL PUSHINTEGER4(i - 1)
32258 CALL PUSHCONTROL1B(1)
32260 CALL PUSHCONTROL1B(0)
32262 ! x flux-divergence into tendency
32266 CALL PUSHINTEGER4(i - 1)
32267 CALL PUSHINTEGER4(ad_from9)
32270 CALL PUSHINTEGER4(j - 1)
32271 CALL PUSHINTEGER4(ad_from10)
32272 ! Comments on polar boundary condition
32273 ! Force tendency=0 at NP and SP
32274 ! We keep setting this everywhere, but it can't hurt...
32275 IF (config_flags%polar .AND. jts .EQ. jds) THEN
32276 CALL PUSHCONTROL1B(0)
32278 CALL PUSHCONTROL1B(1)
32280 IF (config_flags%polar .AND. jte .EQ. jde) THEN
32281 CALL PUSHCONTROL1B(0)
32283 CALL PUSHCONTROL1B(1)
32285 ! radiative lateral boundary condition in y for normal velocity (v)
32286 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
32288 IF (ite .GT. ide - 1) THEN
32289 CALL PUSHINTEGER4(i_end)
32291 CALL PUSHCONTROL1B(0)
32293 CALL PUSHINTEGER4(i_end)
32295 CALL PUSHCONTROL1B(1)
32297 ad_from11 = i_start
32298 DO i=ad_from11,i_end
32300 IF (rv(i, k, jts) - cb*mut(i, jts) .GT. 0.) THEN
32303 CALL PUSHCONTROL1B(0)
32306 vb = rv(i, k, jts) - cb*mut(i, jts)
32307 CALL PUSHCONTROL1B(1)
32311 CALL PUSHINTEGER4(i - 1)
32312 CALL PUSHINTEGER4(ad_from11)
32313 CALL PUSHCONTROL1B(0)
32315 CALL PUSHCONTROL1B(1)
32317 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
32319 IF (ite .GT. ide - 1) THEN
32320 CALL PUSHINTEGER4(i_end)
32322 CALL PUSHCONTROL1B(0)
32324 CALL PUSHINTEGER4(i_end)
32326 CALL PUSHCONTROL1B(1)
32328 ad_from12 = i_start
32329 DO i=ad_from12,i_end
32331 IF (rv(i, k, jte) + cb*mut(i, jte-1) .LT. 0.) THEN
32334 CALL PUSHCONTROL1B(0)
32337 vb = rv(i, k, jte) + cb*mut(i, jte-1)
32338 CALL PUSHCONTROL1B(1)
32342 CALL PUSHINTEGER4(i - 1)
32343 CALL PUSHINTEGER4(ad_from12)
32344 CALL PUSHCONTROL1B(1)
32346 CALL PUSHCONTROL1B(0)
32348 ! pick up the rest of the horizontal radiation boundary conditions.
32349 ! (these are the computations that don't require 'cb'.
32350 ! first, set to index ranges
32352 IF (jte .GT. jde) THEN
32359 IF (config_flags%open_ys) THEN
32360 IF (jds + 1 .LT. jts) THEN
32367 IF (config_flags%open_ye) THEN
32368 IF (jte .GT. jde - 1) THEN
32375 ! compute x (u) conditions for v, w, or scalar
32376 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
32377 ad_from13 = j_start
32378 DO j=ad_from13,j_end
32379 CALL PUSHREAL8(mrdx)
32380 ! ADT eqn 45, 1st term on RHS
32381 mrdx = msfvy(its, j)*rdx
32382 IF (jmax .GT. j) THEN
32383 CALL PUSHINTEGER4(jp)
32385 CALL PUSHCONTROL1B(0)
32387 CALL PUSHINTEGER4(jp)
32389 CALL PUSHCONTROL1B(1)
32391 IF (jmin .LT. j - 1) THEN
32392 CALL PUSHINTEGER4(jm)
32394 CALL PUSHCONTROL1B(0)
32396 CALL PUSHINTEGER4(jm)
32398 CALL PUSHCONTROL1B(1)
32401 uw = 0.5*(ru(its, k, jp)+ru(its, k, jm))
32402 IF (uw .GT. 0.) THEN
32405 CALL PUSHCONTROL1B(0)
32409 CALL PUSHCONTROL1B(1)
32413 CALL PUSHINTEGER4(j - 1)
32414 CALL PUSHINTEGER4(ad_from13)
32415 CALL PUSHCONTROL1B(0)
32417 CALL PUSHCONTROL1B(1)
32419 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
32420 ad_from14 = j_start
32421 DO j=ad_from14,j_end
32422 CALL PUSHREAL8(mrdx)
32423 ! ADT eqn 45, 1st term on RHS
32424 mrdx = msfvy(ite-1, j)*rdx
32425 IF (jmax .GT. j) THEN
32426 CALL PUSHINTEGER4(jp)
32428 CALL PUSHCONTROL1B(0)
32430 CALL PUSHINTEGER4(jp)
32432 CALL PUSHCONTROL1B(1)
32434 IF (jmin .LT. j - 1) THEN
32435 CALL PUSHINTEGER4(jm)
32437 CALL PUSHCONTROL1B(0)
32439 CALL PUSHINTEGER4(jm)
32441 CALL PUSHCONTROL1B(1)
32444 uw = 0.5*(ru(ite, k, jp)+ru(ite, k, jm))
32445 IF (uw .LT. 0.) THEN
32448 CALL PUSHCONTROL1B(0)
32452 CALL PUSHCONTROL1B(1)
32456 CALL PUSHINTEGER4(j - 1)
32457 CALL PUSHINTEGER4(ad_from14)
32458 CALL PUSHCONTROL1B(1)
32460 CALL PUSHCONTROL1B(0)
32462 !-------------------- vertical advection
32463 ! ADT eqn 45 has 3rd term on RHS = -(1/mx) partial d/dz (rho v w)
32464 ! Here we have: - partial d/dz (v*rom) = - partial d/dz (v rho w / my)
32465 ! We therefore need to make a correction for advect_v
32466 ! since 'my' (map scale factor in y direction) isn't a function of z,
32467 ! we can do this using *(my/mx) (see eqn. 45 for example)
32469 IF (ite .GT. ide - 1) THEN
32470 CALL PUSHINTEGER4(i_end)
32472 CALL PUSHCONTROL1B(0)
32474 CALL PUSHINTEGER4(i_end)
32476 CALL PUSHCONTROL1B(1)
32480 ! Polar boundary conditions are like open or specified
32481 ! We don't want to calculate vertical v tendencies at the N or S pole
32482 IF ((config_flags%open_ys .OR. specified) .OR. config_flags%polar) &
32484 IF (jds + 1 .LT. jts) THEN
32490 IF ((config_flags%open_ye .OR. specified) .OR. config_flags%polar) &
32492 IF (jde - 1 .GT. jte) THEN
32498 ! vert_order_test : IF (vert_order == 6) THEN
32499 ! ELSE IF (vert_order == 5) THEN
32503 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
32504 IF (-vel*sign(1,time_step) .GE. 0.0) THEN
32505 CALL PUSHREAL8(qip2)
32506 qip2 = v(i, k+1, j)
32507 CALL PUSHREAL8(qip1)
32511 CALL PUSHREAL8(qim1)
32512 qim1 = v(i, k-2, j)
32513 CALL PUSHREAL8(qim2)
32514 qim2 = v(i, k-3, j)
32515 CALL PUSHCONTROL1B(0)
32517 CALL PUSHREAL8(qip2)
32518 qip2 = v(i, k-2, j)
32519 CALL PUSHREAL8(qip1)
32520 qip1 = v(i, k-1, j)
32523 CALL PUSHREAL8(qim1)
32524 qim1 = v(i, k+1, j)
32525 CALL PUSHREAL8(qim2)
32526 qim2 = v(i, k+2, j)
32527 CALL PUSHCONTROL1B(1)
32530 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
32532 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
32534 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
32535 CALL PUSHREAL8(beta0)
32536 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
32538 CALL PUSHREAL8(beta1)
32539 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
32540 CALL PUSHREAL8(beta2)
32541 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
32545 CALL PUSHINTEGER4(k)
32548 DO j=j_end,j_start,-1
32550 DO i=i_end,i_start,-1
32551 temp32b1 = -(msfvy(i, j)*rdzw(k)*tendencyb(i, k, j)/msfvx(i, j))
32552 vfluxb(i, k+1) = vfluxb(i, k+1) + temp32b1
32553 vfluxb(i, k) = vfluxb(i, k) - temp32b1
32556 CALL POPINTEGER4(k)
32557 DO i=i_end,i_start,-1
32559 temp32b = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i, k)
32560 temp32b0 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
32561 romb(i, k, j) = romb(i, k, j) + temp32b
32562 romb(i, k, j-1) = romb(i, k, j-1) + temp32b
32563 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp32b0
32564 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp32b0
32567 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
32568 temp28 = v(i, k+1, j) - v(i, k-2, j) - 3.*(v(i, k, j)-v(i, k-1, j)&
32570 temp31 = SIGN(1., -vel)
32571 temp30 = temp31/12.0
32572 temp29 = SIGN(1, time_step)
32573 temp28b = vel*vfluxb(i, k)
32574 temp28b0 = temp28b/12.0
32575 temp28b1 = temp29*temp30*temp28b
32576 velb = ((7.*(v(i, k, j)+v(i, k-1, j))-v(i, k+1, j)-v(i, k-2, j))/&
32577 & 12.0+temp29*(temp30*temp28))*vfluxb(i, k)
32578 vb0(i, k, j) = vb0(i, k, j) + 7.*temp28b0 - 3.*temp28b1
32579 vb0(i, k-1, j) = vb0(i, k-1, j) + 3.*temp28b1 + 7.*temp28b0
32580 vb0(i, k+1, j) = vb0(i, k+1, j) + temp28b1 - temp28b0
32581 vb0(i, k-2, j) = vb0(i, k-2, j) - temp28b1 - temp28b0
32583 romb(i, k, j) = romb(i, k, j) + 0.5*velb
32584 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
32586 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
32587 temp24 = v(i, k+1, j) - v(i, k-2, j) - 3.*(v(i, k, j)-v(i, k-1, j)&
32589 temp27 = SIGN(1., -vel)
32590 temp26 = temp27/12.0
32591 temp25 = SIGN(1, time_step)
32592 temp24b1 = vel*vfluxb(i, k)
32593 temp24b2 = temp24b1/12.0
32594 temp24b3 = temp25*temp26*temp24b1
32595 velb = ((7.*(v(i, k, j)+v(i, k-1, j))-v(i, k+1, j)-v(i, k-2, j))/&
32596 & 12.0+temp25*(temp26*temp24))*vfluxb(i, k)
32597 vb0(i, k, j) = vb0(i, k, j) + 7.*temp24b2 - 3.*temp24b3
32598 vb0(i, k-1, j) = vb0(i, k-1, j) + 3.*temp24b3 + 7.*temp24b2
32599 vb0(i, k+1, j) = vb0(i, k+1, j) + temp24b3 - temp24b2
32600 vb0(i, k-2, j) = vb0(i, k-2, j) - temp24b3 - temp24b2
32602 romb(i, k, j) = romb(i, k, j) + 0.5*velb
32603 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
32605 temp24b4 = 0.5*(fzm(k)*v(i, k, j)+fzp(k)*v(i, k-1, j))*vfluxb(i, k&
32607 temp24b5 = 0.5*(rom(i, k, j)+rom(i, k, j-1))*vfluxb(i, k)
32608 romb(i, k, j) = romb(i, k, j) + temp24b4
32609 romb(i, k, j-1) = romb(i, k, j-1) + temp24b4
32610 vb0(i, k, j) = vb0(i, k, j) + fzm(k)*temp24b5
32611 vb0(i, k-1, j) = vb0(i, k-1, j) + fzp(k)*temp24b5
32614 DO k=ktf-2,kts+3,-1
32615 DO i=i_end,i_start,-1
32616 wi0 = gi0/(eps+beta0)**pw
32617 wi1 = gi1/(eps+beta1)**pw
32618 wi2 = gi2/(eps+beta2)**pw
32619 sumwk = wi0 + wi1 + wi2
32620 vel = 0.5*(rom(i, k, j)+rom(i, k, j-1))
32621 temp24b = vel*vfluxb(i, k)/sumwk
32622 temp24b0 = (wi0*f0+wi1*f1+wi2*f2)*vfluxb(i, k)/sumwk
32627 sumwkb = -(vel*temp24b0/sumwk)
32628 wi0b = sumwkb + f0*temp24b
32629 wi1b = sumwkb + f1*temp24b
32630 wi2b = sumwkb + f2*temp24b
32632 temp23 = (eps+beta2)**pw
32633 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
32637 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp23**2)
32639 temp22 = (eps+beta1)**pw
32640 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
32644 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp22**2)
32646 temp21 = (eps+beta0)**pw
32647 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
32651 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp21**2)
32653 CALL POPREAL8(beta2)
32654 temp21b5 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
32655 temp21b6 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
32656 qip2b = temp21b6 - f2b/6. + temp21b5
32657 CALL POPREAL8(beta1)
32658 temp21b7 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
32659 temp21b10 = 2*(qim1-qip1)*beta1b/4.
32660 qip1b = temp21b7 - temp21b10 + f1b/3. + 5.*f2b/6. - 4.*temp21b6 &
32662 CALL POPREAL8(beta0)
32663 temp21b9 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
32664 temp21b8 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
32665 qib = f2b/3. - 2.*temp21b7 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
32666 & temp21b8 + temp21b9 + 3.*temp21b6 + temp21b5
32667 qim1b = temp21b10 - 4.*temp21b8 - 7.*f0b/6. - f1b/6. - 2.*&
32668 & temp21b9 + temp21b7
32669 qim2b = f0b/3. + temp21b8 + temp21b9
32673 CALL POPCONTROL1B(branch)
32674 IF (branch .EQ. 0) THEN
32675 CALL POPREAL8(qim2)
32676 vb0(i, k-3, j) = vb0(i, k-3, j) + qim2b
32677 CALL POPREAL8(qim1)
32678 vb0(i, k-2, j) = vb0(i, k-2, j) + qim1b
32680 vb0(i, k-1, j) = vb0(i, k-1, j) + qib
32681 CALL POPREAL8(qip1)
32682 vb0(i, k, j) = vb0(i, k, j) + qip1b
32683 CALL POPREAL8(qip2)
32684 vb0(i, k+1, j) = vb0(i, k+1, j) + qip2b
32686 CALL POPREAL8(qim2)
32687 vb0(i, k+2, j) = vb0(i, k+2, j) + qim2b
32688 CALL POPREAL8(qim1)
32689 vb0(i, k+1, j) = vb0(i, k+1, j) + qim1b
32691 vb0(i, k, j) = vb0(i, k, j) + qib
32692 CALL POPREAL8(qip1)
32693 vb0(i, k-1, j) = vb0(i, k-1, j) + qip1b
32694 CALL POPREAL8(qip2)
32695 vb0(i, k-2, j) = vb0(i, k-2, j) + qip2b
32697 romb(i, k, j) = romb(i, k, j) + 0.5*velb
32698 romb(i, k, j-1) = romb(i, k, j-1) + 0.5*velb
32702 CALL POPCONTROL1B(branch)
32703 IF (branch .EQ. 0) THEN
32704 CALL POPINTEGER4(i_end)
32706 CALL POPINTEGER4(i_end)
32708 CALL POPCONTROL1B(branch)
32709 IF (branch .NE. 0) THEN
32710 CALL POPINTEGER4(ad_from14)
32711 CALL POPINTEGER4(ad_to14)
32712 DO j=ad_to14,ad_from14,-1
32714 dum = ru(ite, k, jm) - ru(ite-1, k, jm)
32715 dup = ru(ite, k, jp) - ru(ite-1, k, jp)
32716 temp21b3 = -(mrdx*tendencyb(ite-1, k, j))
32717 temp21b4 = 0.5*v(ite-1, k, j)*temp21b3
32718 ubb = (v_old(ite-1, k, j)-v_old(ite-2, k, j))*temp21b3
32719 v_oldb(ite-1, k, j) = v_oldb(ite-1, k, j) + ub*temp21b3
32720 v_oldb(ite-2, k, j) = v_oldb(ite-2, k, j) - ub*temp21b3
32721 vb0(ite-1, k, j) = vb0(ite-1, k, j) + 0.5*(dup+dum)*temp21b3
32724 rub(ite, k, jm) = rub(ite, k, jm) + dumb
32725 rub(ite-1, k, jm) = rub(ite-1, k, jm) - dumb
32726 rub(ite, k, jp) = rub(ite, k, jp) + dupb
32727 rub(ite-1, k, jp) = rub(ite-1, k, jp) - dupb
32728 CALL POPCONTROL1B(branch)
32729 IF (branch .EQ. 0) THEN
32736 rub(ite, k, jp) = rub(ite, k, jp) + 0.5*uwb
32737 rub(ite, k, jm) = rub(ite, k, jm) + 0.5*uwb
32739 CALL POPCONTROL1B(branch)
32740 IF (branch .EQ. 0) THEN
32741 CALL POPINTEGER4(jm)
32743 CALL POPINTEGER4(jm)
32745 CALL POPCONTROL1B(branch)
32746 IF (branch .EQ. 0) THEN
32747 CALL POPINTEGER4(jp)
32749 CALL POPINTEGER4(jp)
32751 CALL POPREAL8(mrdx)
32754 CALL POPCONTROL1B(branch)
32755 IF (branch .EQ. 0) THEN
32756 CALL POPINTEGER4(ad_from13)
32757 CALL POPINTEGER4(ad_to13)
32758 DO j=ad_to13,ad_from13,-1
32760 dum = ru(its+1, k, jm) - ru(its, k, jm)
32761 dup = ru(its+1, k, jp) - ru(its, k, jp)
32762 temp21b1 = -(mrdx*tendencyb(its, k, j))
32763 temp21b2 = 0.5*v(its, k, j)*temp21b1
32764 ubb = (v_old(its+1, k, j)-v_old(its, k, j))*temp21b1
32765 v_oldb(its+1, k, j) = v_oldb(its+1, k, j) + ub*temp21b1
32766 v_oldb(its, k, j) = v_oldb(its, k, j) - ub*temp21b1
32767 vb0(its, k, j) = vb0(its, k, j) + 0.5*(dup+dum)*temp21b1
32770 rub(its+1, k, jm) = rub(its+1, k, jm) + dumb
32771 rub(its, k, jm) = rub(its, k, jm) - dumb
32772 rub(its+1, k, jp) = rub(its+1, k, jp) + dupb
32773 rub(its, k, jp) = rub(its, k, jp) - dupb
32774 CALL POPCONTROL1B(branch)
32775 IF (branch .EQ. 0) THEN
32782 rub(its, k, jp) = rub(its, k, jp) + 0.5*uwb
32783 rub(its, k, jm) = rub(its, k, jm) + 0.5*uwb
32785 CALL POPCONTROL1B(branch)
32786 IF (branch .EQ. 0) THEN
32787 CALL POPINTEGER4(jm)
32789 CALL POPINTEGER4(jm)
32791 CALL POPCONTROL1B(branch)
32792 IF (branch .EQ. 0) THEN
32793 CALL POPINTEGER4(jp)
32795 CALL POPINTEGER4(jp)
32797 CALL POPREAL8(mrdx)
32800 CALL POPCONTROL1B(branch)
32801 IF (branch .NE. 0) THEN
32802 CALL POPINTEGER4(ad_from12)
32803 CALL POPINTEGER4(ad_to12)
32804 DO i=ad_to12,ad_from12,-1
32806 temp21b0 = -(rdy*tendencyb(i, k, jte))
32807 vbb = (v_old(i, k, jte)-v_old(i, k, jte-1))*temp21b0
32808 v_oldb(i, k, jte) = v_oldb(i, k, jte) + vb*temp21b0
32809 v_oldb(i, k, jte-1) = v_oldb(i, k, jte-1) - vb*temp21b0
32810 CALL POPCONTROL1B(branch)
32811 IF (branch .EQ. 0) THEN
32815 rvb(i, k, jte) = rvb(i, k, jte) + vbb
32816 mutb(i, jte-1) = mutb(i, jte-1) + cb*vbb
32820 CALL POPCONTROL1B(branch)
32821 IF (branch .EQ. 0) THEN
32822 CALL POPINTEGER4(i_end)
32824 CALL POPINTEGER4(i_end)
32827 CALL POPCONTROL1B(branch)
32828 IF (branch .EQ. 0) THEN
32829 CALL POPINTEGER4(ad_from11)
32830 CALL POPINTEGER4(ad_to11)
32831 DO i=ad_to11,ad_from11,-1
32833 temp21b = -(rdy*tendencyb(i, k, jts))
32834 vbb = (v_old(i, k, jts+1)-v_old(i, k, jts))*temp21b
32835 v_oldb(i, k, jts+1) = v_oldb(i, k, jts+1) + vb*temp21b
32836 v_oldb(i, k, jts) = v_oldb(i, k, jts) - vb*temp21b
32837 CALL POPCONTROL1B(branch)
32838 IF (branch .EQ. 0) THEN
32842 rvb(i, k, jts) = rvb(i, k, jts) + vbb
32843 mutb(i, jts) = mutb(i, jts) - cb*vbb
32847 CALL POPCONTROL1B(branch)
32848 IF (branch .EQ. 0) THEN
32849 CALL POPINTEGER4(i_end)
32851 CALL POPINTEGER4(i_end)
32854 CALL POPCONTROL1B(branch)
32855 IF (branch .EQ. 0) THEN
32858 tendencyb(i, k, jte) = 0.0
32862 CALL POPCONTROL1B(branch)
32863 IF (branch .EQ. 0) THEN
32866 tendencyb(i, k, jts) = 0.0
32871 CALL POPINTEGER4(ad_from10)
32872 CALL POPINTEGER4(ad_to10)
32873 DO j=ad_to10,ad_from10,-1
32875 CALL POPINTEGER4(ad_from9)
32876 CALL POPINTEGER4(ad_to9)
32877 DO i=ad_to9,ad_from9,-1
32878 mrdx = msfvy(i, j)*rdx
32879 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
32880 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
32883 CALL POPCONTROL1B(branch)
32884 IF (branch .NE. 0) THEN
32885 CALL POPINTEGER4(ad_to8)
32886 DO i=ad_to8,i_end_f+1,-1
32887 CALL POPCONTROL1B(branch)
32888 IF (branch .NE. 0) THEN
32890 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
32891 temp17 = v(i+1, k, j) - v(i-2, k, j) - 3.*(v(i, k, j)-v(i-1&
32893 temp20 = SIGN(1., vel)
32894 temp19 = temp20/12.0
32895 temp18 = SIGN(1, time_step)
32896 temp17b1 = vel*fqxb(i, k)
32897 temp17b2 = temp17b1/12.0
32898 temp17b3 = temp18*temp19*temp17b1
32899 velb = ((7.*(v(i, k, j)+v(i-1, k, j))-v(i+1, k, j)-v(i-2, k&
32900 & , j))/12.0+temp18*(temp19*temp17))*fqxb(i, k)
32901 vb0(i, k, j) = vb0(i, k, j) + 7.*temp17b2 - 3.*temp17b3
32902 vb0(i-1, k, j) = vb0(i-1, k, j) + 3.*temp17b3 + 7.*temp17b2
32903 vb0(i+1, k, j) = vb0(i+1, k, j) + temp17b3 - temp17b2
32904 vb0(i-2, k, j) = vb0(i-2, k, j) - temp17b3 - temp17b2
32906 rub(i, k, j) = rub(i, k, j) + 0.5*velb
32907 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
32910 CALL POPCONTROL1B(branch)
32911 IF (branch .EQ. 0) THEN
32913 temp17b = 0.25*(v(i_end+1, k, j)+v(i_end, k, j))*fqxb(i, k)
32914 temp17b0 = 0.25*(ru(i_end+1, k, j)+ru(i_end+1, k, j-1))*fqxb&
32916 rub(i_end+1, k, j) = rub(i_end+1, k, j) + temp17b
32917 rub(i_end+1, k, j-1) = rub(i_end+1, k, j-1) + temp17b
32918 vb0(i_end+1, k, j) = vb0(i_end+1, k, j) + temp17b0
32919 vb0(i_end, k, j) = vb0(i_end, k, j) + temp17b0
32925 CALL POPCONTROL1B(branch)
32926 IF (branch .EQ. 0) THEN
32927 CALL POPINTEGER4(ad_from8)
32928 DO i=i_start_f-1,ad_from8,-1
32929 CALL POPCONTROL1B(branch)
32930 IF (branch .NE. 0) THEN
32932 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
32933 temp13 = v(i+1, k, j) - v(i-2, k, j) - 3.*(v(i, k, j)-v(i-1&
32935 temp16 = SIGN(1., vel)
32936 temp15 = temp16/12.0
32937 temp14 = SIGN(1, time_step)
32938 temp13b3 = vel*fqxb(i, k)
32939 temp13b4 = temp13b3/12.0
32940 temp13b5 = temp14*temp15*temp13b3
32941 velb = ((7.*(v(i, k, j)+v(i-1, k, j))-v(i+1, k, j)-v(i-2, k&
32942 & , j))/12.0+temp14*(temp15*temp13))*fqxb(i, k)
32943 vb0(i, k, j) = vb0(i, k, j) + 7.*temp13b4 - 3.*temp13b5
32944 vb0(i-1, k, j) = vb0(i-1, k, j) + 3.*temp13b5 + 7.*temp13b4
32945 vb0(i+1, k, j) = vb0(i+1, k, j) + temp13b5 - temp13b4
32946 vb0(i-2, k, j) = vb0(i-2, k, j) - temp13b5 - temp13b4
32948 rub(i, k, j) = rub(i, k, j) + 0.5*velb
32949 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
32952 CALL POPCONTROL1B(branch)
32953 IF (branch .EQ. 0) THEN
32955 temp13b1 = 0.25*(v(i, k, j)+v(i-1, k, j))*fqxb(i, k)
32956 temp13b2 = 0.25*(ru(i, k, j)+ru(i, k, j-1))*fqxb(i, k)
32957 rub(i, k, j) = rub(i, k, j) + temp13b1
32958 rub(i, k, j-1) = rub(i, k, j-1) + temp13b1
32959 vb0(i, k, j) = vb0(i, k, j) + temp13b2
32960 vb0(i-1, k, j) = vb0(i-1, k, j) + temp13b2
32967 DO i=i_end_f,i_start_f,-1
32968 wi0 = gi0/(eps+beta0)**pw
32969 wi1 = gi1/(eps+beta1)**pw
32970 wi2 = gi2/(eps+beta2)**pw
32971 sumwk = wi0 + wi1 + wi2
32972 vel = 0.5*(ru(i, k, j)+ru(i, k, j-1))
32973 temp13b = vel*fqxb(i, k)/sumwk
32974 temp13b0 = (wi0*f0+wi1*f1+wi2*f2)*fqxb(i, k)/sumwk
32979 sumwkb = -(vel*temp13b0/sumwk)
32980 wi0b = sumwkb + f0*temp13b
32981 wi1b = sumwkb + f1*temp13b
32982 wi2b = sumwkb + f2*temp13b
32984 temp12 = (eps+beta2)**pw
32985 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
32989 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp12**2)
32991 temp11 = (eps+beta1)**pw
32992 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
32996 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp11**2)
32998 temp10 = (eps+beta0)**pw
32999 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
33003 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp10**2)
33005 CALL POPREAL8(beta2)
33006 temp10b = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
33007 temp10b0 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
33008 qip2b = temp10b0 - f2b/6. + temp10b
33009 CALL POPREAL8(beta1)
33010 temp10b1 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
33011 temp10b4 = 2*(qim1-qip1)*beta1b/4.
33012 qip1b = temp10b1 - temp10b4 + f1b/3. + 5.*f2b/6. - 4.*temp10b0 -&
33014 CALL POPREAL8(beta0)
33015 temp10b3 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
33016 temp10b2 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
33017 qib = f2b/3. - 2.*temp10b1 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
33018 & temp10b2 + temp10b3 + 3.*temp10b0 + temp10b
33019 qim1b = temp10b4 - 4.*temp10b2 - 7.*f0b/6. - f1b/6. - 2.*&
33020 & temp10b3 + temp10b1
33021 qim2b = f0b/3. + temp10b2 + temp10b3
33025 CALL POPCONTROL1B(branch)
33026 IF (branch .EQ. 0) THEN
33027 CALL POPREAL8(qim2)
33028 vb0(i-3, k, j) = vb0(i-3, k, j) + qim2b
33029 CALL POPREAL8(qim1)
33030 vb0(i-2, k, j) = vb0(i-2, k, j) + qim1b
33032 vb0(i-1, k, j) = vb0(i-1, k, j) + qib
33033 CALL POPREAL8(qip1)
33034 vb0(i, k, j) = vb0(i, k, j) + qip1b
33035 CALL POPREAL8(qip2)
33036 vb0(i+1, k, j) = vb0(i+1, k, j) + qip2b
33038 CALL POPREAL8(qim2)
33039 vb0(i+2, k, j) = vb0(i+2, k, j) + qim2b
33040 CALL POPREAL8(qim1)
33041 vb0(i+1, k, j) = vb0(i+1, k, j) + qim1b
33043 vb0(i, k, j) = vb0(i, k, j) + qib
33044 CALL POPREAL8(qip1)
33045 vb0(i-1, k, j) = vb0(i-1, k, j) + qip1b
33046 CALL POPREAL8(qip2)
33047 vb0(i-2, k, j) = vb0(i-2, k, j) + qip2b
33049 rub(i, k, j) = rub(i, k, j) + 0.5*velb
33050 rub(i, k, j-1) = rub(i, k, j-1) + 0.5*velb
33055 CALL POPINTEGER4(ad_from7)
33056 CALL POPINTEGER4(ad_to7)
33057 DO j=ad_to7,ad_from7,-1
33058 CALL POPINTEGER4(jp0)
33059 CALL POPINTEGER4(jp1)
33060 CALL POPCONTROL2B(branch)
33061 IF (branch .LT. 2) THEN
33062 IF (branch .EQ. 0) THEN
33064 CALL POPINTEGER4(ad_from4)
33065 CALL POPINTEGER4(ad_to4)
33066 DO i=ad_to4,ad_from4,-1
33067 tendencyb(i, k, j-1) = 0.0
33072 CALL POPINTEGER4(ad_from5)
33073 CALL POPINTEGER4(ad_to5)
33074 DO i=ad_to5,ad_from5,-1
33075 tendencyb(i, k, j-1) = 0.0
33079 ELSE IF (branch .EQ. 2) THEN
33081 CALL POPINTEGER4(ad_from6)
33082 CALL POPINTEGER4(ad_to6)
33083 DO i=ad_to6,ad_from6,-1
33084 mrdy = msfvy(i, j-1)*rdy
33085 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1)
33086 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1)
33090 CALL POPCONTROL3B(branch)
33091 IF (branch .LT. 3) THEN
33092 IF (branch .EQ. 0) THEN
33094 CALL POPINTEGER4(ad_from)
33095 CALL POPINTEGER4(ad_to)
33096 DO i=ad_to,ad_from,-1
33097 wi0 = gi0/(eps+beta0)**pw
33098 wi1 = gi1/(eps+beta1)**pw
33099 wi2 = gi2/(eps+beta2)**pw
33100 sumwk = wi0 + wi1 + wi2
33101 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
33102 temp2b = vel*fqyb(i, k, jp1)/sumwk
33103 temp2b0 = (wi0*f0+wi1*f1+wi2*f2)*fqyb(i, k, jp1)/sumwk
33108 sumwkb = -(vel*temp2b0/sumwk)
33109 wi0b = sumwkb + f0*temp2b
33110 wi1b = sumwkb + f1*temp2b
33111 wi2b = sumwkb + f2*temp2b
33112 fqyb(i, k, jp1) = 0.0
33113 temp1 = (eps+beta2)**pw
33114 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT&
33118 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp1**2)
33120 temp0 = (eps+beta1)**pw
33121 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT&
33125 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp0**2)
33127 temp = (eps+beta0)**pw
33128 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT&
33132 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp**2)
33134 CALL POPREAL8(beta2)
33135 tempb = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
33136 tempb0 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
33137 qip2b = tempb0 - f2b/6. + tempb
33138 CALL POPREAL8(beta1)
33139 tempb1 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
33140 tempb4 = 2*(qim1-qip1)*beta1b/4.
33141 qip1b = tempb1 - tempb4 + f1b/3. + 5.*f2b/6. - 4.*tempb0 - &
33143 CALL POPREAL8(beta0)
33144 tempb3 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
33145 tempb2 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
33146 qib = f2b/3. - 2.*tempb1 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
33147 & tempb2 + tempb3 + 3.*tempb0 + tempb
33148 qim1b = tempb4 - 4.*tempb2 - 7.*f0b/6. - f1b/6. - 2.*tempb3 &
33150 qim2b = f0b/3. + tempb2 + tempb3
33154 CALL POPCONTROL1B(branch)
33155 IF (branch .EQ. 0) THEN
33156 CALL POPREAL8(qim2)
33157 vb0(i, k, j-3) = vb0(i, k, j-3) + qim2b
33158 CALL POPREAL8(qim1)
33159 vb0(i, k, j-2) = vb0(i, k, j-2) + qim1b
33161 vb0(i, k, j-1) = vb0(i, k, j-1) + qib
33162 CALL POPREAL8(qip1)
33163 vb0(i, k, j) = vb0(i, k, j) + qip1b
33164 CALL POPREAL8(qip2)
33165 vb0(i, k, j+1) = vb0(i, k, j+1) + qip2b
33167 CALL POPREAL8(qim2)
33168 vb0(i, k, j+2) = vb0(i, k, j+2) + qim2b
33169 CALL POPREAL8(qim1)
33170 vb0(i, k, j+1) = vb0(i, k, j+1) + qim1b
33172 vb0(i, k, j) = vb0(i, k, j) + qib
33173 CALL POPREAL8(qip1)
33174 vb0(i, k, j-1) = vb0(i, k, j-1) + qip1b
33175 CALL POPREAL8(qip2)
33176 vb0(i, k, j-2) = vb0(i, k, j-2) + qip2b
33178 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
33179 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
33182 ELSE IF (branch .EQ. 1) THEN
33184 CALL POPINTEGER4(ad_from0)
33185 CALL POPINTEGER4(ad_to0)
33186 DO i=ad_to0,ad_from0,-1
33187 temp2b1 = 0.25*(v(i, k, j)+vb)*fqyb(i, k, jp1)
33188 temp2b2 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, jp1)
33189 rvb(i, k, j) = rvb(i, k, j) + temp2b1
33190 rvb(i, k, j-1) = rvb(i, k, j-1) + temp2b1
33191 vb0(i, k, j) = vb0(i, k, j) + temp2b2
33193 fqyb(i, k, jp1) = 0.0
33194 CALL POPCONTROL1B(branch)
33195 IF (branch .EQ. 0) THEN
33196 vb0(i, k, j) = vb0(i, k, j) + vbb
33200 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
33205 CALL POPINTEGER4(ad_from1)
33206 CALL POPINTEGER4(ad_to1)
33207 DO i=ad_to1,ad_from1,-1
33208 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
33209 temp2 = v(i, k, j+1) - v(i, k, j-2) - 3.*(v(i, k, j)-v(i, k&
33211 temp5 = SIGN(1., vel)
33213 temp3 = SIGN(1, time_step)
33214 temp2b3 = vel*fqyb(i, k, jp1)
33215 temp2b4 = temp2b3/12.0
33216 temp2b5 = temp3*temp4*temp2b3
33217 velb = ((7.*(v(i, k, j)+v(i, k, j-1))-v(i, k, j+1)-v(i, k, j&
33218 & -2))/12.0+temp3*(temp4*temp2))*fqyb(i, k, jp1)
33219 vb0(i, k, j) = vb0(i, k, j) + 7.*temp2b4 - 3.*temp2b5
33220 vb0(i, k, j-1) = vb0(i, k, j-1) + 3.*temp2b5 + 7.*temp2b4
33221 vb0(i, k, j+1) = vb0(i, k, j+1) + temp2b5 - temp2b4
33222 vb0(i, k, j-2) = vb0(i, k, j-2) - temp2b5 - temp2b4
33223 fqyb(i, k, jp1) = 0.0
33224 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
33225 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
33229 ELSE IF (branch .EQ. 3) THEN
33231 CALL POPINTEGER4(ad_from2)
33232 CALL POPINTEGER4(ad_to2)
33233 DO i=ad_to2,ad_from2,-1
33234 temp6b = 0.25*(vb+v(i, k, j-1))*fqyb(i, k, jp1)
33235 temp6b0 = 0.25*(rv(i, k, j)+rv(i, k, j-1))*fqyb(i, k, jp1)
33236 rvb(i, k, j) = rvb(i, k, j) + temp6b
33237 rvb(i, k, j-1) = rvb(i, k, j-1) + temp6b
33239 vb0(i, k, j-1) = vb0(i, k, j-1) + temp6b0
33240 fqyb(i, k, jp1) = 0.0
33241 CALL POPCONTROL1B(branch)
33242 IF (branch .EQ. 0) THEN
33243 vb0(i, k, j-1) = vb0(i, k, j-1) + vbb
33247 vb0(i, k, j) = vb0(i, k, j) + vbb
33250 ELSE IF (branch .EQ. 4) THEN
33252 CALL POPINTEGER4(ad_from3)
33253 CALL POPINTEGER4(ad_to3)
33254 DO i=ad_to3,ad_from3,-1
33255 vel = 0.5*(rv(i, k, j)+rv(i, k, j-1))
33256 temp6 = v(i, k, j+1) - v(i, k, j-2) - 3.*(v(i, k, j)-v(i, k, j&
33258 temp9 = SIGN(1., vel)
33260 temp7 = SIGN(1, time_step)
33261 temp6b1 = vel*fqyb(i, k, jp1)
33262 temp6b2 = temp6b1/12.0
33263 temp6b3 = temp7*temp8*temp6b1
33264 velb = ((7.*(v(i, k, j)+v(i, k, j-1))-v(i, k, j+1)-v(i, k, j-2&
33265 & ))/12.0+temp7*(temp8*temp6))*fqyb(i, k, jp1)
33266 vb0(i, k, j) = vb0(i, k, j) + 7.*temp6b2 - 3.*temp6b3
33267 vb0(i, k, j-1) = vb0(i, k, j-1) + 3.*temp6b3 + 7.*temp6b2
33268 vb0(i, k, j+1) = vb0(i, k, j+1) + temp6b3 - temp6b2
33269 vb0(i, k, j-2) = vb0(i, k, j-2) - temp6b3 - temp6b2
33270 fqyb(i, k, jp1) = 0.0
33271 rvb(i, k, j) = rvb(i, k, j) + 0.5*velb
33272 rvb(i, k, j-1) = rvb(i, k, j-1) + 0.5*velb
33277 END SUBROUTINE A_ADVECT_WENO_V
33279 ! Generated by TAPENADE (INRIA, Tropics team)
33280 ! Tapenade 3.6 (r4165) - 21 sep 2011 20:54
33282 ! Differentiation of advect_weno_w in reverse (adjoint) mode:
33283 ! gradient of useful results: rom tendency w ru rv w_old
33284 ! with respect to varying inputs: rom tendency w ru rv w_old
33285 ! RW status of diff variables: rom:incr tendency:in-out w:incr
33286 ! ru:incr rv:incr w_old:incr
33287 SUBROUTINE A_ADVECT_WENO_W(w, wb0, w_old, w_oldb, tendency, tendencyb, &
33288 & ru, rub, rv, rvb, rom, romb, mut, time_step, config_flags, msfux, &
33289 & msfuy, msfvx, msfvy, msftx, msfty, fzm, fzp, rdx, rdy, rdzu, ids, ide&
33290 & , jds, jde, kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, jte&
33294 TYPE(GRID_CONFIG_REC_TYPE), INTENT(IN) :: config_flags
33295 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
33296 & jme, kms, kme, its, ite, jts, jte, kts, kte
33297 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: w, w_old, ru&
33299 REAL, DIMENSION(ims:ime, kms:kme, jms:jme) :: wb0, w_oldb, rub, rvb, &
33301 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: mut
33302 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendency
33303 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: tendencyb
33304 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: msfux, msfuy, msfvx, &
33305 & msfvy, msftx, msfty
33306 REAL, DIMENSION(kms:kme), INTENT(IN) :: fzm, fzp, rdzu
33307 REAL, INTENT(IN) :: rdx, rdy
33308 INTEGER, INTENT(IN) :: time_step
33310 INTEGER :: i, j, k, itf, jtf, ktf
33311 INTEGER :: i_start, i_end, j_start, j_end
33312 INTEGER :: i_start_f, i_end_f, j_start_f, j_end_f
33313 INTEGER :: jmin, jmax, jp, jm, imin, imax
33314 REAL :: mrdx, mrdy, ub, vb, uw, vw
33315 REAL :: ubb, vbb, uwb, vwb
33316 REAL, DIMENSION(its:ite, kts:kte) :: vflux
33317 REAL, DIMENSION(its:ite, kts:kte) :: vfluxb
33319 REAL :: ue, vs, vn, wb, wt
33320 REAL, PARAMETER :: f30=7./12., f31=1./12.
33321 REAL, PARAMETER :: f50=37./60., f51=2./15., f52=1./60.
33323 REAL :: qim2, qim1, qi, qip1, qip2
33324 REAL :: qim2b, qim1b, qib, qip1b, qip2b
33325 DOUBLE PRECISION :: beta0, beta1, beta2, f0, f1, f2, wi0, wi1, wi2, &
33327 DOUBLE PRECISION :: beta0b, beta1b, beta2b, f0b, f1b, f2b, wi0b, wi1b&
33329 DOUBLE PRECISION, PARAMETER :: gi0=1.d0/10.d0, gi1=6.d0/10.d0, gi2=&
33330 & 3.d0/10.d0, eps=1.0d-18
33331 INTEGER, PARAMETER :: pw=2
33332 INTEGER :: horz_order, vert_order
33333 REAL, DIMENSION(its:ite + 1, kts:kte) :: fqx
33334 REAL, DIMENSION(its:ite+1, kts:kte) :: fqxb
33335 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqy
33336 REAL, DIMENSION(its:ite, kts:kte, 2) :: fqyb
33337 LOGICAL :: degrade_xs, degrade_ys
33338 LOGICAL :: degrade_xe, degrade_ye
33339 INTEGER :: jp1, jp0, jtmp
33340 ! definition of flux operators, 3rd, 4th, 5th or 6th order
33341 REAL :: flux3, flux4, flux5, flux6
33342 REAL :: q_im3, q_im2, q_im1, q_i, q_ip1, q_ip2, ua, vel
33344 LOGICAL :: specified
33348 INTEGER :: ad_from0
33350 INTEGER :: ad_from1
33352 INTEGER :: ad_from2
33354 INTEGER :: ad_from3
33356 INTEGER :: ad_from4
33358 INTEGER :: ad_from5
33360 INTEGER :: ad_from6
33362 INTEGER :: ad_from7
33364 INTEGER :: ad_from8
33366 INTEGER :: ad_from9
33368 INTEGER :: ad_from10
33370 INTEGER :: ad_from11
33372 INTEGER :: ad_from12
33374 INTEGER :: ad_from13
33376 INTEGER :: ad_from14
33378 INTEGER :: ad_from15
33380 INTEGER :: ad_from16
33382 INTEGER :: ad_from17
33384 INTEGER :: ad_from18
33386 INTEGER :: ad_from19
33388 INTEGER :: ad_from20
33390 INTEGER :: ad_from21
33392 INTEGER :: ad_from22
33394 INTEGER :: ad_from23
33396 DOUBLE PRECISION :: temp3
33399 DOUBLE PRECISION :: temp2
33401 DOUBLE PRECISION :: temp1
33403 DOUBLE PRECISION :: temp0
33405 DOUBLE PRECISION :: temp26
33407 DOUBLE PRECISION :: temp25
33408 DOUBLE PRECISION :: temp24
33409 DOUBLE PRECISION :: temp23
33412 DOUBLE PRECISION :: temp22
33415 DOUBLE PRECISION :: temp21
33422 DOUBLE PRECISION :: temp24b
33434 DOUBLE PRECISION :: temp27b
33448 DOUBLE PRECISION :: temp46b
33468 DOUBLE PRECISION :: temp2b0
33489 DOUBLE PRECISION :: temp45
33492 DOUBLE PRECISION :: temp44
33494 DOUBLE PRECISION :: temp43
33507 DOUBLE PRECISION :: temp5b0
33525 DOUBLE PRECISION :: temp2b
33528 DOUBLE PRECISION :: temp46b0
33535 DOUBLE PRECISION :: temp24b0
33536 DOUBLE PRECISION :: temp5b
33559 DOUBLE PRECISION :: temp27b0
33569 DOUBLE PRECISION :: temp
33579 DOUBLE PRECISION :: temp4
33580 IF (kte .GT. kde - 1) THEN
33585 ! here is the choice of flux operators
33586 ! begin with horizontal flux divergence
33587 ! horizontal_order_test : IF( horz_order == 6 ) THEN
33588 ! ELSE IF (horz_order == 5 ) THEN
33589 ! determine boundary mods for flux operators
33590 ! We degrade the flux operators from 3rd/4th order
33591 ! to second order one gridpoint in from the boundaries for
33592 ! all boundary conditions except periodic and symmetry - these
33593 ! conditions have boundary zone data fill for correct application
33594 ! of the higher order flux stencils
33595 degrade_xs = .true.
33596 degrade_xe = .true.
33597 degrade_ys = .true.
33598 degrade_ye = .true.
33599 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xs) .OR. its &
33600 & .GT. ids + 3) degrade_xs = .false.
33601 IF ((config_flags%periodic_x .OR. config_flags%symmetric_xe) .OR. ite &
33602 & .LT. ide - 3) degrade_xe = .false.
33603 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ys) .OR. jts &
33604 & .GT. jds + 3) degrade_ys = .false.
33605 IF ((config_flags%periodic_y .OR. config_flags%symmetric_ye) .OR. jte &
33606 & .LT. jde - 4) degrade_ye = .false.
33607 !--------------- y - advection first
33609 IF (ite .GT. ide - 1) THEN
33615 IF (jte .GT. jde - 1) THEN
33620 ! higher order flux has a 5 or 7 point stencil, so compute
33621 ! bounds so we can switch to second order flux close to the boundary
33622 j_start_f = j_start
33623 j_end_f = j_end + 1
33624 IF (degrade_ys) THEN
33625 IF (jts .LT. jds + 1) THEN
33630 j_start_f = jds + 3
33632 IF (degrade_ye) THEN
33633 IF (jte .GT. jde - 2) THEN
33640 IF (config_flags%polar) THEN
33641 IF (jte .GT. jde - 1) THEN
33647 ! compute fluxes, 5th or 6th order
33650 ad_from12 = j_start
33651 j_loop_y_flux_5:DO j=ad_from12,j_end+1
33652 IF (j .GE. j_start_f .AND. j .LE. j_end_f) THEN
33653 CALL PUSHINTEGER4(k)
33657 CALL PUSHREAL8(vel)
33658 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
33659 IF (vel*sign(1,time_step) .GE. 0.0) THEN
33660 CALL PUSHREAL8(qip2)
33661 qip2 = w(i, k, j+1)
33662 CALL PUSHREAL8(qip1)
33666 CALL PUSHREAL8(qim1)
33667 qim1 = w(i, k, j-2)
33668 CALL PUSHREAL8(qim2)
33669 qim2 = w(i, k, j-3)
33670 CALL PUSHCONTROL1B(0)
33672 CALL PUSHREAL8(qip2)
33673 qip2 = w(i, k, j-2)
33674 CALL PUSHREAL8(qip1)
33675 qip1 = w(i, k, j-1)
33678 CALL PUSHREAL8(qim1)
33679 qim1 = w(i, k, j+1)
33680 CALL PUSHREAL8(qim2)
33681 qim2 = w(i, k, j+2)
33682 CALL PUSHCONTROL1B(1)
33685 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
33687 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
33689 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
33690 CALL PUSHREAL8(beta0)
33691 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*&
33693 CALL PUSHREAL8(beta1)
33694 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
33695 CALL PUSHREAL8(beta2)
33696 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*&
33699 CALL PUSHINTEGER4(i - 1)
33700 CALL PUSHINTEGER4(ad_from)
33702 ! fqy( i, k, jp1 ) = vel*flux5( &
33703 ! w(i,k,j-3), w(i,k,j-2), w(i,k,j-1), &
33704 ! w(i,k,j ), w(i,k,j+1), w(i,k,j+2), vel )
33707 DO i=ad_from0,i_end
33708 CALL PUSHREAL8(vel)
33709 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
33710 IF (vel*sign(1,time_step) .GE. 0.0) THEN
33711 CALL PUSHREAL8(qip2)
33712 qip2 = w(i, k, j+1)
33713 CALL PUSHREAL8(qip1)
33717 CALL PUSHREAL8(qim1)
33718 qim1 = w(i, k, j-2)
33719 CALL PUSHREAL8(qim2)
33720 qim2 = w(i, k, j-3)
33721 CALL PUSHCONTROL1B(0)
33723 CALL PUSHREAL8(qip2)
33724 qip2 = w(i, k, j-2)
33725 CALL PUSHREAL8(qip1)
33726 qip1 = w(i, k, j-1)
33729 CALL PUSHREAL8(qim1)
33730 qim1 = w(i, k, j+1)
33731 CALL PUSHREAL8(qim2)
33732 qim2 = w(i, k, j+2)
33733 CALL PUSHCONTROL1B(1)
33736 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
33738 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
33740 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
33741 CALL PUSHREAL8(beta0)
33742 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
33744 CALL PUSHREAL8(beta1)
33745 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
33746 CALL PUSHREAL8(beta2)
33747 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
33750 CALL PUSHINTEGER4(i - 1)
33751 CALL PUSHINTEGER4(ad_from0)
33752 CALL PUSHCONTROL3B(0)
33753 ELSE IF (j .EQ. jds + 1) THEN
33754 ! fqy( i, k, jp1 ) = vel*flux5( &
33755 ! w(i,k,j-3), w(i,k,j-2), w(i,k,j-1), &
33756 ! w(i,k,j ), w(i,k,j+1), w(i,k,j+2), vel )
33757 CALL PUSHINTEGER4(k)
33758 ! 2nd order flux next to south boundary
33762 CALL PUSHINTEGER4(i - 1)
33763 CALL PUSHINTEGER4(ad_from1)
33768 CALL PUSHINTEGER4(i - 1)
33769 CALL PUSHINTEGER4(ad_from2)
33770 CALL PUSHCONTROL3B(1)
33771 ELSE IF (j .EQ. jds + 2) THEN
33772 CALL PUSHINTEGER4(k)
33773 ! third of 4th order flux 2 in from south boundary
33776 DO i=ad_from3,i_end
33777 CALL PUSHREAL8(vel)
33779 CALL PUSHINTEGER4(i - 1)
33780 CALL PUSHINTEGER4(ad_from3)
33784 DO i=ad_from4,i_end
33785 CALL PUSHREAL8(vel)
33786 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
33788 CALL PUSHINTEGER4(i - 1)
33789 CALL PUSHINTEGER4(ad_from4)
33790 CALL PUSHCONTROL3B(2)
33791 ELSE IF (j .EQ. jde - 1) THEN
33792 CALL PUSHINTEGER4(k)
33793 ! 2nd order flux next to north boundary
33797 CALL PUSHINTEGER4(i - 1)
33798 CALL PUSHINTEGER4(ad_from5)
33803 CALL PUSHINTEGER4(i - 1)
33804 CALL PUSHINTEGER4(ad_from6)
33805 CALL PUSHCONTROL3B(3)
33806 ELSE IF (j .EQ. jde - 2) THEN
33807 CALL PUSHINTEGER4(k)
33808 ! 3rd or 4th order flux 2 in from north boundary
33811 DO i=ad_from7,i_end
33812 CALL PUSHREAL8(vel)
33814 CALL PUSHINTEGER4(i - 1)
33815 CALL PUSHINTEGER4(ad_from7)
33819 DO i=ad_from8,i_end
33820 CALL PUSHREAL8(vel)
33821 vel = (2.-fzm(k-1))*rv(i, k-1, j) - fzp(k-1)*rv(i, k-2, j)
33823 CALL PUSHINTEGER4(i - 1)
33824 CALL PUSHINTEGER4(ad_from8)
33825 CALL PUSHCONTROL3B(4)
33827 CALL PUSHCONTROL3B(5)
33829 ! y flux-divergence into tendency
33830 ! Comments for polar boundary conditions
33831 ! Same process as for advect_u - tendencies run from jds to jde-1
33832 ! (latitudes are as for u grid, longitudes are displaced)
33833 ! Therefore: flow is only from one side for points next to poles
33834 IF (config_flags%polar .AND. j .EQ. jds + 1) THEN
33835 CALL PUSHINTEGER4(k)
33839 CALL PUSHINTEGER4(i - 1)
33840 CALL PUSHINTEGER4(ad_from9)
33842 CALL PUSHCONTROL2B(0)
33843 ELSE IF (config_flags%polar .AND. j .EQ. jde) THEN
33844 CALL PUSHINTEGER4(k)
33846 ad_from10 = i_start
33848 CALL PUSHINTEGER4(i - 1)
33849 CALL PUSHINTEGER4(ad_from10)
33851 CALL PUSHCONTROL2B(1)
33852 ELSE IF (j .GT. j_start) THEN
33854 CALL PUSHINTEGER4(k)
33856 ad_from11 = i_start
33858 CALL PUSHINTEGER4(i - 1)
33859 CALL PUSHINTEGER4(ad_from11)
33861 CALL PUSHCONTROL2B(2)
33863 CALL PUSHCONTROL2B(3)
33866 CALL PUSHINTEGER4(jp1)
33868 CALL PUSHINTEGER4(jp0)
33870 END DO j_loop_y_flux_5
33871 CALL PUSHINTEGER4(j - 1)
33872 CALL PUSHINTEGER4(ad_from12)
33873 ! next, x - flux divergence
33875 IF (ite .GT. ide - 1) THEN
33881 IF (jte .GT. jde - 1) THEN
33886 ! higher order flux has a 5 or 7 point stencil, so compute
33887 ! bounds so we can switch to second order flux close to the boundary
33888 i_start_f = i_start
33889 i_end_f = i_end + 1
33890 IF (degrade_xs) THEN
33891 IF (ids + 1 .LT. its) THEN
33896 IF (i_start + 2 .GT. ids + 3) THEN
33897 i_start_f = ids + 3
33899 i_start_f = i_start + 2
33902 IF (degrade_xe) THEN
33903 IF (ide - 2 .GT. ite) THEN
33910 ad_from15 = j_start
33912 DO j=ad_from15,j_end
33913 CALL PUSHINTEGER4(k)
33914 ! 5th or 6th order flux
33916 DO i=i_start_f,i_end_f
33917 CALL PUSHREAL8(vel)
33918 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
33919 IF (vel*sign(1,time_step) .GE. 0.0) THEN
33920 CALL PUSHREAL8(qip2)
33921 qip2 = w(i+1, k, j)
33922 CALL PUSHREAL8(qip1)
33926 CALL PUSHREAL8(qim1)
33927 qim1 = w(i-2, k, j)
33928 CALL PUSHREAL8(qim2)
33929 qim2 = w(i-3, k, j)
33930 CALL PUSHCONTROL1B(0)
33932 CALL PUSHREAL8(qip2)
33933 qip2 = w(i-2, k, j)
33934 CALL PUSHREAL8(qip1)
33935 qip1 = w(i-1, k, j)
33938 CALL PUSHREAL8(qim1)
33939 qim1 = w(i+1, k, j)
33940 CALL PUSHREAL8(qim2)
33941 qim2 = w(i+2, k, j)
33942 CALL PUSHCONTROL1B(1)
33945 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
33947 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
33949 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
33950 CALL PUSHREAL8(beta0)
33951 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
33953 CALL PUSHREAL8(beta1)
33954 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
33955 CALL PUSHREAL8(beta2)
33956 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
33960 ! fqx( i,k ) = vel*flux5( w(i-3,k,j), w(i-2,k,j), &
33961 ! w(i-1,k,j), w(i ,k,j), &
33962 ! w(i+1,k,j), w(i+2,k,j), &
33965 DO i=i_start_f,i_end_f
33966 CALL PUSHREAL8(vel)
33967 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
33968 IF (vel*sign(1,time_step) .GE. 0.0) THEN
33969 CALL PUSHREAL8(qip2)
33970 qip2 = w(i+1, k, j)
33971 CALL PUSHREAL8(qip1)
33975 CALL PUSHREAL8(qim1)
33976 qim1 = w(i-2, k, j)
33977 CALL PUSHREAL8(qim2)
33978 qim2 = w(i-3, k, j)
33979 CALL PUSHCONTROL1B(0)
33981 CALL PUSHREAL8(qip2)
33982 qip2 = w(i-2, k, j)
33983 CALL PUSHREAL8(qip1)
33984 qip1 = w(i-1, k, j)
33987 CALL PUSHREAL8(qim1)
33988 qim1 = w(i+1, k, j)
33989 CALL PUSHREAL8(qim2)
33990 qim2 = w(i+2, k, j)
33991 CALL PUSHCONTROL1B(1)
33994 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
33996 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
33998 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
33999 CALL PUSHREAL8(beta0)
34000 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi)&
34002 CALL PUSHREAL8(beta1)
34003 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
34004 CALL PUSHREAL8(beta2)
34005 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi)&
34008 ! fqx( i,k ) = vel*flux5( w(i-3,k,j), w(i-2,k,j), &
34009 ! w(i-1,k,j), w(i ,k,j), &
34010 ! w(i+1,k,j), w(i+2,k,j), &
34012 ! lower order fluxes close to boundaries (if not periodic or symmetric)
34013 IF (degrade_xs) THEN
34014 ad_from13 = i_start
34015 DO i=ad_from13,i_start_f-1
34016 IF (i .EQ. ids + 1) THEN
34017 CALL PUSHINTEGER4(k)
34018 CALL PUSHCONTROL1B(0)
34020 CALL PUSHCONTROL1B(1)
34022 IF (i .EQ. ids + 2) THEN
34023 CALL PUSHINTEGER4(k)
34026 CALL PUSHREAL8(vel)
34029 CALL PUSHREAL8(vel)
34030 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
34031 CALL PUSHCONTROL1B(1)
34033 CALL PUSHCONTROL1B(0)
34036 CALL PUSHINTEGER4(ad_from13)
34037 CALL PUSHCONTROL1B(0)
34039 CALL PUSHCONTROL1B(1)
34041 IF (degrade_xe) THEN
34042 DO i=i_end_f+1,i_end+1
34043 IF (i .EQ. ide - 1) THEN
34044 CALL PUSHINTEGER4(k)
34045 CALL PUSHCONTROL1B(0)
34047 CALL PUSHCONTROL1B(1)
34049 IF (i .EQ. ide - 2) THEN
34050 CALL PUSHINTEGER4(k)
34051 ! third order flux one in from the boundary
34053 CALL PUSHREAL8(vel)
34056 CALL PUSHREAL8(vel)
34057 vel = (2.-fzm(k-1))*ru(i, k-1, j) - fzp(k-1)*ru(i, k-2, j)
34058 CALL PUSHCONTROL1B(1)
34060 CALL PUSHCONTROL1B(0)
34063 CALL PUSHINTEGER4(i - 1)
34064 CALL PUSHCONTROL1B(1)
34066 CALL PUSHCONTROL1B(0)
34068 CALL PUSHINTEGER4(k)
34069 ! x flux-divergence into tendency
34071 ad_from14 = i_start
34073 CALL PUSHINTEGER4(i - 1)
34074 CALL PUSHINTEGER4(ad_from14)
34077 CALL PUSHINTEGER4(j - 1)
34078 CALL PUSHINTEGER4(ad_from15)
34079 ! pick up the the horizontal radiation boundary conditions.
34080 ! (these are the computations that don't require 'cb'.
34081 ! first, set to index ranges
34083 IF (ite .GT. ide - 1) THEN
34089 IF (jte .GT. jde - 1) THEN
34094 IF (config_flags%open_xs .AND. its .EQ. ids) THEN
34095 ad_from16 = j_start
34096 DO j=ad_from16,j_end
34097 CALL PUSHINTEGER4(k)
34099 uw = 0.5*(fzm(k)*(ru(its, k, j)+ru(its+1, k, j))+fzp(k)*(ru(its&
34100 & , k-1, j)+ru(its+1, k-1, j)))
34101 IF (uw .GT. 0.) THEN
34104 CALL PUSHCONTROL1B(0)
34108 CALL PUSHCONTROL1B(1)
34112 CALL PUSHINTEGER4(j - 1)
34113 CALL PUSHINTEGER4(ad_from16)
34114 CALL PUSHINTEGER4(k)
34116 ad_from17 = j_start
34117 DO j=ad_from17,j_end
34118 uw = 0.5*((2.-fzm(k-1))*(ru(its, k-1, j)+ru(its+1, k-1, j))-fzp(k-&
34119 & 1)*(ru(its, k-2, j)+ru(its+1, k-2, j)))
34120 IF (uw .GT. 0.) THEN
34123 CALL PUSHCONTROL1B(0)
34127 CALL PUSHCONTROL1B(1)
34130 CALL PUSHINTEGER4(j - 1)
34131 CALL PUSHINTEGER4(ad_from17)
34132 CALL PUSHCONTROL1B(0)
34134 CALL PUSHCONTROL1B(1)
34136 IF (config_flags%open_xe .AND. ite .EQ. ide) THEN
34137 ad_from18 = j_start
34138 DO j=ad_from18,j_end
34139 CALL PUSHINTEGER4(k)
34141 uw = 0.5*(fzm(k)*(ru(ite-1, k, j)+ru(ite, k, j))+fzp(k)*(ru(ite-&
34142 & 1, k-1, j)+ru(ite, k-1, j)))
34143 IF (uw .LT. 0.) THEN
34146 CALL PUSHCONTROL1B(0)
34150 CALL PUSHCONTROL1B(1)
34154 CALL PUSHINTEGER4(j - 1)
34155 CALL PUSHINTEGER4(ad_from18)
34156 CALL PUSHINTEGER4(k)
34158 ad_from19 = j_start
34159 DO j=ad_from19,j_end
34160 uw = 0.5*((2.-fzm(k-1))*(ru(ite-1, k-1, j)+ru(ite, k-1, j))-fzp(k-&
34161 & 1)*(ru(ite-1, k-2, j)+ru(ite, k-2, j)))
34162 IF (uw .LT. 0.) THEN
34165 CALL PUSHCONTROL1B(0)
34169 CALL PUSHCONTROL1B(1)
34172 CALL PUSHINTEGER4(j - 1)
34173 CALL PUSHINTEGER4(ad_from19)
34174 CALL PUSHCONTROL1B(0)
34176 CALL PUSHCONTROL1B(1)
34178 IF (config_flags%open_ys .AND. jts .EQ. jds) THEN
34179 ad_from20 = i_start
34180 DO i=ad_from20,i_end
34181 CALL PUSHINTEGER4(k)
34183 vw = 0.5*(fzm(k)*(rv(i, k, jts)+rv(i, k, jts+1))+fzp(k)*(rv(i, k&
34184 & -1, jts)+rv(i, k-1, jts+1)))
34185 IF (vw .GT. 0.) THEN
34188 CALL PUSHCONTROL1B(0)
34192 CALL PUSHCONTROL1B(1)
34196 CALL PUSHINTEGER4(i - 1)
34197 CALL PUSHINTEGER4(ad_from20)
34198 CALL PUSHINTEGER4(k)
34200 ad_from21 = i_start
34201 DO i=ad_from21,i_end
34202 vw = 0.5*((2.-fzm(k-1))*(rv(i, k-1, jts)+rv(i, k-1, jts+1))-fzp(k-&
34203 & 1)*(rv(i, k-2, jts)+rv(i, k-2, jts+1)))
34204 IF (vw .GT. 0.) THEN
34207 CALL PUSHCONTROL1B(0)
34211 CALL PUSHCONTROL1B(1)
34214 CALL PUSHINTEGER4(i - 1)
34215 CALL PUSHINTEGER4(ad_from21)
34216 CALL PUSHCONTROL1B(0)
34218 CALL PUSHCONTROL1B(1)
34220 IF (config_flags%open_ye .AND. jte .EQ. jde) THEN
34221 ad_from22 = i_start
34222 DO i=ad_from22,i_end
34223 CALL PUSHINTEGER4(k)
34225 vw = 0.5*(fzm(k)*(rv(i, k, jte-1)+rv(i, k, jte))+fzp(k)*(rv(i, k&
34226 & -1, jte-1)+rv(i, k-1, jte)))
34227 IF (vw .LT. 0.) THEN
34230 CALL PUSHCONTROL1B(0)
34234 CALL PUSHCONTROL1B(1)
34238 CALL PUSHINTEGER4(i - 1)
34239 CALL PUSHINTEGER4(ad_from22)
34240 CALL PUSHINTEGER4(k)
34242 ad_from23 = i_start
34243 DO i=ad_from23,i_end
34244 vw = 0.5*((2.-fzm(k-1))*(rv(i, k-1, jte-1)+rv(i, k-1, jte))-fzp(k-&
34245 & 1)*(rv(i, k-2, jte-1)+rv(i, k-2, jte)))
34246 IF (vw .LT. 0.) THEN
34249 CALL PUSHCONTROL1B(0)
34253 CALL PUSHCONTROL1B(1)
34256 CALL PUSHINTEGER4(i - 1)
34257 CALL PUSHINTEGER4(ad_from23)
34258 CALL PUSHCONTROL1B(1)
34260 CALL PUSHCONTROL1B(0)
34262 !-------------------- vertical advection
34263 ! ADT eqn 46 has 3rd term on RHS (dividing through by my) = - partial d/dz (w rho w /my)
34264 ! Here we have: - partial d/dz (w*rom) = - partial d/dz (w rho w / my)
34265 ! Therefore we don't need to make a correction for advect_w
34267 IF (ite .GT. ide - 1) THEN
34268 CALL PUSHINTEGER4(i_end)
34270 CALL PUSHCONTROL1B(0)
34272 CALL PUSHINTEGER4(i_end)
34274 CALL PUSHCONTROL1B(1)
34277 IF (jte .GT. jde - 1) THEN
34278 CALL PUSHINTEGER4(j_end)
34280 CALL PUSHCONTROL1B(0)
34282 CALL PUSHINTEGER4(j_end)
34284 CALL PUSHCONTROL1B(1)
34286 ! vert_order_test : IF (vert_order == 6) THEN
34287 ! ELSE IF (vert_order == 5) THEN
34289 CALL PUSHINTEGER4(k)
34292 CALL PUSHREAL8(vel)
34293 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
34294 IF (-vel*sign(1,time_step) .GE. 0.0) THEN
34295 CALL PUSHREAL8(qip2)
34296 qip2 = w(i, k+1, j)
34297 CALL PUSHREAL8(qip1)
34301 CALL PUSHREAL8(qim1)
34302 qim1 = w(i, k-2, j)
34303 CALL PUSHREAL8(qim2)
34304 qim2 = w(i, k-3, j)
34305 CALL PUSHCONTROL1B(0)
34307 CALL PUSHREAL8(qip2)
34308 qip2 = w(i, k-2, j)
34309 CALL PUSHREAL8(qip1)
34310 qip1 = w(i, k-1, j)
34313 CALL PUSHREAL8(qim1)
34314 qim1 = w(i, k+1, j)
34315 CALL PUSHREAL8(qim2)
34316 qim2 = w(i, k+2, j)
34317 CALL PUSHCONTROL1B(1)
34320 f0 = 1./3.*qim2 - 7./6.*qim1 + 11./6.*qi
34322 f1 = -(1./6.*qim1) + 5./6.*qi + 1./3.*qip1
34324 f2 = 1./3.*qi + 5./6.*qip1 - 1./6.*qip2
34325 CALL PUSHREAL8(beta0)
34326 beta0 = 13./12.*(qim2-2.*qim1+qi)**2 + 1./4.*(qim2-4.*qim1+3.*qi&
34328 CALL PUSHREAL8(beta1)
34329 beta1 = 13./12.*(qim1-2.*qi+qip1)**2 + 1./4.*(qim1-qip1)**2
34330 CALL PUSHREAL8(beta2)
34331 beta2 = 13./12.*(qi-2.*qip1+qip2)**2 + 1./4.*(qip2-4.*qip1+3.*qi&
34335 ! vflux(i,k) = vel*flux5( &
34336 ! w(i,k-3,j), w(i,k-2,j), w(i,k-1,j), &
34337 ! w(i,k ,j), w(i,k+1,j), w(i,k+2,j), -vel )
34339 CALL PUSHREAL8(vel)
34341 CALL PUSHINTEGER4(k)
34342 ! pick up flux contribution for w at the lid, wcs. 13 march 2004
34346 DO j=j_end,j_start,-1
34347 DO i=i_end,i_start,-1
34348 vfluxb(i, k) = vfluxb(i, k) + rdzu(k-1)*2.*tendencyb(i, k, j)
34351 DO i=i_end,i_start,-1
34352 vfluxb(i, k+1) = vfluxb(i, k+1) - rdzu(k)*tendencyb(i, k, j)
34353 vfluxb(i, k) = vfluxb(i, k) + rdzu(k)*tendencyb(i, k, j)
34356 CALL POPINTEGER4(k)
34357 DO i=i_end,i_start,-1
34359 temp54b = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
34360 temp54b0 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
34361 romb(i, k, j) = romb(i, k, j) + temp54b
34362 romb(i, k-1, j) = romb(i, k-1, j) + temp54b
34363 wb0(i, k, j) = wb0(i, k, j) + temp54b0
34364 wb0(i, k-1, j) = wb0(i, k-1, j) + temp54b0
34367 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
34368 temp50 = w(i, k+1, j) - w(i, k-2, j) - 3.*(w(i, k, j)-w(i, k-1, j)&
34370 temp53 = SIGN(1., -vel)
34371 temp52 = temp53/12.0
34372 temp51 = SIGN(1, time_step)
34373 temp50b = vel*vfluxb(i, k)
34374 temp50b0 = temp50b/12.0
34375 temp50b1 = temp51*temp52*temp50b
34376 velb = ((7.*(w(i, k, j)+w(i, k-1, j))-w(i, k+1, j)-w(i, k-2, j))/&
34377 & 12.0+temp51*(temp52*temp50))*vfluxb(i, k)
34378 wb0(i, k, j) = wb0(i, k, j) + 7.*temp50b0 - 3.*temp50b1
34379 wb0(i, k-1, j) = wb0(i, k-1, j) + 3.*temp50b1 + 7.*temp50b0
34380 wb0(i, k+1, j) = wb0(i, k+1, j) + temp50b1 - temp50b0
34381 wb0(i, k-2, j) = wb0(i, k-2, j) - temp50b1 - temp50b0
34383 romb(i, k, j) = romb(i, k, j) + 0.5*velb
34384 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
34386 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
34387 temp46 = w(i, k+1, j) - w(i, k-2, j) - 3.*(w(i, k, j)-w(i, k-1, j)&
34389 temp49 = SIGN(1., -vel)
34390 temp48 = temp49/12.0
34391 temp47 = SIGN(1, time_step)
34392 temp46b1 = vel*vfluxb(i, k)
34393 temp46b2 = temp46b1/12.0
34394 temp46b3 = temp47*temp48*temp46b1
34395 velb = ((7.*(w(i, k, j)+w(i, k-1, j))-w(i, k+1, j)-w(i, k-2, j))/&
34396 & 12.0+temp47*(temp48*temp46))*vfluxb(i, k)
34397 wb0(i, k, j) = wb0(i, k, j) + 7.*temp46b2 - 3.*temp46b3
34398 wb0(i, k-1, j) = wb0(i, k-1, j) + 3.*temp46b3 + 7.*temp46b2
34399 wb0(i, k+1, j) = wb0(i, k+1, j) + temp46b3 - temp46b2
34400 wb0(i, k-2, j) = wb0(i, k-2, j) - temp46b3 - temp46b2
34403 romb(i, k, j) = romb(i, k, j) + 0.5*velb
34404 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
34406 temp46b4 = 0.25*(w(i, k, j)+w(i, k-1, j))*vfluxb(i, k)
34407 temp46b5 = 0.25*(rom(i, k, j)+rom(i, k-1, j))*vfluxb(i, k)
34408 romb(i, k, j) = romb(i, k, j) + temp46b4
34409 romb(i, k-1, j) = romb(i, k-1, j) + temp46b4
34410 wb0(i, k, j) = wb0(i, k, j) + temp46b5
34411 wb0(i, k-1, j) = wb0(i, k-1, j) + temp46b5
34414 DO k=ktf-1,kts+3,-1
34415 DO i=i_end,i_start,-1
34416 wi0 = gi0/(eps+beta0)**pw
34417 wi1 = gi1/(eps+beta1)**pw
34418 wi2 = gi2/(eps+beta2)**pw
34419 sumwk = wi0 + wi1 + wi2
34420 vel = 0.5*(rom(i, k, j)+rom(i, k-1, j))
34421 temp46b = vel*vfluxb(i, k)/sumwk
34422 temp46b0 = (wi0*f0+wi1*f1+wi2*f2)*vfluxb(i, k)/sumwk
34427 sumwkb = -(vel*temp46b0/sumwk)
34428 wi0b = sumwkb + f0*temp46b
34429 wi1b = sumwkb + f1*temp46b
34430 wi2b = sumwkb + f2*temp46b
34432 temp45 = (eps+beta2)**pw
34433 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
34437 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp45**2)
34439 temp44 = (eps+beta1)**pw
34440 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
34444 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp44**2)
34446 temp43 = (eps+beta0)**pw
34447 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
34451 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp43**2)
34453 CALL POPREAL8(beta2)
34454 temp43b35 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
34455 temp43b36 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
34456 qip2b = temp43b36 - f2b/6. + temp43b35
34457 CALL POPREAL8(beta1)
34458 temp43b37 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
34459 temp43b40 = 2*(qim1-qip1)*beta1b/4.
34460 qip1b = temp43b37 - temp43b40 + f1b/3. + 5.*f2b/6. - 4.*&
34461 & temp43b36 - 2.*temp43b35
34462 CALL POPREAL8(beta0)
34463 temp43b39 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
34464 temp43b38 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
34465 qib = f2b/3. - 2.*temp43b37 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
34466 & temp43b38 + temp43b39 + 3.*temp43b36 + temp43b35
34467 qim1b = temp43b40 - 4.*temp43b38 - 7.*f0b/6. - f1b/6. - 2.*&
34468 & temp43b39 + temp43b37
34469 qim2b = f0b/3. + temp43b38 + temp43b39
34473 CALL POPCONTROL1B(branch)
34474 IF (branch .EQ. 0) THEN
34475 CALL POPREAL8(qim2)
34476 wb0(i, k-3, j) = wb0(i, k-3, j) + qim2b
34477 CALL POPREAL8(qim1)
34478 wb0(i, k-2, j) = wb0(i, k-2, j) + qim1b
34480 wb0(i, k-1, j) = wb0(i, k-1, j) + qib
34481 CALL POPREAL8(qip1)
34482 wb0(i, k, j) = wb0(i, k, j) + qip1b
34483 CALL POPREAL8(qip2)
34484 wb0(i, k+1, j) = wb0(i, k+1, j) + qip2b
34486 CALL POPREAL8(qim2)
34487 wb0(i, k+2, j) = wb0(i, k+2, j) + qim2b
34488 CALL POPREAL8(qim1)
34489 wb0(i, k+1, j) = wb0(i, k+1, j) + qim1b
34491 wb0(i, k, j) = wb0(i, k, j) + qib
34492 CALL POPREAL8(qip1)
34493 wb0(i, k-1, j) = wb0(i, k-1, j) + qip1b
34494 CALL POPREAL8(qip2)
34495 wb0(i, k-2, j) = wb0(i, k-2, j) + qip2b
34498 romb(i, k, j) = romb(i, k, j) + 0.5*velb
34499 romb(i, k-1, j) = romb(i, k-1, j) + 0.5*velb
34502 CALL POPINTEGER4(k)
34504 CALL POPCONTROL1B(branch)
34505 IF (branch .EQ. 0) THEN
34506 CALL POPINTEGER4(j_end)
34508 CALL POPINTEGER4(j_end)
34510 CALL POPCONTROL1B(branch)
34511 IF (branch .EQ. 0) THEN
34512 CALL POPINTEGER4(i_end)
34514 CALL POPINTEGER4(i_end)
34516 CALL POPCONTROL1B(branch)
34517 IF (branch .NE. 0) THEN
34518 CALL POPINTEGER4(ad_from23)
34519 CALL POPINTEGER4(ad_to23)
34520 DO i=ad_to23,ad_from23,-1
34521 temp43b31 = -(rdy*tendencyb(i, k, j_end))
34522 temp43b32 = w(i, k, j_end)*temp43b31
34523 temp43b33 = (2.-fzm(k-1))*temp43b32
34524 temp43b34 = -(fzp(k-1)*temp43b32)
34525 vbb = (w_old(i, k, j_end)-w_old(i, k, j_end-1))*temp43b31
34526 w_oldb(i, k, j_end) = w_oldb(i, k, j_end) + vb*temp43b31
34527 w_oldb(i, k, j_end-1) = w_oldb(i, k, j_end-1) - vb*temp43b31
34528 wb0(i, k, j_end) = wb0(i, k, j_end) + ((2.-fzm(k-1))*(rv(i, k-1, &
34529 & jte)-rv(i, k-1, jte-1))-fzp(k-1)*(rv(i, k-2, jte)-rv(i, k-2, jte&
34531 rvb(i, k-1, jte) = rvb(i, k-1, jte) + temp43b33
34532 rvb(i, k-1, jte-1) = rvb(i, k-1, jte-1) - temp43b33
34533 rvb(i, k-2, jte) = rvb(i, k-2, jte) + temp43b34
34534 rvb(i, k-2, jte-1) = rvb(i, k-2, jte-1) - temp43b34
34535 CALL POPCONTROL1B(branch)
34536 IF (branch .EQ. 0) THEN
34543 temp43b29 = 0.5*(2.-fzm(k-1))*vwb
34544 temp43b30 = -(0.5*fzp(k-1)*vwb)
34545 rvb(i, k-1, jte-1) = rvb(i, k-1, jte-1) + temp43b29
34546 rvb(i, k-1, jte) = rvb(i, k-1, jte) + temp43b29
34547 rvb(i, k-2, jte-1) = rvb(i, k-2, jte-1) + temp43b30
34548 rvb(i, k-2, jte) = rvb(i, k-2, jte) + temp43b30
34550 CALL POPINTEGER4(k)
34551 CALL POPINTEGER4(ad_from22)
34552 CALL POPINTEGER4(ad_to22)
34553 DO i=ad_to22,ad_from22,-1
34555 temp43b27 = -(rdy*tendencyb(i, k, j_end))
34556 temp43b28 = w(i, k, j_end)*temp43b27
34557 vbb = (w_old(i, k, j_end)-w_old(i, k, j_end-1))*temp43b27
34558 w_oldb(i, k, j_end) = w_oldb(i, k, j_end) + vb*temp43b27
34559 w_oldb(i, k, j_end-1) = w_oldb(i, k, j_end-1) - vb*temp43b27
34560 wb0(i, k, j_end) = wb0(i, k, j_end) + (fzm(k)*(rv(i, k, jte)-rv(&
34561 & i, k, jte-1))+fzp(k)*(rv(i, k-1, jte)-rv(i, k-1, jte-1)))*&
34563 rvb(i, k, jte) = rvb(i, k, jte) + fzm(k)*temp43b28
34564 rvb(i, k, jte-1) = rvb(i, k, jte-1) - fzm(k)*temp43b28
34565 rvb(i, k-1, jte) = rvb(i, k-1, jte) + fzp(k)*temp43b28
34566 rvb(i, k-1, jte-1) = rvb(i, k-1, jte-1) - fzp(k)*temp43b28
34567 CALL POPCONTROL1B(branch)
34568 IF (branch .EQ. 0) THEN
34575 temp43b26 = 0.5*vwb
34576 rvb(i, k, jte-1) = rvb(i, k, jte-1) + fzm(k)*temp43b26
34577 rvb(i, k, jte) = rvb(i, k, jte) + fzm(k)*temp43b26
34578 rvb(i, k-1, jte-1) = rvb(i, k-1, jte-1) + fzp(k)*temp43b26
34579 rvb(i, k-1, jte) = rvb(i, k-1, jte) + fzp(k)*temp43b26
34581 CALL POPINTEGER4(k)
34584 CALL POPCONTROL1B(branch)
34585 IF (branch .EQ. 0) THEN
34586 CALL POPINTEGER4(ad_from21)
34587 CALL POPINTEGER4(ad_to21)
34588 DO i=ad_to21,ad_from21,-1
34589 temp43b22 = -(rdy*tendencyb(i, k, jts))
34590 temp43b23 = w(i, k, jts)*temp43b22
34591 temp43b24 = (2.-fzm(k-1))*temp43b23
34592 temp43b25 = -(fzp(k-1)*temp43b23)
34593 vbb = (w_old(i, k, jts+1)-w_old(i, k, jts))*temp43b22
34594 w_oldb(i, k, jts+1) = w_oldb(i, k, jts+1) + vb*temp43b22
34595 w_oldb(i, k, jts) = w_oldb(i, k, jts) - vb*temp43b22
34596 wb0(i, k, jts) = wb0(i, k, jts) + ((2.-fzm(k-1))*(rv(i, k-1, jts+1&
34597 & )-rv(i, k-1, jts))-fzp(k-1)*(rv(i, k-2, jts+1)-rv(i, k-2, jts)))&
34599 rvb(i, k-1, jts+1) = rvb(i, k-1, jts+1) + temp43b24
34600 rvb(i, k-1, jts) = rvb(i, k-1, jts) - temp43b24
34601 rvb(i, k-2, jts+1) = rvb(i, k-2, jts+1) + temp43b25
34602 rvb(i, k-2, jts) = rvb(i, k-2, jts) - temp43b25
34603 CALL POPCONTROL1B(branch)
34604 IF (branch .EQ. 0) THEN
34611 temp43b20 = 0.5*(2.-fzm(k-1))*vwb
34612 temp43b21 = -(0.5*fzp(k-1)*vwb)
34613 rvb(i, k-1, jts) = rvb(i, k-1, jts) + temp43b20
34614 rvb(i, k-1, jts+1) = rvb(i, k-1, jts+1) + temp43b20
34615 rvb(i, k-2, jts) = rvb(i, k-2, jts) + temp43b21
34616 rvb(i, k-2, jts+1) = rvb(i, k-2, jts+1) + temp43b21
34618 CALL POPINTEGER4(k)
34619 CALL POPINTEGER4(ad_from20)
34620 CALL POPINTEGER4(ad_to20)
34621 DO i=ad_to20,ad_from20,-1
34623 temp43b18 = -(rdy*tendencyb(i, k, jts))
34624 temp43b19 = w(i, k, jts)*temp43b18
34625 vbb = (w_old(i, k, jts+1)-w_old(i, k, jts))*temp43b18
34626 w_oldb(i, k, jts+1) = w_oldb(i, k, jts+1) + vb*temp43b18
34627 w_oldb(i, k, jts) = w_oldb(i, k, jts) - vb*temp43b18
34628 wb0(i, k, jts) = wb0(i, k, jts) + (fzm(k)*(rv(i, k, jts+1)-rv(i&
34629 & , k, jts))+fzp(k)*(rv(i, k-1, jts+1)-rv(i, k-1, jts)))*&
34631 rvb(i, k, jts+1) = rvb(i, k, jts+1) + fzm(k)*temp43b19
34632 rvb(i, k, jts) = rvb(i, k, jts) - fzm(k)*temp43b19
34633 rvb(i, k-1, jts+1) = rvb(i, k-1, jts+1) + fzp(k)*temp43b19
34634 rvb(i, k-1, jts) = rvb(i, k-1, jts) - fzp(k)*temp43b19
34635 CALL POPCONTROL1B(branch)
34636 IF (branch .EQ. 0) THEN
34643 temp43b17 = 0.5*vwb
34644 rvb(i, k, jts) = rvb(i, k, jts) + fzm(k)*temp43b17
34645 rvb(i, k, jts+1) = rvb(i, k, jts+1) + fzm(k)*temp43b17
34646 rvb(i, k-1, jts) = rvb(i, k-1, jts) + fzp(k)*temp43b17
34647 rvb(i, k-1, jts+1) = rvb(i, k-1, jts+1) + fzp(k)*temp43b17
34649 CALL POPINTEGER4(k)
34652 CALL POPCONTROL1B(branch)
34653 IF (branch .EQ. 0) THEN
34654 CALL POPINTEGER4(ad_from19)
34655 CALL POPINTEGER4(ad_to19)
34656 DO j=ad_to19,ad_from19,-1
34657 temp43b13 = -(rdx*tendencyb(i_end, k, j))
34658 temp43b14 = w(i_end, k, j)*temp43b13
34659 temp43b15 = (2.-fzm(k-1))*temp43b14
34660 temp43b16 = -(fzp(k-1)*temp43b14)
34661 ubb = (w_old(i_end, k, j)-w_old(i_end-1, k, j))*temp43b13
34662 w_oldb(i_end, k, j) = w_oldb(i_end, k, j) + ub*temp43b13
34663 w_oldb(i_end-1, k, j) = w_oldb(i_end-1, k, j) - ub*temp43b13
34664 wb0(i_end, k, j) = wb0(i_end, k, j) + ((2.-fzm(k-1))*(ru(ite, k-1&
34665 & , j)-ru(ite-1, k-1, j))-fzp(k-1)*(ru(ite, k-2, j)-ru(ite-1, k-2&
34667 rub(ite, k-1, j) = rub(ite, k-1, j) + temp43b15
34668 rub(ite-1, k-1, j) = rub(ite-1, k-1, j) - temp43b15
34669 rub(ite, k-2, j) = rub(ite, k-2, j) + temp43b16
34670 rub(ite-1, k-2, j) = rub(ite-1, k-2, j) - temp43b16
34671 CALL POPCONTROL1B(branch)
34672 IF (branch .EQ. 0) THEN
34679 temp43b11 = 0.5*(2.-fzm(k-1))*uwb
34680 temp43b12 = -(0.5*fzp(k-1)*uwb)
34681 rub(ite-1, k-1, j) = rub(ite-1, k-1, j) + temp43b11
34682 rub(ite, k-1, j) = rub(ite, k-1, j) + temp43b11
34683 rub(ite-1, k-2, j) = rub(ite-1, k-2, j) + temp43b12
34684 rub(ite, k-2, j) = rub(ite, k-2, j) + temp43b12
34686 CALL POPINTEGER4(k)
34687 CALL POPINTEGER4(ad_from18)
34688 CALL POPINTEGER4(ad_to18)
34689 DO j=ad_to18,ad_from18,-1
34691 temp43b9 = -(rdx*tendencyb(i_end, k, j))
34692 temp43b10 = w(i_end, k, j)*temp43b9
34693 ubb = (w_old(i_end, k, j)-w_old(i_end-1, k, j))*temp43b9
34694 w_oldb(i_end, k, j) = w_oldb(i_end, k, j) + ub*temp43b9
34695 w_oldb(i_end-1, k, j) = w_oldb(i_end-1, k, j) - ub*temp43b9
34696 wb0(i_end, k, j) = wb0(i_end, k, j) + (fzm(k)*(ru(ite, k, j)-ru(&
34697 & ite-1, k, j))+fzp(k)*(ru(ite, k-1, j)-ru(ite-1, k-1, j)))*&
34699 rub(ite, k, j) = rub(ite, k, j) + fzm(k)*temp43b10
34700 rub(ite-1, k, j) = rub(ite-1, k, j) - fzm(k)*temp43b10
34701 rub(ite, k-1, j) = rub(ite, k-1, j) + fzp(k)*temp43b10
34702 rub(ite-1, k-1, j) = rub(ite-1, k-1, j) - fzp(k)*temp43b10
34703 CALL POPCONTROL1B(branch)
34704 IF (branch .EQ. 0) THEN
34712 rub(ite-1, k, j) = rub(ite-1, k, j) + fzm(k)*temp43b8
34713 rub(ite, k, j) = rub(ite, k, j) + fzm(k)*temp43b8
34714 rub(ite-1, k-1, j) = rub(ite-1, k-1, j) + fzp(k)*temp43b8
34715 rub(ite, k-1, j) = rub(ite, k-1, j) + fzp(k)*temp43b8
34717 CALL POPINTEGER4(k)
34720 CALL POPCONTROL1B(branch)
34721 IF (branch .EQ. 0) THEN
34722 CALL POPINTEGER4(ad_from17)
34723 CALL POPINTEGER4(ad_to17)
34724 DO j=ad_to17,ad_from17,-1
34725 temp43b4 = -(rdx*tendencyb(its, k, j))
34726 temp43b5 = w(its, k, j)*temp43b4
34727 temp43b6 = (2.-fzm(k-1))*temp43b5
34728 temp43b7 = -(fzp(k-1)*temp43b5)
34729 ubb = (w_old(its+1, k, j)-w_old(its, k, j))*temp43b4
34730 w_oldb(its+1, k, j) = w_oldb(its+1, k, j) + ub*temp43b4
34731 w_oldb(its, k, j) = w_oldb(its, k, j) - ub*temp43b4
34732 wb0(its, k, j) = wb0(its, k, j) + ((2.-fzm(k-1))*(ru(its+1, k-1, j&
34733 & )-ru(its, k-1, j))-fzp(k-1)*(ru(its+1, k-2, j)-ru(its, k-2, j)))&
34735 rub(its+1, k-1, j) = rub(its+1, k-1, j) + temp43b6
34736 rub(its, k-1, j) = rub(its, k-1, j) - temp43b6
34737 rub(its+1, k-2, j) = rub(its+1, k-2, j) + temp43b7
34738 rub(its, k-2, j) = rub(its, k-2, j) - temp43b7
34739 CALL POPCONTROL1B(branch)
34740 IF (branch .EQ. 0) THEN
34747 temp43b2 = 0.5*(2.-fzm(k-1))*uwb
34748 temp43b3 = -(0.5*fzp(k-1)*uwb)
34749 rub(its, k-1, j) = rub(its, k-1, j) + temp43b2
34750 rub(its+1, k-1, j) = rub(its+1, k-1, j) + temp43b2
34751 rub(its, k-2, j) = rub(its, k-2, j) + temp43b3
34752 rub(its+1, k-2, j) = rub(its+1, k-2, j) + temp43b3
34754 CALL POPINTEGER4(k)
34755 CALL POPINTEGER4(ad_from16)
34756 CALL POPINTEGER4(ad_to16)
34757 DO j=ad_to16,ad_from16,-1
34759 temp43b0 = -(rdx*tendencyb(its, k, j))
34760 temp43b1 = w(its, k, j)*temp43b0
34761 ubb = (w_old(its+1, k, j)-w_old(its, k, j))*temp43b0
34762 w_oldb(its+1, k, j) = w_oldb(its+1, k, j) + ub*temp43b0
34763 w_oldb(its, k, j) = w_oldb(its, k, j) - ub*temp43b0
34764 wb0(its, k, j) = wb0(its, k, j) + (fzm(k)*(ru(its+1, k, j)-ru(&
34765 & its, k, j))+fzp(k)*(ru(its+1, k-1, j)-ru(its, k-1, j)))*&
34767 rub(its+1, k, j) = rub(its+1, k, j) + fzm(k)*temp43b1
34768 rub(its, k, j) = rub(its, k, j) - fzm(k)*temp43b1
34769 rub(its+1, k-1, j) = rub(its+1, k-1, j) + fzp(k)*temp43b1
34770 rub(its, k-1, j) = rub(its, k-1, j) - fzp(k)*temp43b1
34771 CALL POPCONTROL1B(branch)
34772 IF (branch .EQ. 0) THEN
34780 rub(its, k, j) = rub(its, k, j) + fzm(k)*temp43b
34781 rub(its+1, k, j) = rub(its+1, k, j) + fzm(k)*temp43b
34782 rub(its, k-1, j) = rub(its, k-1, j) + fzp(k)*temp43b
34783 rub(its+1, k-1, j) = rub(its+1, k-1, j) + fzp(k)*temp43b
34785 CALL POPINTEGER4(k)
34789 CALL POPINTEGER4(ad_from15)
34790 CALL POPINTEGER4(ad_to15)
34791 DO j=ad_to15,ad_from15,-1
34792 DO k=ktf+1,kts+1,-1
34793 CALL POPINTEGER4(ad_from14)
34794 CALL POPINTEGER4(ad_to14)
34795 DO i=ad_to14,ad_from14,-1
34796 mrdx = msftx(i, j)*rdx
34797 fqxb(i+1, k) = fqxb(i+1, k) - mrdx*tendencyb(i, k, j)
34798 fqxb(i, k) = fqxb(i, k) + mrdx*tendencyb(i, k, j)
34801 CALL POPINTEGER4(k)
34802 CALL POPCONTROL1B(branch)
34803 IF (branch .NE. 0) THEN
34804 CALL POPINTEGER4(ad_to13)
34805 DO i=ad_to13,i_end_f+1,-1
34806 CALL POPCONTROL1B(branch)
34807 IF (branch .NE. 0) THEN
34809 temp39 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-1, k&
34811 temp42 = SIGN(1., vel)
34812 temp41 = temp42/12.0
34813 temp40 = SIGN(1, time_step)
34814 temp39b = vel*fqxb(i, k)
34815 temp39b0 = temp39b/12.0
34816 temp39b1 = temp40*temp41*temp39b
34817 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k, j&
34818 & ))/12.0+temp40*(temp41*temp39))*fqxb(i, k)
34819 wb0(i, k, j) = wb0(i, k, j) + 7.*temp39b0 - 3.*temp39b1
34820 wb0(i-1, k, j) = wb0(i-1, k, j) + 3.*temp39b1 + 7.*temp39b0
34821 wb0(i+1, k, j) = wb0(i+1, k, j) + temp39b1 - temp39b0
34822 wb0(i-2, k, j) = wb0(i-2, k, j) - temp39b1 - temp39b0
34825 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
34826 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
34828 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
34829 temp35 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-1&
34831 temp38 = SIGN(1., vel)
34832 temp37 = temp38/12.0
34833 temp36 = SIGN(1, time_step)
34834 temp35b3 = vel*fqxb(i, k)
34835 temp35b4 = temp35b3/12.0
34836 temp35b5 = temp36*temp37*temp35b3
34837 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k&
34838 & , j))/12.0+temp36*(temp37*temp35))*fqxb(i, k)
34839 wb0(i, k, j) = wb0(i, k, j) + 7.*temp35b4 - 3.*temp35b5
34840 wb0(i-1, k, j) = wb0(i-1, k, j) + 3.*temp35b5 + 7.*temp35b4
34841 wb0(i+1, k, j) = wb0(i+1, k, j) + temp35b5 - temp35b4
34842 wb0(i-2, k, j) = wb0(i-2, k, j) - temp35b5 - temp35b4
34845 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
34846 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
34848 CALL POPINTEGER4(k)
34850 CALL POPCONTROL1B(branch)
34851 IF (branch .EQ. 0) THEN
34853 temp35b1 = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
34854 temp35b2 = 0.5*((2.-fzm(k-1))*ru(i, k-1, j)-fzp(k-1)*ru(i, k-2&
34856 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*temp35b1
34857 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*temp35b1
34858 wb0(i, k, j) = wb0(i, k, j) + temp35b2
34859 wb0(i-1, k, j) = wb0(i-1, k, j) + temp35b2
34862 temp35b = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
34863 temp35b0 = 0.5*(fzm(k)*ru(i, k, j)+fzp(k)*ru(i, k-1, j))*&
34865 rub(i, k, j) = rub(i, k, j) + fzm(k)*temp35b
34866 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*temp35b
34867 wb0(i, k, j) = wb0(i, k, j) + temp35b0
34868 wb0(i-1, k, j) = wb0(i-1, k, j) + temp35b0
34871 CALL POPINTEGER4(k)
34875 CALL POPCONTROL1B(branch)
34876 IF (branch .EQ. 0) THEN
34877 CALL POPINTEGER4(ad_from13)
34878 DO i=i_start_f-1,ad_from13,-1
34879 CALL POPCONTROL1B(branch)
34880 IF (branch .NE. 0) THEN
34882 temp31 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-1, k&
34884 temp34 = SIGN(1., vel)
34885 temp33 = temp34/12.0
34886 temp32 = SIGN(1, time_step)
34887 temp31b = vel*fqxb(i, k)
34888 temp31b0 = temp31b/12.0
34889 temp31b1 = temp32*temp33*temp31b
34890 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k, j&
34891 & ))/12.0+temp32*(temp33*temp31))*fqxb(i, k)
34892 wb0(i, k, j) = wb0(i, k, j) + 7.*temp31b0 - 3.*temp31b1
34893 wb0(i-1, k, j) = wb0(i-1, k, j) + 3.*temp31b1 + 7.*temp31b0
34894 wb0(i+1, k, j) = wb0(i+1, k, j) + temp31b1 - temp31b0
34895 wb0(i-2, k, j) = wb0(i-2, k, j) - temp31b1 - temp31b0
34898 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
34899 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
34901 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
34902 temp27 = w(i+1, k, j) - w(i-2, k, j) - 3.*(w(i, k, j)-w(i-1&
34904 temp30 = SIGN(1., vel)
34905 temp29 = temp30/12.0
34906 temp28 = SIGN(1, time_step)
34907 temp27b5 = vel*fqxb(i, k)
34908 temp27b6 = temp27b5/12.0
34909 temp27b7 = temp28*temp29*temp27b5
34910 velb = ((7.*(w(i, k, j)+w(i-1, k, j))-w(i+1, k, j)-w(i-2, k&
34911 & , j))/12.0+temp28*(temp29*temp27))*fqxb(i, k)
34912 wb0(i, k, j) = wb0(i, k, j) + 7.*temp27b6 - 3.*temp27b7
34913 wb0(i-1, k, j) = wb0(i-1, k, j) + 3.*temp27b7 + 7.*temp27b6
34914 wb0(i+1, k, j) = wb0(i+1, k, j) + temp27b7 - temp27b6
34915 wb0(i-2, k, j) = wb0(i-2, k, j) - temp27b7 - temp27b6
34918 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
34919 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
34921 CALL POPINTEGER4(k)
34923 CALL POPCONTROL1B(branch)
34924 IF (branch .EQ. 0) THEN
34926 temp27b3 = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
34927 temp27b4 = 0.5*((2.-fzm(k-1))*ru(i, k-1, j)-fzp(k-1)*ru(i, k-2&
34929 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*temp27b3
34930 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*temp27b3
34931 wb0(i, k, j) = wb0(i, k, j) + temp27b4
34932 wb0(i-1, k, j) = wb0(i-1, k, j) + temp27b4
34935 temp27b1 = 0.5*(w(i, k, j)+w(i-1, k, j))*fqxb(i, k)
34936 temp27b2 = 0.5*(fzm(k)*ru(i, k, j)+fzp(k)*ru(i, k-1, j))*&
34938 rub(i, k, j) = rub(i, k, j) + fzm(k)*temp27b1
34939 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*temp27b1
34940 wb0(i, k, j) = wb0(i, k, j) + temp27b2
34941 wb0(i-1, k, j) = wb0(i-1, k, j) + temp27b2
34944 CALL POPINTEGER4(k)
34949 DO i=i_end_f,i_start_f,-1
34950 wi0 = gi0/(eps+beta0)**pw
34951 wi1 = gi1/(eps+beta1)**pw
34952 wi2 = gi2/(eps+beta2)**pw
34953 sumwk = wi0 + wi1 + wi2
34954 temp27b = vel*fqxb(i, k)/sumwk
34955 temp27b0 = (wi0*f0+wi1*f1+wi2*f2)*fqxb(i, k)/sumwk
34960 sumwkb = -(vel*temp27b0/sumwk)
34961 wi0b = sumwkb + f0*temp27b
34962 wi1b = sumwkb + f1*temp27b
34963 wi2b = sumwkb + f2*temp27b
34965 temp26 = (eps+beta2)**pw
34966 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw))&
34970 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp26**2)
34972 temp25 = (eps+beta1)**pw
34973 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw))&
34977 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp25**2)
34979 temp24 = (eps+beta0)**pw
34980 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw))&
34984 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp24**2)
34986 CALL POPREAL8(beta2)
34987 temp24b1 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
34988 temp24b2 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
34989 qip2b = temp24b2 - f2b/6. + temp24b1
34990 CALL POPREAL8(beta1)
34991 temp24b3 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
34992 temp24b6 = 2*(qim1-qip1)*beta1b/4.
34993 qip1b = temp24b3 - temp24b6 + f1b/3. + 5.*f2b/6. - 4.*temp24b2 - &
34995 CALL POPREAL8(beta0)
34996 temp24b5 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
34997 temp24b4 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
34998 qib = f2b/3. - 2.*temp24b3 + 11.*f0b/6. + 5.*f1b/6. + 3.*temp24b4 &
34999 & + temp24b5 + 3.*temp24b2 + temp24b1
35000 qim1b = temp24b6 - 4.*temp24b4 - 7.*f0b/6. - f1b/6. - 2.*temp24b5 &
35002 qim2b = f0b/3. + temp24b4 + temp24b5
35006 CALL POPCONTROL1B(branch)
35007 IF (branch .EQ. 0) THEN
35008 CALL POPREAL8(qim2)
35009 wb0(i-3, k, j) = wb0(i-3, k, j) + qim2b
35010 CALL POPREAL8(qim1)
35011 wb0(i-2, k, j) = wb0(i-2, k, j) + qim1b
35013 wb0(i-1, k, j) = wb0(i-1, k, j) + qib
35014 CALL POPREAL8(qip1)
35015 wb0(i, k, j) = wb0(i, k, j) + qip1b
35016 CALL POPREAL8(qip2)
35017 wb0(i+1, k, j) = wb0(i+1, k, j) + qip2b
35019 CALL POPREAL8(qim2)
35020 wb0(i+2, k, j) = wb0(i+2, k, j) + qim2b
35021 CALL POPREAL8(qim1)
35022 wb0(i+1, k, j) = wb0(i+1, k, j) + qim1b
35024 wb0(i, k, j) = wb0(i, k, j) + qib
35025 CALL POPREAL8(qip1)
35026 wb0(i-1, k, j) = wb0(i-1, k, j) + qip1b
35027 CALL POPREAL8(qip2)
35028 wb0(i-2, k, j) = wb0(i-2, k, j) + qip2b
35031 rub(i, k-1, j) = rub(i, k-1, j) + (2.-fzm(k-1))*velb
35032 rub(i, k-2, j) = rub(i, k-2, j) - fzp(k-1)*velb
35035 DO i=i_end_f,i_start_f,-1
35036 wi0 = gi0/(eps+beta0)**pw
35037 wi1 = gi1/(eps+beta1)**pw
35038 wi2 = gi2/(eps+beta2)**pw
35039 sumwk = wi0 + wi1 + wi2
35040 vel = fzm(k)*ru(i, k, j) + fzp(k)*ru(i, k-1, j)
35041 temp24b = vel*fqxb(i, k)/sumwk
35042 temp24b0 = (wi0*f0+wi1*f1+wi2*f2)*fqxb(i, k)/sumwk
35047 sumwkb = -(vel*temp24b0/sumwk)
35048 wi0b = sumwkb + f0*temp24b
35049 wi1b = sumwkb + f1*temp24b
35050 wi2b = sumwkb + f2*temp24b
35052 temp23 = (eps+beta2)**pw
35053 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
35057 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp23**2)
35059 temp22 = (eps+beta1)**pw
35060 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
35064 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp22**2)
35066 temp21 = (eps+beta0)**pw
35067 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(pw)&
35071 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp21**2)
35073 CALL POPREAL8(beta2)
35074 temp21b = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
35075 temp21b0 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
35076 qip2b = temp21b0 - f2b/6. + temp21b
35077 CALL POPREAL8(beta1)
35078 temp21b1 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
35079 temp21b4 = 2*(qim1-qip1)*beta1b/4.
35080 qip1b = temp21b1 - temp21b4 + f1b/3. + 5.*f2b/6. - 4.*temp21b0 -&
35082 CALL POPREAL8(beta0)
35083 temp21b3 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
35084 temp21b2 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
35085 qib = f2b/3. - 2.*temp21b1 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
35086 & temp21b2 + temp21b3 + 3.*temp21b0 + temp21b
35087 qim1b = temp21b4 - 4.*temp21b2 - 7.*f0b/6. - f1b/6. - 2.*&
35088 & temp21b3 + temp21b1
35089 qim2b = f0b/3. + temp21b2 + temp21b3
35093 CALL POPCONTROL1B(branch)
35094 IF (branch .EQ. 0) THEN
35095 CALL POPREAL8(qim2)
35096 wb0(i-3, k, j) = wb0(i-3, k, j) + qim2b
35097 CALL POPREAL8(qim1)
35098 wb0(i-2, k, j) = wb0(i-2, k, j) + qim1b
35100 wb0(i-1, k, j) = wb0(i-1, k, j) + qib
35101 CALL POPREAL8(qip1)
35102 wb0(i, k, j) = wb0(i, k, j) + qip1b
35103 CALL POPREAL8(qip2)
35104 wb0(i+1, k, j) = wb0(i+1, k, j) + qip2b
35106 CALL POPREAL8(qim2)
35107 wb0(i+2, k, j) = wb0(i+2, k, j) + qim2b
35108 CALL POPREAL8(qim1)
35109 wb0(i+1, k, j) = wb0(i+1, k, j) + qim1b
35111 wb0(i, k, j) = wb0(i, k, j) + qib
35112 CALL POPREAL8(qip1)
35113 wb0(i-1, k, j) = wb0(i-1, k, j) + qip1b
35114 CALL POPREAL8(qip2)
35115 wb0(i-2, k, j) = wb0(i-2, k, j) + qip2b
35118 rub(i, k, j) = rub(i, k, j) + fzm(k)*velb
35119 rub(i, k-1, j) = rub(i, k-1, j) + fzp(k)*velb
35122 CALL POPINTEGER4(k)
35125 CALL POPINTEGER4(ad_from12)
35126 CALL POPINTEGER4(ad_to12)
35127 DO j=ad_to12,ad_from12,-1
35128 CALL POPINTEGER4(jp0)
35129 CALL POPINTEGER4(jp1)
35130 CALL POPCONTROL2B(branch)
35131 IF (branch .LT. 2) THEN
35132 IF (branch .EQ. 0) THEN
35134 CALL POPINTEGER4(ad_from9)
35135 CALL POPINTEGER4(ad_to9)
35136 DO i=ad_to9,ad_from9,-1
35137 mrdy = msftx(i, j-1)*rdy
35138 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1&
35142 CALL POPINTEGER4(k)
35145 CALL POPINTEGER4(ad_from10)
35146 CALL POPINTEGER4(ad_to10)
35147 DO i=ad_to10,ad_from10,-1
35148 mrdy = msftx(i, j-1)*rdy
35149 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1&
35153 CALL POPINTEGER4(k)
35155 ELSE IF (branch .EQ. 2) THEN
35156 DO k=ktf+1,kts+1,-1
35157 CALL POPINTEGER4(ad_from11)
35158 CALL POPINTEGER4(ad_to11)
35159 DO i=ad_to11,ad_from11,-1
35160 mrdy = msftx(i, j-1)*rdy
35161 fqyb(i, k, jp1) = fqyb(i, k, jp1) - mrdy*tendencyb(i, k, j-1)
35162 fqyb(i, k, jp0) = fqyb(i, k, jp0) + mrdy*tendencyb(i, k, j-1)
35165 CALL POPINTEGER4(k)
35167 CALL POPCONTROL3B(branch)
35168 IF (branch .LT. 3) THEN
35169 IF (branch .EQ. 0) THEN
35170 CALL POPINTEGER4(ad_from0)
35171 CALL POPINTEGER4(ad_to0)
35172 DO i=ad_to0,ad_from0,-1
35173 wi0 = gi0/(eps+beta0)**pw
35174 wi1 = gi1/(eps+beta1)**pw
35175 wi2 = gi2/(eps+beta2)**pw
35176 sumwk = wi0 + wi1 + wi2
35177 temp5b = vel*fqyb(i, k, jp1)/sumwk
35178 temp5b0 = (wi0*f0+wi1*f1+wi2*f2)*fqyb(i, k, jp1)/sumwk
35183 sumwkb = -(vel*temp5b0/sumwk)
35184 wi0b = sumwkb + f0*temp5b
35185 wi1b = sumwkb + f1*temp5b
35186 wi2b = sumwkb + f2*temp5b
35187 fqyb(i, k, jp1) = 0.0
35188 temp4 = (eps+beta2)**pw
35189 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(&
35193 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp4**2)
35195 temp3 = (eps+beta1)**pw
35196 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(&
35200 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp3**2)
35202 temp2 = (eps+beta0)**pw
35203 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT(&
35207 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp2**2)
35209 CALL POPREAL8(beta2)
35210 temp2b1 = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
35211 temp2b2 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
35212 qip2b = temp2b2 - f2b/6. + temp2b1
35213 CALL POPREAL8(beta1)
35214 temp2b3 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
35215 temp2b6 = 2*(qim1-qip1)*beta1b/4.
35216 qip1b = temp2b3 - temp2b6 + f1b/3. + 5.*f2b/6. - 4.*temp2b2 - &
35218 CALL POPREAL8(beta0)
35219 temp2b5 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
35220 temp2b4 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
35221 qib = f2b/3. - 2.*temp2b3 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
35222 & temp2b4 + temp2b5 + 3.*temp2b2 + temp2b1
35223 qim1b = temp2b6 - 4.*temp2b4 - 7.*f0b/6. - f1b/6. - 2.*temp2b5&
35225 qim2b = f0b/3. + temp2b4 + temp2b5
35229 CALL POPCONTROL1B(branch)
35230 IF (branch .EQ. 0) THEN
35231 CALL POPREAL8(qim2)
35232 wb0(i, k, j-3) = wb0(i, k, j-3) + qim2b
35233 CALL POPREAL8(qim1)
35234 wb0(i, k, j-2) = wb0(i, k, j-2) + qim1b
35236 wb0(i, k, j-1) = wb0(i, k, j-1) + qib
35237 CALL POPREAL8(qip1)
35238 wb0(i, k, j) = wb0(i, k, j) + qip1b
35239 CALL POPREAL8(qip2)
35240 wb0(i, k, j+1) = wb0(i, k, j+1) + qip2b
35242 CALL POPREAL8(qim2)
35243 wb0(i, k, j+2) = wb0(i, k, j+2) + qim2b
35244 CALL POPREAL8(qim1)
35245 wb0(i, k, j+1) = wb0(i, k, j+1) + qim1b
35247 wb0(i, k, j) = wb0(i, k, j) + qib
35248 CALL POPREAL8(qip1)
35249 wb0(i, k, j-1) = wb0(i, k, j-1) + qip1b
35250 CALL POPREAL8(qip2)
35251 wb0(i, k, j-2) = wb0(i, k, j-2) + qip2b
35254 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
35255 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
35258 CALL POPINTEGER4(ad_from)
35259 CALL POPINTEGER4(ad_to)
35260 DO i=ad_to,ad_from,-1
35261 wi0 = gi0/(eps+beta0)**pw
35262 wi1 = gi1/(eps+beta1)**pw
35263 wi2 = gi2/(eps+beta2)**pw
35264 sumwk = wi0 + wi1 + wi2
35265 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
35266 temp2b = vel*fqyb(i, k, jp1)/sumwk
35267 temp2b0 = (wi0*f0+wi1*f1+wi2*f2)*fqyb(i, k, jp1)/sumwk
35272 sumwkb = -(vel*temp2b0/sumwk)
35273 wi0b = sumwkb + f0*temp2b
35274 wi1b = sumwkb + f1*temp2b
35275 wi2b = sumwkb + f2*temp2b
35276 fqyb(i, k, jp1) = 0.0
35277 temp1 = (eps+beta2)**pw
35278 IF (eps + beta2 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT&
35282 beta2b = -(gi2*pw*(eps+beta2)**(pw-1)*wi2b/temp1**2)
35284 temp0 = (eps+beta1)**pw
35285 IF (eps + beta1 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT&
35289 beta1b = -(gi1*pw*(eps+beta1)**(pw-1)*wi1b/temp0**2)
35291 temp = (eps+beta0)**pw
35292 IF (eps + beta0 .LE. 0.0 .AND. (pw .EQ. 0.0 .OR. pw .NE. INT&
35296 beta0b = -(gi0*pw*(eps+beta0)**(pw-1)*wi0b/temp**2)
35298 CALL POPREAL8(beta2)
35299 tempb = 13.*2*(qi-2.*qip1+qip2)*beta2b/12.
35300 tempb0 = 2*(qip2-4.*qip1+3.*qi)*beta2b/4.
35301 qip2b = tempb0 - f2b/6. + tempb
35302 CALL POPREAL8(beta1)
35303 tempb1 = 13.*2*(qim1-2.*qi+qip1)*beta1b/12.
35304 tempb4 = 2*(qim1-qip1)*beta1b/4.
35305 qip1b = tempb1 - tempb4 + f1b/3. + 5.*f2b/6. - 4.*tempb0 - &
35307 CALL POPREAL8(beta0)
35308 tempb3 = 13.*2*(qim2-2.*qim1+qi)*beta0b/12.
35309 tempb2 = 2*(qim2-4.*qim1+3.*qi)*beta0b/4.
35310 qib = f2b/3. - 2.*tempb1 + 11.*f0b/6. + 5.*f1b/6. + 3.*&
35311 & tempb2 + tempb3 + 3.*tempb0 + tempb
35312 qim1b = tempb4 - 4.*tempb2 - 7.*f0b/6. - f1b/6. - 2.*tempb3 &
35314 qim2b = f0b/3. + tempb2 + tempb3
35318 CALL POPCONTROL1B(branch)
35319 IF (branch .EQ. 0) THEN
35320 CALL POPREAL8(qim2)
35321 wb0(i, k, j-3) = wb0(i, k, j-3) + qim2b
35322 CALL POPREAL8(qim1)
35323 wb0(i, k, j-2) = wb0(i, k, j-2) + qim1b
35325 wb0(i, k, j-1) = wb0(i, k, j-1) + qib
35326 CALL POPREAL8(qip1)
35327 wb0(i, k, j) = wb0(i, k, j) + qip1b
35328 CALL POPREAL8(qip2)
35329 wb0(i, k, j+1) = wb0(i, k, j+1) + qip2b
35331 CALL POPREAL8(qim2)
35332 wb0(i, k, j+2) = wb0(i, k, j+2) + qim2b
35333 CALL POPREAL8(qim1)
35334 wb0(i, k, j+1) = wb0(i, k, j+1) + qim1b
35336 wb0(i, k, j) = wb0(i, k, j) + qib
35337 CALL POPREAL8(qip1)
35338 wb0(i, k, j-1) = wb0(i, k, j-1) + qip1b
35339 CALL POPREAL8(qip2)
35340 wb0(i, k, j-2) = wb0(i, k, j-2) + qip2b
35343 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
35344 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
35347 CALL POPINTEGER4(k)
35348 ELSE IF (branch .EQ. 1) THEN
35349 CALL POPINTEGER4(ad_from2)
35350 CALL POPINTEGER4(ad_to2)
35351 DO i=ad_to2,ad_from2,-1
35352 temp5b3 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
35353 temp5b4 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j)-fzp(k-1)*rv(i, k-2&
35354 & , j))*fqyb(i, k, jp1)
35355 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*temp5b3
35356 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*temp5b3
35357 wb0(i, k, j) = wb0(i, k, j) + temp5b4
35358 wb0(i, k, j-1) = wb0(i, k, j-1) + temp5b4
35359 fqyb(i, k, jp1) = 0.0
35362 CALL POPINTEGER4(ad_from1)
35363 CALL POPINTEGER4(ad_to1)
35364 DO i=ad_to1,ad_from1,-1
35365 temp5b1 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
35366 temp5b2 = 0.5*(fzm(k)*rv(i, k, j)+fzp(k)*rv(i, k-1, j))*fqyb&
35368 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*temp5b1
35369 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*temp5b1
35370 wb0(i, k, j) = wb0(i, k, j) + temp5b2
35371 wb0(i, k, j-1) = wb0(i, k, j-1) + temp5b2
35372 fqyb(i, k, jp1) = 0.0
35375 CALL POPINTEGER4(k)
35377 CALL POPINTEGER4(ad_from4)
35378 CALL POPINTEGER4(ad_to4)
35379 DO i=ad_to4,ad_from4,-1
35380 temp9 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i, k, j&
35382 temp12 = SIGN(1., vel)
35383 temp11 = temp12/12.0
35384 temp10 = SIGN(1, time_step)
35385 temp9b = vel*fqyb(i, k, jp1)
35386 temp9b0 = temp9b/12.0
35387 temp9b1 = temp10*temp11*temp9b
35388 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j-2&
35389 & ))/12.0+temp10*(temp11*temp9))*fqyb(i, k, jp1)
35390 wb0(i, k, j) = wb0(i, k, j) + 7.*temp9b0 - 3.*temp9b1
35391 wb0(i, k, j-1) = wb0(i, k, j-1) + 3.*temp9b1 + 7.*temp9b0
35392 wb0(i, k, j+1) = wb0(i, k, j+1) + temp9b1 - temp9b0
35393 wb0(i, k, j-2) = wb0(i, k, j-2) - temp9b1 - temp9b0
35394 fqyb(i, k, jp1) = 0.0
35396 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
35397 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
35400 CALL POPINTEGER4(ad_from3)
35401 CALL POPINTEGER4(ad_to3)
35402 DO i=ad_to3,ad_from3,-1
35403 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
35404 temp5 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i, k&
35406 temp8 = SIGN(1., vel)
35408 temp6 = SIGN(1, time_step)
35409 temp5b5 = vel*fqyb(i, k, jp1)
35410 temp5b6 = temp5b5/12.0
35411 temp5b7 = temp6*temp7*temp5b5
35412 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j&
35413 & -2))/12.0+temp6*(temp7*temp5))*fqyb(i, k, jp1)
35414 wb0(i, k, j) = wb0(i, k, j) + 7.*temp5b6 - 3.*temp5b7
35415 wb0(i, k, j-1) = wb0(i, k, j-1) + 3.*temp5b7 + 7.*temp5b6
35416 wb0(i, k, j+1) = wb0(i, k, j+1) + temp5b7 - temp5b6
35417 wb0(i, k, j-2) = wb0(i, k, j-2) - temp5b7 - temp5b6
35418 fqyb(i, k, jp1) = 0.0
35420 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
35421 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
35424 CALL POPINTEGER4(k)
35426 ELSE IF (branch .EQ. 3) THEN
35427 CALL POPINTEGER4(ad_from6)
35428 CALL POPINTEGER4(ad_to6)
35429 DO i=ad_to6,ad_from6,-1
35430 temp13b1 = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
35431 temp13b2 = 0.5*((2.-fzm(k-1))*rv(i, k-1, j)-fzp(k-1)*rv(i, k-2, &
35432 & j))*fqyb(i, k, jp1)
35433 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*temp13b1
35434 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*temp13b1
35435 wb0(i, k, j) = wb0(i, k, j) + temp13b2
35436 wb0(i, k, j-1) = wb0(i, k, j-1) + temp13b2
35437 fqyb(i, k, jp1) = 0.0
35440 CALL POPINTEGER4(ad_from5)
35441 CALL POPINTEGER4(ad_to5)
35442 DO i=ad_to5,ad_from5,-1
35443 temp13b = 0.5*(w(i, k, j)+w(i, k, j-1))*fqyb(i, k, jp1)
35444 temp13b0 = 0.5*(fzm(k)*rv(i, k, j)+fzp(k)*rv(i, k-1, j))*fqyb(&
35446 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*temp13b
35447 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*temp13b
35448 wb0(i, k, j) = wb0(i, k, j) + temp13b0
35449 wb0(i, k, j-1) = wb0(i, k, j-1) + temp13b0
35450 fqyb(i, k, jp1) = 0.0
35453 CALL POPINTEGER4(k)
35454 ELSE IF (branch .EQ. 4) THEN
35455 CALL POPINTEGER4(ad_from8)
35456 CALL POPINTEGER4(ad_to8)
35457 DO i=ad_to8,ad_from8,-1
35458 temp17 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i, k, j-&
35460 temp20 = SIGN(1., vel)
35461 temp19 = temp20/12.0
35462 temp18 = SIGN(1, time_step)
35463 temp17b = vel*fqyb(i, k, jp1)
35464 temp17b0 = temp17b/12.0
35465 temp17b1 = temp18*temp19*temp17b
35466 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j-2))&
35467 & /12.0+temp18*(temp19*temp17))*fqyb(i, k, jp1)
35468 wb0(i, k, j) = wb0(i, k, j) + 7.*temp17b0 - 3.*temp17b1
35469 wb0(i, k, j-1) = wb0(i, k, j-1) + 3.*temp17b1 + 7.*temp17b0
35470 wb0(i, k, j+1) = wb0(i, k, j+1) + temp17b1 - temp17b0
35471 wb0(i, k, j-2) = wb0(i, k, j-2) - temp17b1 - temp17b0
35472 fqyb(i, k, jp1) = 0.0
35474 rvb(i, k-1, j) = rvb(i, k-1, j) + (2.-fzm(k-1))*velb
35475 rvb(i, k-2, j) = rvb(i, k-2, j) - fzp(k-1)*velb
35478 CALL POPINTEGER4(ad_from7)
35479 CALL POPINTEGER4(ad_to7)
35480 DO i=ad_to7,ad_from7,-1
35481 vel = fzm(k)*rv(i, k, j) + fzp(k)*rv(i, k-1, j)
35482 temp13 = w(i, k, j+1) - w(i, k, j-2) - 3.*(w(i, k, j)-w(i, k, &
35484 temp16 = SIGN(1., vel)
35485 temp15 = temp16/12.0
35486 temp14 = SIGN(1, time_step)
35487 temp13b3 = vel*fqyb(i, k, jp1)
35488 temp13b4 = temp13b3/12.0
35489 temp13b5 = temp14*temp15*temp13b3
35490 velb = ((7.*(w(i, k, j)+w(i, k, j-1))-w(i, k, j+1)-w(i, k, j-2&
35491 & ))/12.0+temp14*(temp15*temp13))*fqyb(i, k, jp1)
35492 wb0(i, k, j) = wb0(i, k, j) + 7.*temp13b4 - 3.*temp13b5
35493 wb0(i, k, j-1) = wb0(i, k, j-1) + 3.*temp13b5 + 7.*temp13b4
35494 wb0(i, k, j+1) = wb0(i, k, j+1) + temp13b5 - temp13b4
35495 wb0(i, k, j-2) = wb0(i, k, j-2) - temp13b5 - temp13b4
35496 fqyb(i, k, jp1) = 0.0
35498 rvb(i, k, j) = rvb(i, k, j) + fzm(k)*velb
35499 rvb(i, k-1, j) = rvb(i, k-1, j) + fzp(k)*velb
35502 CALL POPINTEGER4(k)
35505 CALL POPCONTROL1B(branch)
35506 CALL POPCONTROL1B(branch)
35507 CALL POPCONTROL1B(branch)
35508 CALL POPCONTROL1B(branch)
35509 END SUBROUTINE A_ADVECT_WENO_W
35511 END MODULE a_module_advect_em