/[MITgcm]/MITgcm/pkg/streamice/streamice_vel_solve_openad.F
ViewVC logotype

Contents of /MITgcm/pkg/streamice/streamice_vel_solve_openad.F

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


Revision 1.3 - (show annotations) (download)
Mon Mar 23 14:07:17 2015 UTC (9 years, 2 months ago) by dgoldberg
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65k, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, HEAD
Changes since 1.2: +5 -4 lines
further changes to allow for residual convergence check with christianson f.p. algorithm,
and to allow for the PHI() format of calling vel_solve() without openad

1 C $Header: /u/gcmpack/MITgcm/pkg/streamice/streamice_vel_solve_openad.F,v 1.2 2015/03/02 18:11:58 dgoldberg Exp $
2 C $Name: $
3
4 #include "STREAMICE_OPTIONS.h"
5 #ifdef ALLOW_AUTODIFF
6 # include "AUTODIFF_OPTIONS.h"
7 #endif
8
9 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
10
11 CBOP
12 SUBROUTINE STREAMICE_VEL_SOLVE_OPENAD ( myThid, maxNLIter,
13 & maxCGiter, myiter )
14 C /============================================================\
15 C | SUBROUTINE |
16 C | o |
17 C |============================================================|
18 C | |
19 C \============================================================/
20 IMPLICIT NONE
21
22 C === Global variables ===
23 #include "SIZE.h"
24 #include "EEPARAMS.h"
25 #include "PARAMS.h"
26 #include "STREAMICE.h"
27 #include "STREAMICE_CG.h"
28
29
30 #ifdef ALLOW_AUTODIFF_TAMC
31 # include "tamc.h"
32 #endif
33
34 C !INPUT/OUTPUT ARGUMENTS
35 INTEGER myThid
36 INTEGER maxNLIter
37 INTEGER maxCGIter
38 INTEGER myIter
39
40 #ifdef ALLOW_STREAMICE
41
42 C LOCAL VARIABLES
43
44 INTEGER i, j, k, l, bi, bj, loopiter
45 CHARACTER*(MAX_LEN_MBUF) msgBuf
46
47 INTEGER NL_iter
48 _RL err_last_change, cgtol, err_init
49 LOGICAL CONVERGED
50
51 #ifdef ALLOW_OPENAD
52 INTEGER ADJ_ITER
53 LOGICAL ADJ_CONVERGED
54 #endif
55
56
57
58 #ifdef ALLOW_STREAMICE_OAD_FP
59 isinloop0 =0
60 isinloop1 =1
61 isinloop2 =2
62 #endif
63
64
65 #if (defined (ALLOW_STREAMICE_OAD_FP))
66
67 IF (STREAMICE_ppm_driving_stress) THEN
68 CALL STREAMICE_DRIVING_STRESS_PPM (myThid)
69 ELSE
70 CALL STREAMICE_DRIVING_STRESS (myThid)
71 ENDIF
72
73 #ifdef STREAMICE_STRESS_BOUNDARY_CONTROL
74 _EXCH_XY_RL( taudx_SI , myThid )
75 _EXCH_XY_RL( taudy_SI , myThid )
76 CALL STREAMICE_FORCED_BUTTRESS (myThid)
77 #endif
78
79 CALL TIMER_START ('STREAMICE_VEL_SOLVE',myThid)
80
81 cgtol = streamice_cg_tol
82 nl_iter = 0
83 CONVERGED = .false.
84 err_last_change = 1 _d 1
85
86 _EXCH_XY_RL( taudx_SI , myThid )
87 _EXCH_XY_RL( taudy_SI , myThid )
88
89 DO bj = myByLo(myThid), myByHi(myThid)
90 DO bi = myBxLo(myThid), myBxHi(myThid)
91 DO j=1-OLy,sNy+OLy
92 DO i=1-OLx,sNx+OLx
93 U_streamice (i,j,bi,bj)=U_streamice (i,j,bi,bj)
94 & + 0*u_new_SI (i,j,bi,bj)
95 V_streamice (i,j,bi,bj)=V_streamice (i,j,bi,bj)
96 & + 0*v_new_SI (i,j,bi,bj)
97 ENDDO
98 ENDDO
99 ENDDO
100 ENDDO
101
102 #ifdef STREAMICE_HYBRID_STRESS
103 CALL STREAMICE_VISC_BETA_HYBRID ( myThid )
104 #else
105 CALL STREAMICE_VISC_BETA ( myThid )
106 #endif
107
108 if (STREAMICE_chkresidconvergence .or.
109 & (streamice_maxnliter_cpl.eq.0 .and. myIter.eq.0)) then
110
111 CALL STREAMICE_GET_VEL_RESID_ERR_OAD ( err_init, myThid )
112 err_last_change = err_init
113
114 WRITE(msgBuf,'(A,E15.7)') 'initial nonlinear resid (error): ',
115 & err_init
116 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
117 & SQUEEZE_RIGHT , 1)
118
119 endif
120
121
122
123 #ifndef ALLOW_OPENAD
124 CALL STREAMICE_VEL_PHISTAGE (
125 I myThid,
126 I maxNLIter,
127 I maxCGiter,
128 O cgtol,
129 O nL_iter,
130 O CONVERGED,
131 O err_last_change,
132 O err_init,
133 I isinloop0)
134 #else
135 CALL STREAMICE_VEL_PHISTAGE (
136 I myThid,
137 I maxNLIter,
138 I maxCGiter,
139 O cgtol,
140 O nL_iter,
141 O adj_iter,
142 O CONVERGED,
143 O ADJ_CONVERGED,
144 O err_last_change,
145 O err_init,
146 I isinloop0)
147 #endif
148
149 DO loopiter=1,maxNLIter
150
151 C To avoid using "exit", loop goes through all iterations
152 C but after convergence loop does nothing
153
154 ! IF (.not.CONVERGED) THEN
155
156 #ifndef ALLOW_OPENAD
157 CALL STREAMICE_VEL_PHISTAGE (
158 I myThid,
159 I maxNLIter,
160 I maxCGiter,
161 O cgtol,
162 O nL_iter,
163 O CONVERGED,
164 O err_last_change,
165 O err_init,
166 I isinloop1)
167 #else
168 CALL STREAMICE_VEL_PHISTAGE (
169 I myThid,
170 I maxNLIter,
171 I maxCGiter,
172 O cgtol,
173 O nL_iter,
174 O adj_iter,
175 O CONVERGED,
176 O ADJ_CONVERGED,
177 O err_last_change,
178 O err_init,
179 I isinloop1)
180 #endif
181
182 !DO bj = myByLo(myThid), myByHi(myThid)
183 ! DO bi = myBxLo(myThid), myBxHi(myThid)
184 ! DO j=1-OLy,sNy+OLy
185 ! DO i=1-OLx,sNx+OLx
186 ! U_streamice (i,j,bi,bj)=u_new_SI (i,j,bi,bj)
187 ! V_streamice (i,j,bi,bj)=v_new_SI (i,j,bi,bj)
188 ! ENDDO
189 ! ENDDO
190 ! ENDDO
191 !ENDDO
192
193
194 ENDDO
195
196 #ifndef ALLOW_OPENAD
197 CALL STREAMICE_VEL_PHISTAGE (
198 I myThid,
199 I maxNLIter,
200 I maxCGiter,
201 O cgtol,
202 O nL_iter,
203 O CONVERGED,
204 O err_last_change,
205 O err_init,
206 I isinloop2)
207 #else
208 CALL STREAMICE_VEL_PHISTAGE (
209 I myThid,
210 I maxNLIter,
211 I maxCGiter,
212 O cgtol,
213 O nL_iter,
214 O adj_iter,
215 O CONVERGED,
216 O ADJ_CONVERGED,
217 O err_last_change,
218 O err_init,
219 I isinloop2)
220 #endif
221
222
223
224 C END NL ITER. LOOP
225 C-------------------------------------------------------------------
226
227 if (nl_iter .lt. streamice_max_nl_iter) then
228 WRITE(msgBuf,'(A,I5,A)') 'VELOCITY SOLVE CONVERGED, ',
229 & nl_iter, ' iterations'
230 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
231 & SQUEEZE_RIGHT , 1)
232 else
233 WRITE(msgBuf,'(A,I5,A)') 'VELOCITY SOLVE NOT CONVERGED IN ',
234 & nl_iter, ' iterations'
235 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
236 & SQUEEZE_RIGHT , 1)
237 endif
238
239 _EXCH_XY_RL(U_streamice, myThid)
240 _EXCH_XY_RL(V_streamice, myThid)
241
242 CALL TIMER_STOP ('STREAMICE_VEL_SOLVE',myThid)
243
244 #endif
245 #endif
246 RETURN
247 END

  ViewVC Help
Powered by ViewVC 1.1.22