| 70 | 
       INTEGER i,j,bi,bj | 
       INTEGER i,j,bi,bj | 
| 71 | 
       _RL epsilon, reps | 
       _RL epsilon, reps | 
| 72 | 
 CEOP | 
 CEOP | 
| 73 | 
   | 
 C     Instructions for using TAF or TAMC to generate exact Jacobian times | 
| 74 | 
  | 
 C     vector operations: | 
| 75 | 
  | 
 C | 
| 76 | 
  | 
 C     1. make small_f | 
| 77 | 
  | 
 C     2. cat seaice_calc_residual.f seaice_oceandrag_coeffs.f seaice_calc_strainrates.f seaice_calc_viscosities.f seaice_calc_rhs.f seaice_calc_lhs.f > taf_input.f | 
| 78 | 
  | 
 C     3. staf -v1 -forward -toplevel seaice_calc_residual -input uIceLoc,viceLoc -output uIceRes,vIceRes taf_input.f | 
| 79 | 
  | 
 C     4. insert content of taf_input_ftl.f at the end of this file | 
| 80 | 
  | 
 C     5. add the following code and comment out the finite difference code | 
| 81 | 
  | 
 CML      _RL g_duIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) | 
| 82 | 
  | 
 CML      _RL g_dvIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) | 
| 83 | 
  | 
 CML      _RL g_uIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) | 
| 84 | 
  | 
 CML      _RL g_vIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) | 
| 85 | 
  | 
 CML | 
| 86 | 
  | 
 CML      IF (.false.) then | 
| 87 | 
  | 
 CMLC     Initialise | 
| 88 | 
  | 
 CML      DO bj=myByLo(myThid),myByHi(myThid) | 
| 89 | 
  | 
 CML       DO bi=myBxLo(myThid),myBxHi(myThid) | 
| 90 | 
  | 
 CML        DO J=1-Oly,sNy+Oly | 
| 91 | 
  | 
 CML         DO I=1-Olx,sNx+Olx | 
| 92 | 
  | 
 CML          g_duIce(I,J,bi,bj) = duice(I,J,bi,bj) | 
| 93 | 
  | 
 CML          g_dvIce(I,J,bi,bj) = dvice(I,J,bi,bj) | 
| 94 | 
  | 
 CML          g_uIceRes(I,J,bi,bj) = 0. _d 0 | 
| 95 | 
  | 
 CML          g_vIceRes(I,J,bi,bj) = 0. _d 0 | 
| 96 | 
  | 
 CML          uIceResP(I,J,bi,bj) = 0. _d 0 | 
| 97 | 
  | 
 CML          vIceResP(I,J,bi,bj) = 0. _d 0 | 
| 98 | 
  | 
 CML         ENDDO | 
| 99 | 
  | 
 CML        ENDDO | 
| 100 | 
  | 
 CML       ENDDO | 
| 101 | 
  | 
 CML      ENDDO | 
| 102 | 
  | 
 CML | 
| 103 | 
  | 
 CML      CALL G_SEAICE_CALC_RESIDUAL( uIce, g_duice, vIce,  | 
| 104 | 
  | 
 CML     $g_dvice, uiceresp, g_uiceres, viceresp, g_viceres, newtoniter,  | 
| 105 | 
  | 
 CML     $kryloviter, mytime, myiter, mythid ) | 
| 106 | 
  | 
 CML | 
| 107 | 
  | 
 CML      DO bj=myByLo(myThid),myByHi(myThid) | 
| 108 | 
  | 
 CML       DO bi=myBxLo(myThid),myBxHi(myThid) | 
| 109 | 
  | 
 CML        DO J=1-Oly,sNy+Oly | 
| 110 | 
  | 
 CML         DO I=1-Olx,sNx+Olx | 
| 111 | 
  | 
 CML          duice(I,J,bi,bj)=g_uiceres(I,J,bi,bj) | 
| 112 | 
  | 
 CML          dvice(I,J,bi,bj)=g_viceres(I,J,bi,bj) | 
| 113 | 
  | 
 CML         ENDDO | 
| 114 | 
  | 
 CML        ENDDO | 
| 115 | 
  | 
 CML       ENDDO | 
| 116 | 
  | 
 CML      ENDDO | 
| 117 | 
  | 
  | 
| 118 | 
 C     Initialise | 
 C     Initialise | 
| 119 | 
       epsilon = 1. _d -06 | 
       epsilon = 1. _d -06 | 
| 120 | 
       reps    = 1. _d 0/epsilon | 
       reps    = 1. _d 0/epsilon |