50 |
C actualResidual - residual |
C actualResidual - residual |
51 |
C bi - Block index in X and Y. |
C bi - Block index in X and Y. |
52 |
C bj |
C bj |
53 |
C etaN - Used in computing search directions |
C eta_qrN - Used in computing search directions |
54 |
C etaNM1 suffix N and NM1 denote current and |
C eta_qrNM1 suffix N and NM1 denote current and |
55 |
C cgBeta previous iterations respectively. |
C cgBeta previous iterations respectively. |
56 |
C alpha |
C alpha |
57 |
C sumRHS - Sum of right-hand-side. Sometimes this is a |
C sumRHS - Sum of right-hand-side. Sometimes this is a |
65 |
INTEGER bi, bj |
INTEGER bi, bj |
66 |
INTEGER I, J, it2d |
INTEGER I, J, it2d |
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 |
88 |
|
|
89 |
|
|
90 |
C-- Initialise inverter |
C-- Initialise inverter |
91 |
etaNM1 = 1. _d 0 |
eta_qrNM1 = 1. _d 0 |
92 |
|
|
93 |
CcnhDebugStarts |
CcnhDebugStarts |
94 |
C _EXCH_XY_R8( cg2d_b, myThid ) |
C _EXCH_XY_R8( cg2d_b, myThid ) |
225 |
IF ( err .LT. cg2dTargetResidual ) GOTO 11 |
IF ( err .LT. cg2dTargetResidual ) GOTO 11 |
226 |
C-- Solve preconditioning equation and update |
C-- Solve preconditioning equation and update |
227 |
C-- conjugate direction vector "s". |
C-- conjugate direction vector "s". |
228 |
etaN = 0. _d 0 |
eta_qrN = 0. _d 0 |
229 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
230 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
231 |
DO J=1,sNy |
DO J=1,sNy |
239 |
CcnhDebugStarts |
CcnhDebugStarts |
240 |
C cg2d_q(I,J,bi,bj) = cg2d_r(I ,J ,bi,bj) |
C cg2d_q(I,J,bi,bj) = cg2d_r(I ,J ,bi,bj) |
241 |
CcnhDebugEnds |
CcnhDebugEnds |
242 |
etaN = etaN |
eta_qrN = eta_qrN |
243 |
& +cg2d_q(I,J,bi,bj)*cg2d_r(I,J,bi,bj) |
& +cg2d_q(I,J,bi,bj)*cg2d_r(I,J,bi,bj) |
244 |
ENDDO |
ENDDO |
245 |
ENDDO |
ENDDO |
246 |
ENDDO |
ENDDO |
247 |
ENDDO |
ENDDO |
248 |
|
|
249 |
_GLOBAL_SUM_R8(etaN, myThid) |
_GLOBAL_SUM_R8(eta_qrN, myThid) |
250 |
CcnhDebugStarts |
CcnhDebugStarts |
251 |
C WRITE(0,*) ' CG2D: Iteration ',it2d-1,' etaN = ',etaN |
C WRITE(0,*) ' CG2D: Iteration ',it2d-1,' eta_qrN = ',eta_qrN |
252 |
CcnhDebugEnds |
CcnhDebugEnds |
253 |
cgBeta = etaN/etaNM1 |
cgBeta = eta_qrN/eta_qrNM1 |
254 |
CcnhDebugStarts |
CcnhDebugStarts |
255 |
C WRITE(0,*) ' CG2D: Iteration ',it2d-1,' beta = ',cgBeta |
C WRITE(0,*) ' CG2D: Iteration ',it2d-1,' beta = ',cgBeta |
256 |
CcnhDebugEnds |
CcnhDebugEnds |
257 |
etaNM1 = etaN |
eta_qrNM1 = eta_qrN |
258 |
|
|
259 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
260 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
313 |
CcnhDebugStarts |
CcnhDebugStarts |
314 |
C WRITE(0,*) ' CG2D: Iteration ',it2d-1,' SUM(s*q)= ',alpha |
C WRITE(0,*) ' CG2D: Iteration ',it2d-1,' SUM(s*q)= ',alpha |
315 |
CcnhDebugEnds |
CcnhDebugEnds |
316 |
alpha = etaN/alpha |
alpha = eta_qrN/alpha |
317 |
CcnhDebugStarts |
CcnhDebugStarts |
318 |
C WRITE(0,*) ' CG2D: Iteration ',it2d-1,' alpha= ',alpha |
C WRITE(0,*) ' CG2D: Iteration ',it2d-1,' alpha= ',alpha |
319 |
CcnhDebugEnds |
CcnhDebugEnds |