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 (iv_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    if (trace_use_dull) call da_trace_entry("da_oi_stats_ssmt1")
19 
20    nt = 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(ssmt1)%nlocal
28       if (iv%info(ssmt1)%proc_domain(1,n)) then
29          do k=1, iv%info(ssmt1)%levels(n)   
30             call da_stats_calculate(n, k, iv%ssmt1(n)%t(k)%qc, iv%ssmt1(n)%t(k)%inv, nt, &
31                minimum, maximum, average, rms_err)
32          end do
33       end if    ! end if (iv%info(ssmt1)%proc_domain(1,n))
34    end do
35 
36    ! Do inter-processor communication to gather statistics.
37    call da_proc_sum_int(nt)
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 (nt /= 0) then  
44          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of O-B for SSMT1'
45             call da_print_stats_ssmt1(stats_unit, nt, minimum, maximum, average, rms_err)   
46       end if
47    end if
48 
49    if (trace_use_dull) call da_trace_exit("da_oi_stats_ssmt1")
50 
51 end subroutine da_oi_stats_ssmt1
52 
53