/[MITgcm]/MITgcm/tools/OAD_support/ad_template.streamice_vel_phistage.F
ViewVC logotype

Diff of /MITgcm/tools/OAD_support/ad_template.streamice_vel_phistage.F

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

revision 1.1 by dgoldberg, Sat Feb 21 19:07:27 2015 UTC revision 1.2 by dgoldberg, Mon Mar 2 18:16:02 2015 UTC
# Line 14  Line 14 
14    
15        integer iaddr        integer iaddr
16        external iaddr        external iaddr
17          _RL err_max
18  !<------------------Begin user declarations ---------------------->!  !<------------------Begin user declarations ---------------------->!
19  ! Insert declarations of dummy variables for calling adjoint computation  ! Insert declarations of dummy variables for calling adjoint computation
20  ! without side effects, and storing adjoint variable iterates  ! without side effects, and storing adjoint variable iterates
# Line 62  Line 63 
63            CALL print_message(MSGBUF,STANDARDMESSAGEUNIT,'R',1)            CALL print_message(MSGBUF,STANDARDMESSAGEUNIT,'R',1)
64    
65  !!!!!!!!!!!! conv check  !!!!!!!!!!!! conv check
             
           if (STREAMICE_chkfixedptconvergence) then  
66    
67             CALL openad_STREAMICE_GET_FP_ERR_OAD ( err_max_fp, myThid )            if (STREAMICE_chkresidconvergence) then
68    
69             WRITE(msgBuf,'(A,1PE22.14)') 'STREAMICE_FP_ERROR =',             CALL openad_STREAMICE_GET_VEL_RESID_ERR_OAD (err_max,myThid)
70       &                       err_max_fp  
71               WRITE(msgBuf,'(A,E15.7)') 'err/err_init',
72         &                       err_max/err_init
73             CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,             CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
74       &                    SQUEEZE_RIGHT , 1)       &                    SQUEEZE_RIGHT , 1)
75    
76             IF (err_max_fp .LE. streamice_nonlin_tol_fp) THEN             IF (err_max .LE. streamice_nonlin_tol * err_init) THEN
77              CONVERGED = .true.              CONVERGED = .true.
78             ENDIF             ENDIF
79    
80             IF (err_max_fp<err_last_change*1.e-2 .and.             IF (err_max<err_last_change*1.e-2 .and.
81       &      STREAMICE_lower_cg_tol) THEN       &      STREAMICE_lower_cg_tol) THEN
82              cgtol = cgtol * 5.e-2              cgtol = cgtol * 5.e-2
83              err_last_change = err_max_fp              err_last_change = err_max
84              WRITE(msgBuf,'(A,E15.7)') 'new cg tol: ',              WRITE(msgBuf,'(A,E15.7)') 'new cg tol: ',
85       &                       cgtol       &                       cgtol
86              CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,              CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
# Line 87  Line 88 
88             ENDIF             ENDIF
89    
90            endif            endif
91              
92              if (STREAMICE_chkfixedptconvergence) then
93    
94               CALL openad_STREAMICE_GET_FP_ERR_OAD ( err_max_fp, myThid )
95    
96               WRITE(msgBuf,'(A,1PE22.14)') 'STREAMICE_FP_ERROR =',
97         &                       err_max_fp
98               CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
99         &                    SQUEEZE_RIGHT , 1)
100    
101               IF (err_max_fp .LE. streamice_nonlin_tol_fp) THEN
102                CONVERGED = .true.
103               ENDIF
104    
105    
106              endif
107    
108  !!!!!!!!!!!! end conv check  !!!!!!!!!!!! end conv check
109    
# Line 148  Line 165 
165    
166  !---- conv check  !---- conv check
167                        
168            if (STREAMICE_chkfixedptconvergence) then            if (STREAMICE_chkresidconvergence) then
169    
170             CALL openad_STREAMICE_GET_FP_ERR_OAD ( err_max_fp, myThid )             CALL openad_STREAMICE_GET_VEL_RESID_ERR_OAD (err_max,myThid)
171    
172             WRITE(msgBuf,'(A,1PE22.14)') 'STREAMICE_FP_ERROR =',             WRITE(msgBuf,'(A,E15.7)') 'err/err_init',
173       &                       err_max_fp       &                       err_max/err_init
174             CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,             CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
175       &                    SQUEEZE_RIGHT , 1)       &                    SQUEEZE_RIGHT , 1)
176    
177             IF (err_max_fp .LE. streamice_nonlin_tol_fp) THEN             IF (err_max .LE. streamice_nonlin_tol * err_init) THEN
178              CONVERGED = .true.              CONVERGED = .true.
179             ENDIF             ENDIF
180    
181             IF (err_max_fp<err_last_change*1.e-2 .and.             IF (err_max<err_last_change*1.e-2 .and.
182       &      STREAMICE_lower_cg_tol) THEN       &      STREAMICE_lower_cg_tol) THEN
183              cgtol = cgtol * 5.e-2              cgtol = cgtol * 5.e-2
184              err_last_change = err_max_fp              err_last_change = err_max
185              WRITE(msgBuf,'(A,E15.7)') 'new cg tol: ',              WRITE(msgBuf,'(A,E15.7)') 'new cg tol: ',
186       &                       cgtol       &                       cgtol
187              CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,              CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
# Line 173  Line 190 
190    
191            endif            endif
192    
193              if (STREAMICE_chkfixedptconvergence) then
194    
195               CALL openad_STREAMICE_GET_FP_ERR_OAD ( err_max_fp, myThid )
196    
197               WRITE(msgBuf,'(A,1PE22.14)') 'STREAMICE_FP_ERROR =',
198         &                       err_max_fp
199               CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
200         &                    SQUEEZE_RIGHT , 1)
201    
202               IF (err_max_fp .LE. streamice_nonlin_tol_fp) THEN
203                CONVERGED = .true.
204               ENDIF
205    
206              endif
207    
208  !--------conv check done  !--------conv check done
209    
210            DO bj = myByLo(myThid), myByHi(myThid)            DO bj = myByLo(myThid), myByHi(myThid)
# Line 200  Line 232 
232              our_rev_mode%plain=.false.              our_rev_mode%plain=.false.
233              our_rev_mode%tape=.true.              our_rev_mode%tape=.true.
234              our_rev_mode%adjoint=.false.              our_rev_mode%adjoint=.false.
235              CALL OpenAD_streamice_vel_phi(MYTHID,MAXNLITER,MAXCGITER,CGTOL              CALL OpenAD_streamice_vel_phi(MYTHID,MAXNLITER,MAXCGITER,CG
236       +,CG_ITERS)       +TOL,CG_ITERS)
237            end if            end if
238          end if          end if
239        end if        end if

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

  ViewVC Help
Powered by ViewVC 1.1.22