78 real(RP),
intent(out) :: S33_C (KA,IA,JA)
79 real(RP),
intent(out) :: S11_C (KA,IA,JA)
80 real(RP),
intent(out) :: S22_C (KA,IA,JA)
81 real(RP),
intent(out) :: S31_C (KA,IA,JA)
82 real(RP),
intent(out) :: S12_C (KA,IA,JA)
83 real(RP),
intent(out) :: S23_C (KA,IA,JA)
84 real(RP),
intent(out) :: S12_Z (KA,IA,JA)
85 real(RP),
intent(out) :: S23_X (KA,IA,JA)
86 real(RP),
intent(out) :: S31_Y (KA,IA,JA)
87 real(RP),
intent(out) :: S2 (KA,IA,JA)
89 real(RP),
intent(in) :: DENS (KA,IA,JA)
90 real(RP),
intent(in) :: MOMZ (KA,IA,JA)
91 real(RP),
intent(in) :: MOMX (KA,IA,JA)
92 real(RP),
intent(in) :: MOMY (KA,IA,JA)
94 real(RP),
intent(in) :: GSQRT (KA,IA,JA,7)
95 real(RP),
intent(in) :: J13G (KA,IA,JA,7)
96 real(RP),
intent(in) :: J23G (KA,IA,JA,7)
97 real(RP),
intent(in) :: J33G
98 real(RP),
intent(in) :: MAPF (IA,JA,2,4)
101 real(RP) :: VELZ_C (KA,IA,JA)
102 real(RP) :: VELZ_XY(KA,IA,JA)
103 real(RP) :: VELX_C (KA,IA,JA)
104 real(RP) :: VELX_YZ(KA,IA,JA)
105 real(RP) :: VELY_C (KA,IA,JA)
106 real(RP) :: VELY_ZX(KA,IA,JA)
109 real(RP) :: WORK_V(KA,IA,JA)
110 real(RP) :: WORK_Z(KA,IA,JA)
111 real(RP) :: WORK_X(KA,IA,JA)
112 real(RP) :: WORK_Y(KA,IA,JA)
114 integer :: IIS, IIE, JJS, JJE
136 velz_c(:,:,:) = undef
137 velz_xy(:,:,:) = undef
138 velx_c(:,:,:) = undef
139 velx_yz(:,:,:) = undef
140 vely_c(:,:,:) = undef
141 vely_zx(:,:,:) = undef
143 work_v(:,:,:) = undef
144 work_z(:,:,:) = undef
145 work_x(:,:,:) = undef
146 work_y(:,:,:) = undef
157 call check( __line__, momz(k,i,j) )
158 call check( __line__, dens(k+1,i,j) )
159 call check( __line__, dens(k,i,j) )
161 velz_xy(k,i,j) = 2.0_rp * momz(k,i,j) / ( dens(k+1,i,j)+dens(k,i,j) )
167 i = iundef; j = iundef; k = iundef
173 velz_xy(ke,i,j) = 0.0_rp
178 i = iundef; j = iundef; k = iundef
186 call check( __line__, momz(k,i,j) )
187 call check( __line__, momz(k-1,i,j) )
188 call check( __line__, dens(k,i,j) )
190 velz_c(k,i,j) = 0.5_rp * ( momz(k,i,j) + momz(k-1,i,j) ) / dens(k,i,j)
196 i = iundef; j = iundef; k = iundef
203 call check( __line__, momz(ks,i,j) )
204 call check( __line__, dens(ks,i,j) )
206 velz_c(ks,i,j) = 0.5_rp * momz(ks,i,j) / dens(ks,i,j)
211 i = iundef; j = iundef; k = iundef
220 call check( __line__, momx(k,i,j) )
221 call check( __line__, dens(k,i+1,j) )
222 call check( __line__, dens(k,i,j) )
224 velx_yz(k,i,j) = 2.0_rp * momx(k,i,j) / ( dens(k,i+1,j)+dens(k,i,j) )
230 i = iundef; j = iundef; k = iundef
236 velx_yz(ke+1,i,j) = 0.0_rp
241 i = iundef; j = iundef; k = iundef
249 call check( __line__, momx(k,i,j) )
250 call check( __line__, momx(k,i-1,j) )
251 call check( __line__, dens(k,i,j) )
253 velx_c(k,i,j) = 0.5_rp * ( momx(k,i,j) + momx(k,i-1,j) ) / dens(k,i,j)
259 i = iundef; j = iundef; k = iundef
269 call check( __line__, momy(k,i,j) )
270 call check( __line__, dens(k,i,j+1) )
271 call check( __line__, dens(k,i,j) )
273 vely_zx(k,i,j) = 2.0_rp * momy(k,i,j) / ( dens(k,i,j+1)+dens(k,i,j) )
279 i = iundef; j = iundef; k = iundef
285 vely_zx(ke+1,i,j) = 0.0_rp
290 i = iundef; j = iundef; k = iundef
298 call check( __line__, momy(k,i,j) )
299 call check( __line__, momy(k,i,j-1) )
300 call check( __line__, dens(k,i,j) )
302 vely_c(k,i,j) = 0.5_rp * ( momy(k,i,j) + momy(k,i,j-1) ) / dens(k,i,j)
308 i = iundef; j = iundef; k = iundef
311 do jjs = js, je, jblock
313 do iis = is, ie, iblock
317 work_z(:,:,:) = undef; work_x(:,:,:) = undef; work_y(:,:,:) = undef; work_v(:,:,:) = undef
329 call check( __line__, velz_c(k,i+1,j) )
330 call check( __line__, velz_c(k,i,j) )
332 work_x(k,i,j) = 0.5_rp * ( velz_c(k,i+1,j) + velz_c(k,i,j) )
338 i = iundef; j = iundef; k = iundef
344 work_x(ke+1,i,j) = 0.0_rp
349 i = iundef; j = iundef; k = iundef
358 call check( __line__, velz_c(k,i,j+1) )
359 call check( __line__, velz_c(k,i,j) )
361 work_y(k,i,j) = 0.5_rp * ( velz_c(k,i,j+1) + velz_c(k,i,j) )
367 i = iundef; j = iundef; k = iundef
373 work_y(ke+1,i,j) = 0.0_rp
378 i = iundef; j = iundef; k = iundef
389 call check( __line__, velz_xy(k,i,j) )
390 call check( __line__, velz_xy(k-1,i,j) )
391 call check( __line__, rcdz(k) )
393 s33_c(k,i,j) = ( velz_xy(k,i,j) - velz_xy(k-1,i,j) ) * rcdz(k) &
394 * j33g / gsqrt(k,i,j,
i_xyz)
400 i = iundef; j = iundef; k = iundef
407 call check( __line__, velz_xy(ks,i,j) )
408 call check( __line__, gsqrt(ks,i,j,
i_xyz) )
409 call check( __line__, rcdz(ks) )
411 s33_c(ks,i,j) = velz_xy(ks,i,j) * rcdz(ks) &
412 * j33g / gsqrt(ks,i,j,
i_xyz)
417 i = iundef; j = iundef; k = iundef
429 call check( __line__, velz_c(k,i+1,j) )
430 call check( __line__, velz_c(k,i-1,j) )
431 call check( __line__, gsqrt(k,i+1,j,
i_xyz) )
432 call check( __line__, gsqrt(k,i-1,j,
i_xyz) )
433 call check( __line__, velz_xy(k,i,j) )
434 call check( __line__, velz_xy(k-1,i,j) )
435 call check( __line__, j13g(k,i,j,
i_xyw) )
436 call check( __line__, j13g(k-1,i,j,
i_xyw) )
437 call check( __line__, fdx(i) )
438 call check( __line__, fdx(i-1) )
440 s31_c(k,i,j) = 0.5_rp * ( &
441 ( gsqrt(k,i+1,j,
i_xyz)*velz_c(k,i+1,j) - gsqrt(k,i-1,j,
i_xyz)*velz_c(k,i-1,j) ) / ( fdx(i) + fdx(i-1) ) &
442 + ( j13g(k,i,j,
i_xyw)*velz_xy(k,i,j) - j13g(k-1,i,j,
i_xyw)*velz_xy(k-1,i,j) ) * rcdz(k) &
450 i = iundef; j = iundef; k = iundef
457 call check( __line__, velz_c(ks,i+1,j) )
458 call check( __line__, velz_c(ks,i-1,j) )
459 call check( __line__, gsqrt(ks,i+1,j,
i_xyz) )
460 call check( __line__, gsqrt(ks,i-1,j,
i_xyz) )
461 call check( __line__, velz_xy(ks,i,j) )
462 call check( __line__, j13g(ks,i,j,
i_xyw) )
463 call check( __line__, velz_c(ke,i+1,j) )
464 call check( __line__, velz_c(ke,i-1,j) )
465 call check( __line__, gsqrt(ke,i+1,j,
i_xyz) )
466 call check( __line__, gsqrt(ke,i-1,j,
i_xyz) )
467 call check( __line__, velz_xy(ke,i,j) )
468 call check( __line__, j13g(ke,i,j,
i_xyw) )
469 call check( __line__, fdx(i) )
470 call check( __line__, fdx(i-1) )
472 s31_c(ks,i,j) = 0.5_rp * ( &
473 ( gsqrt(ks,i+1,j,
i_xyz)*velz_c(ks,i+1,j) - gsqrt(ks,i-1,j,
i_xyz)*velz_c(ks,i-1,j) ) / ( fdx(i) + fdx(i-1) ) &
474 + ( j13g(ks,i,j,
i_xyw)*velz_xy(ks,i,j) ) * rcdz(ks) &
476 s31_c(ke,i,j) = 0.5_rp * ( &
477 ( gsqrt(ke,i+1,j,
i_xyz)*velz_c(ke,i+1,j) - gsqrt(ke,i-1,j,
i_xyz)*velz_c(ke,i-1,j) ) / ( fdx(i) + fdx(i-1) ) &
478 - ( j13g(ke-1,i,j,
i_xyw)*velz_xy(ke-1,i,j) ) * rcdz(ke) &
484 i = iundef; j = iundef; k = iundef
494 call check( __line__, velz_xy(k,i+1,j) )
495 call check( __line__, velz_xy(k,i,j) )
496 call check( __line__, rfdx(i) )
498 s31_y(k,i,j) = 0.5_rp * ( &
499 ( gsqrt(k,i+1,j,
i_xyw)*velz_xy(k,i+1,j) - gsqrt(k,i,j,
i_xyw)*velz_xy(k,i,j) ) * rfdx(i) &
500 + ( j13g(k+1,i,j,
i_uyz)*work_x(k+1,i,j) - j13g(k,i,j,
i_uyz)*work_x(k,i,j)) * rfdz(k) &
507 i = iundef; j = iundef; k = iundef
518 call check( __line__, velz_c(k,i,j+1) )
519 call check( __line__, velz_c(k,i,j-1) )
520 call check( __line__, gsqrt(k,i,j+1,
i_xyz) )
521 call check( __line__, gsqrt(k,i,j-1,
i_xyz) )
522 call check( __line__, velz_xy(k,i,j) )
523 call check( __line__, velz_xy(k-1,i,j) )
524 call check( __line__, j23g(k,i,j,
i_xyw) )
525 call check( __line__, j23g(k-1,i,j,
i_xyw) )
526 call check( __line__, fdy(j) )
527 call check( __line__, fdy(j-1) )
529 s23_c(k,i,j) = 0.5_rp * ( &
530 ( gsqrt(k,i,j+1,
i_xyz)*velz_c(k,i,j+1) - gsqrt(k,i,j-1,
i_xyz)*velz_c(k,i,j-1) ) / ( fdy(j) + fdy(j-1) ) &
531 + ( j23g(k,i,j,
i_xyw)*velz_xy(k,i,j) - j23g(k-1,i,j,
i_xyw)*velz_xy(k-1,i,j) ) * rcdz(k) &
538 i = iundef; j = iundef; k = iundef
545 call check( __line__, velz_c(ks,i,j+1) )
546 call check( __line__, velz_c(ks,i,j-1) )
547 call check( __line__, gsqrt(ks,i,j+1,
i_xyz) )
548 call check( __line__, gsqrt(ks,i,j-1,
i_xyz) )
549 call check( __line__, velz_xy(ks,i,j) )
550 call check( __line__, j23g(ks,i,j,
i_xyw) )
551 call check( __line__, velz_c(ke,i,j+1) )
552 call check( __line__, velz_c(ke,i,j-1) )
553 call check( __line__, gsqrt(ke,i,j+1,
i_xyz) )
554 call check( __line__, gsqrt(ke,i,j-1,
i_xyz) )
555 call check( __line__, velz_xy(ke,i,j) )
556 call check( __line__, j23g(ke,i,j,
i_xyw) )
557 call check( __line__, fdy(j) )
558 call check( __line__, fdy(j-1) )
560 s23_c(ks,i,j) = 0.5_rp * ( &
561 ( gsqrt(ks,i,j+1,
i_xyz)*velz_c(ks,i,j+1) - gsqrt(ks,i,j-1,
i_xyz)*velz_c(ks,i,j-1) ) / ( fdy(j) + fdy(j-1) ) &
562 + ( j23g(ks,i,j,
i_xyw)*velz_xy(ks,i,j) ) * rcdz(ks) &
564 s23_c(ke,i,j) = 0.5_rp * ( &
565 ( gsqrt(ke,i,j+1,
i_xyz)*velz_c(ke,i,j+1) - gsqrt(ke,i,j-1,
i_xyz)*velz_c(ke,i,j-1) ) / ( fdy(j) + fdy(j-1) ) &
566 - ( j23g(ke-1,i,j,
i_xyw)*velz_xy(ke-1,i,j) ) * rcdz(ke) &
572 i = iundef; j = iundef; k = iundef
582 call check( __line__, velz_xy(k,i,j+1) )
583 call check( __line__, velz_xy(k,i,j) )
584 call check( __line__, rfdy(j) )
586 s23_x(k,i,j) = 0.5_rp * ( &
587 ( gsqrt(k,i,j+1,
i_xyw)*velz_xy(k,i,j+1) - gsqrt(k,i,j,
i_xyw)*velz_xy(k,i,j) ) * rfdy(j) &
588 + ( j23g(k+1,i,j,
i_xvz)*work_y(k+1,i,j) - j23g(k,i,j,
i_xvz)*work_y(k,i,j) ) * rfdz(k) &
595 i = iundef; j = iundef; k = iundef
599 work_z(:,:,:) = undef; work_x(:,:,:) = undef; work_y(:,:,:) = undef; work_v(:,:,:) = undef
609 call check( __line__, velx_c(k+1,i,j) )
610 call check( __line__, velx_c(k,i,j) )
612 work_z(k,i,j) = 0.5_rp * ( velx_c(k+1,i,j) + velx_c(k,i,j) )
618 i = iundef; j = iundef; k = iundef
629 call check( __line__, velx_c(k,i,j+1) )
630 call check( __line__, velx_c(k,i,j) )
632 work_y(k,i,j) = 0.5_rp * ( velx_c(k,i,j+1) + velx_c(k,i,j) )
638 i = iundef; j = iundef; k = iundef
647 call check( __line__, velx_yz(k,i,j) )
648 call check( __line__, velx_yz(k,i,j+1) )
649 call check( __line__, velx_yz(k+1,i,j) )
650 call check( __line__, velx_yz(k+1,i,j+1) )
651 call check( __line__, j23g(k ,i,j ,
i_uvz) )
652 call check( __line__, j23g(k+1,i,j ,
i_uvz) )
653 call check( __line__, j23g(k ,i,j+1,
i_uvz) )
654 call check( __line__, j23g(k+1,i,j+1,
i_uvz) )
656 work_v(k,i,j) = 0.25_rp &
657 * ( j23g(k ,i,j ,
i_uyz)*velx_yz(k ,i,j ) &
658 + j23g(k+1,i,j ,
i_uyz)*velx_yz(k+1,i,j ) &
659 + j23g(k ,i,j+1,
i_uyz)*velx_yz(k ,i,j+1) &
660 + j23g(k+1,i,j+1,
i_uyz)*velx_yz(k+1,i,j+1) )
666 i = iundef; j = iundef; k = iundef
677 call check( __line__, velx_yz(k,i,j) )
678 call check( __line__, velx_yz(k,i-1,j) )
679 call check( __line__, gsqrt(k,i,j,
i_uyz) )
680 call check( __line__, gsqrt(k,i-1,j,
i_uyz) )
681 call check( __line__, work_z(k,i,j) )
682 call check( __line__, work_z(k-1,i,j) )
683 call check( __line__, j13g(k,i,j,
i_xyw) )
684 call check( __line__, j13g(k-1,i,j,
i_xyw) )
685 call check( __line__, gsqrt(k,i,j,
i_xyz) )
686 call check( __line__, rcdx(i) )
689 ( gsqrt(k,i,j,
i_uyz)*velx_yz(k,i,j) - gsqrt(k,i-1,j,
i_uyz)*velx_yz(k,i-1,j) ) * rcdx(i) &
690 + ( j13g(k,i,j,
i_xyw)*work_z(k,i,j) - j13g(k-1,i,j,
i_xyw)*work_z(k-1,i,j) ) * rcdz(k) &
691 ) * mapf(i,j,1,
i_xy) / gsqrt(k,i,j,
i_xyz)
697 i = iundef; j = iundef; k = iundef
704 call check( __line__, velx_yz(ks,i,j) )
705 call check( __line__, velx_yz(ks,i-1,j) )
706 call check( __line__, gsqrt(ks,i,j,
i_uyz) )
707 call check( __line__, gsqrt(ks,i-1,j,
i_uyz) )
708 call check( __line__, velx_c(ks+1,i,j) )
709 call check( __line__, velx_c(ks,i,j) )
710 call check( __line__, j13g(ks+1,i,j,
i_xyz) )
711 call check( __line__, j13g(ks,i,j,
i_xyz) )
712 call check( __line__, gsqrt(ks,i,j,
i_xyz) )
713 call check( __line__, velx_yz(ke,i,j) )
714 call check( __line__, velx_yz(ke,i-1,j) )
715 call check( __line__, gsqrt(ke,i,j,
i_uyz) )
716 call check( __line__, gsqrt(ke,i-1,j,
i_uyz) )
717 call check( __line__, velx_c(ke,i,j) )
718 call check( __line__, velx_c(ke-1,i,j) )
719 call check( __line__, j13g(ke,i,j,
i_xyz) )
720 call check( __line__, j13g(ke-1,i,j,
i_xyz) )
721 call check( __line__, gsqrt(ke,i,j,
i_xyz) )
722 call check( __line__, rcdx(i) )
725 ( gsqrt(ks,i,j,
i_uyz)*velx_yz(ks,i,j) - gsqrt(ks,i-1,j,
i_uyz)*velx_yz(ks,i-1,j) ) * rcdx(i) &
726 + ( j13g(ks+1,i,j,
i_xyz)*velx_c(ks+1,i,j) - j13g(ks,i,j,
i_xyz)*velx_c(ks,i,j) ) * rfdz(ks) &
727 ) * mapf(i,j,1,
i_xy) / gsqrt(ks,i,j,
i_xyz)
729 ( gsqrt(ke,i,j,
i_uyz)*velx_yz(ke,i,j) - gsqrt(ke,i-1,j,
i_uyz)*velx_yz(ke,i-1,j) ) * rcdx(i) &
730 + ( j13g(ke,i,j,
i_xyz)*velx_c(ke,i,j) - j13g(ke-1,i,j,
i_xyz)*velx_c(ke-1,i,j) ) * rfdz(ke-1) &
731 ) * mapf(i,j,1,
i_xy) / gsqrt(ke,i,j,
i_xyz)
736 i = iundef; j = iundef; k = iundef
747 call check( __line__, s31_c(k,i,j) )
748 call check( __line__, velx_c(k+1,i,j) )
749 call check( __line__, velx_c(k-1,i,j) )
750 call check( __line__, fdz(k) )
751 call check( __line__, fdz(k-1) )
753 s31_c(k,i,j) = ( s31_c(k,i,j) &
754 + 0.5_rp * ( velx_c(k+1,i,j) - velx_c(k-1,i,j) ) * j33g / ( fdz(k) + fdz(k-1) ) &
755 ) / gsqrt(k,i,j,
i_xyz)
761 i = iundef; j = iundef; k = iundef
768 call check( __line__, s31_c(ks,i,j) )
769 call check( __line__, velx_c(ks+1,i,j) )
770 call check( __line__, velx_c(ks,i,j) )
771 call check( __line__, rfdz(ks) )
772 call check( __line__, s31_c(ke,i,j) )
773 call check( __line__, velx_c(ke,i,j) )
774 call check( __line__, velx_c(ke-1,i,j) )
775 call check( __line__, rfdz(ke-1) )
777 s31_c(ks,i,j) = ( s31_c(ks,i,j) &
778 + 0.5_rp * ( velx_c(ks+1,i,j) - velx_c(ks,i,j) ) * j33g * rfdz(ks) &
779 ) / gsqrt(ks,i,j,
i_xyz)
780 s31_c(ke,i,j) = ( s31_c(ke,i,j) &
781 + 0.5_rp * ( velx_c(ke,i,j) - velx_c(ke-1,i,j) ) * j33g * rfdz(ke-1) &
782 ) / gsqrt(ke,i,j,
i_xyz)
787 i = iundef; j = iundef; k = iundef
796 call check( __line__, s31_y(k,i,j) )
797 call check( __line__, velx_yz(k+1,i,j) )
798 call check( __line__, velx_yz(k,i,j) )
799 call check( __line__, rfdz(k) )
801 s31_y(k,i,j) = ( s31_y(k,i,j) &
802 + 0.5_rp * ( velx_yz(k+1,i,j) - velx_yz(k,i,j) ) * j33g * rfdz(k) &
803 ) / gsqrt(k,i,j,
i_uyw)
809 i = iundef; j = iundef; k = iundef
820 call check( __line__, velx_c(k,i,j+1) )
821 call check( __line__, velx_c(k,i,j-1) )
822 call check( __line__, gsqrt(k,i,j+1,
i_xyz) )
823 call check( __line__, gsqrt(k,i,j-1,
i_xyz) )
824 call check( __line__, work_z(k,i,j) )
825 call check( __line__, work_z(k-1,i,j) )
826 call check( __line__, j23g(k,i,j,
i_xyw) )
827 call check( __line__, j23g(k-1,i,j,
i_xyw) )
829 s12_c(k,i,j) = 0.5_rp * ( &
830 ( gsqrt(k,i,j+1,
i_xyz)*velx_c(k,i,j+1) - gsqrt(k,i,j-1,
i_xyz)*velx_c(k,i,j-1) ) / ( fdy(j) + fdy(j-1) ) &
831 + ( j23g(k,i,j,
i_xyw)*work_z(k,i,j) - j23g(k-1,i,j,
i_xyw)*work_z(k-1,i,j) ) * rcdz(k) &
832 ) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz)
838 i = iundef; j = iundef; k = iundef
845 call check( __line__, velx_c(ks,i,j+1) )
846 call check( __line__, velx_c(ks,i,j-1) )
847 call check( __line__, gsqrt(ks,i,j+1,
i_xyz) )
848 call check( __line__, gsqrt(ks,i,j-1,
i_xyz) )
849 call check( __line__, velx_c(ks+1,i,j) )
850 call check( __line__, velx_c(ks,i,j) )
851 call check( __line__, j23g(ks+1,i,j,
i_xyz) )
852 call check( __line__, j23g(ks,i,j,
i_xyz) )
853 call check( __line__, gsqrt(ks,i,j,
i_xyz) )
854 call check( __line__, velx_c(ke,i,j+1) )
855 call check( __line__, velx_c(ke,i,j-1) )
856 call check( __line__, gsqrt(ke,i,j+1,
i_xyz) )
857 call check( __line__, gsqrt(ke,i,j-1,
i_xyz) )
858 call check( __line__, velx_c(ke,i,j) )
859 call check( __line__, velx_c(ke-1,i,j) )
860 call check( __line__, j23g(ke,i,j,
i_xyz) )
861 call check( __line__, j23g(ke-1,i,j,
i_xyz) )
862 call check( __line__, gsqrt(ke,i,j,
i_xyz) )
863 call check( __line__, fdy(j) )
864 call check( __line__, fdy(j-1) )
866 s12_c(ks,i,j) = 0.5_rp * ( &
867 ( gsqrt(ks,i,j+1,
i_xyz)*velx_c(ks,i,j+1) - gsqrt(ks,i,j-1,
i_xyz)*velx_c(ks,i,j-1) ) / ( fdy(j) + fdy(j-1) ) &
868 + ( j23g(ks+1,i,j,
i_xyz)*velx_c(ks+1,i,j) - j23g(ks,i,j,
i_xyz)*velx_c(ks,i,j) ) * rfdz(ks) &
869 ) * mapf(i,j,2,
i_xy) / gsqrt(ks,i,j,
i_xyz)
870 s12_c(ke,i,j) = 0.5_rp * ( &
871 ( gsqrt(ke,i,j+1,
i_xyz)*velx_c(ke,i,j+1) - gsqrt(ke,i,j-1,
i_xyz)*velx_c(ke,i,j-1) ) / ( fdy(j) + fdy(j-1) ) &
872 + ( j23g(ke,i,j,
i_xyz)*velx_c(ke,i,j) - j23g(ke-1,i,j,
i_xyz)*velx_c(ke-1,i,j) ) * rfdz(ke-1) &
873 ) * mapf(i,j,2,
i_xy) / gsqrt(ke,i,j,
i_xyz)
878 i = iundef; j = iundef; k = iundef
888 call check( __line__, velx_yz(k,i,j+1) )
889 call check( __line__, velx_yz(k,i,j) )
890 call check( __line__, work_v(k,i,j) )
891 call check( __line__, work_v(k-1,i,j) )
892 call check( __line__, rfdy(j) )
894 s12_z(k,i,j) = 0.5_rp * ( &
895 ( gsqrt(k,i,j+1,
i_uyz)*velx_yz(k,i,j+1) - gsqrt(k,i,j,
i_uyz)*velx_yz(k,i,j) ) * rfdy(j) &
896 + ( work_v(k,i,j) - work_v(k-1,i,j) ) * rcdz(k) &
903 i = iundef; j = iundef; k = iundef
910 call check( __line__, velx_yz(ks,i,j+1) )
911 call check( __line__, velx_yz(ks,i,j) )
912 call check( __line__, velx_yz(ks+1,i,j) )
913 call check( __line__, velx_yz(ks+1,i,j+1) )
914 call check( __line__, j23g(ks+1,i,j,
i_uvz) )
915 call check( __line__, j23g(ks ,i,j,
i_uvz) )
916 call check( __line__, velx_yz(ke,i,j+1) )
917 call check( __line__, velx_yz(ke,i,j) )
918 call check( __line__, velx_yz(ke-1,i,j) )
919 call check( __line__, velx_yz(ke-1,i,j+1) )
920 call check( __line__, j23g(ke ,i,j,
i_uvz) )
921 call check( __line__, j23g(ke-1,i,j,
i_uvz) )
923 s12_z(ks,i,j) = 0.25_rp * ( &
924 ( gsqrt(ks,i,j+1,
i_uyz)*velx_yz(ks,i,j+1) - gsqrt(ks,i,j,
i_uyz)*velx_yz(ks,i,j) ) * rfdy(j) &
925 + ( j23g(ks+1,i,j,
i_uvz) * ( velx_yz(ks+1,i,j) + velx_yz(ks+1,i,j+1) ) &
926 - j23g(ks ,i,j,
i_uvz) * ( velx_yz(ks ,i,j) + velx_yz(ks ,i,j+1) ) ) * rfdz(ks) &
928 s12_z(ke,i,j) = 0.25_rp * ( &
929 ( gsqrt(ke,i,j+1,
i_uyz)*velx_yz(ke,i,j+1) - gsqrt(ke,i,j,
i_uyz)*velx_yz(ke,i,j) ) * rfdy(j) &
930 + ( j23g(ke ,i,j,
i_uvz) * ( velx_yz(ke ,i,j) + velx_yz(ke ,i,j+1) ) &
931 - j23g(ke-1,i,j,
i_uvz) * ( velx_yz(ke-1,i,j) + velx_yz(ke-1,i,j+1) ) ) * rfdz(ke-1) &
937 i = iundef; j = iundef; k = iundef
941 work_z(:,:,:) = undef; work_x(:,:,:) = undef; work_y(:,:,:) = undef; work_v(:,:,:) = undef
951 call check( __line__, vely_c(k+1,i,j) )
952 call check( __line__, vely_c(k,i,j) )
954 work_z(k,i,j) = 0.5_rp * ( vely_c(k+1,i,j) + vely_c(k,i,j) )
960 i = iundef; j = iundef; k = iundef
969 call check( __line__, vely_c(k,i+1,j) )
970 call check( __line__, vely_c(k,i,j) )
972 work_x(k,i,j) = 0.5_rp * ( velz_c(k,i+1,j) + velz_c(k,i,j) )
978 i = iundef; j = iundef; k = iundef
989 call check( __line__, vely_zx(k,i,j) )
990 call check( __line__, vely_zx(k+1,i,j) )
991 call check( __line__, vely_zx(k,i+1,j) )
992 call check( __line__, vely_zx(k+1,i+1,j) )
994 work_v(k,i,j) = 0.25_rp &
995 * ( j13g(k ,i ,j,
i_xvz)*vely_zx(k ,i ,j) &
996 + j13g(k+1,i ,j,
i_xvz)*vely_zx(k+1,i ,j) &
997 + j13g(k ,i+1,j,
i_xvz)*vely_zx(k ,i+1,j) &
998 + j13g(k+1,i+1,j,
i_xvz)*vely_zx(k+1,i+1,j) )
1004 i = iundef; j = iundef; k = iundef
1015 call check( __line__, vely_zx(k,i,j) )
1016 call check( __line__, vely_zx(k,i,j-1) )
1017 call check( __line__, gsqrt(k,i,j,
i_xvz) )
1018 call check( __line__, gsqrt(k,i,j-1,
i_xvz) )
1019 call check( __line__, work_z(k,i,j) )
1020 call check( __line__, work_z(k-1,i,j) )
1021 call check( __line__, j23g(k,i,j,
i_xyw) )
1022 call check( __line__, j23g(k-1,i,j,
i_xyw) )
1023 call check( __line__, rcdy(j) )
1026 ( gsqrt(k,i,j,
i_xvz)*vely_zx(k,i,j) - gsqrt(k,i,j-1,
i_xvz)*vely_zx(k,i,j-1) ) * rcdy(j) &
1027 + ( j23g(k,i,j,
i_xyw)*work_z(k,i,j) - j23g(k-1,i,j,
i_xyw)*work_z(k-1,i,j) ) * rcdz(k) &
1028 ) * mapf(i,j,2,
i_xy) / gsqrt(k,i,j,
i_xyz)
1034 i = iundef; j = iundef; k = iundef
1041 call check( __line__, vely_zx(ks,i,j) )
1042 call check( __line__, vely_zx(ks,i,j-1) )
1043 call check( __line__, gsqrt(ks,i,j,
i_xvz) )
1044 call check( __line__, gsqrt(ks,i,j-1,
i_xvz) )
1045 call check( __line__, vely_c(ks+1,i,j) )
1046 call check( __line__, vely_c(ks,i,j) )
1047 call check( __line__, j23g(ks+1,i,j,
i_xyz) )
1048 call check( __line__, j23g(ks,i,j,
i_xyz) )
1049 call check( __line__, rcdy(j) )
1050 call check( __line__, vely_zx(ke,i,j) )
1051 call check( __line__, vely_zx(ke,i,j-1) )
1052 call check( __line__, gsqrt(ke,i,j,
i_xvz) )
1053 call check( __line__, gsqrt(ke,i,j-1,
i_xvz) )
1054 call check( __line__, vely_c(ke,i,j) )
1055 call check( __line__, vely_c(ke-1,i,j) )
1056 call check( __line__, j23g(ke,i,j,
i_xyz) )
1057 call check( __line__, j23g(ke-1,i,j,
i_xyz) )
1060 ( gsqrt(ks,i,j,
i_xvz)*vely_zx(ks,i,j) - gsqrt(ks,i,j-1,
i_xvz)*vely_zx(ks,i,j-1) ) * rcdy(j) &
1061 + ( j23g(ks+1,i,j,
i_xyz)*vely_c(ks+1,i,j) - j23g(ks,i,j,
i_xyz)*vely_c(ks,i,j) ) * rfdz(ks) &
1062 ) * mapf(i,j,2,
i_xy) / gsqrt(ks,i,j,
i_xyz)
1064 ( gsqrt(ke,i,j,
i_xvz)*vely_zx(ke,i,j) - gsqrt(ke,i,j-1,
i_xvz)*vely_zx(ke,i,j-1) ) * rcdy(j) &
1065 + ( j23g(ke,i,j,
i_xyz)*vely_c(ke,i,j) - j23g(ke-1,i,j,
i_xyz)*vely_c(ke-1,i,j) ) * rfdz(ke-1) &
1066 ) * mapf(i,j,2,
i_xy) / gsqrt(ke,i,j,
i_xyz)
1071 i = iundef; j = iundef; k = iundef
1082 call check( __line__, s12_c(k,i,j) )
1083 call check( __line__, vely_c(k,i+1,j) )
1084 call check( __line__, vely_c(k,i-1,j) )
1085 call check( __line__, gsqrt(k,i+1,j,
i_xyz) )
1086 call check( __line__, gsqrt(k,i-1,j,
i_xyz) )
1087 call check( __line__, work_z(k,i,j) )
1088 call check( __line__, work_z(k-1,i,j) )
1089 call check( __line__, j13g(k,i,j,
i_xyw) )
1090 call check( __line__, j13g(k-1,i,j,
i_xyw) )
1091 call check( __line__, gsqrt(k,i,j,
i_xyz) )
1092 call check( __line__, fdx(i) )
1093 call check( __line__, fdx(i-1) )
1095 s12_c(k,i,j) = ( s12_c(k,i,j) &
1097 ( gsqrt(k,i+1,j,
i_xyz)*vely_c(k,i+1,j) - gsqrt(k,i-1,j,
i_xyz)*vely_c(k,i-1,j) ) / ( fdx(i) + fdx(i-1) ) &
1098 + ( j13g(k,i,j,
i_xyw)*work_z(k,i,j) - j13g(k-1,i,j,
i_xyw)*work_z(k-1,i,j) ) * rcdz(k) ) * mapf(i,j,1,
i_xy) &
1099 ) / gsqrt(k,i,j,
i_xyz)
1105 i = iundef; j = iundef; k = iundef
1112 call check( __line__, s12_c(ks,i,j) )
1113 call check( __line__, vely_c(ks,i+1,j) )
1114 call check( __line__, vely_c(ks,i-1,j) )
1115 call check( __line__, gsqrt(ks,i+1,j,
i_xyz) )
1116 call check( __line__, gsqrt(ks,i-1,j,
i_xyz) )
1117 call check( __line__, vely_c(ks+1,i,j) )
1118 call check( __line__, vely_c(ks,i,j) )
1119 call check( __line__, j13g(ks+1,i,j,
i_xyz) )
1120 call check( __line__, j13g(ks,i,j,
i_xyz) )
1121 call check( __line__, gsqrt(ks,i,j,
i_xyz) )
1122 call check( __line__, s12_c(ke,i,j) )
1123 call check( __line__, vely_c(ke,i+1,j) )
1124 call check( __line__, vely_c(ke,i-1,j) )
1125 call check( __line__, gsqrt(ke,i+1,j,
i_xyz) )
1126 call check( __line__, gsqrt(ke,i-1,j,
i_xyz) )
1127 call check( __line__, vely_c(ke,i,j) )
1128 call check( __line__, vely_c(ke-1,i,j) )
1129 call check( __line__, j13g(ke,i,j,
i_xyz) )
1130 call check( __line__, j13g(ke-1,i,j,
i_xyz) )
1131 call check( __line__, gsqrt(ke,i,j,
i_xyz) )
1132 call check( __line__, fdx(i) )
1133 call check( __line__, fdx(i-1) )
1135 s12_c(ks,i,j) = ( s12_c(ks,i,j) &
1137 ( gsqrt(ks,i+1,j,
i_xyz)*vely_c(ks,i+1,j) - gsqrt(ks,i-1,j,
i_xyz)*vely_c(ks,i-1,j) ) / ( fdx(i) + fdx(i-1) ) &
1138 + ( j13g(ks+1,i,j,
i_xyz)*vely_c(ks+1,i,j) - j13g(ks,i,j,
i_xyz)*vely_c(ks,i,j) ) * rfdz(ks) ) &
1139 * mapf(i,j,1,
i_xy) &
1140 ) / gsqrt(ks,i,j,
i_xyz)
1141 s12_c(ke,i,j) = ( s12_c(ke,i,j) &
1143 ( gsqrt(ke,i+1,j,
i_xyz)*vely_c(ke,i+1,j) - gsqrt(ke,i-1,j,
i_xyz)*vely_c(ke,i-1,j) ) / ( fdx(i) + fdx(i-1) ) &
1144 + ( j13g(ke,i,j,
i_xyz)*vely_c(ke,i,j) - j13g(ke-1,i,j,
i_xyz)*vely_c(ke-1,i,j) ) * rfdz(ke-1) ) &
1145 * mapf(i,j,1,
i_xy) &
1146 ) / gsqrt(ke,i,j,
i_xyz)
1151 i = iundef; j = iundef; k = iundef
1160 call check( __line__, s12_z(k,i,j) )
1161 call check( __line__, vely_zx(k,i+1,j) )
1162 call check( __line__, vely_zx(k,i,j) )
1163 call check( __line__, work_v(k,i,j) )
1164 call check( __line__, work_v(k-1,i,j) )
1165 call check( __line__, rfdx(i) )
1167 s12_z(k,i,j) = ( s12_z(k,i,j) &
1169 ( gsqrt(k,i+1,j,
i_xvz)*vely_zx(k,i+1,j) - gsqrt(k,i,j,
i_xvz)*vely_zx(k,i,j) ) * rfdx(i) &
1170 + ( work_v(k,i,j) - work_v(k-1,i,j) ) * rcdz(k) ) * mapf(i,j,1,
i_uv) &
1171 ) / gsqrt(k,i,j,
i_uvz)
1177 i = iundef; j = iundef; k = iundef
1184 call check( __line__, s12_z(ks,i,j) )
1185 call check( __line__, vely_zx(ks,i+1,j) )
1186 call check( __line__, vely_zx(ks,i,j) )
1187 call check( __line__, vely_zx(ks+1,i,j) )
1188 call check( __line__, vely_zx(ks+1,i+1,j) )
1189 call check( __line__, s12_z(ke,i,j) )
1190 call check( __line__, vely_zx(ke,i+1,j) )
1191 call check( __line__, vely_zx(ke,i,j) )
1192 call check( __line__, vely_zx(ke-1,i,j) )
1193 call check( __line__, vely_zx(ke-1,i+1,j) )
1194 call check( __line__, rfdx(i) )
1196 s12_z(ks,i,j) = ( s12_z(ks,i,j) &
1198 ( gsqrt(ks,i+1,j,
i_xvz)*vely_zx(ks,i+1,j) - gsqrt(ks,i,j,
i_xvz)*vely_zx(ks,i,j) ) * rfdx(i) &
1199 + ( j13g(ks+1,i,j,
i_uvz) * ( vely_zx(ks+1,i,j) + vely_zx(ks+1,i+1,j) ) &
1200 - j13g(ks ,i,j,
i_uvz) * ( vely_zx(ks ,i,j) + vely_zx(ks ,i+1,j) ) ) * rfdz(ks) ) * mapf(i,j,1,
i_uv) &
1201 ) / gsqrt(ks,i,j,
i_uvz)
1202 s12_z(ke,i,j) = ( s12_z(ke,i,j) &
1204 ( gsqrt(ke,i+1,j,
i_xvz)*vely_zx(ke,i+1,j) - gsqrt(ke,i,j,
i_xvz)*vely_zx(ke,i,j) ) * rfdx(i) &
1205 + ( j13g(ke ,i,j,
i_uvz) * ( vely_zx(ke ,i,j) + vely_zx(ke ,i+1,j) ) &
1206 - j13g(ke-1,i,j,
i_uvz) * ( vely_zx(ke-1,i,j) + vely_zx(ke-1,i+1,j) ) ) * rfdz(ke-1) ) * mapf(i,j,1,
i_uv) &
1207 ) / gsqrt(ke,i,j,
i_uvz)
1212 i = iundef; j = iundef; k = iundef
1223 call check( __line__, s23_c(k,i,j) )
1224 call check( __line__, vely_c(k+1,i,j) )
1225 call check( __line__, vely_c(k-1,i,j) )
1226 call check( __line__, fdz(k) )
1227 call check( __line__, fdz(k-1) )
1229 s23_c(k,i,j) = ( s23_c(k,i,j) &
1230 + 0.5_rp * ( vely_c(k+1,i,j) - vely_c(k-1,i,j) ) * j33g / ( fdz(k) + fdz(k-1) ) &
1231 ) / gsqrt(k,i,j,
i_xyz)
1237 i = iundef; j = iundef; k = iundef
1244 call check( __line__, s23_c(ks,i,j) )
1245 call check( __line__, vely_c(ks+1,i,j) )
1246 call check( __line__, vely_c(ks,i,j) )
1247 call check( __line__, rfdz(ks) )
1248 call check( __line__, s23_c(ke,i,j) )
1249 call check( __line__, vely_c(ke,i,j) )
1250 call check( __line__, vely_c(ke-1,i,j) )
1251 call check( __line__, rfdz(ke-1) )
1253 s23_c(ks,i,j) = ( s23_c(ks,i,j) &
1254 + 0.5_rp * ( vely_c(ks+1,i,j) - vely_c(ks,i,j) ) * j33g * rfdz(ks) &
1255 ) / gsqrt(ks,i,j,
i_xyz)
1256 s23_c(ke,i,j) = ( s23_c(ke,i,j) &
1257 + 0.5_rp * ( vely_c(ke,i,j) - vely_c(ke-1,i,j) ) * j33g * rfdz(ke-1) &
1258 ) / gsqrt(ke,i,j,
i_xyz)
1263 i = iundef; j = iundef; k = iundef
1273 call check( __line__, s23_x(k,i,j) )
1274 call check( __line__, vely_zx(k+1,i,j) )
1275 call check( __line__, vely_zx(k,i,j) )
1276 call check( __line__, rfdz(k) )
1278 s23_x(k,i,j) = ( s23_x(k,i,j) &
1279 + 0.5_rp * ( vely_zx(k+1,i,j) - vely_zx(k,i,j) ) * j33g * rfdz(k) &
1280 ) / gsqrt(k,i,j,
i_xvw)
1286 i = iundef; j = iundef; k = iundef
1292 work_z(:,:,:) = undef; work_x(:,:,:) = undef; work_y(:,:,:) = undef
1303 call check( __line__, s11_c(k,i,j) )
1304 call check( __line__, s22_c(k,i,j) )
1305 call check( __line__, s33_c(k,i,j) )
1306 call check( __line__, s31_c(k,i,j) )
1307 call check( __line__, s12_c(k,i,j) )
1308 call check( __line__, s23_c(k,i,j) )
1310 s2(k,i,j) = 2.0_rp * ( s11_c(k,i,j)**2 + s22_c(k,i,j)**2 + s33_c(k,i,j)**2 ) &
1311 + 4.0_rp * ( s31_c(k,i,j)**2 + s12_c(k,i,j)**2 + s23_c(k,i,j)**2 )
1317 i = iundef; j = iundef; k = iundef