/[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.2 - (show annotations) (download)
Fri Mar 6 20:16:05 2015 UTC (5 years, 6 months ago) by dgoldberg
Branch: MAIN
Changes since 1.1: +19 -18 lines
fix for residual calc with openad FP alg

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,sNy
33 DO i=1,sNx
34 Au_SI (i,j,bi,bj) = 0. _d 0
35 Av_SI (i,j,bi,bj) = 0. _d 0
36 ubd_SI (i,j,bi,bj)%v = 0. _d 0
37 vbd_SI (i,j,bi,bj)%v = 0. _d 0
38 ENDDO
39 ENDDO
40 ENDDO
41 ENDDO
42
43 CALL openad_STREAMICE_CG_BOUND_VALS( myThid,
44 O ubd_SI,
45 O vbd_SI)
46
47 CALL openad_STREAMICE_CG_ACTION( myThid,
48 O Au_SI,
49 O Av_SI,
50 I U_streamice%v,
51 I V_streamice%v,
52 I 0, sNx+1, 0, sNy+1 )
53
54
55 DO bj = myByLo(myThid), myByHi(myThid)
56 DO bi = myBxLo(myThid), myBxHi(myThid)
57 DO j=1,sNy
58 DO i=1,sNx
59 err_tempu = 0. _d 0
60 err_tempv = 0. _d 0
61 IF (STREAMICE_umask(i,j,bi,bj).eq.1) THEN
62 err_tempu =
63 & ABS (Au_SI(i,j,bi,bj)+0*ubd_SI(i,j,bi,bj)%v -
64 & taudx_SI(i,j,bi,bj)%v)
65 ENDIF
66 IF (STREAMICE_vmask(i,j,bi,bj).eq.1) THEN
67 err_tempv = MAX( err_tempu,
68 & ABS (Av_SI(i,j,bi,bj)+0*vbd_SI(i,j,bi,bj)%v -
69 & taudy_SI(i,j,bi,bj)%v))
70 ENDIF
71 IF (err_tempv .ge. err_max) THEN
72 err_max = err_tempv
73 ENDIF
74 ENDDO
75 ENDDO
76 ENDDO
77 ENDDO
78
79 CALL GLOBAL_MAX_R8 (err_max, myThid)
80
81 if (testTape.eq.1) then
82 our_rev_mode%plain=.false.
83 our_rev_mode%tape=.true.
84 our_rev_mode%adjoint=.false.
85 endif
86
87 end if
88
89
90
91 end subroutine template

  ViewVC Help
Powered by ViewVC 1.1.22