/[MITgcm]/MITgcm_contrib/shelfice_remeshing/CLEAN/code/shelfice_update_masks_JJ.F
ViewVC logotype

Annotation of /MITgcm_contrib/shelfice_remeshing/CLEAN/code/shelfice_update_masks_JJ.F

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


Revision 1.4 - (hide annotations) (download)
Tue Jan 19 16:46:55 2016 UTC (9 years, 6 months ago) by dgoldberg
Branch: MAIN
Changes since 1.3: +2 -6 lines
Grounding lines, sea level restore, Effective mass diagnostic

1 dgoldberg 1.3 C $Header: /u/gcmpack/MITgcm_contrib/verification_other/shelfice_remeshing/code/shelfice_update_masks_JJ.F,v 1.2 2016/01/05 16:04:36 dgoldberg Exp $
2 dgoldberg 1.1 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    
74     gvnm1(I,J,K-1,bi,bj)=gvnm1(I,J,K,bi,bj)
75     gvnm1(I,J+1,K-1,bi,bj)=gvnm1(I,J+1,K,bi,bj)
76     gunm1(I,J,K-1,bi,bj)=gunm1(I,J,K,bi,bj)
77     gunm1(I+1,J,K-1,bi,bj)=gunm1(I,J,K,bi,bj)
78    
79     salt(I,J,K-1,bi,bj)=salt(I,J,K,bi,bj)
80     theta(I,J,K-1,bi,bj)=theta(I,J,K,bi,bj)
81     hfacC(I,J,K,bi,bj)=1.0
82 dgoldberg 1.3 Rmin_surf(I,J,bi,bj) = Rmin_surf(I,J,bi,bj)+1/recip_drF(K)
83 dgoldberg 1.1
84     ENDIF
85     IF (R_shelfice(i,j,bi,bj) .NE. R_grounding(i,j,bi,bj))THEN
86     IF (etah(I,J,bi,bj) .LT. SHELFICEMergeThreshold ) THEN
87     K = MAX(1,kTopC(I,J,bi,bj))
88    
89     salt(I,J,K+1,bi,bj)=((salt(I,J,K,bi,bj)*(1/recip_drF(K)+
90     & etaN(I,J,bi,bj)))+(salt(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     theta(I,J,K+1,bi,bj)=((theta(I,J,K,bi,bj)*(1/recip_drF(K)+
94     & etaN(I,J,bi,bj)))+(theta(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,K+1,bi,bj)=((vVel(I,J,K,bi,bj)*(1/recip_drF(K)+
98     & etaN(I,J,bi,bj)))+(vVel(I,J,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     vVel(I,J+1,K+1,bi,bj)=((vVel(I,J+1,K,bi,bj)*(1/recip_drF(K)+
102     & etaN(I,J,bi,bj)))+(vVel(I,J+1,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,J,K+1,bi,bj)=((uVel(I,J,K,bi,bj)*(1/recip_drF(K)+
106     & etaN(I,J,bi,bj)))+(uVel(I,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     uVel(I+1,J,K+1,bi,bj)=((uVel(I+1,J,K,bi,bj)*(1/recip_drF(K)+
110     & etaN(I,J,bi,bj)))+(uVel(I+1,J,K+1,bi,bj)*1/recip_drF(K+1)))/
111     & (1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj))
112    
113     etaN(I,J,bi,bj) = etaN(I,J,bi,bj) +1/recip_drF(K)
114     etaH(I,J,bi,bj) = etaH(I,J,bi,bj) +1/recip_drF(K)
115     R_shelfice(I,J,bi,bj) = R_shelfice(I,J,bi,bj) -1/recip_drF(K)
116 dgoldberg 1.3 Rmin_surf(I,J,bi,bj) = Rmin_surf(I,J,bi,bj) -1/recip_drF(K)
117 dgoldberg 1.1
118     gunm1(I+1,J,K+1,bi,bj)=((gunm1(I+1,J,K,bi,bj)*(1/recip_drF(K)+
119     & etaN(I,J,bi,bj)))+(gunm1(I+1,J,K+1,bi,bj)*1/recip_drF(K+1)))/
120     & (1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj))
121    
122     gunm1(I,J,K+1,bi,bj)=((gunm1(I,J,K,bi,bj)*(1/recip_drF(K)+
123     & etaN(I,J,bi,bj)))+(gunm1(I,J,K+1,bi,bj)*1/recip_drF(K+1)))/
124     & (1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj))
125    
126     gvnm1(I,J+1,K+1,bi,bj)=((gvnm1(I,J+1,K,bi,bj)*(1/recip_drF(K)+
127     & etaN(I,J,bi,bj)))+(gvnm1(I,J+1,K+1,bi,bj)*1/recip_drF(K+1)))/
128     & (1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj))
129    
130 dgoldberg 1.3
131 dgoldberg 1.1 gvnm1(I,J,K+1,bi,bj)=((gvnm1(I,J,K,bi,bj)*(1/recip_drF(K)+
132     & etaN(I,J,bi,bj)))+(gvnm1(I,J,K+1,bi,bj)*1/recip_drF(K+1)))/
133     & (1/recip_drF(K)+1/recip_drF(K+1)+etaN(I,J,bi,bj))
134    
135     hfacC(I,J,K,bi,bj)=1.0
136     ENDIF
137     ENDIF
138     ENDIF
139     ENDDO
140     ENDDO
141     ENDDO
142     ENDDO
143    
144    
145     DO bj = myByLo(myThid), myByHi(myThid)
146     DO bi = myBxLo(myThid), myBxHi(myThid)
147     DO J = 1-OLy,sNy+OLy
148     DO I = 1-OLx,sNx+OLx
149     etaH(I,J,bi,bj)=etaN(I,J,bi,bj)
150     etaHnm1(I,J,bi,bj)=etaH(I,J,bi,bj)
151     ENDDO
152     ENDDO
153     ENDDO
154     ENDDO
155    
156    
157    
158 dgoldberg 1.4 DO bj = myByLo(myThid), myByHi(myThid)
159 dgoldberg 1.1 DO bi = myBxLo(myThid), myBxHi(myThid)
160     DO J = 1-OLy,sNy+OLy
161     DO I = 1-OLx,sNx+OLx
162 dgoldberg 1.4 K = MAX(1,kTopC(I,J,bi,bj))
163 dgoldberg 1.3
164 dgoldberg 1.1 hfac_surfc(I,J,bi,bj)= ((etaH(I,J,bi,bJ) +(1/recip_drF(K)))
165     & *recip_drF(K))
166 dgoldberg 1.3
167    
168    
169 dgoldberg 1.1 ENDDO
170     ENDDO
171     ENDDO
172     ENDDO
173    
174    
175    
176    
177    
178     C- fill in the overlap (+ BARRIER):
179     _EXCH_XY_RS(R_shelfIce, myThid )
180    
181     C-- Calculate lopping factor hFacC : Remove part outside of the domain
182     C taking into account the Reference (=at rest) Surface Position Ro_shelfIce
183     DO bj=myByLo(myThid), myByHi(myThid)
184     DO bi=myBxLo(myThid), myBxHi(myThid)
185    
186     C-- compute contributions of shelf ice to looping factors
187     DO K=1, Nr
188     hFacMnSz=max( hFacMin, min(hFacMinDr*recip_drF(k),1. _d 0) )
189     DO J=1-OLy,sNy+OLy
190     DO I=1-OLx,sNx+OLx
191     C o Non-dimensional distance between grid boundary and model surface
192     hFacCtmp = (rF(k)-R_shelfIce(I,J,bi,bj))*recip_drF(K)
193     C o Reduce the previous fraction : substract the outside part.
194     hFacCtmp = hFacC(I,J,K,bi,bj) - max( hFacCtmp, 0. _d 0)
195     C o set to zero if empty Column :
196     hFacCtmp = max( hFacCtmp, 0. _d 0)
197     C o Impose minimum fraction and/or size (dimensional)
198     IF (hFacCtmp.LT.hFacMnSz) THEN
199     IF (hFacCtmp.LT.hFacMnSz*0.5) THEN
200     hFacC(I,J,K,bi,bj)=0.
201     ELSE
202     hFacC(I,J,K,bi,bj)=hFacMnSz
203     ENDIF
204     ELSE
205     hFacC(I,J,K,bi,bj)=hFacCtmp
206     ENDIF
207     ENDDO
208     ENDDO
209     ENDDO
210    
211     #ifdef ALLOW_SHIFWFLX_CONTROL
212     C maskSHI is a hack to play along with the general ctrl-package
213     C infrastructure, where only the k=1 layer of a 3D mask is used
214     C for 2D fields. We cannot use maskInC instead, because routines
215     C like ctrl_get_gen and ctrl_set_unpack_xy require 3D masks.
216     DO K=1,Nr
217     DO J=1-OLy,sNy+OLy
218     DO I=1-OLx,sNx+OLx
219     maskSHI(I,J,K,bi,bj) = 0. _d 0
220     ENDDO
221     ENDDO
222     ENDDO
223     DO K=1,Nr
224     DO J=1-OLy,sNy+OLy
225     DO I=1-OLx,sNx+OLx
226     IF ( ABS(R_shelfice(I,J,bi,bj)) .GT. 0. _d 0
227     & .AND. hFacC(I,J,K,bi,bj) .NE. 0. _d 0 ) THEN
228     maskSHI(I,J,K,bi,bj) = 1. _d 0
229     maskSHI(I,J,1,bi,bj) = 1. _d 0
230     ENDIF
231     ENDDO
232     ENDDO
233     ENDDO
234     #endif /* ALLOW_SHIFWFLX_CONTROL */
235    
236     C - end bi,bj loops.
237     ENDDO
238     ENDDO
239     #endif /* ALLOW_SHELFICE */
240     RETURN
241     END

  ViewVC Help
Powered by ViewVC 1.1.22