| 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 |
| 79 |
_RL 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 |
| 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) |
| 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 |
| 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 |