da_ao_stats_profiler.inc

References to this file elsewhere.
1 subroutine da_ao_stats_profiler (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 (iv_type), intent(inout) :: iv            ! iv
11    type (y_type),  intent(in)    :: re            ! A - O
12 
13    type (stats_profiler_type)       :: stats
14    integer                          :: nu, nv
15    integer                          :: n, k
16    
17    if (trace_use_dull) call da_trace_entry("da_ao_stats_profiler")
18 
19    nu = 0
20    nv = 0
21 
22    stats%maximum%u = maxmin_type (missing_r, 0, 0)
23    stats%maximum%v = maxmin_type (missing_r, 0, 0)
24    stats%minimum%u = maxmin_type(-missing_r, 0, 0)
25    stats%minimum%v = maxmin_type(-missing_r, 0, 0)
26 
27    stats%average = residual_profiler1_type(0.0, 0.0)
28    stats%rms_err = stats%average
29 
30    do n=1, iv%info(profiler)%nlocal
31       if (iv%info(profiler)%proc_domain(1,n)) then
32          do k=1, iv%info(profiler)%levels(n)
33             call da_stats_calculate (n, k, iv%profiler(n)%u(k)%qc, & 
34                re%profiler(n)%u(k), nu, & 
35                stats%minimum%u, stats%maximum%u, &
36                stats%average%u, stats%rms_err%u)
37             call da_stats_calculate (n, k, iv%profiler(n)%v(k)%qc, & 
38                re%profiler(n)%v(k), nv, & 
39                stats%minimum%v, stats%maximum%v, &
40                stats%average%v, stats%rms_err%v)
41          end do
42       end if    ! end if (iv%info(profiler)%proc_domain(1,n))
43    end do 
44 
45    ! do inter-processor communication to gather statistics.
46    call da_proc_sum_int (nu)
47    call da_proc_sum_int (nv)
48    iv%nstats(profiler) = nu + nv
49    
50    call da_proc_stats_combine(stats%average%u, stats%rms_err%u, &
51       stats%minimum%u%value, stats%maximum%u%value, &
52       stats%minimum%u%n, stats%maximum%u%n, &
53       stats%minimum%u%l, stats%maximum%u%l)
54    call da_proc_stats_combine(stats%average%v, stats%rms_err%v, &
55       stats%minimum%v%value, stats%maximum%v%value, &
56       stats%minimum%v%n, stats%maximum%v%n, &
57       stats%minimum%v%l, stats%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, stats)
63       end if 
64    end if
65    
66    if (trace_use_dull) call da_trace_exit("da_ao_stats_profiler")
67 
68 end subroutine da_ao_stats_profiler
69 
70