/[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.4 - (show annotations) (download)
Wed Mar 25 17:35:29 2015 UTC (5 years, 6 months ago) by dgoldberg
Branch: MAIN
CVS Tags: checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65t, checkpoint65u, checkpoint65k, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m
Changes since 1.3: +3 -1 lines
allow mechanical adjoint with OAD

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 (defined (ALLOW_STREAMICE_OAD_FP))
16
17 if (our_rev_mode%plain .or. our_rev_mode%tape) then
18 ! if (our_rev_mode%plain) then
19
20 if (our_rev_mode%tape) then
21 testTape=1
22 our_rev_mode%plain=.true.
23 our_rev_mode%tape=.false.
24 our_rev_mode%adjoint=.false.
25 else
26 testTape=0
27 endif
28
29
30 err_max = 0. _d 0
31
32 DO bj = myByLo(myThid), myByHi(myThid)
33 DO bi = myBxLo(myThid), myBxHi(myThid)
34 DO j=1-oly,sNy+oly
35 DO i=1-olx,sNx+olx
36 Au_SI (i,j,bi,bj) = 0. _d 0
37 Av_SI (i,j,bi,bj) = 0. _d 0
38 u_dummy (i,j,bi,bj) = u_streamice(i,j,bi,bj)%v
39 v_dummy (i,j,bi,bj) = v_streamice(i,j,bi,bj)%v
40 ubd_SI (i,j,bi,bj)%v = 0. _d 0
41 vbd_SI (i,j,bi,bj)%v = 0. _d 0
42 ENDDO
43 ENDDO
44 ENDDO
45 ENDDO
46
47 CALL openad_STREAMICE_CG_BOUND_VALS( myThid,
48 O ubd_SI,
49 O vbd_SI)
50
51 CALL openad_STREAMICE_CG_ACTION( myThid,
52 O Au_SI,
53 O Av_SI,
54 I U_dummy,
55 I V_dummy,
56 I 0, sNx+1, 0, sNy+1 )
57
58
59 DO bj = myByLo(myThid), myByHi(myThid)
60 DO bi = myBxLo(myThid), myBxHi(myThid)
61 DO j=1,sNy
62 DO i=1,sNx
63 err_tempu = 0. _d 0
64 err_tempv = 0. _d 0
65 IF (STREAMICE_umask(i,j,bi,bj).eq.1) THEN
66 err_tempu =
67 & ABS (Au_SI(i,j,bi,bj)+0*ubd_SI(i,j,bi,bj)%v -
68 & taudx_SI(i,j,bi,bj)%v)
69 ENDIF
70 IF (STREAMICE_vmask(i,j,bi,bj).eq.1) THEN
71 err_tempv = MAX( err_tempu,
72 & ABS (Av_SI(i,j,bi,bj)+0*vbd_SI(i,j,bi,bj)%v -
73 & taudy_SI(i,j,bi,bj)%v))
74 ENDIF
75 IF (err_tempv .ge. err_max) THEN
76 err_max = err_tempv
77 ENDIF
78 ENDDO
79 ENDDO
80 ENDDO
81 ENDDO
82
83 CALL GLOBAL_MAX_R8 (err_max, myThid)
84
85 if (testTape.eq.1) then
86 our_rev_mode%plain=.false.
87 our_rev_mode%tape=.true.
88 our_rev_mode%adjoint=.false.
89 endif
90
91 end if
92
93
94 #endif
95 end subroutine template

  ViewVC Help
Powered by ViewVC 1.1.22