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

Contents of /MITgcm/tools/OAD_support/ad_template.streamice_get_vel_resid_err_oad.F

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


Revision 1.3 - (show annotations) (download)
Mon Mar 23 14:08:18 2015 UTC (4 years, 9 months ago) by dgoldberg
Branch: MAIN
Changes since 1.2: +6 -4 lines
further changes to allow for residual convergence check with christianson f.p. algorithm

1 #include "STREAMICE_OPTIONS.h"
2
3 SUBROUTINE template()
4 use OAD_cp
5 use OAD_tape
6 use OAD_rev
7
8
9 !$TEMPLATE_PRAGMA_DECLARATIONS
10
11 integer testTape
12 !logical isTape
13 !type(modeType) :: our_orig_mode
14
15 if (our_rev_mode%plain .or. our_rev_mode%tape) then
16 ! if (our_rev_mode%plain) then
17
18 if (our_rev_mode%tape) then
19 testTape=1
20 our_rev_mode%plain=.true.
21 our_rev_mode%tape=.false.
22 our_rev_mode%adjoint=.false.
23 else
24 testTape=0
25 endif
26
27
28 err_max = 0. _d 0
29
30 DO bj = myByLo(myThid), myByHi(myThid)
31 DO bi = myBxLo(myThid), myBxHi(myThid)
32 DO j=1-oly,sNy+oly
33 DO i=1-olx,sNx+olx
34 Au_SI (i,j,bi,bj) = 0. _d 0
35 Av_SI (i,j,bi,bj) = 0. _d 0
36 u_dummy (i,j,bi,bj) = u_streamice(i,j,bi,bj)%v
37 v_dummy (i,j,bi,bj) = v_streamice(i,j,bi,bj)%v
38 ubd_SI (i,j,bi,bj)%v = 0. _d 0
39 vbd_SI (i,j,bi,bj)%v = 0. _d 0
40 ENDDO
41 ENDDO
42 ENDDO
43 ENDDO
44
45 CALL openad_STREAMICE_CG_BOUND_VALS( myThid,
46 O ubd_SI,
47 O vbd_SI)
48
49 CALL openad_STREAMICE_CG_ACTION( myThid,
50 O Au_SI,
51 O Av_SI,
52 I U_dummy,
53 I V_dummy,
54 I 0, sNx+1, 0, sNy+1 )
55
56
57 DO bj = myByLo(myThid), myByHi(myThid)
58 DO bi = myBxLo(myThid), myBxHi(myThid)
59 DO j=1,sNy
60 DO i=1,sNx
61 err_tempu = 0. _d 0
62 err_tempv = 0. _d 0
63 IF (STREAMICE_umask(i,j,bi,bj).eq.1) THEN
64 err_tempu =
65 & ABS (Au_SI(i,j,bi,bj)+0*ubd_SI(i,j,bi,bj)%v -
66 & taudx_SI(i,j,bi,bj)%v)
67 ENDIF
68 IF (STREAMICE_vmask(i,j,bi,bj).eq.1) THEN
69 err_tempv = MAX( err_tempu,
70 & ABS (Av_SI(i,j,bi,bj)+0*vbd_SI(i,j,bi,bj)%v -
71 & taudy_SI(i,j,bi,bj)%v))
72 ENDIF
73 IF (err_tempv .ge. err_max) THEN
74 err_max = err_tempv
75 ENDIF
76 ENDDO
77 ENDDO
78 ENDDO
79 ENDDO
80
81 CALL GLOBAL_MAX_R8 (err_max, myThid)
82
83 if (testTape.eq.1) then
84 our_rev_mode%plain=.false.
85 our_rev_mode%tape=.true.
86 our_rev_mode%adjoint=.false.
87 endif
88
89 end if
90
91
92
93 end subroutine template

  ViewVC Help
Powered by ViewVC 1.1.22