da_oi_stats_ssmt2.inc
References to this file elsewhere.
1 subroutine da_oi_stats_ssmt2 (stats_unit, iv)
2
3 !-----------------------------------------------------------------------
4 ! Purpose: TBD
5 !-----------------------------------------------------------------------
6
7 implicit none
8
9 integer, intent (in) :: stats_unit ! Output unit for stats.
10 type (iv_type), intent (in) :: iv ! O-B
11
12 type (maxmin_type) :: minimum
13 type (maxmin_type) :: maximum
14 integer :: nrh
15 integer :: n, k
16 real :: average, rms_err
17
18 if (trace_use_dull) call da_trace_entry("da_oi_stats_ssmt2")
19
20 nrh = 0
21
22 maximum = maxmin_type(-1.0E+20, 0, 0)
23 minimum = maxmin_type(1.0E+20, 0, 0)
24 average = 0.0
25 rms_err = 0.0
26
27 do n=1, iv%info(ssmt2)%nlocal
28 if (iv%info(ssmt2)%proc_domain(1,n)) then
29 do k=1, iv%info(ssmt2)%levels(n)
30 call da_stats_calculate(n, k, iv%ssmt2(n)%rh(k)%qc, iv%ssmt2(n)%rh(k)%inv, nrh, &
31 minimum, maximum, average, rms_err)
32 end do
33 end if ! end if (iv%info(ssmt2)%proc_domain(1,n))
34 end do
35
36 ! Do inter-processor communication to gather statistics.
37 call da_proc_sum_int(nrh)
38
39 call da_proc_stats_combine(average, rms_err, minimum%value, maximum%value, &
40 minimum%n, maximum%n, minimum%l, maximum%l)
41
42 if (rootproc) then
43 if (nrh /= 0) then
44 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of O-B for SSMT2'
45 call da_print_stats_ssmt2(stats_unit, nrh, minimum, maximum, average, rms_err)
46 end if
47 end if
48
49 if (trace_use_dull) call da_trace_exit("da_oi_stats_ssmt2")
50
51 end subroutine da_oi_stats_ssmt2
52
53