File indexing completed on 2023-09-21 05:10:52 UTC
view on githubraw file Latest commit 96b00645 on 2023-09-20 15:15:14 UTC
95afe7199b Dani*0001 #include "STREAMICE_OPTIONS.h"
0002 #ifdef ALLOW_AUTODIFF
0003 # include "AUTODIFF_OPTIONS.h"
0004 #endif
0005
0006
0007
0008
4e4ad91a39 Jean*0009 SUBROUTINE STREAMICE_VEL_SOLVE_OPENAD ( myThid, maxNLIter,
96b006450c dngo*0010 & maxCGiter, myIter )
95afe7199b Dani*0011
0012
0013
0014
0015
0016
0017 IMPLICIT NONE
0018
0019
0020 #include "SIZE.h"
0021 #include "EEPARAMS.h"
0022 #include "PARAMS.h"
0023 #include "STREAMICE.h"
0024 #include "STREAMICE_CG.h"
0025
0026
0027 INTEGER myThid
0028 INTEGER maxNLIter
0029 INTEGER maxCGIter
0030 INTEGER myIter
0031
0032 #ifdef ALLOW_STREAMICE
0033
0034
0035
96b006450c dngo*0036 #ifdef ALLOW_STREAMICE_OAD_FP
95afe7199b Dani*0037 INTEGER i, j, k, l, bi, bj, loopiter
4e4ad91a39 Jean*0038 INTEGER NL_iter
96b006450c dngo*0039 CHARACTER*(MAX_LEN_MBUF) msgBuf
351fd6b6a4 Dani*0040 _RL err_last_change, cgtol, err_init
95afe7199b Dani*0041 LOGICAL CONVERGED
0042
0043 #ifdef ALLOW_OPENAD
0044 INTEGER ADJ_ITER
0045 LOGICAL ADJ_CONVERGED
0046 #endif
0047
0048 isinloop0 =0
0049 isinloop1 =1
0050 isinloop2 =2
0051
0052 IF (STREAMICE_ppm_driving_stress) THEN
0053 CALL STREAMICE_DRIVING_STRESS_PPM (myThid)
0054 ELSE
0055 CALL STREAMICE_DRIVING_STRESS (myThid)
0056 ENDIF
0057
0058 #ifdef STREAMICE_STRESS_BOUNDARY_CONTROL
0059 _EXCH_XY_RL( taudx_SI , myThid )
0060 _EXCH_XY_RL( taudy_SI , myThid )
0061 CALL STREAMICE_FORCED_BUTTRESS (myThid)
0062 #endif
0063
0064 CALL TIMER_START ('STREAMICE_VEL_SOLVE',myThid)
0065
0066 cgtol = streamice_cg_tol
0067 nl_iter = 0
0068 CONVERGED = .false.
0069 err_last_change = 1 _d 1
4e4ad91a39 Jean*0070
95afe7199b Dani*0071 _EXCH_XY_RL( taudx_SI , myThid )
0072 _EXCH_XY_RL( taudy_SI , myThid )
0073
0074 DO bj = myByLo(myThid), myByHi(myThid)
0075 DO bi = myBxLo(myThid), myBxHi(myThid)
0076 DO j=1-OLy,sNy+OLy
0077 DO i=1-OLx,sNx+OLx
0078 U_streamice (i,j,bi,bj)=U_streamice (i,j,bi,bj)
0079 & + 0*u_new_SI (i,j,bi,bj)
0080 V_streamice (i,j,bi,bj)=V_streamice (i,j,bi,bj)
4e4ad91a39 Jean*0081 & + 0*v_new_SI (i,j,bi,bj)
95afe7199b Dani*0082 ENDDO
0083 ENDDO
0084 ENDDO
0085 ENDDO
2be4afbb6e Dani*0086
0087 #ifdef STREAMICE_HYBRID_STRESS
0088 CALL STREAMICE_VISC_BETA_HYBRID ( myThid )
0089 #else
0090 CALL STREAMICE_VISC_BETA ( myThid )
0091 #endif
0092
0093 if (STREAMICE_chkresidconvergence .or.
0094 & (streamice_maxnliter_cpl.eq.0 .and. myIter.eq.0)) then
0095
0096 CALL STREAMICE_GET_VEL_RESID_ERR_OAD ( err_init, myThid )
351fd6b6a4 Dani*0097 err_last_change = err_init
2be4afbb6e Dani*0098
0099 WRITE(msgBuf,'(A,E15.7)') 'initial nonlinear resid (error): ',
0100 & err_init
0101 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0102 & SQUEEZE_RIGHT , 1)
0103
4e4ad91a39 Jean*0104 endif
2be4afbb6e Dani*0105
95afe7199b Dani*0106 #ifndef ALLOW_OPENAD
4e4ad91a39 Jean*0107 CALL STREAMICE_VEL_PHISTAGE (
0108 I myThid,
0109 I maxNLIter,
0110 I maxCGiter,
0111 O cgtol,
95afe7199b Dani*0112 O nL_iter,
0113 O CONVERGED,
0114 O err_last_change,
2be4afbb6e Dani*0115 O err_init,
95afe7199b Dani*0116 I isinloop0)
0117 #else
4e4ad91a39 Jean*0118 CALL STREAMICE_VEL_PHISTAGE (
0119 I myThid,
0120 I maxNLIter,
0121 I maxCGiter,
0122 O cgtol,
95afe7199b Dani*0123 O nL_iter,
0124 O adj_iter,
0125 O CONVERGED,
0126 O ADJ_CONVERGED,
0127 O err_last_change,
2be4afbb6e Dani*0128 O err_init,
95afe7199b Dani*0129 I isinloop0)
0130 #endif
0131
0132 DO loopiter=1,maxNLIter
0133
0134
0135
0136
96b006450c dngo*0137
95afe7199b Dani*0138
0139 #ifndef ALLOW_OPENAD
4e4ad91a39 Jean*0140 CALL STREAMICE_VEL_PHISTAGE (
0141 I myThid,
0142 I maxNLIter,
0143 I maxCGiter,
0144 O cgtol,
95afe7199b Dani*0145 O nL_iter,
0146 O CONVERGED,
0147 O err_last_change,
2be4afbb6e Dani*0148 O err_init,
95afe7199b Dani*0149 I isinloop1)
0150 #else
4e4ad91a39 Jean*0151 CALL STREAMICE_VEL_PHISTAGE (
0152 I myThid,
0153 I maxNLIter,
0154 I maxCGiter,
0155 O cgtol,
95afe7199b Dani*0156 O nL_iter,
0157 O adj_iter,
0158 O CONVERGED,
0159 O ADJ_CONVERGED,
0160 O err_last_change,
2be4afbb6e Dani*0161 O err_init,
95afe7199b Dani*0162 I isinloop1)
0163 #endif
0164
96b006450c dngo*0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
95afe7199b Dani*0175
0176 ENDDO
0177
0178 #ifndef ALLOW_OPENAD
4e4ad91a39 Jean*0179 CALL STREAMICE_VEL_PHISTAGE (
0180 I myThid,
0181 I maxNLIter,
0182 I maxCGiter,
0183 O cgtol,
95afe7199b Dani*0184 O nL_iter,
0185 O CONVERGED,
0186 O err_last_change,
2be4afbb6e Dani*0187 O err_init,
95afe7199b Dani*0188 I isinloop2)
0189 #else
4e4ad91a39 Jean*0190 CALL STREAMICE_VEL_PHISTAGE (
0191 I myThid,
0192 I maxNLIter,
0193 I maxCGiter,
0194 O cgtol,
95afe7199b Dani*0195 O nL_iter,
0196 O adj_iter,
0197 O CONVERGED,
0198 O ADJ_CONVERGED,
0199 O err_last_change,
2be4afbb6e Dani*0200 O err_init,
95afe7199b Dani*0201 I isinloop2)
0202 #endif
0203
0204
0205
0206
0207 if (nl_iter .lt. streamice_max_nl_iter) then
0208 WRITE(msgBuf,'(A,I5,A)') 'VELOCITY SOLVE CONVERGED, ',
0209 & nl_iter, ' iterations'
0210 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0211 & SQUEEZE_RIGHT , 1)
0212 else
0213 WRITE(msgBuf,'(A,I5,A)') 'VELOCITY SOLVE NOT CONVERGED IN ',
0214 & nl_iter, ' iterations'
0215 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0216 & SQUEEZE_RIGHT , 1)
0217 endif
0218
0219 _EXCH_XY_RL(U_streamice, myThid)
0220 _EXCH_XY_RL(V_streamice, myThid)
0221
0222 CALL TIMER_STOP ('STREAMICE_VEL_SOLVE',myThid)
0223
0224 #endif
0225 #endif
0226 RETURN
0227 END