/[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.5 - (show annotations) (download)
Tue Oct 9 00:05:45 2007 UTC (16 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint60, checkpoint61, checkpoint62, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59k, checkpoint59j, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62x, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.4: +7 -6 lines
add missing cvs $Header:$ or $Name:$

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

  ViewVC Help
Powered by ViewVC 1.1.22