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

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

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


Revision 1.8 - (show annotations) (download)
Tue Nov 4 20:47:42 2003 UTC (20 years, 7 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint57m_post, checkpoint52l_pre, hrcube4, hrcube5, checkpoint57g_pre, checkpoint57s_post, checkpoint58b_post, checkpoint57b_post, checkpoint52d_pre, checkpoint57g_post, checkpoint56b_post, checkpoint57y_post, checkpoint52j_pre, checkpoint54d_post, checkpoint54e_post, checkpoint57r_post, checkpoint57d_post, checkpoint57i_post, checkpoint52l_post, checkpoint52k_post, checkpoint58, checkpoint55, checkpoint54, checkpoint57, checkpoint56, checkpoint53, checkpoint52, checkpoint52f_post, checkpoint57n_post, checkpoint58d_post, checkpoint58a_post, checkpoint57z_post, checkpoint54f_post, checkpoint51t_post, checkpoint55i_post, checkpoint57l_post, checkpoint52i_pre, hrcube_1, hrcube_2, hrcube_3, checkpoint51s_post, checkpoint57t_post, checkpoint55c_post, checkpoint52e_pre, checkpoint57v_post, checkpoint57f_post, checkpoint52e_post, checkpoint53d_post, checkpoint57a_post, checkpoint57h_pre, checkpoint52b_pre, checkpoint54b_post, checkpoint57h_post, checkpoint52m_post, checkpoint57y_pre, checkpoint55g_post, checkpoint52b_post, checkpoint52c_post, checkpoint57c_post, checkpoint52f_pre, checkpoint55d_post, checkpoint54a_pre, checkpoint53c_post, checkpoint55d_pre, checkpoint57c_pre, checkpoint55j_post, checkpoint54a_post, checkpoint55h_post, checkpoint57e_post, checkpoint55b_post, checkpoint53a_post, checkpoint55f_post, checkpoint52d_post, checkpoint53g_post, checkpoint57p_post, checkpint57u_post, checkpoint57q_post, eckpoint57e_pre, checkpoint52a_pre, checkpoint52i_post, checkpoint52h_pre, checkpoint56a_post, checkpoint53f_post, checkpoint57h_done, checkpoint52j_post, checkpoint57j_post, checkpoint57f_pre, branch-netcdf, checkpoint52n_post, checkpoint53b_pre, checkpoint56c_post, checkpoint57a_pre, checkpoint55a_post, checkpoint57o_post, checkpoint57k_post, checkpoint53b_post, checkpoint52a_post, checkpoint57w_post, ecco_c52_e35, checkpoint57x_post, checkpoint58c_post, checkpoint53d_pre, checkpoint55e_post, checkpoint54c_post, checkpoint51u_post
Branch point for: netcdf-sm0
Changes since 1.7: +12 -10 lines
o merged from ecco-branch
  (remaining bug fixes for obcs gradient checks)
o additional high-precision output for testreport
  (grep for precision_grdchk_result)

1 C $Header: /u/gcmpack/MITgcm/pkg/grdchk/grdchk_loc.F,v 1.2.6.4 2003/07/07 16:18:18 heimbach Exp $
2
3 #include "CTRL_CPPOPTIONS.h"
4
5
6 subroutine grdchk_loc(
7 I icomp,
8 I ichknum,
9 O icvrec,
10 O itile,
11 O jtile,
12 O layer,
13 O obcspos,
14 O itilepos,
15 O jtilepos,
16 O itest,
17 O ierr,
18 I mythid
19 & )
20
21 c ==================================================================
22 c SUBROUTINE grdchk_loc
23 c ==================================================================
24 c
25 c o Get the location of a given component of the control vector for
26 c the current process.
27 c
28 c started: Christian Eckert eckert@mit.edu 04-Apr-2000
29 c continued: heimbach@mit.edu: 13-Jun-2001
30 c
31 c ==================================================================
32 c SUBROUTINE grdchk_loc
33 c ==================================================================
34
35 implicit none
36
37 c == global variables ==
38
39 #include "EEPARAMS.h"
40 #include "SIZE.h"
41 #include "GRID.h"
42 #include "ctrl.h"
43 #include "grdchk.h"
44
45 c == routine arguments ==
46
47 integer icomp
48 integer ichknum
49 integer icvrec
50 integer jtile
51 integer itile
52 integer layer
53 integer obcspos
54 integer itilepos
55 integer jtilepos
56 integer itest
57 integer ierr
58 integer mythid
59
60 #ifdef ALLOW_GRDCHK
61 c == local variables ==
62
63 integer bi,bj
64 integer i,j,k
65 integer iobcs
66 integer biwrk,bjwrk
67 integer iwrk, jwrk, kwrk
68 integer iobcswrk
69 integer irec, irecwrk
70 integer itlo,ithi
71 integer jtlo,jthi
72 integer jmin,jmax
73 integer imin,imax
74 integer icomptest
75 integer nobcsmax
76
77 c == end of interface ==
78
79 jtlo = 1
80 jthi = nsy
81 itlo = 1
82 ithi = nsx
83 jmin = 1
84 jmax = sny
85 imin = 1
86 imax = snx
87
88 _BEGIN_MASTER( mythid )
89
90 c initialise parameters
91 ierr = -5
92
93 if ( icomp .gt. 0 ) then
94 if ( icomp .le. ncvarcomp ) then
95 c-- A valid component of the control variable has been selected.
96 if ( ichknum .EQ. 1 ) then
97 itest = 0
98 icomptest = 0
99 irecwrk = 1
100 bjwrk = 1
101 biwrk = 1
102 kwrk = 1
103 iobcswrk = 1
104 jwrk = 1
105 iwrk = 1
106 else
107 itest = itestmem (ichknum-1)
108 icomptest = icompmem (ichknum-1)
109 irecwrk = irecmem (ichknum-1)
110 bjwrk = bjmem (ichknum-1)
111 biwrk = bimem (ichknum-1)
112 kwrk = klocmem (ichknum-1)
113 iobcswrk = iobcsmem (ichknum-1)
114 jwrk = jlocmem (ichknum-1)
115 iwrk = ilocmem (ichknum-1)
116 iwrk = iwrk + 1
117 end if
118
119 c-- set max loop index for obcs multiplicities
120 if ( ncvargrd(grdchkvarindex) .eq. 'm' ) then
121 nobcsmax = nobcs
122 else
123 nobcsmax = 1
124 endif
125
126 c-- Start to loop over records.
127 do irec = irecwrk, ncvarrecs(grdchkvarindex)
128 cph do iobcs = iobcswrk, nobcsmax
129 iobcs = MOD((irec-1),nobcsmax) + 1
130 do bj = bjwrk, jthi
131 do bi = biwrk, ithi
132 do k = kwrk, ncvarnrmax(grdchkvarindex)
133
134 if ( (ierr .ne. 0) .and.
135 & (icomp .gt. itest) .and.
136 & (icomp .le. itest + nwettile(bi,bj,k,iobcs))) then
137 icvrec = irec
138 itile = bi
139 jtile = bj
140
141 do j = jwrk, ncvarymax(grdchkvarindex)
142 do i = iwrk, ncvarxmax(grdchkvarindex)
143 if (ierr .ne. 0) then
144 if ( ncvargrd(grdchkvarindex) .eq. 'c' ) then
145 if ( maskC(i,j,k,bi,bj) .gt. 0.) then
146 icomptest = icomptest + 1
147 endif
148 else if ( ncvargrd(grdchkvarindex) .eq. 's' ) then
149 if ( _maskS(i,j,k,bi,bj) .gt. 0.) then
150 icomptest = icomptest + 1
151 endif
152 else if ( ncvargrd(grdchkvarindex) .eq. 'w' ) then
153 if ( _maskW(i,j,k,bi,bj) .gt. 0.) then
154 icomptest = icomptest + 1
155 endif
156 else if ( ncvargrd(grdchkvarindex) .eq. 'm' ) then
157 if ( grdchkvarindex .EQ. 11 ) then
158 #ifdef ALLOW_OBCSN_CONTROL
159 if (grdchk_maskxz(i,k,bi,bj,iobcs) .gt. 0.) then
160 icomptest = icomptest + 1
161 endif
162 #endif
163 else if ( grdchkvarindex .EQ. 12 ) then
164 #ifdef ALLOW_OBCSS_CONTROL
165 if (grdchk_maskxz(i,k,bi,bj,iobcs) .gt. 0.) then
166 icomptest = icomptest + 1
167 endif
168 #endif
169 else if ( grdchkvarindex .EQ. 13 ) then
170 #ifdef ALLOW_OBCSW_CONTROL
171 if (grdchk_maskyz(j,k,bi,bj,iobcs) .gt. 0.) then
172 icomptest = icomptest + 1
173 endif
174 #endif
175 else if ( grdchkvarindex .EQ. 14 ) then
176 #ifdef ALLOW_OBCSE_CONTROL
177 if (grdchk_maskyz(j,k,bi,bj,iobcs) .gt. 0.) then
178 icomptest = icomptest + 1
179 endif
180 #endif
181 endif
182 endif
183 if ( icomp .eq. icomptest ) then
184 itilepos = i
185 jtilepos = j
186 layer = k
187 obcspos = iobcs
188 ierr = 0
189 endif
190 endif
191 enddo
192 iwrk = 1
193 enddo
194 jwrk = 1
195 else if (ierr .NE. 0) then
196 itest = itest + nwettile(bi,bj,k,iobcs)
197 iwrk = 1
198 jwrk = 1
199 else
200 c
201 endif
202 c-- End of loop over k
203 enddo
204 kwrk = 1
205 c-- End of loop over bi
206 enddo
207 biwrk = 1
208 c-- End of loop over bj
209 enddo
210 bjwrk = 1
211 c-- End of loop over iobcs
212 cph enddo
213 cph iobcswrk = 1
214 c-- End of loop over irec records.
215 enddo
216 c
217 else
218 if ( icomp .gt. maxncvarcomps ) then
219 c-- Such a component does not exist.
220 ierr = -4
221 icvrec = -1
222 jtile = -1
223 itile = -1
224 layer = -1
225 obcspos = -1
226 jtilepos = -1
227 itilepos = -1
228 else
229 c-- The component is a land point.
230 ierr = -3
231 icvrec = -1
232 jtile = -1
233 itile = -1
234 layer = -1
235 obcspos = -1
236 jtilepos = -1
237 itilepos = -1
238 endif
239 endif
240 else
241 if ( icomp .lt. 0 ) then
242 c-- Such a component does not exist.
243 ierr = -2
244 icvrec = -1
245 jtile = -1
246 itile = -1
247 layer = -1
248 obcspos = -1
249 jtilepos = -1
250 itilepos = -1
251 else
252 c-- Component zero.
253 ierr = -1
254 icvrec = -1
255 jtile = -1
256 itile = -1
257 layer = -1
258 obcspos = -1
259 jtilepos = -1
260 itilepos = -1
261 endif
262 endif
263
264 _END_MASTER( mythid )
265
266 _BARRIER
267
268 #endif /* ALLOW_GRDCHK */
269
270 end
271

  ViewVC Help
Powered by ViewVC 1.1.22