| 479 | 
       facLS = 1. _d 0 | 
       facLS = 1. _d 0 | 
| 480 | 
       doLineSearch = .TRUE. | 
       doLineSearch = .TRUE. | 
| 481 | 
       DO WHILE ( doLineSearch ) | 
       DO WHILE ( doLineSearch ) | 
 | 
 C     Determine, if we need more iterations | 
  | 
 | 
        doLineSearch = resLoc .GE. JFNKresidual  | 
  | 
 | 
 C     Limit the maximum number of iterations arbitrarily to four | 
  | 
 | 
        doLineSearch = doLineSearch .AND. l .LE. 4  | 
  | 
 | 
 C     For the first iteration du/vIce = 0 and there will be no | 
  | 
 | 
 C     improvement of the residual possible, so we do only the first | 
  | 
 | 
 C     iteration | 
  | 
 | 
        IF ( newtonIter .EQ. 1 ) doLineSearch = .FALSE. | 
  | 
 | 
 C     Only start a linesearch after some Newton iterations | 
  | 
 | 
        IF ( newtonIter .LE. SEAICE_JFNK_lsIter ) doLineSearch = .FALSE. | 
  | 
 | 
 C     Increment counter | 
  | 
 | 
        l = l + 1 | 
  | 
| 482 | 
 C     Create update | 
 C     Create update | 
| 483 | 
        DO bj=myByLo(myThid),myByHi(myThid) | 
        DO bj=myByLo(myThid),myByHi(myThid) | 
| 484 | 
         DO bi=myBxLo(myThid),myBxHi(myThid) | 
         DO bi=myBxLo(myThid),myBxHi(myThid) | 
| 501 | 
        CALL SEAICE_MAP2VEC(nVec,uIceRes,vIceRes,resTmp,.TRUE.,myThid) | 
        CALL SEAICE_MAP2VEC(nVec,uIceRes,vIceRes,resTmp,.TRUE.,myThid) | 
| 502 | 
        CALL SEAICE_SCALPROD(nVec,1,1,1,resTmp,resTmp,resLoc,myThid) | 
        CALL SEAICE_SCALPROD(nVec,1,1,1,resTmp,resTmp,resLoc,myThid) | 
| 503 | 
        resLoc = SQRT(resLoc) | 
        resLoc = SQRT(resLoc) | 
| 504 | 
  | 
 C     Determine, if we need more iterations | 
| 505 | 
  | 
        doLineSearch = resLoc .GE. JFNKresidual  | 
| 506 | 
  | 
 C     Limit the maximum number of iterations arbitrarily to four | 
| 507 | 
  | 
        doLineSearch = doLineSearch .AND. l .LT. 4  | 
| 508 | 
  | 
 C     For the first iteration du/vIce = 0 and there will be no | 
| 509 | 
  | 
 C     improvement of the residual possible, so we do only the first | 
| 510 | 
  | 
 C     iteration | 
| 511 | 
  | 
        IF ( newtonIter .EQ. 1 ) doLineSearch = .FALSE. | 
| 512 | 
  | 
 C     Only start a linesearch after some Newton iterations | 
| 513 | 
  | 
        IF ( newtonIter .LE. SEAICE_JFNK_lsIter ) doLineSearch = .FALSE. | 
| 514 | 
  | 
 C     Increment counter | 
| 515 | 
  | 
        l = l + 1 | 
| 516 | 
 C     some output diagnostics | 
 C     some output diagnostics | 
| 517 | 
        IF ( debugLevel.GE.debLevA .AND. doLineSearch ) THEN | 
        IF ( debugLevel.GE.debLevA .AND. doLineSearch ) THEN | 
| 518 | 
         _BEGIN_MASTER( myThid ) | 
         _BEGIN_MASTER( myThid ) |