| 7 |
#else |
#else |
| 8 |
# define OBCS_UVICE_OLD |
# define OBCS_UVICE_OLD |
| 9 |
#endif |
#endif |
| 10 |
|
#ifdef ALLOW_AUTODIFF |
| 11 |
|
# include "AUTODIFF_OPTIONS.h" |
| 12 |
|
#endif |
| 13 |
|
|
| 14 |
CBOP |
CBOP |
| 15 |
C !ROUTINE: SEAICE_CALC_STRAINRATES |
C !ROUTINE: SEAICE_CALC_STRAINRATES |
| 75 |
C hFacU, hFacV :: determine the no-slip boundary condition |
C hFacU, hFacV :: determine the no-slip boundary condition |
| 76 |
INTEGER k |
INTEGER k |
| 77 |
_RS hFacU, hFacV, noSlipFac |
_RS hFacU, hFacV, noSlipFac |
| 78 |
|
_RL third |
| 79 |
|
PARAMETER ( third = 0.333333333333333333333333333 _d 0 ) |
| 80 |
C auxillary variables that help writing code that |
C auxillary variables that help writing code that |
| 81 |
C vectorizes even after TAFization |
C vectorizes even after TAFization |
| 82 |
_RL dudx (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL dudx (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
| 89 |
k = 1 |
k = 1 |
| 90 |
noSlipFac = 0. _d 0 |
noSlipFac = 0. _d 0 |
| 91 |
IF ( SEAICE_no_slip ) noSlipFac = 1. _d 0 |
IF ( SEAICE_no_slip ) noSlipFac = 1. _d 0 |
| 92 |
|
C in order repoduce results before fixing a bug in r1.20 comment out |
| 93 |
|
C the following line |
| 94 |
|
CML IF ( SEAICE_no_slip ) noSlipFac = 2. _d 0 |
| 95 |
C |
C |
| 96 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
| 97 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
| 156 |
& ) |
& ) |
| 157 |
& *maskC(i ,j ,k,bi,bj)*maskC(i-1,j ,k,bi,bj) |
& *maskC(i ,j ,k,bi,bj)*maskC(i-1,j ,k,bi,bj) |
| 158 |
& *maskC(i ,j-1,k,bi,bj)*maskC(i-1,j-1,k,bi,bj) |
& *maskC(i ,j-1,k,bi,bj)*maskC(i-1,j-1,k,bi,bj) |
| 159 |
& + 2.0 _d 0 * noSlipFac * ( |
& + noSlipFac * ( |
| 160 |
& 2.0 _d 0 * uave(i,j) * _recip_dyU(i,j,bi,bj) * hFacU |
& 2.0 _d 0 * uave(i,j) * _recip_dyU(i,j,bi,bj) * hFacU |
| 161 |
& + 2.0 _d 0 * vave(i,j) * _recip_dxV(i,j,bi,bj) * hFacV |
& + 2.0 _d 0 * vave(i,j) * _recip_dxV(i,j,bi,bj) * hFacV |
| 162 |
& ) |
& ) |
| 167 |
c$$$ & - hFacU * k2AtZ(i,j,bi,bj) * uave(i,j) |
c$$$ & - hFacU * k2AtZ(i,j,bi,bj) * uave(i,j) |
| 168 |
ENDDO |
ENDDO |
| 169 |
ENDDO |
ENDDO |
| 170 |
|
IF ( SEAICE_no_slip .AND. SEAICE_2ndOrderBC ) THEN |
| 171 |
|
DO j=1-OLy+2,sNy+OLy-1 |
| 172 |
|
DO i=1-OLx+2,sNx+OLx-1 |
| 173 |
|
hFacU = (_maskW(i,j,k,bi,bj) - _maskW(i,j-1,k,bi,bj))*third |
| 174 |
|
hFacV = (_maskS(i,j,k,bi,bj) - _maskS(i-1,j,k,bi,bj))*third |
| 175 |
|
hFacU = hFacU*( _maskW(i,j-2,k,bi,bj)*_maskW(i,j-1,k,bi,bj) |
| 176 |
|
& + _maskW(i,j+1,k,bi,bj)*_maskW(i,j, k,bi,bj) ) |
| 177 |
|
hFacV = hFacV*( _maskS(i-2,j,k,bi,bj)*_maskS(i-1,j,k,bi,bj) |
| 178 |
|
& + _maskS(i+1,j,k,bi,bj)*_maskS(i ,j,k,bi,bj) ) |
| 179 |
|
C right hand sided dv/dx = (9*v(i,j)-v(i+1,j))/(4*dxv(i,j)-dxv(i+1,j)) |
| 180 |
|
C according to a Taylor expansion to 2nd order. We assume that dxv |
| 181 |
|
C varies very slowly, so that the denominator simplifies to 3*dxv(i,j), |
| 182 |
|
C then dv/dx = (6*v(i,j)+3*v(i,j)-v(i+1,j))/(3*dxv(i,j)) |
| 183 |
|
C = 2*v(i,j)/dxv(i,j) + (3*v(i,j)-v(i+1,j))/(3*dxv(i,j)) |
| 184 |
|
C the left hand sided dv/dx is analogously |
| 185 |
|
C = - 2*v(i-1,j)/dxv(i,j) - (3*v(i-1,j)-v(i-2,j))/(3*dxv(i,j)) |
| 186 |
|
C the first term is the first order part, which is already added. |
| 187 |
|
C For e12 we only need 0.5 of this gradient and vave = is either |
| 188 |
|
C 0.5*v(i,j) or 0.5*v(i-1,j) near the boundary so that we need an |
| 189 |
|
C extra factor of 2. This explains the six. du/dy is analogous. |
| 190 |
|
C The masking is ugly, but hopefully effective. |
| 191 |
|
e12Loc(i,j,bi,bj) = e12Loc(i,j,bi,bj) + 0.5 _d 0 * ( |
| 192 |
|
& _recip_dyU(i,j,bi,bj) * ( 6.0 _d 0 * uave(i,j) |
| 193 |
|
& - uFld(i,j-2,bi,bj)*_maskW(i,j-1,k,bi,bj) |
| 194 |
|
& - uFld(i,j+1,bi,bj)*_maskW(i,j ,k,bi,bj) ) * hFacU |
| 195 |
|
& + _recip_dxV(i,j,bi,bj) * ( 6.0 _d 0 * vave(i,j) |
| 196 |
|
& - vFld(i-2,j,bi,bj)*_maskS(i-1,j,k,bi,bj) |
| 197 |
|
& - vFld(i+1,j,bi,bj)*_maskS(i ,j,k,bi,bj) ) * hFacV |
| 198 |
|
& ) |
| 199 |
|
ENDDO |
| 200 |
|
ENDDO |
| 201 |
|
ENDIF |
| 202 |
ENDDO |
ENDDO |
| 203 |
ENDDO |
ENDDO |
| 204 |
|
|