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