/[MITgcm]/MITgcm/pkg/seaice/seaice_jacvec.F
ViewVC logotype

Diff of /MITgcm/pkg/seaice/seaice_jacvec.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1 by mlosch, Tue Oct 16 07:00:21 2012 UTC revision 1.7 by mlosch, Fri Apr 22 08:50:34 2016 UTC
# Line 56  C     du/vIce   :: correction of ice vel Line 56  C     du/vIce   :: correction of ice vel
56        _RL duIce  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL duIce  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
57        _RL dvIce  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL dvIce  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
58    
59  #if ( defined (SEAICE_CGRID) && \  #ifdef SEAICE_ALLOW_JFNK
       defined (SEAICE_ALLOW_JFNK) && \  
       defined (SEAICE_ALLOW_DYNAMICS) )  
60  C     Local variables:  C     Local variables:
61        _RL utp     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL utp     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
62        _RL vtp     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)        _RL vtp     (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
# Line 70  C     i,j,bi,bj :: loop indices Line 68  C     i,j,bi,bj :: loop indices
68        INTEGER i,j,bi,bj        INTEGER i,j,bi,bj
69        _RL epsilon, reps        _RL epsilon, reps
70  CEOP  CEOP
71    C     Instructions for using TAF or TAMC to generate exact Jacobian times
72    C     vector operations:
73    C
74    C     1. make small_f
75    C     2. cat seaice_calc_residual.f seaice_oceandrag_coeffs.f \
76    C        seaice_bottomdrag_coeffs.f \
77    C        seaice_calc_strainrates.f seaice_calc_viscosities.f \
78    C        seaice_calc_rhs.f seaice_calc_lhs.f > taf_input.f
79    C     3. staf -v1 -forward -toplevel seaice_calc_residual \
80    C             -input uIceLoc,viceLoc -output uIceRes,vIceRes taf_input.f
81    C     4. insert content of taf_input_ftl.f at the end of this file
82    C     5. add the following code and comment out the finite difference code
83    C
84    C     Instruction for using TAF 2.4 and higher (or staf with default -v2
85    C     starting with version 2.0):
86    C
87    C     1. make small_f
88    C     2. files="seaice_calc_residual.f seaice_oceandrag_coeffs.f \
89    C               seaice_bottomdrag_coeffs.f \
90    C               seaice_calc_strainrates.f seaice_calc_viscosities.f \
91    C               seaice_calc_rhs.f seaice_calc_lhs.f"
92    C     3. staf -forward -toplevel seaice_calc_residual \
93    C             -input uIceLoc,viceLoc -output uIceRes,vIceRes $files
94    C     4. copy files seaice_*_tl.f to the corresponding seaice_*.f files,
95    C        e.g. with this bash script:
96    C     for file in $files; do
97    C       nfile=`echo $file | awk -F. '{printf "%s_tl.f", $1}'`;
98    C       \cp -f $nfile $file
99    C     done
100    C     5. add the following code, change "call g_seaice_calc_residual"
101    C        to "call seaice_calc_residual_tl", and comment out the finite
102    C        difference code
103    CML      _RL g_duIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
104    CML      _RL g_dvIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
105    CML      _RL g_uIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
106    CML      _RL g_vIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
107    CML
108    CMLC     Initialise
109    CML      DO bj=myByLo(myThid),myByHi(myThid)
110    CML       DO bi=myBxLo(myThid),myBxHi(myThid)
111    CML        DO J=1-Oly,sNy+Oly
112    CML         DO I=1-Olx,sNx+Olx
113    CML          g_duIce(I,J,bi,bj) = duice(I,J,bi,bj)
114    CML          g_dvIce(I,J,bi,bj) = dvice(I,J,bi,bj)
115    CML          g_uIceRes(I,J,bi,bj) = 0. _d 0
116    CML          g_vIceRes(I,J,bi,bj) = 0. _d 0
117    CML          uIceResP(I,J,bi,bj) = 0. _d 0
118    CML          vIceResP(I,J,bi,bj) = 0. _d 0
119    CML         ENDDO
120    CML        ENDDO
121    CML       ENDDO
122    CML      ENDDO
123    CML
124    CML      CALL G_SEAICE_CALC_RESIDUAL( uIce, g_duice, vIce,
125    CML     $g_dvice, uiceresp, g_uiceres, viceresp, g_viceres, newtoniter,
126    CML     $kryloviter, mytime, myiter, mythid )
127    CMLCML      For staf -v2 replace the above with the below call
128    CMLCML      CALL SEAICE_CALC_RESIDUAL_TL( uIce, g_duice, vIce,
129    CMLCML     $g_dvice, uiceresp, g_uiceres, viceresp, g_viceres, newtoniter,
130    CMLCML     $kryloviter, mytime, myiter, mythid )
131    CML
132    CML      DO bj=myByLo(myThid),myByHi(myThid)
133    CML       DO bi=myBxLo(myThid),myBxHi(myThid)
134    CML        DO J=1-Oly,sNy+Oly
135    CML         DO I=1-Olx,sNx+Olx
136    CML          duice(I,J,bi,bj)=g_uiceres(I,J,bi,bj)
137    CML          dvice(I,J,bi,bj)=g_viceres(I,J,bi,bj)
138    CML         ENDDO
139    CML        ENDDO
140    CML       ENDDO
141    CML      ENDDO
142    
143  C     Initialise  C     Initialise
144        epsilon = 1. _d -06        epsilon = SEAICE_JFNKepsilon
145        reps    = 1. _d 0/epsilon        reps    = 1. _d 0/epsilon
146    
147        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
# Line 107  C     and store in du/vIce Line 176  C     and store in du/vIce
176         ENDDO         ENDDO
177        ENDDO        ENDDO
178    
179  #endif /* SEAICE_ALLOW_DYNAMICS and SEAICE_CGRID and SEAICE_ALLOW_JFNK */  #endif /* SEAICE_ALLOW_JFNK */
180    
181        RETURN        RETURN
182        END        END

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22