/[MITgcm]/MITgcm/model/src/ini_sigma_hfac.F
ViewVC logotype

Contents of /MITgcm/model/src/ini_sigma_hfac.F

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


Revision 1.1 - (show annotations) (download)
Sat Sep 11 21:24:52 2010 UTC (13 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62k, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, HEAD
first check-in of sigma (and hybrid-sigma) coordinate code

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_masks_etc.F,v 1.45 2010/01/16 23:00:16 jmc Exp $
2 C $Name: $
3
4 c#include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: INI_SIGMA_HFAC
9 C !INTERFACE:
10 SUBROUTINE INI_SIGMA_HFAC( myThid )
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE INI_SIGMA_HFAC
14 C | o Initialise grid factors when using Sigma coordiante
15 C *==========================================================*
16 C | These arrays are used throughout the code and describe
17 C | fractional height factors.
18 C *==========================================================*
19 C \ev
20
21 C !USES:
22 IMPLICIT NONE
23 C === Global variables ===
24 #include "SIZE.h"
25 #include "EEPARAMS.h"
26 #include "PARAMS.h"
27 #include "GRID.h"
28 #include "SURFACE.h"
29
30 C !INPUT/OUTPUT PARAMETERS:
31 C == Routine arguments ==
32 C myThid :: Number of this instance of INI_SIGMA_HFAC
33 INTEGER myThid
34
35 C !LOCAL VARIABLES:
36 C == Local variables ==
37 C bi, bj :: tile indices
38 C i, j, k :: Loop counters
39 C rEmpty :: empty column r-position
40 C rFullDepth :: maximum depth of a full column
41 C tmpFld :: Temporary array used to compute & write Total Depth
42 C min_hFac :: actual minimum of cell-centered hFac
43 C msgBuf :: Informational/error message buffer
44 INTEGER bi, bj
45 INTEGER i, j, k
46 _RS rEmpty
47 _RL rFullDepth
48 _RL tmpFld(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
49 _RL min_hFac
50 _RL hFactmp
51 CHARACTER*(MAX_LEN_MBUF) msgBuf
52 CEOP
53
54 C r(ij,k,t) = rLow(ij) + aHybSigm(k)*[rF(1)-rF(Nr+1)]
55 C + bHybSigm(k)*[eta(ij,t)+Ro_surf(ij) - rLow(ij)]
56
57 IF ( usingPCoords ) rEmpty = rF(Nr+1)
58 IF ( usingZCoords ) rEmpty = rF(1)
59 rFullDepth = rF(1)-rF(Nr+1)
60
61 C--- Calculate partial-cell factor hFacC :
62 min_hFac = 1.
63 DO bj=myByLo(myThid), myByHi(myThid)
64 DO bi=myBxLo(myThid), myBxHi(myThid)
65 C- Remove column (mask=0) thinner than hFacMin*rFullDepth
66 C ensures hFac > hFacMin (assuming we use pure Sigma)
67 C Note: because of unfortunate hFacMin default value (=1) (would produce
68 C unexpected empty column), for now, use hFacInf instead of hFacMin
69 DO j=1-Oly,sNy+Oly
70 DO i=1-Olx,sNx+Olx
71 tmpFld(i,j) = Ro_surf(i,j,bi,bj)-R_low(i,j,bi,bj)
72 c IF ( tmpFld(i,j).LT.hFacMin*rFullDepth )
73 IF ( tmpFld(i,j).LT.hFacInf*rFullDepth )
74 & tmpFld(i,j) = 0. _d 0
75 ENDDO
76 ENDDO
77 c#ifdef ALLOW_SHELFICE
78 C-- Would need a specific call here similar to SHELFICE_UPDATE_MASKS
79 c IF ( useShelfIce ) THEN
80 c ENDIF
81 c#endif /* ALLOW_SHELFICE */
82 C- Set (or reset) other 2-D cell-centered fields
83 DO j=1-Oly,sNy+Oly
84 DO i=1-Olx,sNx+Olx
85 IF ( tmpFld(i,j).GT.0. _d 0 ) THEN
86 kSurfC (i,j,bi,bj) = 1
87 kLowC (i,j,bi,bj) = Nr
88 maskInC(i,j,bi,bj) = 1.
89 recip_Rcol(i,j,bi,bj) = 1. _d 0 / tmpFld(i,j)
90 ELSE
91 kSurfC (i,j,bi,bj) = Nr+1
92 kLowC (i,j,bi,bj) = 0
93 maskInC(i,j,bi,bj) = 0.
94 recip_Rcol(i,j,bi,bj) = 0. _d 0
95 Ro_surf(i,j,bi,bj) = rEmpty
96 R_low(i,j,bi,bj) = rEmpty
97 ENDIF
98 ENDDO
99 ENDDO
100 C- Set 3-D hFacC
101 DO k=1, Nr
102 DO j=1-Oly,sNy+Oly
103 DO i=1-Olx,sNx+Olx
104 IF ( maskInC(i,j,bi,bj).NE.0. _d 0 ) THEN
105 hFactmp = ( dAHybSigF(k)*rFullDepth
106 & + dBHybSigF(k)*tmpFld(i,j)
107 & )*recip_drF(k)
108 hFacC(i,j,k,bi,bj) = hFactmp
109 min_hFac = MIN( min_hFac, hFactmp )
110 ELSE
111 hFacC(i,j,k,bi,bj) = 0.
112 ENDIF
113 ENDDO
114 ENDDO
115 ENDDO
116 C- end bi,bj loops.
117 ENDDO
118 ENDDO
119
120 WRITE(msgBuf,'(A,1PE14.6)')
121 & 'S/R INI_SIGMA_HFAC: minimum hFacC=', min_hFac
122 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
123 & SQUEEZE_RIGHT, myThid )
124
125 c CALL PLOT_FIELD_XYRS(R_low,
126 c & 'Model R_low (ini_masks_etc)', 1, myThid)
127 c CALL PLOT_FIELD_XYRS(Ro_surf,
128 c & 'Model Ro_surf (ini_masks_etc)', 1, myThid)
129
130 C-- Set Western & Southern fields (at U and V points)
131 DO bj=myByLo(myThid), myByHi(myThid)
132 DO bi=myBxLo(myThid), myBxHi(myThid)
133 C- set 2-D mask and rLow & reference rSurf at Western & Southern edges
134 i = 1-OlX
135 DO j=1-Oly,sNy+Oly
136 rSurfW(i,j,bi,bj) = rEmpty
137 rLowW (i,j,bi,bj) = rEmpty
138 maskInW(i,j,bi,bj)= 0.
139 ENDDO
140 j = 1-Oly
141 DO i=1-Olx,sNx+Olx
142 rSurfS(i,j,bi,bj) = rEmpty
143 rLowS (i,j,bi,bj) = rEmpty
144 maskInS(i,j,bi,bj)= 0.
145 ENDDO
146 DO j=1-Oly,sNy+Oly
147 DO i=2-Olx,sNx+Olx
148 maskInW(i,j,bi,bj)= maskInC(i-1,j,bi,bj)*maskInC(i,j,bi,bj)
149 rSurfW(i,j,bi,bj) =
150 & ( Ro_surf(i-1,j,bi,bj)
151 & + Ro_surf( i, j,bi,bj) )*0.5 _d 0
152 rLowW(i,j,bi,bj) =
153 & ( R_low(i-1,j,bi,bj)
154 & + R_low( i, j,bi,bj) )*0.5 _d 0
155 c rSurfW(i,j,bi,bj) =
156 c & ( Ro_surf(i-1,j,bi,bj)*rA(i-1,j,bi,bj)
157 c & + Ro_surf( i, j,bi,bj)*rA( i, j,bi,bj)
158 c & )*recip_rAw(i,j,bi,bj)*0.5 _d 0
159 c rLowW(i,j,bi,bj) =
160 c & ( R_low(i-1,j,bi,bj)*rA(i-1,j,bi,bj)
161 c & + R_low( i, j,bi,bj)*rA( i, j,bi,bj)
162 c & )*recip_rAw(i,j,bi,bj)*0.5 _d 0
163 IF ( maskInW(i,j,bi,bj).EQ.0. ) THEN
164 rSurfW(i,j,bi,bj) = rEmpty
165 rLowW (i,j,bi,bj) = rEmpty
166 ENDIF
167 ENDDO
168 ENDDO
169 DO j=2-Oly,sNy+Oly
170 DO i=1-Olx,sNx+Olx
171 maskInS(i,j,bi,bj)= maskInC(i,j-1,bi,bj)*maskInC(i,j,bi,bj)
172 rSurfS(i,j,bi,bj) =
173 & ( Ro_surf(i,j-1,bi,bj)
174 & + Ro_surf(i, j, bi,bj) )*0.5 _d 0
175 rLowS(i,j,bi,bj) =
176 & ( R_low(i,j-1,bi,bj)
177 & + R_low(i, j, bi,bj) )*0.5 _d 0
178 c rSurfS(i,j,bi,bj) =
179 c & ( Ro_surf(i,j-1,bi,bj)*rA(i,j-1,bi,bj)
180 c & + Ro_surf(i, j, bi,bj)*rA(i, j, bi,bj)
181 c & )*recip_rAs(i,j,bi,bj)*0.5 _d 0
182 c rLowS(i,j,bi,bj) =
183 c & ( R_low(i,j-1,bi,bj)*rA(i,j-1,bi,bj)
184 c & + R_low(i, j, bi,bj)*rA(i, j, bi,bj)
185 c & )*recip_rAs(i,j,bi,bj)*0.5 _d 0
186 IF ( maskInS(i,j,bi,bj).EQ.0. ) THEN
187 rSurfS(i,j,bi,bj) = rEmpty
188 rLowS (i,j,bi,bj) = rEmpty
189 ENDIF
190 ENDDO
191 ENDDO
192 ENDDO
193 ENDDO
194 CALL EXCH_UV_XY_RS( rSurfW, rSurfS, .FALSE., myThid )
195 CALL EXCH_UV_XY_RS( rLowW, rLowS, .FALSE., myThid )
196 CALL EXCH_UV_XY_RS( maskInW, maskInS, .FALSE., myThid )
197
198 C-- The following block allows thin walls representation of non-periodic
199 C boundaries such as happen on the lat-lon grid at the N/S poles.
200 C We should really supply a flag for doing this.
201 DO bj=myByLo(myThid), myByHi(myThid)
202 DO bi=myBxLo(myThid), myBxHi(myThid)
203 DO j=1-Oly,sNy+Oly
204 DO i=1-Olx,sNx+Olx
205 IF (dyG(i,j,bi,bj).EQ.0.) maskInW(i,j,bi,bj) = 0.
206 IF (dxG(i,j,bi,bj).EQ.0.) maskInS(i,j,bi,bj) = 0.
207 ENDDO
208 ENDDO
209 ENDDO
210 ENDDO
211
212 C- Set hFacW and hFacS (at U and V points)
213 DO bj=myByLo(myThid), myByHi(myThid)
214 DO bi=myBxLo(myThid), myBxHi(myThid)
215 DO k=1, Nr
216 DO j=1-Oly,sNy+Oly
217 DO i=1-Olx,sNx+Olx
218 hFactmp =
219 & ( dAHybSigF(k)*rFullDepth
220 & + dBHybSigF(k)*( rSurfW(i,j,bi,bj)-rLowW(i,j,bi,bj) )
221 & )*recip_drF(k)
222 hFacW(i,j,k,bi,bj) = hFactmp*maskInW(i,j,bi,bj)
223 ENDDO
224 ENDDO
225 ENDDO
226 DO k=1, Nr
227 DO j=1-Oly,sNy+Oly
228 DO i=1-Olx,sNx+Olx
229 hFactmp =
230 & ( dAHybSigF(k)*rFullDepth
231 & + dBHybSigF(k)*( rSurfS(i,j,bi,bj)-rLowS(i,j,bi,bj) )
232 & )*recip_drF(k)
233 hFacS(i,j,k,bi,bj) = hFactmp*maskInS(i,j,bi,bj)
234 ENDDO
235 ENDDO
236 ENDDO
237 C- Set surface k index for interface W & S (U & V points)
238 DO j=1-Oly,sNy+Oly
239 DO i=1-Olx,sNx+Olx
240 kSurfW(i,j,bi,bj) = Nr+1
241 kSurfS(i,j,bi,bj) = Nr+1
242 IF ( maskInW(i,j,bi,bj).NE.0. ) kSurfW(i,j,bi,bj) = 1
243 IF ( maskInS(i,j,bi,bj).NE.0. ) kSurfS(i,j,bi,bj) = 1
244 ENDDO
245 ENDDO
246 C- end bi,bj loops.
247 ENDDO
248 ENDDO
249
250 RETURN
251 END

  ViewVC Help
Powered by ViewVC 1.1.22