/[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.20 by jmc, Sat Mar 2 04:35:05 2013 UTC revision 1.27 by gforget, Mon Oct 20 03:20:57 2014 UTC
# Line 2  C $Header$ Line 2  C $Header$
2  C $Name$  C $Name$
3    
4  #include "SEAICE_OPTIONS.h"  #include "SEAICE_OPTIONS.h"
5    #ifdef ALLOW_AUTODIFF
6    # include "AUTODIFF_OPTIONS.h"
7    #endif
8    
9  C--  File seaice_jfnk.F: seaice jfnk dynamical solver S/R:  C--  File seaice_jfnk.F: seaice jfnk dynamical solver S/R:
10  C--   Contents  C--   Contents
# Line 53  C     myThid :: my Thread Id. number Line 56  C     myThid :: my Thread Id. number
56        INTEGER myIter        INTEGER myIter
57        INTEGER myThid        INTEGER myThid
58    
59  #if ( (defined SEAICE_CGRID) && \  #ifdef SEAICE_ALLOW_JFNK
       (defined SEAICE_ALLOW_JFNK) && \  
       (defined SEAICE_ALLOW_DYNAMICS) )  
60  C     !FUNCTIONS:  C     !FUNCTIONS:
61        LOGICAL  DIFFERENT_MULTIPLE        LOGICAL  DIFFERENT_MULTIPLE
62        EXTERNAL DIFFERENT_MULTIPLE        EXTERNAL DIFFERENT_MULTIPLE
# Line 75  C     FGMRES flag that indicates what fg Line 76  C     FGMRES flag that indicates what fg
76        _RL     JFNKresidual        _RL     JFNKresidual
77        _RL     JFNKresidualKm1        _RL     JFNKresidualKm1
78  C     parameters to compute convergence criterion  C     parameters to compute convergence criterion
79        _RL     phi_e, alp_e, JFNKgamma_lin        _RL     JFNKgamma_lin
80        _RL     FGMRESeps        _RL     FGMRESeps
81        _RL     JFNKtol        _RL     JFNKtol
82    C     backward differences extrapolation factors
83          _RL bdfFac, bdfAlpha
84    C
85        _RL     recip_deltaT        _RL     recip_deltaT
86        LOGICAL JFNKconverged, krylovConverged        LOGICAL JFNKconverged, krylovConverged
87        LOGICAL writeNow        LOGICAL writeNow
# Line 87  C     parameters to compute convergence Line 90  C     parameters to compute convergence
90  C     u/vIceRes :: residual of sea-ice momentum equations  C     u/vIceRes :: residual of sea-ice momentum equations
91        _RL uIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL uIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
92        _RL vIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL vIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
93    C     extra time level required for backward difference time stepping
94          _RL duIcNm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
95          _RL dvIcNm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
96  C     du/vIce   :: ice velocity increment to be added to u/vIce  C     du/vIce   :: ice velocity increment to be added to u/vIce
97        _RL duIce  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL duIce  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
98        _RL dvIce  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL dvIce  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
# Line 115  C     with iOutFgmres=1, seaice_fgmres p Line 121  C     with iOutFgmres=1, seaice_fgmres p
121       &     DIFFERENT_MULTIPLE( SEAICE_monFreq, myTime, deltaTClock ) )       &     DIFFERENT_MULTIPLE( SEAICE_monFreq, myTime, deltaTClock ) )
122       &     iOutFGMRES=1       &     iOutFGMRES=1
123    
124    C     backward difference extrapolation factors
125          bdfFac = 0. _d 0
126          IF ( SEAICEuseBDF2 ) THEN
127           IF ( myIter.EQ.nIter0 .AND. SEAICEmomStartBDF.EQ.0 ) THEN
128            bdfFac = 0. _d 0
129           ELSE
130            bdfFac = 0.5 _d 0
131           ENDIF
132          ENDIF
133          bdfAlpha = 1. _d 0 + bdfFac
134    
135        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
136         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
137          DO J=1-OLy,sNy+OLy          DO J=1-OLy,sNy+OLy
# Line 123  C     with iOutFgmres=1, seaice_fgmres p Line 140  C     with iOutFgmres=1, seaice_fgmres p
140            vIceRes(I,J,bi,bj) = 0. _d 0            vIceRes(I,J,bi,bj) = 0. _d 0
141            duIce  (I,J,bi,bj) = 0. _d 0            duIce  (I,J,bi,bj) = 0. _d 0
142            dvIce  (I,J,bi,bj) = 0. _d 0            dvIce  (I,J,bi,bj) = 0. _d 0
143             ENDDO
144            ENDDO
145    C     cycle ice velocities
146            DO J=1-OLy,sNy+OLy
147             DO I=1-OLx,sNx+OLx
148              duIcNm1(I,J,bi,bj) = uIce(I,J,bi,bj) * bdfAlpha
149         &         + ( uIce(I,J,bi,bj) - uIceNm1(I,J,bi,bj) ) * bdfFac
150              dvIcNm1(I,J,bi,bj) = vIce(I,J,bi,bj) * bdfAlpha
151         &         + ( vIce(I,J,bi,bj) - vIceNm1(I,J,bi,bj) ) * bdfFac
152            uIceNm1(I,J,bi,bj) = uIce(I,J,bi,bj)            uIceNm1(I,J,bi,bj) = uIce(I,J,bi,bj)
153            vIceNm1(I,J,bi,bj) = vIce(I,J,bi,bj)            vIceNm1(I,J,bi,bj) = vIce(I,J,bi,bj)
154           ENDDO           ENDDO
155          ENDDO          ENDDO
156    C     As long as IMEX is not properly implemented leave this commented out
157    CML        IF ( .NOT.SEAICEuseIMEX ) THEN
158  C     Compute things that do no change during the Newton iteration:  C     Compute things that do no change during the Newton iteration:
159  C     sea-surface tilt and wind stress:  C     sea-surface tilt and wind stress:
160  C     FORCEX/Y0 - mass*(u/vIceNm1)/deltaT  C     FORCEX/Y0 - mass*(1.5*u/vIceNm1+0.5*(u/vIceNm1-u/vIceNm2))/deltaT
161          DO J=1-OLy,sNy+OLy          DO J=1-OLy,sNy+OLy
162           DO I=1-OLx,sNx+OLx           DO I=1-OLx,sNx+OLx
163            FORCEX(I,J,bi,bj) = FORCEX0(I,J,bi,bj)            FORCEX(I,J,bi,bj) = FORCEX0(I,J,bi,bj)
164       &         + seaiceMassU(I,J,bi,bj)*uIceNm1(I,J,bi,bj)*recip_deltaT       &         + seaiceMassU(I,J,bi,bj)*duIcNm1(I,J,bi,bj)*recip_deltaT
165            FORCEY(I,J,bi,bj) = FORCEY0(I,J,bi,bj)            FORCEY(I,J,bi,bj) = FORCEY0(I,J,bi,bj)
166       &         + seaiceMassV(I,J,bi,bj)*vIceNm1(I,J,bi,bj)*recip_deltaT       &         + seaiceMassV(I,J,bi,bj)*dvIcNm1(I,J,bi,bj)*recip_deltaT
167           ENDDO           ENDDO
168          ENDDO          ENDDO
169    CML        ENDIF
170         ENDDO         ENDDO
171        ENDDO        ENDDO
172  C     Start nonlinear Newton iteration: outer loop iteration  C     Start nonlinear Newton iteration: outer loop iteration
# Line 169  C     compute convergence criterion for Line 198  C     compute convergence criterion for
198         JFNKgamma_lin = JFNKgamma_lin_max         JFNKgamma_lin = JFNKgamma_lin_max
199         IF ( newtonIter.GT.1.AND.newtonIter.LE.SEAICE_JFNK_tolIter         IF ( newtonIter.GT.1.AND.newtonIter.LE.SEAICE_JFNK_tolIter
200       &      .AND.JFNKresidual.LT.JFNKres_t ) THEN       &      .AND.JFNKresidual.LT.JFNKres_t ) THEN
201  C     Eisenstat, 1996, equ.(2.6)  C     Eisenstat and Walker (1996), eq.(2.6)
202          phi_e = 1. _d 0          JFNKgamma_lin = SEAICE_JFNKphi
203          alp_e = 1. _d 0       &       *( JFNKresidual/JFNKresidualKm1 )**SEAICE_JFNKalpha
         JFNKgamma_lin = phi_e*( JFNKresidual/JFNKresidualKm1 )**alp_e  
204          JFNKgamma_lin = min(JFNKgamma_lin_max, JFNKgamma_lin)          JFNKgamma_lin = min(JFNKgamma_lin_max, JFNKgamma_lin)
205          JFNKgamma_lin = max(JFNKgamma_lin_min, JFNKgamma_lin)          JFNKgamma_lin = max(JFNKgamma_lin_min, JFNKgamma_lin)
206         ENDIF         ENDIF
# Line 529  C     iterations, 0.25*du/vIce in the se Line 557  C     iterations, 0.25*du/vIce in the se
557  C     This is the new residual  C     This is the new residual
558        JFNKresidual = resLoc        JFNKresidual = resLoc
559    
560  #endif /* SEAICE_ALLOW_DYNAMICS and SEAICE_CGRID and SEAICE_ALLOW_JFNK */  #endif /* SEAICE_ALLOW_JFNK */
561    
562        RETURN        RETURN
563        END        END

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.22