/[MITgcm]/MITgcm/model/src/ini_cg2d.F
ViewVC logotype

Diff of /MITgcm/model/src/ini_cg2d.F

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

revision 1.3 by cnh, Sun Apr 26 23:41:54 1998 UTC revision 1.4 by cnh, Thu May 21 18:26:36 1998 UTC
# Line 37  C     myNorm - Work variable used in clc Line 37  C     myNorm - Work variable used in clc
37        INTEGER I,  J, K        INTEGER I,  J, K
38        real    faceArea        real    faceArea
39        _RL     myNorm        _RL     myNorm
40          _RL     aC, aCw, aCs
41    
42  C--   Initialise laplace operator  C--   Initialise laplace operator
43  C     aW2d: integral in Z Ax/dX  C     aW2d: integral in Z Ax/dX
# Line 110  C     CALL PLOT_FIELD_XYR8( aS2d, 'AS2D Line 111  C     CALL PLOT_FIELD_XYR8( aS2d, 'AS2D
111  CcnhDebugEnds  CcnhDebugEnds
112    
113  C--   Initialise preconditioner  C--   Initialise preconditioner
114    C     Note. 20th May 1998
115    C           I made a weird discovery! In the model paper we argue
116    C           for the form of the preconditioner used here ( see
117    C           A Finite-volume, Incompressible Navier-Stokes Model
118    C           ...., Marshall et. al ). The algebra gives a simple
119    C           0.5 factor for the averaging of ac and aCw to get a
120    C           symmettric pre-conditioner. By using a factor of 0.51
121    C           i.e. scaling the off-diagonal terms in the
122    C           preconditioner down slightly I managed to get the
123    C           number of iterations for convergence in a test case to
124    C           drop form 192 -> 134! Need to investigate this further!
125    C           For now I have introduced a parameter cg2dpcOffDFac which
126    C           defaults to 0.51 but can be set at runtime.
127        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
128         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
129          DO J=1,sNy          DO J=1,sNy
130           DO I=1,sNx           DO I=1,sNx
131            pC(I,J,bi,bj) = 1. _d 0            pC(I,J,bi,bj) = 1. _d 0
132            IF (            aC = -(
133       &     aW2d(I,J,bi,bj) + aW2d(I+1,J,bi,bj)       &     aW2d(I,J,bi,bj) + aW2d(I+1,J  ,bi,bj)
134       &    +aS2d(I,J,bi,bj) + aS2D(I,J+1,bi,bj)       &    +aS2d(I,J,bi,bj) + aS2D(I  ,J+1,bi,bj)
135       &     .EQ. 0.       &    )
136       &       )  pC(I,J,bi,bj) = 0. _d 0            aCs = -(
137            pW(I,J,bi,bj) = 0.       &     aW2d(I,J-1,bi,bj) + aW2d(I+1,J-1,bi,bj)
138            pS(I,J,bi,bj) = 0.       &    +aS2d(I,J-1,bi,bj) + aS2d(I  ,J  ,bi,bj)
139         &    )
140              aCw = -(
141         &     aW2d(I-1,J,bi,bj) + aW2d(I  ,J  ,bi,bj)
142         &    +aS2d(I-1,J,bi,bj) + aS2d(I-1,J+1,bi,bj)
143         &    )
144              IF ( aC .EQ. 0. ) THEN
145                pC(I,J,bi,bj) = 0. _d 0
146              ELSE
147               pC(I,J,bi,bj) =  1. _d 0 / aC
148              ENDIF
149              IF ( aC + aCw .EQ. 0. ) THEN
150               pW(I,J,bi,bj) = 0.
151              ELSE
152               pW(I,J,bi,bj) =
153         &     -aW2d(I  ,J  ,bi,bj)/((cg2dpcOffDFac *(aCw+aC))**2 )
154              ENDIF
155              IF ( aC + aCs .EQ. 0. ) THEN
156               pS(I,J,bi,bj) = 0.
157              ELSE
158               pS(I,J,bi,bj) =
159         &     -aS2d(I  ,J  ,bi,bj)/((cg2dpcOffDFac *(aCs+aC))**2 )
160              ENDIF
161           ENDDO           ENDDO
162          ENDDO          ENDDO
163         ENDDO         ENDDO
# Line 132  C--   Update overlap regions Line 168  C--   Update overlap regions
168        _EXCH_XY_R4(pS, myThid)        _EXCH_XY_R4(pS, myThid)
169    
170  C--   Set default values for initial guess  C--   Set default values for initial guess
171        DO bj=myByLo(myThid),myByHi(myThid)        IF ( startTime .EQ. 0 ) THEN
172         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bj=myByLo(myThid),myByHi(myThid)
173          DO J=1,sNy          DO bi=myBxLo(myThid),myBxHi(myThid)
174           DO I=1,sNx           DO J=1,sNy
175            cg2d_x(I,J,bi,bj) = 0. _d 0            DO I=1,sNx
176               cg2d_x(I,J,bi,bj) = 0. _d 0
177              ENDDO
178           ENDDO           ENDDO
179          ENDDO          ENDDO
180         ENDDO         ENDDO
181        ENDDO  C--    Update overlap regions
182  C--   Update overlap regions         _EXCH_XY_R8(cg2d_x, myThid)
183        _EXCH_XY_R8(cg2d_x, myThid)        ENDIF
184    
185        RETURN        RETURN
186        END        END

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.22