--- MITgcm/pkg/seaice/seaice_jacvec.F 2012/11/06 13:09:30 1.2 +++ MITgcm/pkg/seaice/seaice_jacvec.F 2013/04/04 07:02:51 1.5 @@ -1,4 +1,4 @@ -C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/seaice/seaice_jacvec.F,v 1.2 2012/11/06 13:09:30 mlosch Exp $ +C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/pkg/seaice/seaice_jacvec.F,v 1.5 2013/04/04 07:02:51 mlosch Exp $ C $Name: $ #include "SEAICE_OPTIONS.h" @@ -56,9 +56,7 @@ _RL duIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RL dvIce (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) -#if ( defined (SEAICE_CGRID) && \ - defined (SEAICE_ALLOW_JFNK) && \ - defined (SEAICE_ALLOW_DYNAMICS) ) +#ifdef SEAICE_ALLOW_JFNK C Local variables: _RL utp (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) _RL vtp (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) @@ -78,12 +76,24 @@ C 3. staf -v1 -forward -toplevel seaice_calc_residual -input uIceLoc,viceLoc -output uIceRes,vIceRes taf_input.f C 4. insert content of taf_input_ftl.f at the end of this file C 5. add the following code and comment out the finite difference code +C +C Instruction for using TAF 2.4 and higher (or staf with default -v2 +C starting with version 2.0): +C +C 1. make small_f +C 2. staf -forward -toplevel seaice_calc_residual -input uIceLoc,viceLoc -output uIceRes,vIceRes seaice_calc_residual.f seaice_oceandrag_coeffs.f seaice_calc_strainrates.f seaice_calc_viscosities.f seaice_calc_rhs.f seaice_calc_lhs.f +C 3. copy files seaice_*_tl.f to the corresponding seaice_*.f files, +C e.g. with this bash script: +C for file in `ls seaice_*_tl.f`; do +C nfile=`echo $file | awk -F_ '{printf "%s_%s_%s.f", $1,$2,$3}'`; +C \cp -f $file $nfile +C done +C 4. add the following code, change "call g_seaice_calc_residual" to "call seaice_calc_residual_tl", and comment out the finite difference code CML _RL g_duIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) CML _RL g_dvIce(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) CML _RL g_uIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) CML _RL g_vIceRes(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) CML -CML IF (.false.) then CMLC Initialise CML DO bj=myByLo(myThid),myByHi(myThid) CML DO bi=myBxLo(myThid),myBxHi(myThid) @@ -103,6 +113,10 @@ CML CALL G_SEAICE_CALC_RESIDUAL( uIce, g_duice, vIce, CML $g_dvice, uiceresp, g_uiceres, viceresp, g_viceres, newtoniter, CML $kryloviter, mytime, myiter, mythid ) +CMLCML For staf -v2 replace the above with the below call +CMLCML CALL SEAICE_CALC_RESIDUAL_TL( uIce, g_duice, vIce, +CMLCML $g_dvice, uiceresp, g_uiceres, viceresp, g_viceres, newtoniter, +CMLCML $kryloviter, mytime, myiter, mythid ) CML CML DO bj=myByLo(myThid),myByHi(myThid) CML DO bi=myBxLo(myThid),myBxHi(myThid) @@ -116,7 +130,7 @@ CML ENDDO C Initialise - epsilon = 1. _d -06 + epsilon = SEAICE_JFNKepsilon reps = 1. _d 0/epsilon DO bj=myByLo(myThid),myByHi(myThid) @@ -151,7 +165,7 @@ ENDDO ENDDO -#endif /* SEAICE_ALLOW_DYNAMICS and SEAICE_CGRID and SEAICE_ALLOW_JFNK */ +#endif /* SEAICE_ALLOW_JFNK */ RETURN END