/[MITgcm]/MITgcm/pkg/grdchk/grdchk_print.F
ViewVC logotype

Contents of /MITgcm/pkg/grdchk/grdchk_print.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.11 - (show annotations) (download)
Fri Apr 30 18:41:50 2010 UTC (14 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62g, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62w, checkpoint62x
Changes since 1.10: +8 -8 lines
fix printing format (unbalanced parenthesis)

1 C $Header: /u/gcmpack/MITgcm/pkg/grdchk/grdchk_print.F,v 1.10 2010/04/26 21:29:57 jmc Exp $
2 C $Name: $
3
4 #include "AD_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7
8 subroutine grdchk_print(
9 I ichknum,
10 I ierr_grdchk,
11 I mythid
12 & )
13
14 c ==================================================================
15 c SUBROUTINE grdchk_print
16 c ==================================================================
17 c
18 c o Print the results of the gradient check.
19 c
20 c started: Christian Eckert eckert@mit.edu 08-Mar-2000
21 c continued: heimbach@mit.edu: 13-Jun-2001
22 c
23 c ==================================================================
24 c SUBROUTINE grdchk_print
25 c ==================================================================
26
27 implicit none
28
29 c == global variables ==
30
31 #include "SIZE.h"
32 #include "EEPARAMS.h"
33 #include "grdchk.h"
34
35 c == routine arguments ==
36
37 integer ichknum
38 integer ierr_grdchk
39 integer mythid
40
41 #ifdef ALLOW_GRDCHK
42 c == local variables ==
43
44 _RL fcref
45 _RL fcpertplus, fcpertminus
46 _RL xxmemo_ref
47 _RL xxmemo_pert
48 _RL gfd
49 _RL adxxmemo
50 _RL ftlxxmemo
51 _RL ratio_ad
52 _RL ratio_ftl
53
54 integer i
55 integer itile
56 integer jtile
57 integer itilepos
58 integer jtilepos
59 integer layer
60 integer icomp
61 integer ierr
62
63 integer numchecks
64
65 character*(max_len_mbuf) msgbuf
66
67 c == end of interface ==
68
69 c-- Print header.
70 write(msgbuf,'(a)')
71 &' '
72 call print_message( msgbuf, standardmessageunit,
73 & SQUEEZE_RIGHT, mythid )
74 write(msgbuf,'(a)')
75 &'// ======================================================='
76 call print_message( msgbuf, standardmessageunit,
77 & SQUEEZE_RIGHT, mythid )
78 write(msgbuf,'(a)')
79 &'// Gradient check results >>> START <<<'
80 call print_message( msgbuf, standardmessageunit,
81 & SQUEEZE_RIGHT, mythid)
82 write(msgbuf,'(a)')
83 &'// ======================================================='
84 call print_message( msgbuf, standardmessageunit,
85 & SQUEEZE_RIGHT , mythid )
86 write(msgbuf,'(a)')
87 &' '
88 call print_message( msgbuf, standardmessageunit,
89 & SQUEEZE_RIGHT, mythid )
90
91 write(msgbuf,'(A,1PE14.6)')
92 &' EPS = ',grdchk_eps
93 call print_message( msgbuf, standardmessageunit,
94 & SQUEEZE_RIGHT, mythid )
95 write(msgbuf,'(a)')
96 &' '
97 call print_message( msgbuf, standardmessageunit,
98 & SQUEEZE_RIGHT, mythid )
99
100 write(msgbuf,'(A,2X,A,1X,3A6,A8,11X,A12)')
101 & 'grdchk output h.p:', 'Id', 'Itile', 'Jtile',
102 & 'LAYER', 'X(Id)', 'X(Id)+/-EPS'
103 call print_message( msgbuf, standardmessageunit,
104 & SQUEEZE_RIGHT , mythid )
105 write(msgbuf,'(A,2X,A,A4,1X,2A21)')
106 & 'grdchk output h.c:', 'Id', 'FC', 'FC1', 'FC2'
107 call print_message( msgbuf, standardmessageunit,
108 & SQUEEZE_RIGHT, mythid )
109 #ifdef ALLOW_TANGENTLINEAR_RUN
110 write(msgbuf,'(A,2X,A,2X,2A18,4X,A18)')
111 & 'grdchk output h.g:', 'Id',
112 & 'FC1-FC2/(2*EPS)', 'TLM GRAD(FC)', '1-FDGRD/TLMGRD'
113 #else
114 write(msgbuf,'(A,2X,A,2X,2A18,4X,A18)')
115 & 'grdchk output h.g:', 'Id',
116 & 'FC1-FC2/(2*EPS)', 'ADJ GRAD(FC)', '1-FDGRD/ADGRD'
117 #endif
118 call print_message( msgbuf, standardmessageunit,
119 & SQUEEZE_RIGHT, mythid )
120
121 c-- Individual checks.
122 if ( ierr_grdchk .eq. 0 ) then
123 numchecks = ichknum
124 else
125 numchecks = maxgrdchecks
126 endif
127
128 do i = 1, numchecks
129 xxmemo_ref = xxmemref (i)
130 xxmemo_pert = xxmempert (i)
131 adxxmemo = adxxmem (i)
132 ftlxxmemo = ftlxxmem (i)
133 fcref = fcrmem (i)
134 fcpertplus = fcppmem (i)
135 fcpertminus = fcpmmem (i)
136 gfd = gfdmem (i)
137 ratio_ad = ratioadmem (i)
138 ratio_ftl = ratioftlmem (i)
139 itile = bimem (i)
140 jtile = bjmem (i)
141 itilepos = ilocmem (i)
142 jtilepos = jlocmem (i)
143 layer = klocmem (i)
144 icomp = icompmem(i)
145 ierr = ierrmem (i)
146
147 write(msgbuf,'(a)')
148 & ' '
149 call print_message( msgbuf, standardmessageunit,
150 & SQUEEZE_RIGHT, mythid )
151 write(msgbuf,'(A,I4,3I6,2x,1P2E17.9)')
152 & 'grdchk output (p):',
153 & i, itilepos, jtilepos, layer,
154 & xxmemo_ref, xxmemo_pert
155 call print_message( msgbuf, standardmessageunit,
156 & SQUEEZE_RIGHT, mythid )
157 if ( ierr .eq. 0 ) then
158 write(msgbuf,'(A,I4,1P3E21.13)')
159 & 'grdchk output (c):',
160 & i, fcref, fcpertplus, fcpertminus
161 call print_message( msgbuf, standardmessageunit,
162 & SQUEEZE_RIGHT, mythid )
163 #ifdef ALLOW_TANGENTLINEAR_RUN
164 write(msgbuf,'(A,I4,3x,1P3E21.13)')
165 & 'grdchk output (g):',
166 & i, gfd, ftlxxmemo, ratio_ftl
167 #else
168 write(msgbuf,'(A,I4,3x,1P3E21.13)')
169 & 'grdchk output (g):',
170 & i, gfd, adxxmemo, ratio_ad
171 #endif
172 call print_message( msgbuf, standardmessageunit,
173 & SQUEEZE_RIGHT, mythid )
174 else
175 if ( ierr .eq. -1 ) then
176 write(msgbuf,'(a)')
177 & ' Component does not exist (zero)'
178 else if ( ierr .eq. -2 ) then
179 write(msgbuf,'(a)')
180 & ' Component does not exist (negative)'
181 else if ( ierr .eq. -3 ) then
182 write(msgbuf,'(a)')
183 & ' Component does not exist (too large)'
184 else if ( ierr .eq. -4 ) then
185 write(msgbuf,'(a)')
186 & ' Component does not exist (land point)'
187 endif
188 call print_message( msgbuf, standardmessageunit,
189 & SQUEEZE_RIGHT, mythid )
190 endif
191 enddo
192
193 c-- Print final lines.
194 write(msgbuf,'(a)')
195 &' '
196 call print_message( msgbuf, standardmessageunit,
197 & SQUEEZE_RIGHT, mythid )
198 write(msgbuf,'(a)')
199 &'// ======================================================='
200 call print_message( msgbuf, standardmessageunit,
201 & SQUEEZE_RIGHT, mythid )
202 write(msgbuf,'(a)')
203 &'// Gradient check results >>> END <<<'
204 call print_message( msgbuf, standardmessageunit,
205 & SQUEEZE_RIGHT, mythid )
206 write(msgbuf,'(a)')
207 &'// ======================================================='
208 call print_message( msgbuf, standardmessageunit,
209 & SQUEEZE_RIGHT, mythid )
210 write(msgbuf,'(a)')
211 &' '
212 call print_message( msgbuf, standardmessageunit,
213 & SQUEEZE_RIGHT, mythid )
214
215 #endif /* ALLOW_GRDCHK */
216
217 return
218 end

  ViewVC Help
Powered by ViewVC 1.1.22