--- MITgcm/pkg/seaice/seaice_jfnk.F 2012/11/07 09:56:23 1.5 +++ MITgcm/pkg/seaice/seaice_jfnk.F 2012/12/03 15:49:17 1.11 @@ -1,4 +1,4 @@ -C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/seaice/seaice_jfnk.F,v 1.5 2012/11/07 09:56:23 mlosch Exp $ +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/seaice/seaice_jfnk.F,v 1.11 2012/12/03 15:49:17 mlosch Exp $ C $Name: $ #include "SEAICE_OPTIONS.h" @@ -74,6 +74,7 @@ C _RL recip_deltaT LOGICAL JFNKconverged, krylovConverged + LOGICAL writeNow CHARACTER*(MAX_LEN_MBUF) msgBuf C C u/vIceRes :: residual of sea-ice momentum equations @@ -86,8 +87,8 @@ C zeta, eta, and DWATN, press _RL zetaPre (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RL etaPre (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) + _RL etaZPre (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) CEOP C Initialise @@ -150,10 +151,10 @@ DO bi=myBxLo(myThid),myBxHi(myThid) DO j=1-Oly,sNy+Oly DO i=1-Olx,sNx+Olx - zetaPre(I,J,bi,bj) = zeta(I,J,bi,bj) - etaPre(I,J,bi,bj) = eta(I,J,bi,bj) - dwatPre(I,J,bi,bj) = DWATN(I,J,bi,bj) - pressPre(I,J,bi,bj) = press(I,J,bi,bj) + zetaPre(I,J,bi,bj) = zeta(I,J,bi,bj) + etaPre(I,J,bi,bj) = eta(I,J,bi,bj) + etaZPre(I,J,bi,bj) = etaZ(I,J,bi,bj) + dwatPre(I,J,bi,bj) = DWATN(I,J,bi,bj) ENDDO ENDDO ENDDO @@ -240,10 +241,11 @@ C or product of matrix (Jacobian) times vector. For iCode = 0, terminate C iteration IF (iCode.EQ.1) THEN -C Call preconditioner - CALL SEAICE_PRECONDITIONER( +C Call preconditioner + IF ( SOLV_MAX_ITERS .GT. 0 ) + & CALL SEAICE_PRECONDITIONER( U duIce, dvIce, - I zetaPre, etaPre, dwatPre, pressPre, + I zetaPre, etaPre, etaZpre, dwatPre, I newtonIter, krylovIter, myTime, myIter, myThid ) ELSEIF (iCode.GE.2) THEN C Compute Jacobian times vector @@ -292,18 +294,29 @@ C C-- Output diagnostics C + IF ( SEAICE_monFreq .GT. 0. _d 0 ) THEN C Count iterations - totalJFNKtimeSteps = totalJFNKtimeSteps + 1 - totalNewtonIters = totalNewtonIters + newtonIter - totalKrylovIters = totalKrylovIters + totalKrylovItersLoc + totalJFNKtimeSteps = totalJFNKtimeSteps + 1 + totalNewtonIters = totalNewtonIters + newtonIter + totalKrylovIters = totalKrylovIters + totalKrylovItersLoc C Record failure - totalKrylovFails = totalKrylovFails + krylovFails - IF ( newtonIter .EQ. SEAICEnewtonIterMax ) THEN - totalNewtonFails = totalNewtonFails + 1 + totalKrylovFails = totalKrylovFails + krylovFails + IF ( newtonIter .EQ. SEAICEnewtonIterMax ) THEN + totalNewtonFails = totalNewtonFails + 1 + ENDIF ENDIF C Decide whether it is time to dump and reset the counter - IF ( DIFFERENT_MULTIPLE(SEAICE_monFreq,myTime+deltaTClock, - & deltaTClock) ) THEN + writeNow = DIFFERENT_MULTIPLE(SEAICE_monFreq, + & myTime+deltaTClock, deltaTClock) +#ifdef ALLOW_CAL + IF ( useCAL ) THEN + CALL CAL_TIME2DUMP( + I zeroRL, SEAICE_monFreq, deltaTClock, + U writeNow, + I myTime+deltaTclock, myIter+1, myThid ) + ENDIF +#endif + IF ( writeNow ) THEN _BEGIN_MASTER( myThid ) WRITE(msgBuf,'(A)') &' // =======================================================' @@ -344,7 +357,7 @@ &' // =======================================================' CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, & SQUEEZE_RIGHT, myThid ) - WRITE(msgBuf,'(A)') ' // Begin JFNK statistics' + WRITE(msgBuf,'(A)') ' // End JFNK statistics' CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, & SQUEEZE_RIGHT, myThid ) WRITE(msgBuf,'(A)')