-
Notifications
You must be signed in to change notification settings - Fork 237
/
shelfice_forcing.F
222 lines (205 loc) · 7.18 KB
/
shelfice_forcing.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#include "SHELFICE_OPTIONS.h"
#ifdef ALLOW_STEEP_ICECAVITY
# include "STIC_OPTIONS.h"
#endif
C-- File shelfice_forcing.F:
C-- Contents
C-- o SHELFICE_FORCING_T
C-- o SHELFICE_FORCING_S
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
CBOP
C !ROUTINE: SHELFICE_FORCING_T
C !INTERFACE:
SUBROUTINE SHELFICE_FORCING_T(
U gT_arr,
I iMin,iMax,jMin,jMax, kLev, bi, bj,
I myTime, myIter, myThid )
C !DESCRIPTION: \bv
C *==========================================================*
C | S/R SHELFICE_FORCING_T
C | o Contains problem specific forcing for temperature.
C *==========================================================*
C | Adds terms to gT for forcing by shelfice sources
C | e.g. heat flux
C *==========================================================*
C \ev
C !USES:
IMPLICIT NONE
C == Global data ==
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "GRID.h"
c#include "DYNVARS.h"
c#include "FFIELDS.h"
#include "SHELFICE.h"
#ifdef ALLOW_STEEP_ICECAVITY
# include "STIC.h"
#endif
C !INPUT/OUTPUT PARAMETERS:
C gT_arr :: the tendency array
C iMin,iMax :: Working range of x-index for applying forcing.
C jMin,jMax :: Working range of y-index for applying forcing.
C kLev :: Current vertical level index
C bi,bj :: Current tile indices
C myTime :: Current time in simulation
C myIter :: Current iteration number
C myThid :: my Thread Id number
_RL gT_arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
INTEGER iMin, iMax, jMin, jMax
INTEGER kLev, bi, bj
_RL myTime
INTEGER myIter
INTEGER myThid
#ifdef ALLOW_SHELFICE
C !LOCAL VARIABLES:
C == Local variables ==
C i,j :: Loop counters
C kp1,km1 :: index of next/previous level
C gTloc :: local tendency in boundary layer
C drLoc :: fractional cell width of boundary layer in (k+/-1)th layer
INTEGER i, j
INTEGER Kp1, Km1
_RS drLoc
_RL gTloc
CEOP
C-- Forcing term
IF ( SHELFICEboundaryLayer ) THEN
DO j=1,sNy
DO i=1,sNx
IF ( kLev .LT. Nr .AND. kLev .EQ. kTopC(I,J,bi,bj) ) THEN
kp1 = MIN(kLev+1,Nr)
drLoc = drF(kLev)*( 1. _d 0 - _hFacC(I,J,kLev,bi,bj) )
drLoc = MIN( drLoc, drF(Kp1) * _hFacC(I,J,Kp1,bi,bj) )
drLoc = MAX( drLoc, 0. _d 0)
gTloc = shelficeForcingT(i,j,bi,bj)
& /( drF(kLev)*_hFacC(I,J,kLev,bi,bj)+drLoc )
gT_arr(i,j) = gT_arr(i,j) + gTloc
ELSEIF ( kLev .GT. 1 .AND. kLev-1 .EQ. kTopC(I,J,bi,bj) ) THEN
km1 = MAX(kLev-1,1)
drLoc = drF(km1)*( 1. _d 0 - _hFacC(I,J,km1,bi,bj) )
drLoc = MIN( drLoc, drF(kLev) * _hFacC(I,J,kLev,bi,bj) )
drLoc = MAX( drLoc, 0. _d 0)
gTloc = shelficeForcingT(i,j,bi,bj)
& /( drF(km1)*_hFacC(I,J,km1,bi,bj)+drLoc )
C The following is shorthand for the averaged tendency:
C gT(k+1) = gT(k+1) + { gTloc * [drF(k)*(1-hFacC(k))]
C + 0 * [drF(k+1) - drF(k)*(1-hFacC(k))]
C }/[drF(k+1)*hFacC(k+1)]
gT_arr(i,j) = gT_arr(i,j) + gTloc
& * drLoc*recip_drF(kLev)* _recip_hFacC(i,j,kLev,bi,bj)
ENDIF
ENDDO
ENDDO
ENDIF
# ifdef ALLOW_STEEP_ICECAVITY
IF ( useSTIC ) THEN
DO j=1,sNy
DO i=1,sNx
C-- TENDENCY FROM STEEP ICECAVITY (BOTH ICE SHELF AND ICE FRONT)
gT_arr(i,j) = gT_arr(i,j) + stic_gT(i,j,kLev,bi,bj)
ENDDO
ENDDO
ENDIF
# endif /* ALLOW_STEEP_ICECAVITY */
#endif /* ALLOW_SHELFICE */
RETURN
END
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
CBOP
C !ROUTINE: SHELFICE_FORCING_S
C !INTERFACE:
SUBROUTINE SHELFICE_FORCING_S(
U gS_arr,
I iMin,iMax,jMin,jMax, kLev, bi, bj,
I myTime, myIter, myThid )
C !DESCRIPTION: \bv
C *==========================================================*
C | S/R SHELFICE_FORCING_S
C | o Contains problem specific forcing for merid velocity.
C *==========================================================*
C | Adds terms to gS for forcing by shelfice sources
C | e.g. fresh-water flux (virtual salt flux).
C *==========================================================*
C \ev
C !USES:
IMPLICIT NONE
C == Global data ==
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "GRID.h"
c#include "DYNVARS.h"
c#include "FFIELDS.h"
#include "SHELFICE.h"
#ifdef ALLOW_STEEP_ICECAVITY
# include "STIC.h"
#endif
C !INPUT/OUTPUT PARAMETERS:
C gS_arr :: the tendency array
C iMin,iMax :: Working range of x-index for applying forcing.
C jMin,jMax :: Working range of y-index for applying forcing.
C kLev :: Current vertical level index
C bi,bj :: Current tile indices
C myTime :: Current time in simulation
C myIter :: Current iteration number
C myThid :: my Thread Id number
_RL gS_arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
INTEGER iMin, iMax, jMin, jMax
INTEGER kLev, bi, bj
_RL myTime
INTEGER myIter
INTEGER myThid
#ifdef ALLOW_SHELFICE
C !LOCAL VARIABLES:
C i,j :: Loop counters
C kp/m1 :: index of next/previous level
C gTloc :: local tendency in boundary layer
C drLoc :: fractional cell width of boundary layer
INTEGER i, j
INTEGER Kp1, Km1
_RS drLoc
_RL gSloc
CEOP
C-- Forcing term
IF ( SHELFICEboundaryLayer ) THEN
DO j=1,sNy
DO i=1,sNx
IF ( kLev .LT. Nr .AND. kLev .EQ. kTopC(I,J,bi,bj) ) THEN
kp1 = MIN(kLev+1,Nr)
drLoc = drF(kLev)*( 1. _d 0 - _hFacC(I,J,kLev,bi,bj) )
drLoc = MIN( drLoc, drF(Kp1) * _hFacC(I,J,Kp1,bi,bj) )
drLoc = MAX( drLoc, 0. _d 0)
gSloc = shelficeForcingS(i,j,bi,bj)
& /( drF(kLev)*_hFacC(I,J,kLev,bi,bj)+drLoc )
gS_arr(i,j) = gS_arr(i,j) + gSloc
ELSEIF ( kLev .GT. 1 .AND. kLev-1 .EQ. kTopC(I,J,bi,bj) ) THEN
km1 = MAX(kLev-1,1)
drLoc = drF(km1)*( 1. _d 0 - _hFacC(I,J,km1,bi,bj) )
drLoc = MIN( drLoc, drF(kLev) * _hFacC(I,J,kLev,bi,bj) )
drLoc = MAX( drLoc, 0. _d 0)
gSloc = shelficeForcingS(i,j,bi,bj)
& /( drF(km1)*_hFacC(I,J,km1,bi,bj)+drLoc )
C The following is shorthand for the averaged tendency:
C gS(k+1) = gS(k+1) + { gSloc * [drF(k)*(1-hFacC(k))]
C + 0 * [drF(k+1) - drF(k)*(1-hFacC(k))]
C }/[drF(k+1)*hFacC(k+1)]
gS_arr(i,j) = gS_arr(i,j) + gSloc
& * drLoc*recip_drF(kLev)* _recip_hFacC(i,j,kLev,bi,bj)
ENDIF
ENDDO
ENDDO
ENDIF
# ifdef ALLOW_STEEP_ICECAVITY
IF ( useSTIC ) THEN
DO j=1,sNy
DO i=1,sNx
C-- TENDENCY FROM STEEP ICECAVITY (BOTH ICE SHELF AND ICE FRONT)
gS_arr(i,j) = gS_arr(i,j) + stic_gS(i,j,kLev,bi,bj)
ENDDO
ENDDO
ENDIF
# endif /* ALLOW_STEEP_ICECAVITY */
#endif /* ALLOW_SHELFICE */
RETURN
END