/[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.1 - (show annotations) (download)
Mon Mar 2 18:16:02 2015 UTC (4 years, 10 months ago) by dgoldberg
Branch: MAIN
add files to allow residual-based fwd loop termination

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

  ViewVC Help
Powered by ViewVC 1.1.22