23 use mom_coms, only : pe_here, root_pe, num_pes, sum_across_pes
24 use mom_coms, only : min_across_pes, max_across_pes
30 implicit none ;
private 91 subroutine chksum_pair_h_2d(mesg, arrayA, arrayB, HI, haloshift, omit_corners, scale)
92 character(len=*),
intent(in) :: mesg
94 real,
dimension(HI%isd:,HI%jsd:),
intent(in) :: arrayA, arrayB
95 integer,
optional,
intent(in) :: haloshift
96 logical,
optional,
intent(in) :: omit_corners
97 real,
optional,
intent(in) :: scale
99 if (
present(haloshift))
then 100 call chksum_h_2d(arraya,
'x '//mesg, hi, haloshift, omit_corners, scale=scale)
101 call chksum_h_2d(arrayb,
'y '//mesg, hi, haloshift, omit_corners, scale=scale)
103 call chksum_h_2d(arraya,
'x '//mesg, hi, scale=scale)
104 call chksum_h_2d(arrayb,
'y '//mesg, hi, scale=scale)
109 subroutine chksum_pair_h_3d(mesg, arrayA, arrayB, HI, haloshift, omit_corners, scale)
110 character(len=*),
intent(in) :: mesg
112 real,
dimension(HI%isd:,HI%jsd:, :),
intent(in) :: arrayA, arrayB
113 integer,
optional,
intent(in) :: haloshift
114 logical,
optional,
intent(in) :: omit_corners
115 real,
optional,
intent(in) :: scale
117 if (
present(haloshift))
then 118 call chksum_h_3d(arraya,
'x '//mesg, hi, haloshift, omit_corners, scale=scale)
119 call chksum_h_3d(arrayb,
'y '//mesg, hi, haloshift, omit_corners, scale=scale)
121 call chksum_h_3d(arraya,
'x '//mesg, hi, scale=scale)
122 call chksum_h_3d(arrayb,
'y '//mesg, hi, scale=scale)
128 subroutine chksum_h_2d(array, mesg, HI, haloshift, omit_corners, scale)
130 real,
dimension(HI%isd:,HI%jsd:),
intent(in) :: array
131 character(len=*),
intent(in) :: mesg
132 integer,
optional,
intent(in) :: haloshift
133 logical,
optional,
intent(in) :: omit_corners
134 real,
optional,
intent(in) :: scale
137 integer :: bc0, bcSW, bcSE, bcNW, bcNE, hshift
138 integer :: bcN, bcS, bcE, bcW
139 logical :: do_corners
142 if (
is_nan(array(hi%isc:hi%iec,hi%jsc:hi%jec))) &
147 scaling = 1.0 ;
if (
present(scale)) scaling = scale
154 if (
present(haloshift)) hshift = haloshift
155 if (hshift<0) hshift = hi%ied-hi%iec
157 if ( hi%isc-hshift<hi%isd .or. hi%iec+hshift>hi%ied .or. &
158 hi%jsc-hshift<hi%jsd .or. hi%jec+hshift>hi%jed )
then 159 write(0,*)
'chksum_h_2d: haloshift =',hshift
160 write(0,*)
'chksum_h_2d: isd,isc,iec,ied=',hi%isd,hi%isc,hi%iec,hi%ied
161 write(0,*)
'chksum_h_2d: jsd,jsc,jec,jed=',hi%jsd,hi%jsc,hi%jec,hi%jed
162 call chksum_error(fatal,
'Error in chksum_h_2d '//trim(mesg))
165 bc0 =
subchk(array, hi, 0, 0, scaling)
172 do_corners = .true. ;
if (
present(omit_corners)) do_corners = .not.omit_corners
175 bcsw =
subchk(array, hi, -hshift, -hshift, scaling)
176 bcse =
subchk(array, hi, hshift, -hshift, scaling)
177 bcnw =
subchk(array, hi, -hshift, hshift, scaling)
178 bcne =
subchk(array, hi, hshift, hshift, scaling)
182 bcs =
subchk(array, hi, 0, -hshift, scaling)
183 bce =
subchk(array, hi, hshift, 0, scaling)
184 bcw =
subchk(array, hi, -hshift, 0, scaling)
185 bcn =
subchk(array, hi, 0, hshift, scaling)
192 integer function subchk(array, HI, di, dj, scale)
194 real,
dimension(HI%isd:,HI%jsd:),
intent(in) :: array
195 integer,
intent(in) :: di, dj
196 real,
intent(in) :: scale
197 integer :: bitcount, i, j, bc
199 do j=hi%jsc+dj,hi%jec+dj;
do i=hi%isc+di,hi%iec+di
200 bc = bitcount(abs(scale*array(i,j)))
203 call sum_across_pes(
subchk)
207 subroutine substats(HI, array, mesg, scale)
209 real,
dimension(HI%isd:,HI%jsd:),
intent(in) :: array
210 character(len=*),
intent(in) :: mesg
211 real,
intent(in) :: scale
213 real :: aMean, aMin, aMax
215 amin = array(hi%isc,hi%jsc)
216 amax = array(hi%isc,hi%jsc)
218 do j=hi%jsc,hi%jec ;
do i=hi%isc,hi%iec
219 amin = min(amin, array(i,j))
220 amax = max(amax, array(i,j))
224 call sum_across_pes(n)
225 call min_across_pes(amin)
226 call max_across_pes(amax)
227 amean = amean /
real(n)
235 subroutine chksum_pair_b_2d(mesg, arrayA, arrayB, HI, haloshift, symmetric, omit_corners, scale)
236 character(len=*),
intent(in) :: mesg
237 type(hor_index_type),
intent(in) :: HI
238 real,
dimension(HI%isd:,HI%jsd:),
intent(in) :: arrayA, arrayB
239 logical,
optional,
intent(in) :: symmetric
240 integer,
optional,
intent(in) :: haloshift
241 logical,
optional,
intent(in) :: omit_corners
242 real,
optional,
intent(in) :: scale
246 sym = .false. ;
if (
present(symmetric)) sym = symmetric
248 if (
present(haloshift))
then 249 call chksum_b_2d(arraya,
'x '//mesg, hi, haloshift, symmetric=sym, &
250 omit_corners=omit_corners, scale=scale)
251 call chksum_b_2d(arrayb,
'y '//mesg, hi, haloshift, symmetric=sym, &
252 omit_corners=omit_corners, scale=scale)
254 call chksum_b_2d(arraya,
'x '//mesg, hi, symmetric=sym, scale=scale)
255 call chksum_b_2d(arrayb,
'y '//mesg, hi, symmetric=sym, scale=scale)
260 subroutine chksum_pair_b_3d(mesg, arrayA, arrayB, HI, haloshift, symmetric, omit_corners, scale)
261 character(len=*),
intent(in) :: mesg
262 type(hor_index_type),
intent(in) :: HI
263 real,
dimension(HI%IsdB:,HI%JsdB:, :),
intent(in) :: arrayA, arrayB
264 integer,
optional,
intent(in) :: haloshift
265 logical,
optional,
intent(in) :: symmetric
266 logical,
optional,
intent(in) :: omit_corners
267 real,
optional,
intent(in) :: scale
271 if (
present(haloshift))
then 272 call chksum_b_3d(arraya,
'x '//mesg, hi, haloshift, symmetric, &
273 omit_corners, scale=scale)
274 call chksum_b_3d(arrayb,
'y '//mesg, hi, haloshift, symmetric, &
275 omit_corners, scale=scale)
277 call chksum_b_3d(arraya,
'x '//mesg, hi, symmetric=symmetric, scale=scale)
278 call chksum_b_3d(arrayb,
'y '//mesg, hi, symmetric=symmetric, scale=scale)
284 subroutine chksum_b_2d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
285 type(hor_index_type),
intent(in) :: HI
286 real,
dimension(HI%IsdB:,HI%JsdB:), &
288 character(len=*),
intent(in) :: mesg
289 integer,
optional,
intent(in) :: haloshift
290 logical,
optional,
intent(in) :: symmetric
292 logical,
optional,
intent(in) :: omit_corners
293 real,
optional,
intent(in) :: scale
296 integer :: bc0, bcSW, bcSE, bcNW, bcNE, hshift
297 integer :: bcN, bcS, bcE, bcW
298 logical :: do_corners, sym, sym_stats
301 if (
is_nan(array(hi%IscB:hi%IecB,hi%JscB:hi%JecB))) &
306 scaling = 1.0 ;
if (
present(scale)) scaling = scale
308 sym_stats = .false. ;
if (
present(symmetric)) sym_stats = symmetric
309 if (
present(haloshift))
then ;
if (haloshift > 0) sym_stats = .true. ;
endif 315 if (
present(haloshift)) hshift = haloshift
316 if (hshift<0) hshift = hi%ied-hi%iec
318 if ( hi%iscB-hshift<hi%isdB .or. hi%iecB+hshift>hi%iedB .or. &
319 hi%jscB-hshift<hi%jsdB .or. hi%jecB+hshift>hi%jedB )
then 320 write(0,*)
'chksum_B_2d: haloshift =',hshift
321 write(0,*)
'chksum_B_2d: isd,isc,iec,ied=',hi%isdB,hi%iscB,hi%iecB,hi%iedB
322 write(0,*)
'chksum_B_2d: jsd,jsc,jec,jed=',hi%jsdB,hi%jscB,hi%jecB,hi%jedB
323 call chksum_error(fatal,
'Error in chksum_B_2d '//trim(mesg))
326 bc0 =
subchk(array, hi, 0, 0, scaling)
328 sym = .false. ;
if (
present(symmetric)) sym = symmetric
330 if ((hshift==0) .and. .not.sym)
then 331 if (is_root_pe())
call chk_sum_msg(
"B-point:",bc0,mesg)
335 do_corners = .true. ;
if (
present(omit_corners)) do_corners = .not.omit_corners
339 bcsw =
subchk(array, hi, -hshift-1, -hshift-1, scaling)
340 bcse =
subchk(array, hi, hshift, -hshift-1, scaling)
341 bcnw =
subchk(array, hi, -hshift-1, hshift, scaling)
343 bcsw =
subchk(array, hi, -hshift, -hshift, scaling)
344 bcse =
subchk(array, hi, hshift, -hshift, scaling)
345 bcnw =
subchk(array, hi, -hshift, hshift, scaling)
347 bcne =
subchk(array, hi, hshift, hshift, scaling)
349 if (is_root_pe())
call chk_sum_msg(
"B-point:",bc0,bcsw,bcse,bcnw,bcne,mesg)
351 bcs =
subchk(array, hi, 0, -hshift, scaling)
352 bce =
subchk(array, hi, hshift, 0, scaling)
353 bcw =
subchk(array, hi, -hshift, 0, scaling)
354 bcn =
subchk(array, hi, 0, hshift, scaling)
356 if (is_root_pe())
call chk_sum_msg_nsew(
"B-point:",bc0,bcn,bcs,bce,bcw,mesg)
361 integer function subchk(array, HI, di, dj, scale)
362 type(hor_index_type),
intent(in) :: HI
363 real,
dimension(HI%IsdB:,HI%JsdB:),
intent(in) :: array
364 integer,
intent(in) :: di, dj
365 real,
intent(in) :: scale
366 integer :: bitcount, i, j, bc
369 do j=hi%jsc+dj,hi%jec+dj;
do i=hi%isc+di,hi%iec+di
370 bc = bitcount(abs(scale*array(i,j)))
373 call sum_across_pes(
subchk)
377 subroutine substats(HI, array, mesg, sym_stats, scale)
378 type(hor_index_type),
intent(in) :: HI
379 real,
dimension(HI%IsdB:,HI%JsdB:),
intent(in) :: array
380 character(len=*),
intent(in) :: mesg
381 logical,
intent(in) :: sym_stats
382 real,
intent(in) :: scale
383 integer :: i, j, n, IsB, JsB
384 real :: aMean, aMin, aMax
386 isb = hi%isc ;
if (sym_stats) isb = hi%isc-1
387 jsb = hi%jsc ;
if (sym_stats) jsb = hi%jsc-1
389 amin = array(hi%isc,hi%jsc) ; amax = amin
390 do j=jsb,hi%JecB ;
do i=isb,hi%IecB
391 amin = min(amin, array(i,j))
392 amax = max(amax, array(i,j))
395 amean = reproducing_sum(array(hi%isc:hi%iec,hi%jsc:hi%jec))
396 n = (1 + hi%jec - hi%jsc) * (1 + hi%iec - hi%isc)
397 call sum_across_pes(n)
398 call min_across_pes(amin)
399 call max_across_pes(amax)
400 amean = amean /
real(n)
401 if (is_root_pe())
call chk_sum_msg(
"B-point:",amean*scale,amin*scale,amax*scale,mesg)
408 subroutine chksum_uv_2d(mesg, arrayU, arrayV, HI, haloshift, symmetric, omit_corners, scale)
409 character(len=*),
intent(in) :: mesg
410 type(hor_index_type),
intent(in) :: HI
411 real,
dimension(HI%IsdB:,HI%jsd:),
intent(in) :: arrayU
412 real,
dimension(HI%isd:,HI%JsdB:),
intent(in) :: arrayV
413 integer,
optional,
intent(in) :: haloshift
414 logical,
optional,
intent(in) :: symmetric
415 logical,
optional,
intent(in) :: omit_corners
416 real,
optional,
intent(in) :: scale
418 if (
present(haloshift))
then 419 call chksum_u_2d(arrayu,
'u '//mesg, hi, haloshift, symmetric, omit_corners, scale)
420 call chksum_v_2d(arrayv,
'v '//mesg, hi, haloshift, symmetric, omit_corners, scale)
422 call chksum_u_2d(arrayu,
'u '//mesg, hi, symmetric=symmetric)
423 call chksum_v_2d(arrayv,
'v '//mesg, hi, symmetric=symmetric)
428 subroutine chksum_uv_3d(mesg, arrayU, arrayV, HI, haloshift, symmetric, omit_corners, scale)
429 character(len=*),
intent(in) :: mesg
430 type(hor_index_type),
intent(in) :: HI
431 real,
dimension(HI%IsdB:,HI%jsd:,:),
intent(in) :: arrayU
432 real,
dimension(HI%isd:,HI%JsdB:,:),
intent(in) :: arrayV
433 integer,
optional,
intent(in) :: haloshift
434 logical,
optional,
intent(in) :: symmetric
435 logical,
optional,
intent(in) :: omit_corners
436 real,
optional,
intent(in) :: scale
438 if (
present(haloshift))
then 439 call chksum_u_3d(arrayu,
'u '//mesg, hi, haloshift, symmetric, omit_corners, scale)
440 call chksum_v_3d(arrayv,
'v '//mesg, hi, haloshift, symmetric, omit_corners, scale)
442 call chksum_u_3d(arrayu,
'u '//mesg, hi, symmetric=symmetric)
443 call chksum_v_3d(arrayv,
'v '//mesg, hi, symmetric=symmetric)
449 subroutine chksum_u_2d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
450 type(hor_index_type),
intent(in) :: HI
451 real,
dimension(HI%IsdB:,HI%jsd:),
intent(in) :: array
452 character(len=*),
intent(in) :: mesg
453 integer,
optional,
intent(in) :: haloshift
454 logical,
optional,
intent(in) :: symmetric
455 logical,
optional,
intent(in) :: omit_corners
456 real,
optional,
intent(in) :: scale
459 integer :: bc0, bcSW, bcSE, bcNW, bcNE, hshift
460 integer :: bcN, bcS, bcE, bcW
461 logical :: do_corners, sym, sym_stats
464 if (
is_nan(array(hi%IscB:hi%IecB,hi%jsc:hi%jec))) &
469 scaling = 1.0 ;
if (
present(scale)) scaling = scale
471 sym_stats = .false. ;
if (
present(symmetric)) sym_stats = symmetric
472 if (
present(haloshift))
then ;
if (haloshift > 0) sym_stats = .true. ;
endif 478 if (
present(haloshift)) hshift = haloshift
479 if (hshift<0) hshift = hi%iedB-hi%iecB
481 if ( hi%iscB-hshift<hi%isdB .or. hi%iecB+hshift>hi%iedB .or. &
482 hi%jsc-hshift<hi%jsd .or. hi%jec+hshift>hi%jed )
then 483 write(0,*)
'chksum_u_2d: haloshift =',hshift
484 write(0,*)
'chksum_u_2d: isd,isc,iec,ied=',hi%isdB,hi%iscB,hi%iecB,hi%iedB
485 write(0,*)
'chksum_u_2d: jsd,jsc,jec,jed=',hi%jsd,hi%jsc,hi%jec,hi%jed
486 call chksum_error(fatal,
'Error in chksum_u_2d '//trim(mesg))
489 bc0 =
subchk(array, hi, 0, 0, scaling)
491 sym = .false. ;
if (
present(symmetric)) sym = symmetric
493 if ((hshift==0) .and. .not.sym)
then 494 if (is_root_pe())
call chk_sum_msg(
"u-point:",bc0,mesg)
498 do_corners = .true. ;
if (
present(omit_corners)) do_corners = .not.omit_corners
501 bcw =
subchk(array, hi, -hshift-1, 0, scaling)
502 if (is_root_pe())
call chk_sum_msg_w(
"u-point:",bc0,bcw,mesg)
503 elseif (do_corners)
then 505 bcsw =
subchk(array, hi, -hshift-1, -hshift, scaling)
506 bcnw =
subchk(array, hi, -hshift-1, hshift, scaling)
508 bcsw =
subchk(array, hi, -hshift, -hshift, scaling)
509 bcnw =
subchk(array, hi, -hshift, hshift, scaling)
511 bcse =
subchk(array, hi, hshift, -hshift, scaling)
512 bcne =
subchk(array, hi, hshift, hshift, scaling)
514 if (is_root_pe())
call chk_sum_msg(
"u-point:",bc0,bcsw,bcse,bcnw,bcne,mesg)
516 bcs =
subchk(array, hi, 0, -hshift, scaling)
517 bce =
subchk(array, hi, hshift, 0, scaling)
519 bcw =
subchk(array, hi, -hshift-1, 0, scaling)
521 bcw =
subchk(array, hi, -hshift, 0, scaling)
523 bcn =
subchk(array, hi, 0, hshift, scaling)
525 if (is_root_pe())
call chk_sum_msg_nsew(
"u-point:",bc0,bcn,bcs,bce,bcw,mesg)
530 integer function subchk(array, HI, di, dj, scale)
531 type(hor_index_type),
intent(in) :: HI
532 real,
dimension(HI%IsdB:,HI%jsd:),
intent(in) :: array
533 integer,
intent(in) :: di, dj
534 real,
intent(in) :: scale
535 integer :: bitcount, i, j, bc
538 do j=hi%jsc+dj,hi%jec+dj;
do i=hi%isc+di,hi%iec+di
539 bc = bitcount(abs(scale*array(i,j)))
542 call sum_across_pes(
subchk)
546 subroutine substats(HI, array, mesg, sym_stats, scale)
547 type(hor_index_type),
intent(in) :: HI
548 real,
dimension(HI%IsdB:,HI%jsd:),
intent(in) :: array
549 character(len=*),
intent(in) :: mesg
550 logical,
intent(in) :: sym_stats
551 real,
intent(in) :: scale
552 integer :: i, j, n, IsB
553 real :: aMean, aMin, aMax
555 isb = hi%isc ;
if (sym_stats) isb = hi%isc-1
557 amin = array(hi%isc,hi%jsc) ; amax = amin
558 do j=hi%jsc,hi%jec ;
do i=isb,hi%IecB
559 amin = min(amin, array(i,j))
560 amax = max(amax, array(i,j))
563 amean = reproducing_sum(array(hi%isc:hi%iec,hi%jsc:hi%jec))
564 n = (1 + hi%jec - hi%jsc) * (1 + hi%iec - hi%isc)
565 call sum_across_pes(n)
566 call min_across_pes(amin)
567 call max_across_pes(amax)
568 amean = amean /
real(n)
569 if (is_root_pe())
call chk_sum_msg(
"u-point:",amean*scale,amin*scale,amax*scale,mesg)
577 subroutine chksum_v_2d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
578 type(hor_index_type),
intent(in) :: HI
579 real,
dimension(HI%isd:,HI%JsdB:),
intent(in) :: array
580 character(len=*),
intent(in) :: mesg
581 integer,
optional,
intent(in) :: haloshift
582 logical,
optional,
intent(in) :: symmetric
583 logical,
optional,
intent(in) :: omit_corners
584 real,
optional,
intent(in) :: scale
587 integer :: bc0, bcSW, bcSE, bcNW, bcNE, hshift
588 integer :: bcN, bcS, bcE, bcW
589 logical :: do_corners, sym, sym_stats
592 if (
is_nan(array(hi%isc:hi%iec,hi%JscB:hi%JecB))) &
597 scaling = 1.0 ;
if (
present(scale)) scaling = scale
599 sym_stats = .false. ;
if (
present(symmetric)) sym_stats = symmetric
600 if (
present(haloshift))
then ;
if (haloshift > 0) sym_stats = .true. ;
endif 606 if (
present(haloshift)) hshift = haloshift
607 if (hshift<0) hshift = hi%ied-hi%iec
609 if ( hi%isc-hshift<hi%isd .or. hi%iec+hshift>hi%ied .or. &
610 hi%jscB-hshift<hi%jsdB .or. hi%jecB+hshift>hi%jedB )
then 611 write(0,*)
'chksum_v_2d: haloshift =',hshift
612 write(0,*)
'chksum_v_2d: isd,isc,iec,ied=',hi%isd,hi%isc,hi%iec,hi%ied
613 write(0,*)
'chksum_v_2d: jsd,jsc,jec,jed=',hi%jsdB,hi%jscB,hi%jecB,hi%jedB
614 call chksum_error(fatal,
'Error in chksum_v_2d '//trim(mesg))
617 bc0 =
subchk(array, hi, 0, 0, scaling)
619 sym = .false. ;
if (
present(symmetric)) sym = symmetric
621 if ((hshift==0) .and. .not.sym)
then 622 if (is_root_pe())
call chk_sum_msg(
"v-point:",bc0,mesg)
626 do_corners = .true. ;
if (
present(omit_corners)) do_corners = .not.omit_corners
629 bcs =
subchk(array, hi, 0, -hshift-1, scaling)
630 if (is_root_pe())
call chk_sum_msg_s(
"v-point:",bc0,bcs,mesg)
631 elseif (do_corners)
then 633 bcsw =
subchk(array, hi, -hshift, -hshift-1, scaling)
634 bcse =
subchk(array, hi, hshift, -hshift-1, scaling)
636 bcsw =
subchk(array, hi, -hshift, -hshift, scaling)
637 bcse =
subchk(array, hi, hshift, -hshift, scaling)
639 bcnw =
subchk(array, hi, -hshift, hshift, scaling)
640 bcne =
subchk(array, hi, hshift, hshift, scaling)
642 if (is_root_pe())
call chk_sum_msg(
"v-point:",bc0,bcsw,bcse,bcnw,bcne,mesg)
645 bcs =
subchk(array, hi, 0, -hshift-1, scaling)
647 bcs =
subchk(array, hi, 0, -hshift, scaling)
649 bce =
subchk(array, hi, hshift, 0, scaling)
650 bcw =
subchk(array, hi, -hshift, 0, scaling)
651 bcn =
subchk(array, hi, 0, hshift, scaling)
653 if (is_root_pe())
call chk_sum_msg_nsew(
"v-point:",bc0,bcn,bcs,bce,bcw,mesg)
658 integer function subchk(array, HI, di, dj, scale)
659 type(hor_index_type),
intent(in) :: HI
660 real,
dimension(HI%isd:,HI%JsdB:),
intent(in) :: array
661 integer,
intent(in) :: di, dj
662 real,
intent(in) :: scale
663 integer :: bitcount, i, j, bc
666 do j=hi%jsc+dj,hi%jec+dj;
do i=hi%isc+di,hi%iec+di
667 bc = bitcount(abs(scale*array(i,j)))
670 call sum_across_pes(
subchk)
674 subroutine substats(HI, array, mesg, sym_stats, scale)
675 type(hor_index_type),
intent(in) :: HI
676 real,
dimension(HI%isd:,HI%JsdB:),
intent(in) :: array
677 character(len=*),
intent(in) :: mesg
678 logical,
intent(in) :: sym_stats
679 real,
intent(in) :: scale
680 integer :: i, j, n, JsB
681 real :: aMean, aMin, aMax
683 jsb = hi%jsc ;
if (sym_stats) jsb = hi%jsc-1
685 amin = array(hi%isc,hi%jsc) ; amax = amin
686 do j=jsb,hi%JecB ;
do i=hi%isc,hi%iec
687 amin = min(amin, array(i,j))
688 amax = max(amax, array(i,j))
691 amean = reproducing_sum(array(hi%isc:hi%iec,hi%jsc:hi%jec))
692 n = (1 + hi%jec - hi%jsc) * (1 + hi%iec - hi%isc)
693 call sum_across_pes(n)
694 call min_across_pes(amin)
695 call max_across_pes(amax)
696 amean = amean /
real(n)
697 if (is_root_pe())
call chk_sum_msg(
"v-point:",amean*scale,amin*scale,amax*scale,mesg)
705 subroutine chksum_h_3d(array, mesg, HI, haloshift, omit_corners, scale)
706 type(hor_index_type),
intent(in) :: HI
707 real,
dimension(HI%isd:,HI%jsd:,:),
intent(in) :: array
708 character(len=*),
intent(in) :: mesg
709 integer,
optional,
intent(in) :: haloshift
710 logical,
optional,
intent(in) :: omit_corners
711 real,
optional,
intent(in) :: scale
714 integer :: bc0, bcSW, bcSE, bcNW, bcNE, hshift
715 integer :: bcN, bcS, bcE, bcW
716 logical :: do_corners
719 if (
is_nan(array(hi%isc:hi%iec,hi%jsc:hi%jec,:))) &
724 scaling = 1.0 ;
if (
present(scale)) scaling = scale
731 if (
present(haloshift)) hshift = haloshift
732 if (hshift<0) hshift = hi%ied-hi%iec
734 if ( hi%isc-hshift<hi%isd .or. hi%iec+hshift>hi%ied .or. &
735 hi%jsc-hshift<hi%jsd .or. hi%jec+hshift>hi%jed )
then 736 write(0,*)
'chksum_h_3d: haloshift =',hshift
737 write(0,*)
'chksum_h_3d: isd,isc,iec,ied=',hi%isd,hi%isc,hi%iec,hi%ied
738 write(0,*)
'chksum_h_3d: jsd,jsc,jec,jed=',hi%jsd,hi%jsc,hi%jec,hi%jed
739 call chksum_error(fatal,
'Error in chksum_h_3d '//trim(mesg))
742 bc0 =
subchk(array, hi, 0, 0, scaling)
745 if (is_root_pe())
call chk_sum_msg(
"h-point:",bc0,mesg)
749 do_corners = .true. ;
if (
present(omit_corners)) do_corners = .not.omit_corners
752 bcsw =
subchk(array, hi, -hshift, -hshift, scaling)
753 bcse =
subchk(array, hi, hshift, -hshift, scaling)
754 bcnw =
subchk(array, hi, -hshift, hshift, scaling)
755 bcne =
subchk(array, hi, hshift, hshift, scaling)
757 if (is_root_pe())
call chk_sum_msg(
"h-point:",bc0,bcsw,bcse,bcnw,bcne,mesg)
759 bcs =
subchk(array, hi, 0, -hshift, scaling)
760 bce =
subchk(array, hi, hshift, 0, scaling)
761 bcw =
subchk(array, hi, -hshift, 0, scaling)
762 bcn =
subchk(array, hi, 0, hshift, scaling)
764 if (is_root_pe())
call chk_sum_msg_nsew(
"h-point:",bc0,bcn,bcs,bce,bcw,mesg)
769 integer function subchk(array, HI, di, dj, scale)
770 type(hor_index_type),
intent(in) :: HI
771 real,
dimension(HI%isd:,HI%jsd:,:),
intent(in) :: array
772 integer,
intent(in) :: di, dj
773 real,
intent(in) :: scale
774 integer :: bitcount, i, j, k, bc
776 do k=lbound(array,3),ubound(array,3) ;
do j=hi%jsc+dj,hi%jec+dj ;
do i=hi%isc+di,hi%iec+di
777 bc = bitcount(abs(scale*array(i,j,k)))
779 enddo ;
enddo ;
enddo 780 call sum_across_pes(
subchk)
784 subroutine substats(HI, array, mesg, scale)
785 type(hor_index_type),
intent(in) :: HI
786 real,
dimension(HI%isd:,HI%jsd:,:),
intent(in) :: array
787 character(len=*),
intent(in) :: mesg
788 real,
intent(in) :: scale
789 integer :: i, j, k, n
790 real :: aMean, aMin, aMax
792 amin = array(hi%isc,hi%jsc,1)
793 amax = array(hi%isc,hi%jsc,1)
795 do k=lbound(array,3),ubound(array,3) ;
do j=hi%jsc,hi%jec ;
do i=hi%isc,hi%iec
796 amin = min(amin, array(i,j,k))
797 amax = max(amax, array(i,j,k))
799 enddo ;
enddo ;
enddo 800 amean = reproducing_sum(array(hi%isc:hi%iec,hi%jsc:hi%jec,:))
801 call sum_across_pes(n)
802 call min_across_pes(amin)
803 call max_across_pes(amax)
804 amean = amean /
real(n)
805 if (is_root_pe())
call chk_sum_msg(
"h-point:",amean*scale,amin*scale,amax*scale,mesg)
813 subroutine chksum_b_3d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
814 type(hor_index_type),
intent(in) :: HI
815 real,
dimension(HI%IsdB:,HI%JsdB:,:),
intent(in) :: array
816 character(len=*),
intent(in) :: mesg
817 integer,
optional,
intent(in) :: haloshift
818 logical,
optional,
intent(in) :: symmetric
819 logical,
optional,
intent(in) :: omit_corners
820 real,
optional,
intent(in) :: scale
823 integer :: bc0, bcSW, bcSE, bcNW, bcNE, hshift
824 integer :: bcN, bcS, bcE, bcW
825 logical :: do_corners, sym, sym_stats
828 if (
is_nan(array(hi%IscB:hi%IecB,hi%JscB:hi%JecB,:))) &
833 scaling = 1.0 ;
if (
present(scale)) scaling = scale
835 sym_stats = .false. ;
if (
present(symmetric)) sym_stats = symmetric
836 if (
present(haloshift))
then ;
if (haloshift > 0) sym_stats = .true. ;
endif 842 if (
present(haloshift)) hshift = haloshift
843 if (hshift<0) hshift = hi%ied-hi%iec
845 if ( hi%isc-hshift<hi%isd .or. hi%iec+hshift>hi%ied .or. &
846 hi%jsc-hshift<hi%jsd .or. hi%jec+hshift>hi%jed )
then 847 write(0,*)
'chksum_B_3d: haloshift =',hshift
848 write(0,*)
'chksum_B_3d: isd,isc,iec,ied=',hi%isd,hi%isc,hi%iec,hi%ied
849 write(0,*)
'chksum_B_3d: jsd,jsc,jec,jed=',hi%jsd,hi%jsc,hi%jec,hi%jed
850 call chksum_error(fatal,
'Error in chksum_B_3d '//trim(mesg))
853 bc0 =
subchk(array, hi, 0, 0, scaling)
855 sym = .false. ;
if (
present(symmetric)) sym = symmetric
857 if ((hshift==0) .and. .not.sym)
then 858 if (is_root_pe())
call chk_sum_msg(
"B-point:",bc0,mesg)
862 do_corners = .true. ;
if (
present(omit_corners)) do_corners = .not.omit_corners
866 bcsw =
subchk(array, hi, -hshift-1, -hshift-1, scaling)
867 bcse =
subchk(array, hi, hshift, -hshift-1, scaling)
868 bcnw =
subchk(array, hi, -hshift-1, hshift, scaling)
870 bcsw =
subchk(array, hi, -hshift-1, -hshift-1, scaling)
871 bcse =
subchk(array, hi, hshift, -hshift-1, scaling)
872 bcnw =
subchk(array, hi, -hshift-1, hshift, scaling)
874 bcne =
subchk(array, hi, hshift, hshift, scaling)
876 if (is_root_pe())
call chk_sum_msg(
"B-point:",bc0,bcsw,bcse,bcnw,bcne,mesg)
879 bcs =
subchk(array, hi, 0, -hshift-1, scaling)
880 bcw =
subchk(array, hi, -hshift-1, 0, scaling)
882 bcs =
subchk(array, hi, 0, -hshift, scaling)
883 bcw =
subchk(array, hi, -hshift, 0, scaling)
885 bce =
subchk(array, hi, hshift, 0, scaling)
886 bcn =
subchk(array, hi, 0, hshift, scaling)
888 if (is_root_pe())
call chk_sum_msg_nsew(
"B-point:",bc0,bcn,bcs,bce,bcw,mesg)
893 integer function subchk(array, HI, di, dj, scale)
894 type(hor_index_type),
intent(in) :: HI
895 real,
dimension(HI%IsdB:,HI%JsdB:,:),
intent(in) :: array
896 integer,
intent(in) :: di, dj
897 real,
intent(in) :: scale
898 integer :: bitcount, i, j, k, bc
901 do k=lbound(array,3),ubound(array,3) ;
do j=hi%jsc+dj,hi%jec+dj ;
do i=hi%isc+di,hi%iec+di
902 bc = bitcount(abs(scale*array(i,j,k)))
904 enddo ;
enddo ;
enddo 905 call sum_across_pes(
subchk)
909 subroutine substats(HI, array, mesg, sym_stats, scale)
910 type(hor_index_type),
intent(in) :: HI
911 real,
dimension(HI%IsdB:,HI%JsdB:,:),
intent(in) :: array
912 character(len=*),
intent(in) :: mesg
913 logical,
intent(in) :: sym_stats
914 real,
intent(in) :: scale
915 integer :: i, j, k, n, IsB, JsB
916 real :: aMean, aMin, aMax
918 isb = hi%isc ;
if (sym_stats) isb = hi%isc-1
919 jsb = hi%jsc ;
if (sym_stats) jsb = hi%jsc-1
921 amin = array(hi%isc,hi%jsc,1) ; amax = amin
922 do k=lbound(array,3),ubound(array,3) ;
do j=jsb,hi%JecB ;
do i=isb,hi%IecB
923 amin = min(amin, array(i,j,k))
924 amax = max(amax, array(i,j,k))
925 enddo ;
enddo ;
enddo 926 amean = reproducing_sum(array(hi%isc:hi%iec,hi%jsc:hi%jec,:))
927 n = (1 + hi%jec - hi%jsc) * (1 + hi%iec - hi%isc) *
size(array,3)
928 call sum_across_pes(n)
929 call min_across_pes(amin)
930 call max_across_pes(amax)
931 amean = amean /
real(n)
932 if (is_root_pe())
call chk_sum_msg(
"B-point:",amean*scale,amin*scale,amax*scale,mesg)
940 subroutine chksum_u_3d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
941 type(hor_index_type),
intent(in) :: HI
942 real,
dimension(HI%isdB:,HI%Jsd:,:),
intent(in) :: array
943 character(len=*),
intent(in) :: mesg
944 integer,
optional,
intent(in) :: haloshift
945 logical,
optional,
intent(in) :: symmetric
946 logical,
optional,
intent(in) :: omit_corners
947 real,
optional,
intent(in) :: scale
950 integer :: bc0, bcSW, bcSE, bcNW, bcNE, hshift
951 integer :: bcN, bcS, bcE, bcW
952 logical :: do_corners, sym, sym_stats
955 if (
is_nan(array(hi%IscB:hi%IecB,hi%jsc:hi%jec,:))) &
960 scaling = 1.0 ;
if (
present(scale)) scaling = scale
962 sym_stats = .false. ;
if (
present(symmetric)) sym_stats = symmetric
963 if (
present(haloshift))
then ;
if (haloshift > 0) sym_stats = .true. ;
endif 969 if (
present(haloshift)) hshift = haloshift
970 if (hshift<0) hshift = hi%ied-hi%iec
972 if ( hi%isc-hshift<hi%isd .or. hi%iec+hshift>hi%ied .or. &
973 hi%jsc-hshift<hi%jsd .or. hi%jec+hshift>hi%jed )
then 974 write(0,*)
'chksum_u_3d: haloshift =',hshift
975 write(0,*)
'chksum_u_3d: isd,isc,iec,ied=',hi%isd,hi%isc,hi%iec,hi%ied
976 write(0,*)
'chksum_u_3d: jsd,jsc,jec,jed=',hi%jsd,hi%jsc,hi%jec,hi%jed
977 call chksum_error(fatal,
'Error in chksum_u_3d '//trim(mesg))
980 bc0 =
subchk(array, hi, 0, 0, scaling)
982 sym = .false. ;
if (
present(symmetric)) sym = symmetric
984 if ((hshift==0) .and. .not.sym)
then 985 if (is_root_pe())
call chk_sum_msg(
"u-point:",bc0,mesg)
989 do_corners = .true. ;
if (
present(omit_corners)) do_corners = .not.omit_corners
992 bcw =
subchk(array, hi, -hshift-1, 0, scaling)
993 if (is_root_pe())
call chk_sum_msg_w(
"u-point:",bc0,bcw,mesg)
994 elseif (do_corners)
then 996 bcsw =
subchk(array, hi, -hshift-1, -hshift, scaling)
997 bcnw =
subchk(array, hi, -hshift-1, hshift, scaling)
999 bcsw =
subchk(array, hi, -hshift, -hshift, scaling)
1000 bcnw =
subchk(array, hi, -hshift, hshift, scaling)
1002 bcse =
subchk(array, hi, hshift, -hshift, scaling)
1003 bcne =
subchk(array, hi, hshift, hshift, scaling)
1005 if (is_root_pe())
call chk_sum_msg(
"u-point:",bc0,bcsw,bcse,bcnw,bcne,mesg)
1007 bcs =
subchk(array, hi, 0, -hshift, scaling)
1008 bce =
subchk(array, hi, hshift, 0, scaling)
1010 bcw =
subchk(array, hi, -hshift-1, 0, scaling)
1012 bcw =
subchk(array, hi, -hshift, 0, scaling)
1014 bcn =
subchk(array, hi, 0, hshift, scaling)
1016 if (is_root_pe())
call chk_sum_msg_nsew(
"u-point:",bc0,bcn,bcs,bce,bcw,mesg)
1021 integer function subchk(array, HI, di, dj, scale)
1022 type(hor_index_type),
intent(in) :: HI
1023 real,
dimension(HI%IsdB:,HI%jsd:,:),
intent(in) :: array
1024 integer,
intent(in) :: di, dj
1025 real,
intent(in) :: scale
1026 integer :: bitcount, i, j, k, bc
1029 do k=lbound(array,3),ubound(array,3) ;
do j=hi%jsc+dj,hi%jec+dj ;
do i=hi%isc+di,hi%iec+di
1030 bc = bitcount(abs(scale*array(i,j,k)))
1032 enddo ;
enddo ;
enddo 1033 call sum_across_pes(
subchk)
1037 subroutine substats(HI, array, mesg, sym_stats, scale)
1038 type(hor_index_type),
intent(in) :: HI
1039 real,
dimension(HI%IsdB:,HI%jsd:,:),
intent(in) :: array
1040 character(len=*),
intent(in) :: mesg
1041 logical,
intent(in) :: sym_stats
1042 real,
intent(in) :: scale
1043 integer :: i, j, k, n, IsB
1044 real :: aMean, aMin, aMax
1046 isb = hi%isc ;
if (sym_stats) isb = hi%isc-1
1048 amin = array(hi%isc,hi%jsc,1) ; amax = amin
1049 do k=lbound(array,3),ubound(array,3) ;
do j=hi%jsc,hi%jec ;
do i=isb,hi%IecB
1050 amin = min(amin, array(i,j,k))
1051 amax = max(amax, array(i,j,k))
1052 enddo ;
enddo ;
enddo 1054 amean = reproducing_sum(array(hi%isc:hi%iec,hi%jsc:hi%jec,:))
1055 n = (1 + hi%jec - hi%jsc) * (1 + hi%iec - hi%isc) *
size(array,3)
1056 call sum_across_pes(n)
1057 call min_across_pes(amin)
1058 call max_across_pes(amax)
1059 amean = amean /
real(n)
1060 if (is_root_pe())
call chk_sum_msg(
"u-point:",amean*scale,amin*scale,amax*scale,mesg)
1068 subroutine chksum_v_3d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
1069 type(hor_index_type),
intent(in) :: HI
1070 real,
dimension(HI%isd:,HI%JsdB:,:),
intent(in) :: array
1071 character(len=*),
intent(in) :: mesg
1072 integer,
optional,
intent(in) :: haloshift
1073 logical,
optional,
intent(in) :: symmetric
1074 logical,
optional,
intent(in) :: omit_corners
1075 real,
optional,
intent(in) :: scale
1078 integer :: bc0, bcSW, bcSE, bcNW, bcNE, hshift
1079 integer :: bcN, bcS, bcE, bcW
1080 logical :: do_corners, sym, sym_stats
1083 if (
is_nan(array(hi%isc:hi%iec,hi%JscB:hi%JecB,:))) &
1088 scaling = 1.0 ;
if (
present(scale)) scaling = scale
1090 sym_stats = .false. ;
if (
present(symmetric)) sym_stats = symmetric
1091 if (
present(haloshift))
then ;
if (haloshift > 0) sym_stats = .true. ;
endif 1097 if (
present(haloshift)) hshift = haloshift
1098 if (hshift<0) hshift = hi%ied-hi%iec
1100 if ( hi%isc-hshift<hi%isd .or. hi%iec+hshift>hi%ied .or. &
1101 hi%jsc-hshift<hi%jsd .or. hi%jec+hshift>hi%jed )
then 1102 write(0,*)
'chksum_v_3d: haloshift =',hshift
1103 write(0,*)
'chksum_v_3d: isd,isc,iec,ied=',hi%isd,hi%isc,hi%iec,hi%ied
1104 write(0,*)
'chksum_v_3d: jsd,jsc,jec,jed=',hi%jsd,hi%jsc,hi%jec,hi%jed
1105 call chksum_error(fatal,
'Error in chksum_v_3d '//trim(mesg))
1108 bc0 =
subchk(array, hi, 0, 0, scaling)
1110 sym = .false. ;
if (
present(symmetric)) sym = symmetric
1112 if ((hshift==0) .and. .not.sym)
then 1113 if (is_root_pe())
call chk_sum_msg(
"v-point:",bc0,mesg)
1117 do_corners = .true. ;
if (
present(omit_corners)) do_corners = .not.omit_corners
1120 bcs =
subchk(array, hi, 0, -hshift-1, scaling)
1121 if (is_root_pe())
call chk_sum_msg_s(
"v-point:",bc0,bcs,mesg)
1122 elseif (do_corners)
then 1124 bcsw =
subchk(array, hi, -hshift, -hshift-1, scaling)
1125 bcse =
subchk(array, hi, hshift, -hshift-1, scaling)
1127 bcsw =
subchk(array, hi, -hshift, -hshift, scaling)
1128 bcse =
subchk(array, hi, hshift, -hshift, scaling)
1130 bcnw =
subchk(array, hi, -hshift, hshift, scaling)
1131 bcne =
subchk(array, hi, hshift, hshift, scaling)
1133 if (is_root_pe())
call chk_sum_msg(
"v-point:",bc0,bcsw,bcse,bcnw,bcne,mesg)
1136 bcs =
subchk(array, hi, 0, -hshift-1, scaling)
1138 bcs =
subchk(array, hi, 0, -hshift, scaling)
1140 bce =
subchk(array, hi, hshift, 0, scaling)
1141 bcw =
subchk(array, hi, -hshift, 0, scaling)
1142 bcn =
subchk(array, hi, 0, hshift, scaling)
1144 if (is_root_pe())
call chk_sum_msg_nsew(
"v-point:",bc0,bcn,bcs,bce,bcw,mesg)
1149 integer function subchk(array, HI, di, dj, scale)
1150 type(hor_index_type),
intent(in) :: HI
1151 real,
dimension(HI%isd:,HI%JsdB:,:),
intent(in) :: array
1152 integer,
intent(in) :: di, dj
1153 real,
intent(in) :: scale
1154 integer :: bitcount, i, j, k, bc
1157 do k=lbound(array,3),ubound(array,3) ;
do j=hi%jsc+dj,hi%jec+dj ;
do i=hi%isc+di,hi%iec+di
1158 bc = bitcount(abs(scale*array(i,j,k)))
1160 enddo ;
enddo ;
enddo 1161 call sum_across_pes(
subchk)
1165 subroutine substats(HI, array, mesg, sym_stats, scale)
1166 type(hor_index_type),
intent(in) :: HI
1167 real,
dimension(HI%isd:,HI%JsdB:,:),
intent(in) :: array
1168 character(len=*),
intent(in) :: mesg
1169 logical,
intent(in) :: sym_stats
1170 real,
intent(in) :: scale
1171 integer :: i, j, k, n, JsB
1172 real :: aMean, aMin, aMax
1174 jsb = hi%jsc ;
if (sym_stats) jsb = hi%jsc-1
1176 amin = array(hi%isc,hi%jsc,1) ; amax = amin
1177 do k=lbound(array,3),ubound(array,3) ;
do j=jsb,hi%JecB ;
do i=hi%isc,hi%iec
1178 amin = min(amin, array(i,j,k))
1179 amax = max(amax, array(i,j,k))
1180 enddo ;
enddo ;
enddo 1182 amean = reproducing_sum(array(hi%isc:hi%iec,hi%jsc:hi%jec,:))
1183 n = (1 + hi%jec - hi%jsc) * (1 + hi%iec - hi%isc) *
size(array,3)
1184 call sum_across_pes(n)
1185 call min_across_pes(amin)
1186 call max_across_pes(amax)
1187 amean = amean /
real(n)
1188 if (is_root_pe())
call chk_sum_msg(
"v-point:",amean*scale,amin*scale,amax*scale,mesg)
1200 subroutine chksum1d(array, mesg, start_i, end_i, compare_PEs)
1201 real,
dimension(:),
intent(in) :: array
1202 character(len=*),
intent(in) :: mesg
1203 integer,
optional,
intent(in) :: start_i
1204 integer,
optional,
intent(in) :: end_i
1205 logical,
optional,
intent(in) :: compare_PEs
1208 integer :: is, ie, i, bc, sum1, sum_bc
1211 real,
allocatable :: sum_here(:)
1216 is = lbound(array,1) ; ie = ubound(array,1)
1217 if (
present(start_i)) is = start_i
1218 if (
present(end_i)) ie = end_i
1219 compare = .true. ;
if (
present(compare_pes)) compare = compare_pes
1221 sum = 0.0 ; sum_bc = 0
1223 sum = sum + array(i)
1224 bc = bitcount(abs(array(i)))
1225 sum_bc = sum_bc + bc
1228 pe_num = pe_here() + 1 - root_pe() ; npes = num_pes()
1229 allocate(sum_here(npes)) ; sum_here(:) = 0.0 ; sum_here(pe_num) = sum
1230 call sum_across_pes(sum_here,npes)
1233 call sum_across_pes(sum1)
1235 if (.not.compare)
then 1237 do i=1,npes ; sum = sum + sum_here(i) ;
enddo 1239 elseif (is_root_pe())
then 1240 if (sum1 /= npes*sum_bc) &
1241 write(0,
'(A40," bitcounts do not match across PEs: ",I12,1X,I12)') &
1242 mesg, sum1, npes*sum_bc
1243 do i=1,npes ;
if (sum /= sum_here(i))
then 1244 write(0,
'(A40," PE ",i4," sum mismatches root_PE: ",3(ES22.13,1X))') &
1245 mesg, i, sum_here(i), sum, sum_here(i)-sum
1248 deallocate(sum_here)
1251 write(0,
'(A50,1X,ES25.16,1X,I12)') mesg, sum, sum_bc
1262 real,
dimension(:,:) :: array
1263 character(len=*) :: mesg
1266 integer :: xs,xe,ys,ye,i,j,sum1,bc
1269 xs = lbound(array,1) ; xe = ubound(array,1)
1270 ys = lbound(array,2) ; ye = ubound(array,2)
1272 sum = 0.0 ; sum1 = 0
1273 do i=xs,xe ;
do j=ys,ye
1274 bc = bitcount(abs(array(i,j)))
1277 call sum_across_pes(sum1)
1279 sum = reproducing_sum(array(:,:))
1282 write(0,
'(A50,1X,ES25.16,1X,I12)') mesg, sum, sum1
1291 real,
dimension(:,:,:) :: array
1292 character(len=*) :: mesg
1295 integer :: xs,xe,ys,ye,zs,ze,i,j,k, bc,sum1
1298 xs = lbound(array,1) ; xe = ubound(array,1)
1299 ys = lbound(array,2) ; ye = ubound(array,2)
1300 zs = lbound(array,3) ; ze = ubound(array,3)
1302 sum = 0.0 ; sum1 = 0
1303 do i=xs,xe ;
do j=ys,ye ;
do k=zs,ze
1304 bc = bitcount(abs(array(i,j,k)))
1306 enddo ;
enddo ;
enddo 1308 call sum_across_pes(sum1)
1309 sum = reproducing_sum(array(:,:,:))
1312 write(0,
'(A50,1X,ES25.16,1X,I12)') mesg, sum, sum1
1322 real,
intent(in) :: x
1323 logical :: is_NaN_0d
1327 if (((x < 0.0) .and. (x >= 0.0)) .or. &
1328 (.not.(x < 0.0) .and. .not.(x >= 0.0)))
then 1340 real,
dimension(:),
intent(in) :: x
1341 logical :: is_NaN_1d
1342 logical,
optional :: skip_mpp
1348 do i = lbound(x,1), ubound(x,1)
1352 if (
present(skip_mpp)) call_mpp = .not.skip_mpp
1354 if (call_mpp)
call sum_across_pes(n)
1356 if (n>0) is_nan_1d = .true.
1364 real,
dimension(:,:),
intent(in) :: x
1365 logical :: is_NaN_2d
1370 do j = lbound(x,2), ubound(x,2) ;
do i = lbound(x,1), ubound(x,1)
1373 call sum_across_pes(n)
1375 if (n>0) is_nan_2d = .true.
1383 real,
dimension(:,:,:),
intent(in) :: x
1384 logical :: is_NaN_3d
1386 integer :: i, j, k, n
1389 do k = lbound(x,3), ubound(x,3)
1390 do j = lbound(x,2), ubound(x,2) ;
do i = lbound(x,1), ubound(x,1)
1394 call sum_across_pes(n)
1396 if (n>0) is_nan_3d = .true.
1403 character(len=*),
intent(in) :: fmsg, mesg
1404 integer,
intent(in) :: bc0
1405 if (is_root_pe())
write(0,
'(A,1(A,I10,X),A)') fmsg,
" c=",bc0,trim(mesg)
1410 subroutine chk_sum_msg5(fmsg,bc0,bcSW,bcSE,bcNW,bcNE,mesg)
1411 character(len=*),
intent(in) :: fmsg, mesg
1412 integer,
intent(in) :: bc0,bcSW,bcSE,bcNW,bcNE
1413 if (is_root_pe())
write(0,
'(A,5(A,I10,1X),A)') &
1414 fmsg,
" c=",bc0,
"sw=",bcsw,
"se=",bcse,
"nw=",bcnw,
"ne=",bcne,trim(mesg)
1420 character(len=*),
intent(in) :: fmsg, mesg
1421 integer,
intent(in) :: bc0, bcN, bcS, bcE, bcW
1422 if (is_root_pe())
write(0,
'(A,5(A,I10,1X),A)') &
1423 fmsg,
" c=",bc0,
"N=",bcn,
"S=",bcs,
"E=",bce,
"W=",bcw,trim(mesg)
1429 character(len=*),
intent(in) :: fmsg, mesg
1430 integer,
intent(in) :: bc0, bcS
1431 if (is_root_pe())
write(0,
'(A,2(A,I10,1X),A)') &
1432 fmsg,
" c=",bc0,
"S=",bcs,trim(mesg)
1438 character(len=*),
intent(in) :: fmsg, mesg
1439 integer,
intent(in) :: bc0, bcW
1440 if (is_root_pe())
write(0,
'(A,2(A,I10,1X),A)') &
1441 fmsg,
" c=",bc0,
"W=",bcw,trim(mesg)
1447 character(len=*),
intent(in) :: fmsg, mesg
1448 integer,
intent(in) :: bc0,bcSW
1449 if (is_root_pe())
write(0,
'(A,2(A,I9,1X),A)') &
1450 fmsg,
" c=",bc0,
"s/w=",bcsw,trim(mesg)
1456 character(len=*),
intent(in) :: fmsg, mesg
1457 real,
intent(in) :: aMean,aMin,aMax
1458 if (is_root_pe())
write(0,
'(A,3(A,ES25.16,1X),A)') &
1459 fmsg,
" mean=",amean,
"min=",amin,
"max=",amax,trim(mesg)
1467 type(param_file_type),
intent(in) :: param_file
1469 #include "version_variable.h" 1470 character(len=40) :: mdl =
"MOM_checksums" 1472 call log_version(param_file, mdl, version)
1481 integer,
intent(in) :: signal
1482 character(len=*),
intent(in) :: message
1483 call mom_error(signal, message)
subroutine chk_sum_msg5(fmsg, bc0, bcSW, bcSE, bcNW, bcNE, mesg)
subroutine chksum3d(array, mesg)
chksum3d does a checksum of all data in a 2-d array.
subroutine substats(HI, array, mesg, scale)
subroutine chksum_pair_h_2d(mesg, arrayA, arrayB, HI, haloshift, omit_corners, scale)
logical function is_nan_1d(x, skip_mpp)
This function returns .true. if any element of x is a NaN, and .false. otherwise. ...
subroutine chk_sum_msg_w(fmsg, bc0, bcW, mesg)
subroutine chk_sum_msg_nsew(fmsg, bc0, bcN, bcS, bcE, bcW, mesg)
integer, parameter default_shift
subroutine chk_sum_msg2(fmsg, bc0, bcSW, mesg)
subroutine chksum_pair_b_3d(mesg, arrayA, arrayB, HI, haloshift, symmetric, omit_corners, scale)
subroutine chksum_h_2d(array, mesg, HI, haloshift, omit_corners, scale)
chksum_h_2d performs checksums on a 2d array staggered at tracer points.
subroutine chksum_u_2d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
chksum_u_2d performs checksums on a 2d array staggered at C-grid u points.
Defines the horizontal index type (hor_index_type) used for providing index ranges.
subroutine chksum_pair_h_3d(mesg, arrayA, arrayB, HI, haloshift, omit_corners, scale)
subroutine chksum_h_3d(array, mesg, HI, haloshift, omit_corners, scale)
chksum_h_3d performs checksums on a 3d array staggered at tracer points.
Container for horizontal index ranges for data, computational and global domains. ...
logical function is_nan_3d(x)
This function returns .true. if any element of x is a NaN, and .false. otherwise. ...
subroutine chk_sum_msg1(fmsg, bc0, mesg)
subroutine chksum2d(array, mesg)
chksum2d does a checksum of all data in a 2-d array.
logical function is_nan_0d(x)
This function returns .true. if x is a NaN, and .false. otherwise.
subroutine chksum_v_3d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
chksum_v_3d performs checksums on a 3d array staggered at C-grid v points.
logical function, public is_root_pe()
subroutine chksum_b_2d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
chksum_B_2d performs checksums on a 2d array staggered at corner points.
logical calculatestatistics
subroutine chksum_u_3d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
chksum_u_3d performs checksums on a 3d array staggered at C-grid u points.
integer function subchk(array, HI, di, dj, scale)
subroutine chksum_error(signal, message)
subroutine, public mom_checksums_init(param_file)
MOM_checksums_init initializes the MOM_checksums module. As it happens, the only thing that it does i...
subroutine chk_sum_msg_s(fmsg, bc0, bcS, mesg)
subroutine chk_sum_msg3(fmsg, aMean, aMin, aMax, mesg)
logical function is_nan_2d(x)
This function returns .true. if any element of x is a NaN, and .false. otherwise. ...
subroutine chksum_v_2d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
chksum_v_2d performs checksums on a 2d array staggered at C-grid v points.
subroutine chksum_b_3d(array, mesg, HI, haloshift, symmetric, omit_corners, scale)
chksum_B_3d performs checksums on a 3d array staggered at corner points.
subroutine chksum_uv_2d(mesg, arrayU, arrayV, HI, haloshift, symmetric, omit_corners, scale)
subroutine chksum_uv_3d(mesg, arrayU, arrayV, HI, haloshift, symmetric, omit_corners, scale)
subroutine, public mom_error(level, message, all_print)
subroutine chksum1d(array, mesg, start_i, end_i, compare_PEs)
chksum1d does a checksum of a 1-dimensional array.
subroutine chksum_pair_b_2d(mesg, arrayA, arrayB, HI, haloshift, symmetric, omit_corners, scale)