da_oi_stats_ssmt1.inc

References to this file elsewhere.
1 subroutine da_oi_stats_ssmt1 (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                          :: nt
15    integer                          :: n, k
16    real                             :: average, rms_err
17 
18    nt = 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_ssmt1 > 0) then
26       do n=1, iv%num_ssmt1
27          if (iv%ssmt1(n)%loc%proc_domain) then
28             do k=1, iv%ssmt1(n)%info%levels   
29                call da_stats_calculate(n, k, iv%ssmt1(n)%t(k)%qc, &
30                                      iv%ssmt1(n)%t(k)%inv, nt, &
31                                      minimum, maximum, &
32                                      average, rms_err)
33             end do
34          end if    ! end if (iv%ssmt1(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(nt)
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 (nt /= 0) then  
48          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of O-B for SSMT1'
49    
50          call da_print_stats_ssmt1(stats_unit, nt, minimum, maximum, &
51                                  average, rms_err)   
52       end if
53    end if
54 
55 end subroutine da_oi_stats_ssmt1
56 
57