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

Annotation of /MITgcm/tools/OAD_support/ad_template.streamice_invert_surf_forthick.F

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


Revision 1.1 - (hide annotations) (download)
Tue Nov 29 12:37:52 2016 UTC (3 years, 7 months ago) by dgoldberg
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, HEAD
new AD templates for streamice_invert_surf_forthick and streamice_smooth_adjoint_field. ad_template.streamice_vel_phistage.F modified to allow for R_low as control

1 dgoldberg 1.1 #include "STREAMICE_OPTIONS.h"
2    
3     SUBROUTINE template()
4     use OAD_cp
5     use OAD_tape
6     use OAD_rev
7    
8     !$TEMPLATE_PRAGMA_DECLARATIONS
9    
10     integer :: cp_loop_variable_1,cp_loop_variable_2,
11     + cp_loop_variable_3,cp_loop_variable_4
12    
13     type(modeType) :: our_orig_mode
14    
15     integer iaddr
16     external iaddr
17    
18    
19     Real*8 H_p (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
20     Real*8 surf_p (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
21     Real*8 R_p (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
22     Real*8 H_d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
23     Real*8 surf_d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
24     Real*8 R_d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
25    
26     C
27     C **** Statements ****
28     C
29    
30    
31     if (our_rev_mode%plain) then
32     #ifdef STREAMICE_ALLOW_DEPTH_CONTROL
33     #ifdef STREAMICE_SMOOTH_FLOATATION
34    
35     H_p = H_streamice%v
36     surf_p = surf_el_streamice%v
37     R_p = R_low_si%v
38    
39     CALL STREAMICE_INVERT_SURF_FORTHICK(
40     O H_p,
41     I surf_p,
42     I R_p,
43     I delta,
44     I myThid)
45    
46     H_streamice%v = H_p
47     #endif
48     #endif
49     end if
50     if (our_rev_mode%tape) then
51     #ifdef STREAMICE_SMOOTH_FLOATATION
52     #ifdef STREAMICE_ALLOW_DEPTH_CONTROL
53     c set up for plain execution
54     our_orig_mode=our_rev_mode
55     our_rev_mode%arg_store=.FALSE.
56     our_rev_mode%arg_restore=.FALSE.
57     our_rev_mode%plain=.TRUE.
58     our_rev_mode%tape=.FALSE.
59     our_rev_mode%adjoint=.FALSE.
60    
61     H_p = H_streamice%v
62     surf_p = surf_el_streamice%v
63     R_p = R_low_si%v
64    
65     call oad_tape_push(surf_p)
66     call oad_tape_push(R_p)
67     call oad_tape_push(delta)
68     call oad_tape_push(myThid)
69    
70     CALL STREAMICE_INVERT_SURF_FORTHICK(
71     O H_p,
72     I surf_p,
73     I R_p,
74     I delta,
75     I myThid)
76    
77     call oad_tape_push(H_p)
78     H_streamice%v = H_p
79     our_rev_mode=our_orig_mode
80     #endif
81     #endif
82     end if
83     if (our_rev_mode%adjoint) then
84     c set up for plain execution
85     #ifdef STREAMICE_ALLOW_DEPTH_CONTROL
86     #ifdef STREAMICE_SMOOTH_FLOATATION
87     our_orig_mode=our_rev_mode
88     our_rev_mode%arg_store=.FALSE.
89     our_rev_mode%arg_restore=.FALSE.
90     our_rev_mode%plain=.TRUE.
91     our_rev_mode%tape=.FALSE.
92     our_rev_mode%adjoint=.FALSE.
93    
94     call oad_tape_pop(H_p)
95     call oad_tape_pop(myThid)
96     call oad_tape_pop(delta)
97     call oad_tape_pop(R_p)
98     call oad_tape_pop(surf_p)
99    
100     H_d = H_streamice%d
101     surf_d = surf_el_streamice%d
102     R_d = R_low_si%d
103    
104     CALL ADSTRMICE_H_INV (
105     & H_p,
106     & H_d,
107     & Surf_p,
108     & R_p,
109     & R_d,
110     & delta,
111     & mythid)
112    
113     R_low_si%d = R_d
114    
115     our_rev_mode=our_orig_mode
116     #endif
117     #endif
118     end if
119     end subroutine template

  ViewVC Help
Powered by ViewVC 1.1.22