File indexing completed on 2018-03-02 18:45:06 UTC
view on githubraw file Latest commit 73606979 on 2016-11-29 12:37:52 UTC
736069790d Dani*0001 #include "STREAMICE_OPTIONS.h"
0002
0003 SUBROUTINE template()
0004 use OAD_cp
0005 use OAD_tape
0006 use OAD_rev
0007
0008
0009
0010 integer :: cp_loop_variable_1,cp_loop_variable_2,
0011 + cp_loop_variable_3,cp_loop_variable_4
0012
0013 type(modeType) :: our_orig_mode
0014
0015 integer iaddr
0016 external iaddr
0017
0018
0019 Real*8 H_p (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0020 Real*8 surf_p (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0021 Real*8 R_p (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0022 Real*8 H_d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0023 Real*8 surf_d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0024 Real*8 R_d (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
0025
0026
0027
0028
0029
0030
0031 if (our_rev_mode%plain) then
0032 #ifdef STREAMICE_ALLOW_DEPTH_CONTROL
0033 #ifdef STREAMICE_SMOOTH_FLOATATION
0034
0035 H_p = H_streamice%v
0036 surf_p = surf_el_streamice%v
0037 R_p = R_low_si%v
0038
0039 CALL STREAMICE_INVERT_SURF_FORTHICK(
0040 O H_p,
0041 I surf_p,
0042 I R_p,
0043 I delta,
0044 I myThid)
0045
0046 H_streamice%v = H_p
0047 #endif
0048 #endif
0049 end if
0050 if (our_rev_mode%tape) then
0051 #ifdef STREAMICE_SMOOTH_FLOATATION
0052 #ifdef STREAMICE_ALLOW_DEPTH_CONTROL
0053
0054 our_orig_mode=our_rev_mode
0055 our_rev_mode%arg_store=.FALSE.
0056 our_rev_mode%arg_restore=.FALSE.
0057 our_rev_mode%plain=.TRUE.
0058 our_rev_mode%tape=.FALSE.
0059 our_rev_mode%adjoint=.FALSE.
0060
0061 H_p = H_streamice%v
0062 surf_p = surf_el_streamice%v
0063 R_p = R_low_si%v
0064
0065 call oad_tape_push(surf_p)
0066 call oad_tape_push(R_p)
0067 call oad_tape_push(delta)
0068 call oad_tape_push(myThid)
0069
0070 CALL STREAMICE_INVERT_SURF_FORTHICK(
0071 O H_p,
0072 I surf_p,
0073 I R_p,
0074 I delta,
0075 I myThid)
0076
0077 call oad_tape_push(H_p)
0078 H_streamice%v = H_p
0079 our_rev_mode=our_orig_mode
0080 #endif
0081 #endif
0082 end if
0083 if (our_rev_mode%adjoint) then
0084
0085 #ifdef STREAMICE_ALLOW_DEPTH_CONTROL
0086 #ifdef STREAMICE_SMOOTH_FLOATATION
0087 our_orig_mode=our_rev_mode
0088 our_rev_mode%arg_store=.FALSE.
0089 our_rev_mode%arg_restore=.FALSE.
0090 our_rev_mode%plain=.TRUE.
0091 our_rev_mode%tape=.FALSE.
0092 our_rev_mode%adjoint=.FALSE.
0093
0094 call oad_tape_pop(H_p)
0095 call oad_tape_pop(myThid)
0096 call oad_tape_pop(delta)
0097 call oad_tape_pop(R_p)
0098 call oad_tape_pop(surf_p)
0099
0100 H_d = H_streamice%d
0101 surf_d = surf_el_streamice%d
0102 R_d = R_low_si%d
0103
0104 CALL ADSTRMICE_H_INV (
0105 & H_p,
0106 & H_d,
0107 & Surf_p,
0108 & R_p,
0109 & R_d,
0110 & delta,
0111 & mythid)
0112
0113 R_low_si%d = R_d
0114
0115 our_rev_mode=our_orig_mode
0116 #endif
0117 #endif
0118 end if
0119 end subroutine template