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 (ob_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    nrh = 0
19    
20    maximum = maxmin_type(-1.0E+20, 0, 0)
21    minimum = maxmin_type(1.0E+20, 0, 0)
22    average = 0.0
23    rms_err = 0.0
24 
25    if (iv%num_ssmt2 > 0) then
26       do n=1, iv%num_ssmt2
27          if (iv%ssmt2(n)%loc%proc_domain) then
28             do k=1, iv%ssmt2(n)%info%levels   
29                call da_stats_calculate(n, k, iv%ssmt2(n)%rh(k)%qc, &
30                                      iv%ssmt2(n)%rh(k)%inv, nrh, &
31                                      minimum, maximum, &
32                                      average, rms_err)
33             end do
34          end if    ! end if (iv%ssmt2(n)%loc%proc_domain)
35       end do
36    end if
37 
38    ! Do inter-processor communication to gather statistics.
39    call da_proc_sum_int(nrh)
40    
41    call da_proc_stats_combine(average, rms_err, &
42                            minimum%value, maximum%value, &
43                            minimum%n, maximum%n, &
44                            minimum%l, maximum%l)
45    
46    if (rootproc) then
47       if (nrh /= 0) then
48          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of O-B for SSMT2'
49          call da_print_stats_ssmt2(stats_unit, nrh, minimum, maximum, &
50                                  average, rms_err)
51       end if 
52    end if
53 
54 end subroutine da_oi_stats_ssmt2
55 
56