49 |
C actualResidual - residual |
C actualResidual - residual |
50 |
C bi - Block index in X and Y. |
C bi - Block index in X and Y. |
51 |
C bj |
C bj |
52 |
C etaN - Used in computing search directions |
C eta_qrN - Used in computing search directions |
53 |
C etaNM1 suffix N and NM1 denote current and |
C eta_qrNM1 suffix N and NM1 denote current and |
54 |
C cgBeta previous iterations respectively. |
C cgBeta previous iterations respectively. |
55 |
C alpha |
C alpha |
56 |
C sumRHS - Sum of right-hand-side. Sometimes this is a |
C sumRHS - Sum of right-hand-side. Sometimes this is a |
65 |
INTEGER I, J, K, it3d |
INTEGER I, J, K, it3d |
66 |
INTEGER KM1, KP1 |
INTEGER KM1, KP1 |
67 |
_RL err |
_RL err |
68 |
_RL etaN |
_RL eta_qrN |
69 |
_RL etaNM1 |
_RL eta_qrNM1 |
70 |
_RL cgBeta |
_RL cgBeta |
71 |
_RL alpha |
_RL alpha |
72 |
_RL sumRHS |
_RL sumRHS |
83 |
_RL topLevFac |
_RL topLevFac |
84 |
|
|
85 |
C-- Initialise inverter |
C-- Initialise inverter |
86 |
etaNM1 = 1. D0 |
eta_qrNM1 = 1. D0 |
87 |
|
|
88 |
C-- Normalise RHS |
C-- Normalise RHS |
89 |
rhsMax = 0. _d 0 |
rhsMax = 0. _d 0 |
270 |
C Note. On the next to loops over all tiles the inner loop ranges |
C Note. On the next to loops over all tiles the inner loop ranges |
271 |
C in sNx and sNy are expanded by 1 to avoid a communication |
C in sNx and sNy are expanded by 1 to avoid a communication |
272 |
C step. However this entails a bit of gynamastics because we only |
C step. However this entails a bit of gynamastics because we only |
273 |
C want etaN for the interior points. |
C want eta_qrN for the interior points. |
274 |
etaN = 0. _d 0 |
eta_qrN = 0. _d 0 |
275 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
276 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
277 |
DO K=1,1 |
DO K=1,1 |
303 |
caja ENDIF |
caja ENDIF |
304 |
DO J=1,sNy |
DO J=1,sNy |
305 |
DO I=1,sNx |
DO I=1,sNx |
306 |
etaN = etaN |
eta_qrN = eta_qrN |
307 |
& +cg3d_q(I,J,K,bi,bj)*cg3d_r(I,J,K,bi,bj) |
& +cg3d_q(I,J,K,bi,bj)*cg3d_r(I,J,K,bi,bj) |
308 |
ENDDO |
ENDDO |
309 |
ENDDO |
ENDDO |
318 |
ENDDO |
ENDDO |
319 |
DO J=1,sNy |
DO J=1,sNy |
320 |
DO I=1,sNx |
DO I=1,sNx |
321 |
etaN = etaN |
eta_qrN = eta_qrN |
322 |
& +cg3d_q(I,J,K,bi,bj)*cg3d_r(I,J,K,bi,bj) |
& +cg3d_q(I,J,K,bi,bj)*cg3d_r(I,J,K,bi,bj) |
323 |
ENDDO |
ENDDO |
324 |
ENDDO |
ENDDO |
326 |
ENDDO |
ENDDO |
327 |
ENDDO |
ENDDO |
328 |
caja |
caja |
329 |
caja etaN=0. |
caja eta_qrN=0. |
330 |
caja DO bj=myByLo(myThid),myByHi(myThid) |
caja DO bj=myByLo(myThid),myByHi(myThid) |
331 |
caja DO bi=myBxLo(myThid),myBxHi(myThid) |
caja DO bi=myBxLo(myThid),myBxHi(myThid) |
332 |
caja DO K=1,Nr |
caja DO K=1,Nr |
333 |
caja DO J=1,sNy |
caja DO J=1,sNy |
334 |
caja DO I=1,sNx |
caja DO I=1,sNx |
335 |
caja etaN = etaN |
caja eta_qrN = eta_qrN |
336 |
caja & +cg3d_q(I,J,K,bi,bj)*cg3d_r(I,J,K,bi,bj) |
caja & +cg3d_q(I,J,K,bi,bj)*cg3d_r(I,J,K,bi,bj) |
337 |
caja ENDDO |
caja ENDDO |
338 |
caja ENDDO |
caja ENDDO |
341 |
caja ENDDO |
caja ENDDO |
342 |
caja |
caja |
343 |
|
|
344 |
_GLOBAL_SUM_R8(etaN, myThid) |
_GLOBAL_SUM_R8(eta_qrN, myThid) |
345 |
CcnhDebugStarts |
CcnhDebugStarts |
346 |
C WRITE(0,*) ' CG3D: Iteration ',it3d-1,' etaN = ',etaN |
C WRITE(0,*) ' CG3D: Iteration ',it3d-1,' eta_qrN = ',eta_qrN |
347 |
CcnhDebugEnds |
CcnhDebugEnds |
348 |
cgBeta = etaN/etaNM1 |
cgBeta = eta_qrN/eta_qrNM1 |
349 |
CcnhDebugStarts |
CcnhDebugStarts |
350 |
C WRITE(0,*) ' CG3D: Iteration ',it3d-1,' beta = ',cgBeta |
C WRITE(0,*) ' CG3D: Iteration ',it3d-1,' beta = ',cgBeta |
351 |
CcnhDebugEnds |
CcnhDebugEnds |
352 |
etaNM1 = etaN |
eta_qrNM1 = eta_qrN |
353 |
|
|
354 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
355 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
456 |
CcnhDebugStarts |
CcnhDebugStarts |
457 |
C WRITE(0,*) ' CG3D: Iteration ',it3d-1,' SUM(s*q)= ',alpha |
C WRITE(0,*) ' CG3D: Iteration ',it3d-1,' SUM(s*q)= ',alpha |
458 |
CcnhDebugEnds |
CcnhDebugEnds |
459 |
alpha = etaN/alpha |
alpha = eta_qrN/alpha |
460 |
CcnhDebugStarts |
CcnhDebugStarts |
461 |
C WRITE(0,*) ' CG3D: Iteration ',it3d-1,' alpha= ',alpha |
C WRITE(0,*) ' CG3D: Iteration ',it3d-1,' alpha= ',alpha |
462 |
CcnhDebugEnds |
CcnhDebugEnds |