File indexing completed on 2026-10-08 05:09:00 UTC
view on githubraw file Latest commit 27256b2d on 2026-10-07 21:35:21 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_PHISTAGE (
0010 I myThid,
0011 I maxNLIter,
0012 I maxCGiter,
0013 O cgtol,
95afe7199b Dani*0014 O nL_iter,
0015 O CONVERGED,
0016 O err_last_change,
2be4afbb6e Dani*0017 O err_init,
95afe7199b Dani*0018 I isinloop)
0019
0020
0021
0022
0023
0024
0025
0026 IMPLICIT NONE
0027
0028
0029 #include "SIZE.h"
0030 #include "EEPARAMS.h"
0031 #include "PARAMS.h"
0032 #include "STREAMICE.h"
feb7fa5d1e dngo*0033 #include "STREAMICE_FP.h"
95afe7199b Dani*0034 #include "STREAMICE_CG.h"
0035
0036
0037 INTEGER myThid
0038 INTEGER maxNLIter
0039 INTEGER maxCGiter
0040 _RL cgtol
0041 _RL err_last_change
2be4afbb6e Dani*0042 _RL err_init
95afe7199b Dani*0043 INTEGER nL_iter
0044 LOGICAL CONVERGED
0045 INTEGER isinloop
0046
feb7fa5d1e dngo*0047 #ifdef ALLOW_STREAMICE_FP_ADJ
95afe7199b Dani*0048
0049
0050
0051 INTEGER i, j, bi, bj, cg_iters, m
96b006450c dngo*0052 _RL err_max, err_max_fp
95afe7199b Dani*0053 CHARACTER*(MAX_LEN_MBUF) msgBuf
4e4ad91a39 Jean*0054
96b006450c dngo*0055 IF (ISINLOOP .ne. 0) THEN
95ea1bba23 Dani*0056 NL_ITER = (NL_ITER + 1)
0057 CALL streamice_vel_phi(MYTHID,MAXNLITER,MAXCGITER,CGTOL
0058 +,CG_ITERS,err_max)
95afe7199b Dani*0059
96b006450c dngo*0060 WRITE(msgBuf,'(A,I5,A,I4,A)') 'streamice linear solve number',
95ea1bba23 Dani*0061 +NL_ITER,' ',CG_ITERS,' iterations '
96b006450c dngo*0062 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0063 + SQUEEZE_RIGHT, 1)
95afe7199b Dani*0064
95ea1bba23 Dani*0065
95afe7199b Dani*0066
96b006450c dngo*0067 IF (STREAMICE_chkresidconvergence) THEN
95afe7199b Dani*0068
95ea1bba23 Dani*0069 WRITE(msgBuf,'(A,E15.7)') 'err/err_init', err_max/err_init
96b006450c dngo*0070 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0071 + SQUEEZE_RIGHT, 1)
95afe7199b Dani*0072
95ea1bba23 Dani*0073 IF (err_max .LE. streamice_nonlin_tol * err_init) THEN
96b006450c dngo*0074 CONVERGED = .TRUE.
95ea1bba23 Dani*0075 ENDIF
95afe7199b Dani*0076
95ea1bba23 Dani*0077 IF (err_max<err_last_change*1.e-2 .and. STREAMICE_lower_cg_to
0078 +l) THEN
0079 cgtol = cgtol * 5.e-2
0080 err_last_change = err_max
0081 WRITE(msgBuf,'(A,E15.7)') 'new cg tol: ', cgtol
96b006450c dngo*0082 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0083 + SQUEEZE_RIGHT, 1)
95ea1bba23 Dani*0084 ENDIF
351fd6b6a4 Dani*0085
96b006450c dngo*0086 ENDIF
351fd6b6a4 Dani*0087
96b006450c dngo*0088 IF (STREAMICE_chkfixedptconvergence) THEN
351fd6b6a4 Dani*0089
95ea1bba23 Dani*0090 CALL STREAMICE_GET_FP_ERR_OAD ( err_max_fp, myThid )
351fd6b6a4 Dani*0091
95ea1bba23 Dani*0092 WRITE(msgBuf,'(A,1PE22.14)') 'STREAMICE_FP_ERROR =', err_max_
0093 +fp
96b006450c dngo*0094 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0095 + SQUEEZE_RIGHT, 1)
351fd6b6a4 Dani*0096
95ea1bba23 Dani*0097 IF (err_max_fp .LE. streamice_nonlin_tol_fp) THEN
96b006450c dngo*0098 CONVERGED = .TRUE.
351fd6b6a4 Dani*0099 ENDIF
0100
96b006450c dngo*0101 ENDIF
95ea1bba23 Dani*0102
0103 DO bj = myByLo(myThid), myByHi(myThid)
0104 DO bi = myBxLo(myThid), myBxHi(myThid)
0105 DO j=1-OLy,sNy+OLy
0106 DO i=1-OLx,sNx+OLx
0107 U_streamice (i,j,bi,bj)=u_new_SI (i,j,bi,bj)
0108 V_streamice (i,j,bi,bj)=v_new_SI (i,j,bi,bj)
6b6b38f093 Dani*0109 #ifdef STREAMICE_HYBRID_STRESS
95ea1bba23 Dani*0110 streamice_taubx(i,j,bi,bj)=taubx_new_si(i,j,bi,bj)
0111 streamice_tauby(i,j,bi,bj)=tauby_new_si(i,j,bi,bj)
0112 DO m=Nr,1,-1
0113 visc_streamice_full(i,j,m,bi,bj)= visc_full_new_si(i,j,m,
0114 +bi,bj)
0115 ENDDO
6b6b38f093 Dani*0116 #endif
95ea1bba23 Dani*0117 ENDDO
0118 ENDDO
0119 ENDDO
95afe7199b Dani*0120 ENDDO
0121
95ea1bba23 Dani*0122
96b006450c dngo*0123 ENDIF
95ea1bba23 Dani*0124
feb7fa5d1e dngo*0125 #endif /* ALLOW_STREAMICE_FP_ADJ */
95afe7199b Dani*0126 RETURN
0127 END