/[MITgcm]/MITgcm/pkg/seaice/seaice_jfnk.F
ViewVC logotype

Diff of /MITgcm/pkg/seaice/seaice_jfnk.F

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

revision 1.5 by mlosch, Wed Nov 7 09:56:23 2012 UTC revision 1.12 by mlosch, Mon Dec 17 10:08:16 2012 UTC
# Line 74  C     parameters to compute convergence Line 74  C     parameters to compute convergence
74  C      C    
75        _RL     recip_deltaT        _RL     recip_deltaT
76        LOGICAL JFNKconverged, krylovConverged        LOGICAL JFNKconverged, krylovConverged
77          LOGICAL writeNow
78        CHARACTER*(MAX_LEN_MBUF) msgBuf        CHARACTER*(MAX_LEN_MBUF) msgBuf
79  C  C
80  C     u/vIceRes :: residual of sea-ice momentum equations  C     u/vIceRes :: residual of sea-ice momentum equations
# Line 86  C     precomputed (= constant per Newton Line 87  C     precomputed (= constant per Newton
87  C     zeta, eta, and DWATN, press  C     zeta, eta, and DWATN, press
88        _RL zetaPre (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL zetaPre (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
89        _RL etaPre  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL etaPre  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
90          _RL etaZPre (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
91        _RL dwatPre (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL dwatPre (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
       _RL pressPre(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)  
92  CEOP  CEOP
93    
94  C     Initialise  C     Initialise
# Line 102  C     Initialise Line 103  C     Initialise
103        recip_deltaT        = 1. _d 0 / SEAICE_deltaTdyn        recip_deltaT        = 1. _d 0 / SEAICE_deltaTdyn
104    
105        iOutFGMRES=0        iOutFGMRES=0
106  C     iOutFgmres=1 gives a little bit of output  C     with iOutFgmres=1, seaice_fgmres prints the residual at each iteration
107        IF ( debugLevel.GE.debLevA .AND.        IF ( debugLevel.GE.debLevC .AND.
108       &     DIFFERENT_MULTIPLE( SEAICE_monFreq, myTime, deltaTClock ) )       &     DIFFERENT_MULTIPLE( SEAICE_monFreq, myTime, deltaTClock ) )
109       &     iOutFGMRES=1       &     iOutFGMRES=1
110    
# Line 143  C     variables DWATN, zeta, and eta) Line 144  C     variables DWATN, zeta, and eta)
144       I      uIce, vIce,       I      uIce, vIce,
145       O      uIceRes, vIceRes,       O      uIceRes, vIceRes,
146       I      newtonIter, 0, myTime, myIter, myThid )       I      newtonIter, 0, myTime, myIter, myThid )
147    C     probably not necessary, will be removed later:
148         CALL EXCH_UV_XY_RL( uIceRes, vIceRes,.TRUE.,myThid)         CALL EXCH_UV_XY_RL( uIceRes, vIceRes,.TRUE.,myThid)
149  C     local copies of precomputed coefficients that are to stay  C     local copies of precomputed coefficients that are to stay
150  C     constant for the preconditioner  C     constant for the preconditioner
# Line 150  C     constant for the preconditioner Line 152  C     constant for the preconditioner
152          DO bi=myBxLo(myThid),myBxHi(myThid)          DO bi=myBxLo(myThid),myBxHi(myThid)
153           DO j=1-Oly,sNy+Oly           DO j=1-Oly,sNy+Oly
154            DO i=1-Olx,sNx+Olx            DO i=1-Olx,sNx+Olx
155              zetaPre(I,J,bi,bj) =  zeta(I,J,bi,bj)             zetaPre(I,J,bi,bj) =  zeta(I,J,bi,bj)
156               etaPre(I,J,bi,bj) =   eta(I,J,bi,bj)              etaPre(I,J,bi,bj) =   eta(I,J,bi,bj)
157              dwatPre(I,J,bi,bj) = DWATN(I,J,bi,bj)             etaZPre(I,J,bi,bj) =  etaZ(I,J,bi,bj)
158             pressPre(I,J,bi,bj) = press(I,J,bi,bj)             dwatPre(I,J,bi,bj) = DWATN(I,J,bi,bj)
159            ENDDO            ENDDO
160           ENDDO           ENDDO
161          ENDDO          ENDDO
# Line 240  C     FGMRES returns iCode either asking Line 242  C     FGMRES returns iCode either asking
242  C     or product of matrix (Jacobian) times vector. For iCode = 0, terminate  C     or product of matrix (Jacobian) times vector. For iCode = 0, terminate
243  C     iteration  C     iteration
244           IF (iCode.EQ.1) THEN           IF (iCode.EQ.1) THEN
245  C     Call preconditioner  C     Call preconditioner
246            CALL SEAICE_PRECONDITIONER(            IF ( SOLV_MAX_ITERS .GT. 0 )
247         &         CALL SEAICE_PRECONDITIONER(
248       U         duIce, dvIce,       U         duIce, dvIce,
249       I         zetaPre, etaPre, dwatPre, pressPre,       I         zetaPre, etaPre, etaZpre, dwatPre,
250       I         newtonIter, krylovIter, myTime, myIter, myThid )       I         newtonIter, krylovIter, myTime, myIter, myThid )
251           ELSEIF (iCode.GE.2) THEN           ELSEIF (iCode.GE.2) THEN
252  C     Compute Jacobian times vector  C     Compute Jacobian times vector
# Line 292  C     end of Newton iterate Line 295  C     end of Newton iterate
295  C  C
296  C--   Output diagnostics  C--   Output diagnostics
297  C  C
298          IF ( SEAICE_monFreq .GT. 0. _d 0 ) THEN
299  C     Count iterations  C     Count iterations
300        totalJFNKtimeSteps = totalJFNKtimeSteps + 1         totalJFNKtimeSteps = totalJFNKtimeSteps + 1
301        totalNewtonIters   = totalNewtonIters + newtonIter         totalNewtonIters   = totalNewtonIters + newtonIter
302        totalKrylovIters   = totalKrylovIters + totalKrylovItersLoc         totalKrylovIters   = totalKrylovIters + totalKrylovItersLoc
303  C     Record failure  C     Record failure
304        totalKrylovFails   = totalKrylovFails + krylovFails         totalKrylovFails   = totalKrylovFails + krylovFails
305        IF ( newtonIter .EQ. SEAICEnewtonIterMax ) THEN         IF ( newtonIter .EQ. SEAICEnewtonIterMax ) THEN
306         totalNewtonFails = totalNewtonFails + 1          totalNewtonFails = totalNewtonFails + 1
307           ENDIF
308        ENDIF        ENDIF
309  C     Decide whether it is time to dump and reset the counter  C     Decide whether it is time to dump and reset the counter
310        IF ( DIFFERENT_MULTIPLE(SEAICE_monFreq,myTime+deltaTClock,        writeNow = DIFFERENT_MULTIPLE(SEAICE_monFreq,
311       &     deltaTClock) ) THEN       &     myTime+deltaTClock, deltaTClock)
312    #ifdef ALLOW_CAL
313          IF ( useCAL ) THEN
314           CALL CAL_TIME2DUMP(
315         I      zeroRL, SEAICE_monFreq,  deltaTClock,
316         U      writeNow,
317         I      myTime+deltaTclock, myIter+1, myThid )
318          ENDIF
319    #endif
320          IF ( writeNow ) THEN
321         _BEGIN_MASTER( myThid )         _BEGIN_MASTER( myThid )
322         WRITE(msgBuf,'(A)')         WRITE(msgBuf,'(A)')
323       &' // ======================================================='       &' // ======================================================='
# Line 344  C     Decide whether it is time to dump Line 358  C     Decide whether it is time to dump
358       &' // ======================================================='       &' // ======================================================='
359         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
360       &      SQUEEZE_RIGHT, myThid )       &      SQUEEZE_RIGHT, myThid )
361         WRITE(msgBuf,'(A)') ' // Begin JFNK statistics'         WRITE(msgBuf,'(A)') ' // End JFNK statistics'
362         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
363       &      SQUEEZE_RIGHT, myThid )       &      SQUEEZE_RIGHT, myThid )
364         WRITE(msgBuf,'(A)')         WRITE(msgBuf,'(A)')

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.22