da_ao_stats_sound.inc
References to this file elsewhere.
1 subroutine da_ao_stats_sound (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_sound_type) :: Sound
14 integer :: nu, nv, nt, nq
15 integer :: n, k
16
17 nu = 0
18 nv = 0
19 nt = 0
20 nq = 0
21
22 Sound%maximum%u = maxmin_type (missing_r, 0, 0)
23 Sound%maximum%v = maxmin_type (missing_r, 0, 0)
24 Sound%maximum%t = maxmin_type (missing_r, 0, 0)
25 Sound%maximum%q = maxmin_type (missing_r, 0, 0)
26 Sound%minimum%u = maxmin_type(-missing_r, 0, 0)
27 Sound%minimum%v = maxmin_type(-missing_r, 0, 0)
28 Sound%minimum%t = maxmin_type(-missing_r, 0, 0)
29 Sound%minimum%q = maxmin_type(-missing_r, 0, 0)
30 Sound%average = residual_sound1_type(0.0, 0.0, 0.0, 0.0)
31 Sound%rms_err = Sound%average
32
33 if (oi%num_Sound > 0) then
34 do n=1, oi%num_Sound
35 if (oi%sound(n)%loc%proc_domain) then
36 do k=1, oi%sound(n)%info%levels
37
38 call da_stats_calculate (n, k, oi%Sound(n)%u(k)%qc, &
39 re%sound(n)%u(k), nu, &
40 sound%minimum%u, Sound%maximum%u, &
41 sound%average%u, Sound%rms_err%u)
42 call da_stats_calculate (n, k, oi%Sound(n)%v(k)%qc, &
43 re%sound(n)%v(k), nv, &
44 sound%minimum%v, Sound%maximum%v, &
45 sound%average%v, Sound%rms_err%v)
46 call da_stats_calculate (n, k, oi%Sound(n)%t(k)%qc, &
47 re%sound(n)%t(k), nt, &
48 sound%minimum%t, Sound%maximum%t, &
49 sound%average%t, Sound%rms_err%t)
50 call da_stats_calculate (n, k, oi%Sound(n)%q(k)%qc, &
51 re%Sound(n)%q(k), nq, &
52 Sound%minimum%q, Sound%maximum%q, &
53 Sound%average%q, Sound%rms_err%q)
54 end do
55 end if ! end if (oi%sound(n)%loc%proc_domain)
56 end do
57 end if
58
59 ! Do inter-processor communication to gather statistics.
60 call da_proc_sum_int (nu)
61 call da_proc_sum_int (nv)
62 call da_proc_sum_int (nt)
63 call da_proc_sum_int (nq)
64
65 num_sound_tot = nu + nv + nt + nq
66
67 call da_proc_stats_combine(Sound%average%u, Sound%rms_err%u, &
68 Sound%minimum%u%value, Sound%maximum%u%value, &
69 Sound%minimum%u%n, Sound%maximum%u%n, &
70 Sound%minimum%u%l, Sound%maximum%u%l)
71 call da_proc_stats_combine(Sound%average%v, Sound%rms_err%v, &
72 Sound%minimum%v%value, Sound%maximum%v%value, &
73 Sound%minimum%v%n, Sound%maximum%v%n, &
74 Sound%minimum%v%l, Sound%maximum%v%l)
75 call da_proc_stats_combine(Sound%average%t, Sound%rms_err%t, &
76 Sound%minimum%t%value, Sound%maximum%t%value, &
77 Sound%minimum%t%n, Sound%maximum%t%n, &
78 Sound%minimum%t%l, Sound%maximum%t%l)
79 call da_proc_stats_combine(Sound%average%q, Sound%rms_err%q, &
80 Sound%minimum%q%value, Sound%maximum%q%value, &
81 Sound%minimum%q%n, Sound%maximum%q%n, &
82 Sound%minimum%q%l, Sound%maximum%q%l)
83
84 if (rootproc) then
85 if (nu /= 0 .or. nv /= 0 .or. nt /= 0 .or. nq /= 0) then
86 write(unit=stats_unit, fmt='(/a/)') ' Diagnostics of AO for sound'
87 call da_print_stats_sound(stats_unit, nu, nv, nt, nq, Sound)
88 end if
89 end if
90
91 end subroutine da_ao_stats_sound
92
93