1 |
subroutine diagout (myThid,listnum) |
2 |
C*********************************************************************** |
3 |
C |
4 |
C Purpose |
5 |
C Routine to write Output for Diagnostic Fields |
6 |
C |
7 |
C Argument Description |
8 |
C myThid ... Process(or) number |
9 |
C listnum .. Diagnostics list number being written |
10 |
C |
11 |
C*********************************************************************** |
12 |
|
13 |
implicit none |
14 |
#include "EEPARAMS.h" |
15 |
#include "CPP_OPTIONS.h" |
16 |
#include "SIZE.h" |
17 |
|
18 |
#ifdef ALLOW_FIZHI |
19 |
#include "fizhi_SIZE.h" |
20 |
#else |
21 |
integer Nrphys |
22 |
parameter (Nrphys=1) |
23 |
#endif |
24 |
|
25 |
#include "diagnostics_SIZE.h" |
26 |
#include "diagnostics.h" |
27 |
|
28 |
integer myThid, listnum |
29 |
|
30 |
integer i, j, k, m, n, bi, bj |
31 |
character*8 parms1 |
32 |
character*1 parse1(8) |
33 |
character*3 mate_index |
34 |
integer mate |
35 |
_RL qtmp1(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nr+Nrphys,Nsx,Nsy) |
36 |
_RL qtmp2(1-OLx:sNx+Olx,1-Oly:sNy+Oly,Nr+Nrphys,Nsx,Nsy) |
37 |
_RL undef, getcon |
38 |
|
39 |
equivalence ( parms1 , parse1(1) ) |
40 |
equivalence ( mate_index , parse1(6) ) |
41 |
|
42 |
|
43 |
undef = getcon('UNDEF') |
44 |
|
45 |
do n=1,nfields(listnum) |
46 |
do m=1,ndiagt |
47 |
if( flds(n,listnum).eq.cdiag(m) .and. idiag(m).ne.0 ) then |
48 |
parms1 = gdiag(m) |
49 |
if(ndiag(m).ne.0.and.parse1(5).ne.'D')then |
50 |
if( myThid.eq.1 ) write(6,2000) m,cdiag(m),ndiag(m),gdiag(m) |
51 |
if(parse1(5).ne.'C') then |
52 |
do k=1,kdiag(m) |
53 |
call getdiag ( myThid,k,m,undef,qtmp1) |
54 |
enddo |
55 |
|
56 |
c Check for Mate of a Vector Diagnostic |
57 |
c ------------------------------------- |
58 |
if( parse1(1).eq.'U' .or. parse1(1).eq.'V' ) then |
59 |
read (mate_index,100) mate |
60 |
if( idiag(mate).ne.0 ) then |
61 |
if( myThid.eq.1 ) write(6,2001) cdiag(m),mate,cdiag(mate) |
62 |
else |
63 |
if( myThid.eq.1 ) write(6,2002) cdiag(m),mate,cdiag(mate) |
64 |
endif |
65 |
endif |
66 |
|
67 |
else |
68 |
|
69 |
c Check for Mate of a Counter Diagnostic |
70 |
c -------------------------------------- |
71 |
read (mate_index,100) mate |
72 |
do k=1,kdiag(m) |
73 |
call getdiag2 ( myThid,k,m,undef,qtmp1) |
74 |
call getdiag2 ( myThid,k,mate,undef,qtmp2) |
75 |
do bj=myByLo(myThid), myByHi(myThid) |
76 |
do bi=myBxLo(myThid), myBxHi(myThid) |
77 |
do j = 1,sNy |
78 |
do i = 1,sNx |
79 |
if(qtmp2(i,j,k,bi,bj).ne.0.) then |
80 |
qtmp1(i,j,k,bi,bj) = |
81 |
. qtmp1(i,j,k,bi,bj) / qtmp2(i,j,k,bi,bj) |
82 |
else |
83 |
qtmp1(i,j,k,bi,bj) = undef |
84 |
endif |
85 |
enddo |
86 |
enddo |
87 |
enddo |
88 |
enddo |
89 |
enddo |
90 |
|
91 |
endif |
92 |
endif |
93 |
endif |
94 |
enddo |
95 |
call mdswritefield(k) |
96 |
enddo |
97 |
|
98 |
100 format(i3) |
99 |
2000 format(1x,'Computing Diagnostic # ',i3,2x,a8,5x,'Counter: ', |
100 |
. i3,6x,'Parms: ',a16) |
101 |
2001 format(1x,' Vector Mate for ',a8,5x, |
102 |
. 'Diagnostic # ',i3,2x,a8,' exists ') |
103 |
2002 format(1x,' Vector Mate for ',a8,5x, |
104 |
. 'Diagnostic # ',i3,2x,a8,' not enabled') |
105 |
|
106 |
return |
107 |
end |