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) |
72 |
C vector operations: |
C vector operations: |
73 |
C |
C |
74 |
C 1. make small_f |
C 1. make small_f |
75 |
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 |
C 2. cat seaice_calc_residual.f seaice_oceandrag_coeffs.f \ |
76 |
C 3. staf -v1 -forward -toplevel seaice_calc_residual -input uIceLoc,viceLoc -output uIceRes,vIceRes taf_input.f |
C seaice_calc_strainrates.f seaice_calc_viscosities.f \ |
77 |
|
C seaice_calc_rhs.f seaice_calc_lhs.f > taf_input.f |
78 |
|
C 3. staf -v1 -forward -toplevel seaice_calc_residual \ |
79 |
|
C -input uIceLoc,viceLoc -output uIceRes,vIceRes taf_input.f |
80 |
C 4. insert content of taf_input_ftl.f at the end of this file |
C 4. insert content of taf_input_ftl.f at the end of this file |
81 |
C 5. add the following code and comment out the finite difference code |
C 5. add the following code and comment out the finite difference code |
82 |
|
C |
83 |
|
C Instruction for using TAF 2.4 and higher (or staf with default -v2 |
84 |
|
C starting with version 2.0): |
85 |
|
C |
86 |
|
C 1. make small_f |
87 |
|
C 2. files="seaice_calc_residual.f seaice_oceandrag_coeffs.f \ |
88 |
|
C seaice_calc_strainrates.f seaice_calc_viscosities.f \ |
89 |
|
C seaice_calc_rhs.f seaice_calc_lhs.f" |
90 |
|
C 3. staf -forward -toplevel seaice_calc_residual \ |
91 |
|
C -input uIceLoc,viceLoc -output uIceRes,vIceRes $files |
92 |
|
C 4. copy files seaice_*_tl.f to the corresponding seaice_*.f files, |
93 |
|
C e.g. with this bash script: |
94 |
|
C for file in $files; do |
95 |
|
C nfile=`echo $file | awk -F. '{printf "%s_tl.f", $1}'`; |
96 |
|
C \cp -f $nfile $file |
97 |
|
C done |
98 |
|
C 5. add the following code, change "call g_seaice_calc_residual" |
99 |
|
C to "call seaice_calc_residual_tl", and comment out the finite |
100 |
|
C difference code |
101 |
CML _RL g_duIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
CML _RL g_duIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
102 |
CML _RL g_dvIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
CML _RL g_dvIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
103 |
CML _RL g_uIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
CML _RL g_uIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
104 |
CML _RL g_vIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
CML _RL g_vIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
105 |
CML |
CML |
|
CML IF (.false.) then |
|
106 |
CMLC Initialise |
CMLC Initialise |
107 |
CML DO bj=myByLo(myThid),myByHi(myThid) |
CML DO bj=myByLo(myThid),myByHi(myThid) |
108 |
CML DO bi=myBxLo(myThid),myBxHi(myThid) |
CML DO bi=myBxLo(myThid),myBxHi(myThid) |
122 |
CML CALL G_SEAICE_CALC_RESIDUAL( uIce, g_duice, vIce, |
CML CALL G_SEAICE_CALC_RESIDUAL( uIce, g_duice, vIce, |
123 |
CML $g_dvice, uiceresp, g_uiceres, viceresp, g_viceres, newtoniter, |
CML $g_dvice, uiceresp, g_uiceres, viceresp, g_viceres, newtoniter, |
124 |
CML $kryloviter, mytime, myiter, mythid ) |
CML $kryloviter, mytime, myiter, mythid ) |
125 |
|
CMLCML For staf -v2 replace the above with the below call |
126 |
|
CMLCML CALL SEAICE_CALC_RESIDUAL_TL( uIce, g_duice, vIce, |
127 |
|
CMLCML $g_dvice, uiceresp, g_uiceres, viceresp, g_viceres, newtoniter, |
128 |
|
CMLCML $kryloviter, mytime, myiter, mythid ) |
129 |
CML |
CML |
130 |
CML DO bj=myByLo(myThid),myByHi(myThid) |
CML DO bj=myByLo(myThid),myByHi(myThid) |
131 |
CML DO bi=myBxLo(myThid),myBxHi(myThid) |
CML DO bi=myBxLo(myThid),myBxHi(myThid) |
139 |
CML ENDDO |
CML ENDDO |
140 |
|
|
141 |
C Initialise |
C Initialise |
142 |
epsilon = 1. _d -06 |
epsilon = SEAICE_JFNKepsilon |
143 |
reps = 1. _d 0/epsilon |
reps = 1. _d 0/epsilon |
144 |
|
|
145 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
174 |
ENDDO |
ENDDO |
175 |
ENDDO |
ENDDO |
176 |
|
|
177 |
#endif /* SEAICE_ALLOW_DYNAMICS and SEAICE_CGRID and SEAICE_ALLOW_JFNK */ |
#endif /* SEAICE_ALLOW_JFNK */ |
178 |
|
|
179 |
RETURN |
RETURN |
180 |
END |
END |