1 |
dgoldberg |
1.1 |
C $Header: /u/gcmpack/MITgcm_contrib/shelfice_remeshing/AUTO/code/shelfice_update_masks_JJ.F,v 1.3 2015/10/12 11:34:28 dgoldberg Exp $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "SHELFICE_OPTIONS.h" |
5 |
|
|
#ifdef ALLOW_CTRL |
6 |
|
|
# include "CTRL_OPTIONS.h" |
7 |
|
|
#endif |
8 |
|
|
|
9 |
|
|
CBOP |
10 |
|
|
C !ROUTINE: SHELFICE_UPDATE_MASKS |
11 |
|
|
C !INTERFACE: |
12 |
|
|
SUBROUTINE SHELFICE_UPDATE_MASKS_JJ( |
13 |
|
|
I rF, recip_drF, |
14 |
|
|
U hFacC, |
15 |
|
|
I myThid ) |
16 |
|
|
C !DESCRIPTION: \bv |
17 |
|
|
C *==========================================================* |
18 |
|
|
C | SUBROUTINE SHELFICE_UPDATE_MASKS |
19 |
|
|
C | o modify topography factor hFacC according to ice shelf |
20 |
|
|
C | topography |
21 |
|
|
C *==========================================================* |
22 |
|
|
C \ev |
23 |
|
|
|
24 |
|
|
C !USES: |
25 |
|
|
IMPLICIT NONE |
26 |
|
|
C === Global variables === |
27 |
|
|
#include "SIZE.h" |
28 |
|
|
#include "EEPARAMS.h" |
29 |
|
|
#include "PARAMS.h" |
30 |
|
|
#include "DYNVARS.h" |
31 |
|
|
#include "SURFACE.h" |
32 |
|
|
#ifdef ALLOW_SHELFICE |
33 |
|
|
# include "SHELFICE.h" |
34 |
|
|
#endif /* ALLOW_SHELFICE */ |
35 |
|
|
|
36 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
37 |
|
|
C == Routine arguments == |
38 |
|
|
C rF :: R-coordinate of face of cell (units of r). |
39 |
|
|
C recip_drF :: Recipricol of cell face separation along Z axis ( units of r ). |
40 |
|
|
C hFacC :: Fraction of cell in vertical which is open (see GRID.h) |
41 |
|
|
C myThid :: Number of this instance of SHELFICE_UPDATE_MASKS |
42 |
|
|
_RS rF (1:Nr+1) |
43 |
|
|
_RS recip_drF (1:Nr) |
44 |
|
|
_RS hFacC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy) |
45 |
|
|
|
46 |
|
|
INTEGER myThid |
47 |
|
|
|
48 |
|
|
#ifdef ALLOW_SHELFICE |
49 |
|
|
C !LOCAL VARIABLES: |
50 |
|
|
C == Local variables == |
51 |
|
|
C bi,bj :: tile indices |
52 |
|
|
C I,J,K :: Loop counters |
53 |
|
|
INTEGER bi, bj |
54 |
|
|
INTEGER I, J, K |
55 |
|
|
_RL hFacCtmp |
56 |
|
|
_RL hFacMnSz |
57 |
|
|
|
58 |
|
|
C- Update etaN |
59 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
60 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
61 |
|
|
DO J = 1-OLy,sNy+OLy |
62 |
|
|
DO I = 1-OLx,sNx+OLx |
63 |
|
|
IF ( R_shelfice(I,J,bi,bj) .LT. 0.0) THEN |
64 |
|
|
IF (etah(I,J,bi,bj) .GT. SHELFICESplitThreshold ) THEN |
65 |
|
|
K = MAX(1,kTopC(I,J,bi,bj)) |
66 |
|
|
etaN(I,J,bi,bj) = etaN(I,J,bi,bj) - 1/recip_drF(K) |
67 |
|
|
etaH(I,J,bi,bj) = etaH(I,J,bi,bj) - 1/recip_drF(K) |
68 |
|
|
R_shelfIce(I,J,bi,bj) = R_shelfIce(I,J,bi,bj)+1/recip_drF(K) |
69 |
|
|
uVel(I,J,K-1,bi,bj)=uVel(I,J,K,bi,bj) |
70 |
|
|
uVel(I+1,J,K-1,bi,bj)=uVel(I+1,J,K,bi,bj) |
71 |
|
|
vVel(I,J,K-1,bi,bj)=vVel(I,J,K,bi,bj) |
72 |
|
|
vVel(I,J+1,K-1,bi,bj)=vVel(I,J+1,K,bi,bj) |
73 |
|
|
gvnm1(I,J,K-1,bi,bj)=0.0 |
74 |
|
|
gvnm1(I,J+1,K-1,bi,bj)=0.0 |
75 |
|
|
gunm1(I,J,K-1,bi,bj)=0.0 |
76 |
|
|
gunm1(I+1,J,K-1,bi,bj)=0.0 |
77 |
|
|
salt(I,J,K-1,bi,bj)=salt(I,J,K,bi,bj) |
78 |
|
|
theta(I,J,K-1,bi,bj)=theta(I,J,K,bi,bj) |
79 |
|
|
hfacC(I,J,K,bi,bj)=1.0 |
80 |
|
|
|
81 |
|
|
ENDIF |
82 |
|
|
IF (etah(I,J,bi,bj) .LT. SHELFICEMergeThreshold ) THEN |
83 |
|
|
K = MAX(1,kTopC(I,J,bi,bj)) |
84 |
|
|
|
85 |
|
|
salt(I,J,K+1,bi,bj)=((salt(I,J,K,bi,bj)*(1/recip_drF(K)+ |
86 |
|
|
& etaN(I,J,bi,bj)))+(salt(I,J,K+1,bi,bj)*1/recip_drF(K+1)))/( |
87 |
|
|
& 1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj)) |
88 |
|
|
|
89 |
|
|
theta(I,J,K+1,bi,bj)=((theta(I,J,K,bi,bj)*(1/recip_drF(K)+ |
90 |
|
|
& etaN(I,J,bi,bj)))+(theta(I,J,K+1,bi,bj)*1/recip_drF(K+1)))/( |
91 |
|
|
& 1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj)) |
92 |
|
|
|
93 |
|
|
vVel(I,J,K+1,bi,bj)=((vVel(I,J,K,bi,bj)*(1/recip_drF(K)+ |
94 |
|
|
& etaN(I,J,bi,bj)))+(vVel(I,J,K+1,bi,bj)*1/recip_drF(K+1)))/( |
95 |
|
|
& 1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj)) |
96 |
|
|
|
97 |
|
|
vVel(I,J+1,K+1,bi,bj)=((vVel(I,J+1,K,bi,bj)*(1/recip_drF(K)+ |
98 |
|
|
& etaN(I,J,bi,bj)))+(vVel(I,J+1,K+1,bi,bj)*1/recip_drF(K+1)))/ |
99 |
|
|
& (1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj)) |
100 |
|
|
|
101 |
|
|
uVel(I,J,K+1,bi,bj)=((uVel(I,J,K,bi,bj)*(1/recip_drF(K)+ |
102 |
|
|
& etaN(I,J,bi,bj)))+(uVel(I,J,K+1,bi,bj)*1/recip_drF(K+1)))/( |
103 |
|
|
& 1/recip_ drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj)) |
104 |
|
|
|
105 |
|
|
uVel(I+1,J,K+1,bi,bj)=((uVel(I+1,J,K,bi,bj)*(1/recip_drF(K)+ |
106 |
|
|
& etaN(I,J,bi,bj)))+(uVel(I+1,J,K+1,bi,bj)*1/recip_drF(K+1)))/ |
107 |
|
|
& (1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj)) |
108 |
|
|
|
109 |
|
|
etaN(I,J,bi,bj) = etaN(I,J,bi,bj) +1/recip_drF(K) |
110 |
|
|
etaH(I,J,bi,bj) = etaH(I,J,bi,bj) +1/recip_drF(K) |
111 |
|
|
R_shelfice(I,J,bi,bj) = R_shelfice(I,J,bi,bj) -1/recip_drF(K) |
112 |
|
|
|
113 |
|
|
gvnm1(I,J,K+1,bi,bj)=0.0 |
114 |
|
|
gvnm1(I,J+1,K+1,bi,bj)=0.0 |
115 |
|
|
gunm1(I,J,K+1,bi,bj)=0.0 |
116 |
|
|
gunm1(I+1,J,K+1,bi,bj)=0.0 |
117 |
|
|
|
118 |
|
|
hfacC(I,J,K,bi,bj)=1.0 |
119 |
|
|
ENDIF |
120 |
|
|
ENDIF |
121 |
|
|
ENDDO |
122 |
|
|
ENDDO |
123 |
|
|
ENDDO |
124 |
|
|
ENDDO |
125 |
|
|
|
126 |
|
|
|
127 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
128 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
129 |
|
|
DO J = 1-OLy,sNy+OLy |
130 |
|
|
DO I = 1-OLx,sNx+OLx |
131 |
|
|
etaH(I,J,bi,bj)=etaN(I,J,bi,bj) |
132 |
|
|
etaHnm1(I,J,bi,bj)=etaH(I,J,bi,bj) |
133 |
|
|
ENDDO |
134 |
|
|
ENDDO |
135 |
|
|
ENDDO |
136 |
|
|
ENDDO |
137 |
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
141 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
142 |
|
|
DO J = 1-OLy,sNy+OLy |
143 |
|
|
DO I = 1-OLx,sNx+OLx |
144 |
|
|
K = MAX(1,kTopC(I,J,bi,bj)) |
145 |
|
|
|
146 |
|
|
hfac_surfc(I,J,bi,bj)= ((etaH(I,J,bi,bJ) +(1/recip_drF(K))) |
147 |
|
|
& *recip_drF(K)) |
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
ENDDO |
152 |
|
|
ENDDO |
153 |
|
|
ENDDO |
154 |
|
|
ENDDO |
155 |
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
C- fill in the overlap (+ BARRIER): |
161 |
|
|
_EXCH_XY_RS(R_shelfIce, myThid ) |
162 |
|
|
|
163 |
|
|
C-- Calculate lopping factor hFacC : Remove part outside of the domain |
164 |
|
|
C taking into account the Reference (=at rest) Surface Position Ro_shelfIce |
165 |
|
|
DO bj=myByLo(myThid), myByHi(myThid) |
166 |
|
|
DO bi=myBxLo(myThid), myBxHi(myThid) |
167 |
|
|
|
168 |
|
|
C-- compute contributions of shelf ice to looping factors |
169 |
|
|
DO K=1, Nr |
170 |
|
|
hFacMnSz=max( hFacMin, min(hFacMinDr*recip_drF(k),1. _d 0) ) |
171 |
|
|
DO J=1-OLy,sNy+OLy |
172 |
|
|
DO I=1-OLx,sNx+OLx |
173 |
|
|
C o Non-dimensional distance between grid boundary and model surface |
174 |
|
|
hFacCtmp = (rF(k)-R_shelfIce(I,J,bi,bj))*recip_drF(K) |
175 |
|
|
C o Reduce the previous fraction : substract the outside part. |
176 |
|
|
hFacCtmp = hFacC(I,J,K,bi,bj) - max( hFacCtmp, 0. _d 0) |
177 |
|
|
C o set to zero if empty Column : |
178 |
|
|
hFacCtmp = max( hFacCtmp, 0. _d 0) |
179 |
|
|
C o Impose minimum fraction and/or size (dimensional) |
180 |
|
|
IF (hFacCtmp.LT.hFacMnSz) THEN |
181 |
|
|
IF (hFacCtmp.LT.hFacMnSz*0.5) THEN |
182 |
|
|
hFacC(I,J,K,bi,bj)=0. |
183 |
|
|
ELSE |
184 |
|
|
hFacC(I,J,K,bi,bj)=hFacMnSz |
185 |
|
|
ENDIF |
186 |
|
|
ELSE |
187 |
|
|
hFacC(I,J,K,bi,bj)=hFacCtmp |
188 |
|
|
ENDIF |
189 |
|
|
ENDDO |
190 |
|
|
ENDDO |
191 |
|
|
ENDDO |
192 |
|
|
|
193 |
|
|
#ifdef ALLOW_SHIFWFLX_CONTROL |
194 |
|
|
C maskSHI is a hack to play along with the general ctrl-package |
195 |
|
|
C infrastructure, where only the k=1 layer of a 3D mask is used |
196 |
|
|
C for 2D fields. We cannot use maskInC instead, because routines |
197 |
|
|
C like ctrl_get_gen and ctrl_set_unpack_xy require 3D masks. |
198 |
|
|
DO K=1,Nr |
199 |
|
|
DO J=1-OLy,sNy+OLy |
200 |
|
|
DO I=1-OLx,sNx+OLx |
201 |
|
|
maskSHI(I,J,K,bi,bj) = 0. _d 0 |
202 |
|
|
ENDDO |
203 |
|
|
ENDDO |
204 |
|
|
ENDDO |
205 |
|
|
DO K=1,Nr |
206 |
|
|
DO J=1-OLy,sNy+OLy |
207 |
|
|
DO I=1-OLx,sNx+OLx |
208 |
|
|
IF ( ABS(R_shelfice(I,J,bi,bj)) .GT. 0. _d 0 |
209 |
|
|
& .AND. hFacC(I,J,K,bi,bj) .NE. 0. _d 0 ) THEN |
210 |
|
|
maskSHI(I,J,K,bi,bj) = 1. _d 0 |
211 |
|
|
maskSHI(I,J,1,bi,bj) = 1. _d 0 |
212 |
|
|
ENDIF |
213 |
|
|
ENDDO |
214 |
|
|
ENDDO |
215 |
|
|
ENDDO |
216 |
|
|
#endif /* ALLOW_SHIFWFLX_CONTROL */ |
217 |
|
|
|
218 |
|
|
C - end bi,bj loops. |
219 |
|
|
ENDDO |
220 |
|
|
ENDDO |
221 |
|
|
#endif /* ALLOW_SHELFICE */ |
222 |
|
|
RETURN |
223 |
|
|
END |