da_ao_stats_profiler.inc

References to this file elsewhere.
1 subroutine da_ao_stats_profiler (stats_unit, oi, 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)      :: oi            ! OI
11    type  (y_type), intent (in)      :: re            ! A - O
12 
13    type (stats_profiler_type)       :: Profiler
14    integer                          :: nu, nv
15    integer                          :: n, k
16 
17    nu = 0
18    nv = 0
19    num_profiler_tot = 0
20 
21    Profiler%maximum%u = maxmin_type (missing_r, 0, 0)
22    Profiler%maximum%v = maxmin_type (missing_r, 0, 0)
23    Profiler%minimum%u = maxmin_type(-missing_r, 0, 0)
24    Profiler%minimum%v = maxmin_type(-missing_r, 0, 0)
25    Profiler%average = residual_profiler1_type(0.0, 0.0)
26    Profiler%rms_err = Profiler%average
27 
28    if (oi%num_Profiler > 0) then
29       do n=1, oi%num_Profiler
30          if (oi%profiler(n)%loc%proc_domain) then
31             do k=1, oi%Profiler(n)%info%levels
32                call da_stats_calculate (n, k, oi%Profiler(n)%u(k)%qc, & 
33                                re%Profiler(n)%u(k), nu, & 
34                                profiler%minimum%u, Profiler%maximum%u, &
35                                profiler%average%u, Profiler%rms_err%u)
36                call da_stats_calculate (n, k, oi%Profiler(n)%v(k)%qc, & 
37                                re%Profiler(n)%v(k), nv, & 
38                                Profiler%minimum%v, Profiler%maximum%v, &
39                                Profiler%average%v, Profiler%rms_err%v)
40             end do
41          end if    ! end if (oi%profiler(n)%loc%proc_domain)
42       end do 
43    end if
44 
45    ! Do inter-processor communication to gather statistics.
46    call da_proc_sum_int (nu)
47    call da_proc_sum_int (nv)
48    num_profiler_tot = nu + nv
49    
50    call da_proc_stats_combine(Profiler%average%u, Profiler%rms_err%u, &
51                            Profiler%minimum%u%value, Profiler%maximum%u%value, &
52                            Profiler%minimum%u%n, Profiler%maximum%u%n, &
53                            Profiler%minimum%u%l, Profiler%maximum%u%l)
54    call da_proc_stats_combine(Profiler%average%v, Profiler%rms_err%v, &
55                            Profiler%minimum%v%value, Profiler%maximum%v%value, &
56                            Profiler%minimum%v%n, Profiler%maximum%v%n, &
57                            Profiler%minimum%v%l, Profiler%maximum%v%l)
58    
59    if (rootproc) then 
60       if (nu /= 0 .or. nv /= 0) then 
61          write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for profiler'
62          call da_print_stats_profiler(stats_unit, nu, nv, Profiler)
63       end if 
64    end if
65 
66 end subroutine da_ao_stats_profiler
67 
68