da_ao_stats_ssmt2.inc

References to this file elsewhere.
1 subroutine da_ao_stats_ssmt2 (stats_unit, iv, re)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6 
7    implicit none
8 
9    integer,        intent (in)      :: stats_unit    ! Output unit for stats.
10    type (ob_type), intent (in)      :: iv            ! OI
11    type  (y_type), intent (in)      :: re            ! O-A
12 
13    type (maxmin_type)               :: minimum
14    type (maxmin_type)               :: maximum
15    integer                          :: nrh
16    integer                          :: n, k
17    real                             :: average, rms_err
18 
19    nrh = 0
20    num_ssmt2_tot = 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    if (iv%num_ssmt2 > 0) then
28       do n=1, iv%num_ssmt2
29          if (iv%ssmt2(n)%loc%proc_domain) then
30             do k=1, iv%ssmt2(n)%info%levels
31                call da_stats_calculate (n, k, iv%ssmt2(n)%rh(k)%qc, & 
32                                      re%ssmt2(n)%rh(k), nrh, &
33                                      minimum, maximum, &
34                                      average, rms_err)
35 
36             end do
37          end if    ! end if (iv%ssmt2(n)%loc%proc_domain)
38       end do
39    end if
40 
41    ! Do inter-processor communication to gather statistics.
42    call da_proc_sum_int (nrh)
43    num_ssmt2_tot = nrh
44       
45    call da_proc_stats_combine(average, rms_err, &
46                            minimum%value, maximum%value, &
47                            minimum%n, maximum%n, &
48                            minimum%l, maximum%l)
49    
50    if (rootproc) then 
51       if (nrh /= 0) then
52          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of O-A for SSMT2'
53          call da_print_stats_ssmt2 (stats_unit, nrh, minimum, maximum, &
54                                  average, rms_err)
55       end if
56    end if
57 
58 end subroutine da_ao_stats_ssmt2
59 
60