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

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

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


Revision 1.1 - (show annotations) (download)
Tue Mar 23 19:42:53 2004 UTC (20 years, 2 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint57t_post, checkpoint57o_post, checkpoint57v_post, checkpoint52n_post, checkpoint53d_post, checkpoint54a_pre, checkpoint57m_post, checkpoint55c_post, checkpoint54e_post, checkpoint57s_post, checkpoint54a_post, checkpoint53c_post, checkpoint57k_post, checkpoint55d_pre, checkpoint57d_post, checkpoint57g_post, checkpoint57b_post, checkpoint57c_pre, checkpoint55j_post, checkpoint56b_post, checkpoint57i_post, checkpoint57y_post, checkpoint57e_post, checkpoint55h_post, checkpoint57g_pre, checkpoint54b_post, checkpoint53b_pre, checkpoint55b_post, checkpoint54d_post, checkpoint56c_post, checkpoint52m_post, checkpoint57y_pre, checkpoint55, checkpoint53a_post, checkpoint57f_pre, checkpoint57a_post, checkpoint54, checkpoint54f_post, checkpoint53b_post, checkpoint55g_post, checkpoint55f_post, checkpoint57r_post, checkpoint58, checkpoint57a_pre, checkpoint55i_post, checkpoint57, checkpoint56, checkpoint53, eckpoint57e_pre, checkpoint57h_done, checkpoint53g_post, checkpoint57x_post, checkpoint57n_post, checkpoint58d_post, checkpoint58c_post, checkpoint57w_post, checkpoint57p_post, checkpint57u_post, checkpoint57f_post, checkpoint58a_post, checkpoint57q_post, checkpoint57z_post, checkpoint57c_post, checkpoint55e_post, checkpoint53f_post, checkpoint55a_post, checkpoint53d_pre, checkpoint54c_post, checkpoint57j_post, checkpoint58b_post, checkpoint57h_pre, checkpoint57l_post, checkpoint57h_post, checkpoint56a_post, checkpoint55d_post
Added functionality to grdchk:
pick global i,j,k position (or nearest wet) where to perform check.

1 C $Header: /u/gcmpack/MITgcm/pkg/grdchk/grdchk_loc.F,v 1.8 2003/11/04 20:47:42 heimbach Exp $
2
3 #include "CTRL_CPPOPTIONS.h"
4
5 subroutine grdchk_get_position( mythid )
6
7 c ==================================================================
8 c SUBROUTINE grdchk_loc
9 c ==================================================================
10 c
11 c o Get the location of a given component of the control vector for
12 c the current process.
13 c
14 c started: Christian Eckert eckert@mit.edu 04-Apr-2000
15 c continued: heimbach@mit.edu: 13-Jun-2001
16 c
17 c ==================================================================
18 c SUBROUTINE grdchk_loc
19 c ==================================================================
20
21 implicit none
22
23 c == global variables ==
24
25 #include "EEPARAMS.h"
26 #include "SIZE.h"
27 #include "GRID.h"
28 #include "ctrl.h"
29 #include "grdchk.h"
30
31 c == routine arguments ==
32
33 integer icvrec
34 integer jtile
35 integer itile
36 integer layer
37 integer obcspos
38 integer itilepos
39 integer jtilepos
40 integer itest
41 integer ierr
42 integer mythid
43
44 #ifdef ALLOW_GRDCHK
45 c == local variables ==
46
47 integer iG,jG
48 integer bi,bj
49 integer i,j,k
50 integer iobcs
51 integer biwrk,bjwrk
52 integer iwrk, jwrk, kwrk
53 integer iobcswrk
54 integer irec, irecwrk
55 integer itlo,ithi
56 integer jtlo,jthi
57 integer jmin,jmax
58 integer imin,imax
59 integer icomptest
60 integer nobcsmax
61 integer pastit
62
63 _RL wetlocal
64
65 c == end of interface ==
66
67 jtlo = 1
68 jthi = nsy
69 itlo = 1
70 ithi = nsx
71 jmin = 1
72 jmax = sny
73 imin = 1
74 imax = snx
75
76 _BEGIN_MASTER( mythid )
77
78 c-- determine proc. number from following assumptions
79
80 iG = INT(iGloPos/sNx) + 1
81 jG = INT(jGloPos/sNy) + 1
82 grdchkwhichproc = iG-1 + (jG-1)*nPx
83
84 itilepos = iGloPos - (iG-1)*sNx
85 jtilepos = jGloPos - (jG-1)*sNy
86 layer = kGloPos
87 obcspos = obcsglo
88 icvrec = recglo
89
90 if ( myProcId .EQ. grdchkwhichproc ) then
91
92 c initialise parameters
93 ierr = -5
94 pastit = -1
95 wetlocal = 0
96
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
107 c-- set max loop index for obcs multiplicities
108 if ( ncvargrd(grdchkvarindex) .eq. 'm' ) then
109 nobcsmax = nobcs
110 else
111 nobcsmax = 1
112 endif
113
114 c-- Start to loop over records.
115 do irec = irecwrk, ncvarrecs(grdchkvarindex)
116 iobcs = MOD((irec-1),nobcsmax) + 1
117 do bj = bjwrk, jthi
118 do bi = biwrk, ithi
119 do k = kwrk, ncvarnrmax(grdchkvarindex)
120
121 if ( ierr .ne. 0 ) then
122 icvrec = irec
123 itile = bi
124 jtile = bj
125
126 do j = jwrk, ncvarymax(grdchkvarindex)
127 do i = iwrk, ncvarxmax(grdchkvarindex)
128 if (ierr .ne. 0) then
129 if ( ncvargrd(grdchkvarindex) .eq. 'c' ) then
130 if ( maskC(i,j,k,bi,bj) .gt. 0.) then
131 icomptest = icomptest + 1
132 endif
133 wetlocal = maskC(i,j,k,bi,bj)
134 else if ( ncvargrd(grdchkvarindex) .eq. 's' ) then
135 if ( _maskS(i,j,k,bi,bj) .gt. 0.) then
136 icomptest = icomptest + 1
137 endif
138 wetlocal = _maskS(i,j,k,bi,bj)
139 else if ( ncvargrd(grdchkvarindex) .eq. 'w' ) then
140 if ( _maskW(i,j,k,bi,bj) .gt. 0.) then
141 icomptest = icomptest + 1
142 endif
143 wetlocal = _maskW(i,j,k,bi,bj)
144 else if ( ncvargrd(grdchkvarindex) .eq. 'm' ) then
145 if ( grdchkvarindex .EQ. 11 ) then
146 #ifdef ALLOW_OBCSN_CONTROL
147 if (grdchk_maskxz(i,k,bi,bj,iobcs) .gt. 0.) then
148 icomptest = icomptest + 1
149 endif
150 wetlocal = grdchk_maskxz(i,k,bi,bj,iobcs)
151 #endif
152 else if ( grdchkvarindex .EQ. 12 ) then
153 #ifdef ALLOW_OBCSS_CONTROL
154 if (grdchk_maskxz(i,k,bi,bj,iobcs) .gt. 0.) then
155 icomptest = icomptest + 1
156 endif
157 wetlocal = grdchk_maskxz(i,k,bi,bj,iobcs)
158 #endif
159 else if ( grdchkvarindex .EQ. 13 ) then
160 #ifdef ALLOW_OBCSW_CONTROL
161 if (grdchk_maskyz(j,k,bi,bj,iobcs) .gt. 0.) then
162 icomptest = icomptest + 1
163 endif
164 wetlocal = grdchk_maskyz(j,k,bi,bj,iobcs)
165 #endif
166 else if ( grdchkvarindex .EQ. 14 ) then
167 #ifdef ALLOW_OBCSE_CONTROL
168 if (grdchk_maskyz(j,k,bi,bj,iobcs) .gt. 0.) then
169 icomptest = icomptest + 1
170 endif
171 wetlocal = grdchk_maskyz(j,k,bi,bj,iobcs)
172 #endif
173 endif
174 endif
175 c
176 if ( i .EQ. itilepos .AND.
177 & j .EQ. jtilepos .AND.
178 & k .EQ. layer .AND.
179 & iobcs .EQ. obcspos .AND.
180 & irec .EQ. icvrec ) then
181 pastit = 0
182 if ( wetlocal .NE.0 ) then
183 nbeg = icomptest
184 nend = nbeg + nend
185 ierr = 0
186 print '(a,6I5)',
187 & ' grad-res exact position met: '
188 print '(a,7I5)',
189 & ' grad-res ', grdchkwhichproc,
190 & nbeg, itilepos, jtilepos, layer,
191 & iG, jG
192 endif
193 else if ( pastit .EQ. 0 .AND.
194 & wetlocal .NE.0 ) then
195 nbeg = icomptest
196 nend = nbeg + nend
197 ierr = 0
198 print '(a,6I5)',
199 & ' grad-res closest next position: '
200 print '(a,7I5)',
201 & ' grad-res ', grdchkwhichproc,
202 & nbeg, itilepos, jtilepos, layer,
203 & iG, jG
204 endif
205 c
206 endif
207 enddo
208 iwrk = 1
209 enddo
210 jwrk = 1
211 else if (ierr .NE. 0) then
212 itest = itest + nwettile(bi,bj,k,iobcs)
213 iwrk = 1
214 jwrk = 1
215 endif
216 c-- End of loop over k
217 enddo
218 kwrk = 1
219 c-- End of loop over bi
220 enddo
221 biwrk = 1
222 c-- End of loop over bj
223 enddo
224 bjwrk = 1
225 c-- End of loop over iobcs
226 cph enddo
227 cph iobcswrk = 1
228 c-- End of loop over irec records.
229 enddo
230
231 c-- End of if myProcId statement
232 endif
233
234 _END_MASTER( mythid )
235
236 _BARRIER
237
238 #endif /* ALLOW_GRDCHK */
239
240 end
241

  ViewVC Help
Powered by ViewVC 1.1.22