Debian Codegraph @

debian/external_deps/fetk/punc/src/pmg/src_f77/buildAd.f

raw
1 c* ///////////////////////////////////////////////////////////////////////////
2 c* @file buildAd.f
3 c* @author Michael Holst
4 c* @brief PDE Discretization routines.
5 c* @version $Id: buildAd.f,v 1.2 2010/08/12 05:45:30 fetk Exp $
6 c* @attention
7 c* @verbatim
8 c*
9 c* PMG -- Parallel algebraic MultiGrid
10 c* Copyright (C) 1994-- Michael Holst.
11 c*
12 c* Michael Holst <[email protected]>
13 c* University of California, San Diego
14 c* Department of Mathematics, 5739 AP&M
15 c* 9500 Gilman Drive, Dept. 0112
16 c* La Jolla, CA 92093-0112 USA
17 c* http://math.ucsd.edu/~mholst
18 c*
19 c* This file is part of PMG.
20 c*
21 c* PMG is free software; you can redistribute it and/or modify
22 c* it under the terms of the GNU General Public License as published by
23 c* the Free Software Foundation; either version 2 of the License, or
24 c* (at your option) any later version.
25 c*
26 c* PMG is distributed in the hope that it will be useful,
27 c* but WITHOUT ANY WARRANTY; without even the implied warranty of
28 c* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 c* GNU General Public License for more details.
30 c*
31 c* You should have received a copy of the GNU General Public License
32 c* along with PMG; if not, write to the Free Software
33 c* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 c*
35 c* Linking PMG statically or dynamically with other modules is making a
36 c* combined work based on PMG. Thus, the terms and conditions of the GNU
37 c* General Public License cover the whole combination.
38 c*
39 c* SPECIAL GPL EXCEPTION
40 c* In addition, as a special exception, the copyright holders of PMG
41 c* give you permission to combine the PMG program with free software
42 c* programs and libraries that are released under the GNU LGPL or with
43 c* code included in releases of ISIM, PMV, PyMOL, SMOL, VMD, and Vision.
44 c* Such combined software may be linked with PMG and redistributed together
45 c* in original or modified form as mere aggregation without requirement that
46 c* the entire work be under the scope of the GNU General Public License.
47 c* This special exception permission is also extended to any software listed
48 c* in the SPECIAL GPL EXCEPTION clauses by the FEtk and APBS libraries.
49 c*
50 c* Note that people who make modified versions of PMG are not obligated
51 c* to grant this special exception for their modified versions; it is
52 c* their choice whether to do so. The GNU General Public License gives
53 c* permission to release a modified version without this exception; this
54 c* exception also makes it possible to release a modified version which
55 c* carries forward this exception.
56 c*
57 c* @endverbatim
58 c* ///////////////////////////////////////////////////////////////////////////
59
60 subroutine buildA (nx,ny,nz,ipkey,mgdisc,numdia,
61 2 ipc,rpc,ac,cc,fc,
62 3 xf,yf,zf,gxcf,gycf,gzcf,a1cf,a2cf,a3cf,ccf,fcf)
63 c* *********************************************************************
64 c* purpose:
65 c*
66 c* break the matrix data-structure into diagonals
67 c* and then call the matrix build routine.
68 c*
69 c* author: michael holst
70 c* *********************************************************************
71 implicit none
72 integer ipc(*),nx,ny,nz,ipkey,mgdisc,numdia
73 double precision rpc(*),ac(nx*ny*nz,*),cc(*),fc(*)
74 double precision xf(*),yf(*),zf(*),gxcf(*),gycf(*),gzcf(*)
75 double precision a1cf(*),a2cf(*),a3cf(*),ccf(*),fcf(*)
76 c*
77 cmdir 0 0
78 c*
79 c* *** call the build routine ***
80 if (mgdisc .eq. 0) then
81 print*,'% BUILDA: (BOX) performing discretization...'
82 call buildA_fv (nx,ny,nz,ipkey,numdia,
83 2 ipc,rpc,ac(1,1),cc,fc,
84 3 ac(1,2),ac(1,3),ac(1,4),
85 4 xf,yf,zf,gxcf,gycf,gzcf,a1cf,a2cf,a3cf,ccf,fcf)
86 elseif (mgdisc .eq. 1) then
87 print*,'% BUILDA: (FEM) performing discretization...'
88 call buildA_fe (nx,ny,nz,ipkey,numdia,
89 2 ipc,rpc,ac(1,1),cc,fc,
90 3 ac(1,2),ac(1,3),ac(1,4),ac(1,5),ac(1,6),ac(1,7),ac(1,8),
91 4 ac(1,9),ac(1,10),ac(1,11),ac(1,12),ac(1,13),ac(1,14),
92 5 xf,yf,zf,gxcf,gycf,gzcf,a1cf,a2cf,a3cf,ccf,fcf)
93 else
94 print*,'% BUILDA: invalid discretization requested...'
95 endif
96 c*
97 c* *** return and end ***
98 return
99 end
100 subroutine buildA_fv (nx,ny,nz,ipkey,numdia,
101 2 ipc,rpc,oC,cc,fc,
102 3 oE,oN,uC,
103 4 xf,yf,zf,gxcf,gycf,gzcf,a1cf,a2cf,a3cf,ccf,fcf)
104 c* *********************************************************************
105 c* purpose:
106 c*
107 c* box method (finite volume) discretization of a 3d pde on a
108 c* tensor product (axi-parallel) three-dimensional mesh.
109 c*
110 c* this subroutine discretizes the elliptic boundary value problem:
111 c*
112 c* lu = f, u in omega
113 c* u = g, u on boundary of omega
114 c*
115 c* the multigrid code requires the operator in the form:
116 c*
117 c* - \nabla \cdot (a \nabla u) + b \cdot u + c u = f
118 c*
119 c* or:
120 c*
121 c* lu = (a11 u_x)_x + (a22 u_y)_y + (a33 u_z)_z
122 c* + b1 u_x + b2 u_y + b3 u_z + c u
123 c*
124 c* here, we consider only the case: b=b1=b2=b3=0.
125 c* then we assume:
126 c*
127 c* the tensor a=diag(a11,a22,a33) has components which are
128 c* then scalar functions, a11(x,y,z),a22(x,y,z),a33(x,y,z)
129 c* and the functions c(x,y,z) and f(x,y,z) are also scalar.
130 c* functions. All are allowed to be possibly discontinuous on
131 c* omega (the discontinuities must be along grid lines on fine grid).
132 c* the boundary function g(x,y,z) is smooth on boundary of omega.
133 c*
134 c* we will take the following conventions:
135 c* (north,south,east,west refers to x-y plane.
136 c* up/down refers to the z-axis)
137 c* (u(x+h_x,y,z) = u^+ (east neighbor of u(x,y,z))
138 c* (u(x-h_x,y,z) = u^- (west neighbor of u(x,y,z))
139 c* (u(x,y+h_y,z) = u_+ (north neighbor of u(x,y,z))
140 c* (u(x,y-h_y,z) = u_- (south neighbor of u(x,y,z))
141 c* (u(x,y,z+h_z) = u.+ (up neighbor of u(x,y,z))
142 c* (u(x,y,z-h_z) = u.- (down neighbor u(x,y,z))
143 c*
144 c* below, we will denote:
145 c* u(x+h_x,y,z) as u^+
146 c* u(x+(1/2)h_x,y,z) as u^++
147 c* u(x-h_x,y,z) as u^+
148 c* u(x-(1/2)h_x,y,z) as u^--
149 c* and similarly for u_-,u_--,u_+,u_++,u.-,u.--,u.+,u.++.
150 c*
151 c* we use the 3d analogue of the box method (see varga, pg. 191)
152 c* which results in the following difference scheme:
153 c*
154 c* u : [ + (a11^++ + a11^--) * (h_y*h_z/h_x)
155 c* + (a22_++ + a22_--) * (h_x*h_z/h_y)
156 c* + (a33.++ + a33.--) * (h_x*h_y/h_z)
157 c* + c * (h_x*h_y*h_z) ] u
158 c* u^+ (e nbr) : [ - (a11^++) * (h_y*h_z/h_x) ]
159 c* u^_ (w nbr) : [ - (a11^--) * (h_y*h_z/h_x) ]
160 c* u_+ (n nbr) : [ - (a22_++) * (h_x*h_z/h_y) ]
161 c* u_- (s nbr) : [ - (a22_--) * (h_x*h_z/h_y) ]
162 c* u.+ (u nbr) : [ - (a33.++) * (h_x*h_y/h_z) ]
163 c* u.- (d nbr) : [ - (a33.--) * (h_x*h_y/h_z) ]
164 c* f : [ h_x*h_y*h_z ] f
165 c*
166 c* note: fast way to do a conditional: we wish to set (a=coef),
167 c* unless we are on the (z=0)-boundary, which occurs with k=1:
168 c*
169 c* coef = ...etc...
170 c* ike = min0(1,iabs(k-1))
171 c* a (index1) = (ike)*coef
172 c* b(index2) = b(index2) - (1-ike)*coef*bnd_data
173 c*
174 c* author: michael holst
175 c* *********************************************************************
176 implicit none
177 integer ipc(*),nx,ny,nz,i,j,k,ike,jke,kke
178 integer nxm1,nym1,nzm1,ipkey,numdia
179 double precision hx,hy,hz
180 double precision hxm1,hym1,hzm1,coef_fc
181 double precision bc_cond_e,bc_cond_w,bc_cond_n,bc_cond_s
182 double precision bc_cond_u,bc_cond_d
183 double precision coef_oE,coef_oN,coef_uC
184 double precision coef_oEm1,coef_oNm1,coef_uCm1
185 double precision diag
186 double precision a1cf(nx,ny,nz),a2cf(nx,ny,nz),a3cf(nx,ny,nz)
187 double precision ccf(nx,ny,nz),fcf(nx,ny,nz)
188 double precision rpc(*),oE(nx,ny,nz),oN(nx,ny,nz),uC(nx,ny,nz)
189 double precision cc(nx,ny,nz),fc(nx,ny,nz),oC(nx,ny,nz)
190 double precision gxcf(ny,nz,*),gycf(nx,nz,*),gzcf(nx,ny,*)
191 double precision xf(*),yf(*),zf(*)
192 c*
193 cmdir 0 0
194 c*
195 c* *** save the problem key with this operator ***
196 ipc(10) = ipkey
197 c*
198 c* *** note how many nonzeros in this discretization stencil
199 ipc(11) = 7
200 ipc(12) = 1
201 numdia = 4
202 c*
203 c* *** define n and determine number of mesh points ***
204 nxm1 = nx - 1
205 nym1 = ny - 1
206 nzm1 = nz - 1
207 c*
208 c* *** determine diag scale factor ***
209 c* *** (would like something close to ones on the main diagonal) ***
210 diag = 1.0d0
211 c*
212 c* *********************************************************************
213 c* *** interior points ***
214 c* *********************************************************************
215 c*
216 c* *** build the operator ***
217 cmdir 3 1
218 do 10 k = 2, nz-1
219 hzm1 = zf(k) - zf(k-1)
220 hz = zf(k+1) - zf(k)
221 cmdir 3 2
222 do 11 j = 2, ny-1
223 hym1 = yf(j) - yf(j-1)
224 hy = yf(j+1) - yf(j)
225 cmdir 3 3
226 do 12 i = 2, nx-1
227 hxm1 = xf(i) - xf(i-1)
228 hx = xf(i+1) - xf(i)
229 c*
230 c* *** some coefficients ***
231 coef_oE = diag * (hym1+hy)*(hzm1+hz)/(4.*hx)
232 coef_oEm1 = diag * (hym1+hy)*(hzm1+hz)/(4.*hxm1)
233 coef_oN = diag * (hxm1+hx)*(hzm1+hz)/(4.*hy)
234 coef_oNm1 = diag * (hxm1+hx)*(hzm1+hz)/(4.*hym1)
235 coef_uC = diag * (hxm1+hx)*(hym1+hy)/(4.*hz)
236 coef_uCm1 = diag * (hxm1+hx)*(hym1+hy)/(4.*hzm1)
237 coef_fc = diag * (hxm1+hx)*(hym1+hy)*(hzm1+hz)/8.
238 c*
239 c* *** the coefficient and source function ***
240 fc(i,j,k) = coef_fc * fcf(i,j,k)
241 cc(i,j,k) = coef_fc * ccf(i,j,k)
242 c*
243 c* *** the diagonal for matvecs and smoothings ***
244 oC(i,j,k) =
245 2 coef_oE * a1cf(i,j,k)
246 3 + coef_oEm1 * a1cf(i-1,j,k)
247 4 + coef_oN * a2cf(i,j,k)
248 5 + coef_oNm1 * a2cf(i,j-1,k)
249 6 + coef_uC * a3cf(i,j,k)
250 7 + coef_uCm1 * a3cf(i,j,k-1)
251 c*
252 c* *** east neighbor ***
253 ike = min0(1,iabs(i-nxm1))
254 oE(i,j,k) = ike *coef_oE*a1cf(i,j,k)
255 bc_cond_e = (1-ike)*coef_oE*a1cf(i,j,k)*gxcf(j,k,2)
256 fc(i,j,k) = fc(i,j,k) + bc_cond_e
257 c*
258 c* *** north neighbor ***
259 jke = min0(1,iabs(j-nym1))
260 oN(i,j,k) = jke *coef_oN*a2cf(i,j,k)
261 bc_cond_n = (1-jke)*coef_oN*a2cf(i,j,k)*gycf(i,k,2)
262 fc(i,j,k) = fc(i,j,k) + bc_cond_n
263 c*
264 c* *** up neighbor ***
265 kke = min0(1,iabs(k-nzm1))
266 uC(i,j,k) = kke *coef_uC*a3cf(i,j,k)
267 bc_cond_u = (1-kke)*coef_uC*a3cf(i,j,k)*gzcf(i,j,2)
268 fc(i,j,k) = fc(i,j,k) + bc_cond_u
269 c*
270 c* *** west neighbor (just handle b.c.) ***
271 ike = min0(1,iabs(i-2))
272 bc_cond_w = (1-ike)*coef_oEm1*a1cf(i-1,j,k)*gxcf(j,k,1)
273 fc(i,j,k) = fc(i,j,k) + bc_cond_w
274 c*
275 c* *** south neighbor (just handle b.c.) ***
276 jke = min0(1,iabs(j-2))
277 bc_cond_s = (1-jke)*coef_oNm1*a2cf(i,j-1,k)*gycf(i,k,1)
278 fc(i,j,k) = fc(i,j,k) + bc_cond_s
279 c*
280 c* *** down neighbor (just handle b.c.) ***
281 kke = min0(1,iabs(k-2))
282 bc_cond_d = (1-kke)*coef_uCm1*a3cf(i,j,k-1)*gzcf(i,j,1)
283 fc(i,j,k) = fc(i,j,k) + bc_cond_d
284 12 continue
285 11 continue
286 10 continue
287 c*
288 c* *** return and end ***
289 return
290 end
291 subroutine buildA_fe (nx,ny,nz,ipkey,numdia,
292 2 ipc,rpc,oC,cc,fc,
293 3 oE,oN,uC,oNE,oNW,uE,uW,uN,uS,uNE,uNW,uSE,uSW,
294 4 xf,yf,zf,gxcf,gycf,gzcf,a1cf,a2cf,a3cf,ccf,fcf)
295 c* *********************************************************************
296 c* purpose:
297 c*
298 c* finite element method discretization of a 3d pde on a
299 c* tensor product (axi-parallel) three-dimensional mesh.
300 c*
301 c* KEY RESTRICTION: the coefficients in the pde below must
302 c* be piecewise constant in the elements
303 c* for this discretization to be formally
304 c* correct.
305 c*
306 c* this subroutine discretizes the elliptic boundary value problem:
307 c*
308 c* lu = f, u in omega
309 c* u = g, u on boundary of omega
310 c*
311 c* the multigrid code requires the operator in the form:
312 c*
313 c* - \nabla \cdot (a \nabla u) + b \cdot u + c u = f
314 c*
315 c* or:
316 c*
317 c* lu = (a11 u_x)_x + (a22 u_y)_y + (a33 u_z)_z
318 c* + b1 u_x + b2 u_y + b3 u_z + c u
319 c*
320 c* here, we consider only the case: b=b1=b2=b3=0.
321 c* then we assume:
322 c*
323 c* the tensor a=diag(a11,a22,a33) has components which are
324 c* then scalar functions, a11(x,y,z),a22(x,y,z),a33(x,y,z)
325 c* and the functions c(x,y,z) and f(x,y,z) are also scalar.
326 c* functions. All are allowed to be possibly discontinuous on
327 c* omega (the discontinuities must be along grid lines on fine grid).
328 c* the boundary function g(x,y,z) is smooth on boundary of omega.
329 c*
330 c* we will take the following conventions:
331 c* (north,south,east,west refers to x-y plane.
332 c* up/down refers to the z-axis)
333 c* (u(x+h_x,y,z) = u^+ (east neighbor of u(x,y,z))
334 c* (u(x-h_x,y,z) = u^- (west neighbor of u(x,y,z))
335 c* (u(x,y+h_y,z) = u_+ (north neighbor of u(x,y,z))
336 c* (u(x,y-h_y,z) = u_- (south neighbor of u(x,y,z))
337 c* (u(x,y,z+h_z) = u.+ (up neighbor of u(x,y,z))
338 c* (u(x,y,z-h_z) = u.- (down neighbor u(x,y,z))
339 c*
340 c* below, we will denote:
341 c* u(x+h_x,y,z) as u^+
342 c* u(x+(1/2)h_x,y,z) as u^++
343 c* u(x-h_x,y,z) as u^+
344 c* u(x-(1/2)h_x,y,z) as u^--
345 c* and similarly for u_-,u_--,u_+,u_++,u.-,u.--,u.+,u.++.
346 c*
347 c* we use trilinear basis functions and hexahedral elements
348 c* to perform this standard finite element discretization,
349 c* which results in the following difference scheme:
350 c*
351 c* u : [ + (a11^++ + a11^--) * (h_y*h_z/h_x)
352 c* + (a22_++ + a22_--) * (h_x*h_z/h_y)
353 c* + (a33.++ + a33.--) * (h_x*h_y/h_z)
354 c* + c * (h_x*h_y*h_z) ] u
355 c* u^+ (e nbr) : [ - (a11^++) * (h_y*h_z/h_x) ]
356 c* u^_ (w nbr) : [ - (a11^--) * (h_y*h_z/h_x) ]
357 c* u_+ (n nbr) : [ - (a22_++) * (h_x*h_z/h_y) ]
358 c* u_- (s nbr) : [ - (a22_--) * (h_x*h_z/h_y) ]
359 c* u.+ (u nbr) : [ - (a33.++) * (h_x*h_y/h_z) ]
360 c* u.- (d nbr) : [ - (a33.--) * (h_x*h_y/h_z) ]
361 c* f : [ h_x*h_y*h_z ] f
362 c*
363 c* note: fast way to do a conditional: we wish to set (a=coef),
364 c* unless we are on the (z=0)-boundary, which occurs with k=1:
365 c*
366 c* coef = ...etc...
367 c* ike = min0(1,iabs(k-1))
368 c* a (index1) = (ike)*coef
369 c* b(index2) = b(index2) - (1-ike)*coef*bnd_data
370 c*
371 c* author: michael holst
372 c* *********************************************************************
373 implicit none
374 integer ipc(*),nx,ny,nz,i,j,k,ike,jke,kke
375 integer nxm1,nym1,nzm1,ipkey,numdia
376 double precision hx,hy,hz
377 double precision hxm1,hym1,hzm1,coef_fc,coef_uC
378 double precision diag
379 double precision a1cf(nx,ny,nz),a2cf(nx,ny,nz),a3cf(nx,ny,nz)
380 double precision ccf(nx,ny,nz),fcf(nx,ny,nz)
381 double precision rpc(*),oE(nx,ny,nz),oN(nx,ny,nz),uC(nx,ny,nz)
382 double precision oNE(nx,ny,nz),oNW(nx,ny,nz),uE(nx,ny,nz)
383 double precision uW(nx,ny,nz),uN(nx,ny,nz),uS(nx,ny,nz)
384 double precision uNE(nx,ny,nz),uNW(nx,ny,nz),uSE(nx,ny,nz)
385 double precision uSW(nx,ny,nz)
386 double precision cc(nx,ny,nz),fc(nx,ny,nz),oC(nx,ny,nz)
387 double precision gxcf(ny,nz,*),gycf(nx,nz,*),gzcf(nx,ny,*)
388 double precision xf(*),yf(*),zf(*)
389 c*
390 cmdir 0 0
391 c*
392 c* *** save the problem key with this operator ***
393 ipc(10) = ipkey
394 c*
395 c* *** note how many nonzeros in this discretization stencil
396 ipc(11) = 27
397 ipc(12) = 1
398 numdia = 14
399 c*
400 c* *** define n and determine number of mesh points ***
401 nxm1 = nx - 1
402 nym1 = ny - 1
403 nzm1 = nz - 1
404 c*
405 c* *** determine diag scale factor ***
406 c* *** (would like something close to ones on the main diagonal) ***
407 diag = 1.0d0
408 c*
409 c* *********************************************************************
410 c* *** interior points ***
411 c* *********************************************************************
412 c*
413 c* *** build the operator ***
414 cmdir 3 1
415 do 10 k = 2, nz-1
416 hzm1 = zf(k) - zf(k-1)
417 hz = zf(k+1) - zf(k)
418 cmdir 3 2
419 do 11 j = 2, ny-1
420 hym1 = yf(j) - yf(j-1)
421 hy = yf(j+1) - yf(j)
422 cmdir 3 3
423 do 12 i = 2, nx-1
424 hxm1 = xf(i) - xf(i-1)
425 hx = xf(i+1) - xf(i)
426 c*
427 c* *** some coefficients ***
428 coef_uC = hx * hy / (2.0d0 * hz)
429 coef_fc = hx * hy * hz
430 c*
431 c* *** the coefficient and source function ***
432 fc(i,j,k) = coef_fc * fcf(i,j,k)
433 cc(i,j,k) = coef_fc * ccf(i,j,k)
434 c*
435 c* *** the diagonal for matvecs and smoothings ***
436 oC(i,j,k) = coef_uC * 32.0d0 / 6.0d0
437 c*
438 c* *** east neighbor ***
439 ike = min0(1,iabs(i-nxm1))
440 oE(i,j,k) = 0
441 c*
442 c* *** north neighbor ***
443 jke = min0(1,iabs(j-nym1))
444 oN(i,j,k) = 0
445 c*
446 c* *** up neighbor ***
447 kke = min0(1,iabs(k-nzm1))
448 uC(i,j,k) = 0
449 c*
450 c* *** north-east neighbor ***
451 ike = min0(1,iabs(i-nxm1)) * min0(1,iabs(j-nym1))
452 oNE(i,j,k) = ike *coef_uC * 2.0d0 / 6.0d0
453 c*
454 c* *** north-west neighbor ***
455 ike = min0(1,iabs(i-2)) * min0(1,iabs(j-nym1))
456 oNW(i,j,k) = ike *coef_uC * 2.0d0 / 6.0d0
457 c*
458 c* *** up-east neighbor ***
459 ike = min0(1,iabs(i-nxm1)) * min0(1,iabs(k-nzm1))
460 uE(i,j,k) = ike *coef_uC * 2.0d0 / 6.0d0
461 c*
462 c* *** up-west neighbor ***
463 ike = min0(1,iabs(i-2)) * min0(1,iabs(k-nzm1))
464 uW(i,j,k) = ike *coef_uC * 2.0d0 / 6.0d0
465 c*
466 c* *** up-north neighbor ***
467 ike = min0(1,iabs(j-nym1)) * min0(1,iabs(k-nzm1))
468 uN(i,j,k) = ike *coef_uC * 2.0d0 / 6.0d0
469 c*
470 c* *** up-south neighbor ***
471 ike = min0(1,iabs(j-2)) * min0(1,iabs(k-nzm1))
472 uS(i,j,k) = ike *coef_uC * 2.0d0 / 6.0d0
473 c*
474 c* *** up-north-east neighbor ***
475 ike = min0(1,iabs(i-nxm1)) * min0(1,iabs(j-nym1))
476 2 * min0(1,iabs(k-nzm1))
477 uNE(i,j,k) = ike *coef_uC * 1.0d0 / 6.0d0
478 c*
479 c* *** up-north-west neighbor ***
480 ike = min0(1,iabs(i-2)) * min0(1,iabs(j-nym1))
481 2 * min0(1,iabs(k-nzm1))
482 uNW(i,j,k) = ike *coef_uC * 1.0d0 / 6.0d0
483 c*
484 c* *** up-south-east neighbor ***
485 ike = min0(1,iabs(i-nxm1)) * min0(1,iabs(j-2))
486 2 * min0(1,iabs(k-nzm1))
487 uSE(i,j,k) = ike *coef_uC * 1.0d0 / 6.0d0
488 c*
489 c* *** up-south-west neighbor ***
490 ike = min0(1,iabs(i-2)) * min0(1,iabs(j-2))
491 2 * min0(1,iabs(k-nzm1))
492 uSW(i,j,k) = ike *coef_uC * 1.0d0 / 6.0d0
493 c*
494 12 continue
495 11 continue
496 10 continue
497 c*
498 c* *** return and end ***
499 return
500 end