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

Annotation of /MITgcm/model/src/ini_masks_etc.F

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


Revision 1.7 - (hide annotations) (download)
Tue Sep 8 01:37:49 1998 UTC (25 years, 8 months ago) by cnh
Branch: MAIN
CVS Tags: checkpoint14
Changes since 1.6: +17 -2 lines
Consistent isomorphism changes

1 cnh 1.7 C $Header: /u/gcmpack/models/MITgcmUV/model/src/ini_masks_etc.F,v 1.6 1998/09/06 14:45:11 cnh Exp $
2 adcroft 1.1
3     #include "CPP_EEOPTIONS.h"
4    
5     CStartOfInterface
6     SUBROUTINE INI_MASKS_ETC( myThid )
7     C /==========================================================\
8     C | SUBROUTINE INI_MASKS_ETC |
9     C | o Initialise masks and topography factors |
10     C |==========================================================|
11     C | These arrays are used throughout the code and describe |
12     C | the topography of the domain through masks (0s and 1s) |
13     C | and fractional height factors (0<hFac<1). The latter |
14     C | distinguish between the lopped-cell and full-step |
15     C | topographic representations. |
16     C \==========================================================/
17    
18     C === Global variables ===
19     #include "SIZE.h"
20     #include "EEPARAMS.h"
21     #include "PARAMS.h"
22     #include "GRID.h"
23    
24     C == Routine arguments ==
25 cnh 1.6 C myThid - Number of this instance of INI_MASKS_ETC
26 adcroft 1.1 INTEGER myThid
27     CEndOfInterface
28    
29     C == Local variables ==
30     C bi,bj - Loop counters
31     C I,J,K
32     INTEGER bi, bj
33     INTEGER I, J, K
34    
35     C Calculate quantities derived from XY depth map
36     DO bj = myByLo(myThid), myByHi(myThid)
37     DO bi = myBxLo(myThid), myBxHi(myThid)
38     DO J=1,sNy
39     DO I=1,sNx
40     C Inverse of depth
41     IF ( h(i,j,bi,bj) .EQ. 0. _d 0 ) THEN
42 cnh 1.4 recip_H(i,j,bi,bj) = 0. _d 0
43 adcroft 1.1 ELSE
44 cnh 1.4 recip_H(i,j,bi,bj) = 1. _d 0 / abs( H(i,j,bi,bj) )
45 adcroft 1.1 ENDIF
46 cnh 1.7 depthInK(i,j,bi,bj) = 0.
47 adcroft 1.1 ENDDO
48     ENDDO
49     ENDDO
50     ENDDO
51 cnh 1.4 _EXCH_XY_R4( recip_H, myThid )
52 adcroft 1.2
53     C Calculate lopping factor hFacC
54     DO bj=myByLo(myThid), myByHi(myThid)
55     DO bi=myBxLo(myThid), myBxHi(myThid)
56 cnh 1.4 DO K=1, Nr
57 adcroft 1.2 DO J=1,sNy
58     DO I=1,sNx
59 cnh 1.7 C Round depths within a small fraction of layer depth to that
60     C layer depth.
61     IF ( ABS(H(I,J,bi,bj)-rF(K)) .LT. 1. _d -6*ABS(rF(K)) .AND.
62     & ABS(H(I,J,bi,bj)-rF(K)) .LT. 1. _d -6*ABS(H(I,J,bi,bj)) )THEN
63     H(I,J,bi,bj) = rF(K)
64     ENDIF
65 cnh 1.6 IF ( H(I,J,bi,bj)*rkFac .GE. rF(K)*rkFac ) THEN
66 adcroft 1.3 C Top of cell is below base of domain
67 adcroft 1.2 hFacC(I,J,K,bi,bj) = 0.
68 cnh 1.6 ELSEIF ( H(I,J,bi,bj)*rkFac .LE. rF(K+1)*rkFac ) THEN
69 adcroft 1.3 C Base of domain is below bottom of this cell
70 adcroft 1.2 hFacC(I,J,K,bi,bj) = 1.
71     ELSE
72     C Base of domain is in this cell
73 adcroft 1.3 C Set hFac to the fraction of the cell that is open.
74 cnh 1.7 C hFacC(I,J,K,bi,bj) = (rF(K)*rkFac-H(I,J,bi,bj)*rkFac)*recip_drF(K)
75     CcnhDebugStarts
76     C Impose full-step
77     hFacC(I,J,K,bi,bj) = 1.
78     CCnhDebugEnds
79 adcroft 1.3 ENDIF
80     C Impose minimum fraction
81     IF (hFacC(I,J,K,bi,bj).LT.hFacMin) THEN
82     IF (hFacC(I,J,K,bi,bj).LT.hFacMin*0.5) THEN
83     hFacC(I,J,K,bi,bj)=0.
84     ELSE
85     hFacC(I,J,K,bi,bj)=hFacMin
86     ENDIF
87     ENDIF
88     C Impose minimum size (dimensional)
89 cnh 1.5 IF (drF(k)*hFacC(I,J,K,bi,bj).LT.hFacMinDr) THEN
90     IF (drF(k)*hFacC(I,J,K,bi,bj).LT.hFacMinDr*0.5) THEN
91 adcroft 1.3 hFacC(I,J,K,bi,bj)=0.
92     ELSE
93 cnh 1.5 hFacC(I,J,K,bi,bj)=hFacMinDr*recip_drF(k)
94 adcroft 1.3 ENDIF
95 adcroft 1.2 ENDIF
96 cnh 1.7 depthInK(i,j,bi,bj) = depthInK(i,j,bi,bj) + hFacC(i,j,k,bi,bj)
97 adcroft 1.2 ENDDO
98     ENDDO
99     ENDDO
100     ENDDO
101     ENDDO
102     _EXCH_XYZ_R4(hFacC , myThid )
103 cnh 1.7 _EXCH_XY_R4( depthInK, myThid )
104    
105     CALL PLOT_FIELD_XYRS( depthInK, 'Model Depths K Index' , 1, myThid )
106 adcroft 1.1
107     C hFacW and hFacS (at U and V points)
108     DO bj=myByLo(myThid), myByHi(myThid)
109     DO bi=myBxLo(myThid), myBxHi(myThid)
110 cnh 1.4 DO K=1, Nr
111 adcroft 1.1 DO J=1,sNy
112     DO I=1,sNx
113     hFacW(I,J,K,bi,bj)=
114     & MIN(hFacC(I,J,K,bi,bj),hFacC(I-1,J,K,bi,bj))
115     hFacS(I,J,K,bi,bj)=
116     & MIN(hFacC(I,J,K,bi,bj),hFacC(I,J-1,K,bi,bj))
117     ENDDO
118     ENDDO
119     ENDDO
120     ENDDO
121     ENDDO
122     _EXCH_XYZ_R4(hFacW , myThid )
123     _EXCH_XYZ_R4(hFacS , myThid )
124    
125     C Masks and reciprocals of hFac[CWS]
126     DO bj = myByLo(myThid), myByHi(myThid)
127     DO bi = myBxLo(myThid), myBxHi(myThid)
128 cnh 1.4 DO K=1,Nr
129 adcroft 1.1 DO J=1,sNy
130     DO I=1,sNx
131     IF (HFacC(I,J,K,bi,bj) .NE. 0. D0 ) THEN
132 cnh 1.4 recip_HFacC(I,J,K,bi,bj) = 1. D0 / HFacC(I,J,K,bi,bj)
133 adcroft 1.1 ELSE
134 cnh 1.4 recip_HFacC(I,J,K,bi,bj) = 0. D0
135 adcroft 1.1 ENDIF
136     IF (HFacW(I,J,K,bi,bj) .NE. 0. D0 ) THEN
137 cnh 1.4 recip_HFacW(I,J,K,bi,bj) = 1. D0 / HFacW(I,J,K,bi,bj)
138 adcroft 1.1 maskW(I,J,K,bi,bj) = 1. D0
139     ELSE
140 cnh 1.4 recip_HFacW(I,J,K,bi,bj) = 0. D0
141 adcroft 1.1 maskW(I,J,K,bi,bj) = 0.0 D0
142     ENDIF
143     IF (HFacS(I,J,K,bi,bj) .NE. 0. D0 ) THEN
144 cnh 1.4 recip_HFacS(I,J,K,bi,bj) = 1. D0 / HFacS(I,J,K,bi,bj)
145 adcroft 1.1 maskS(I,J,K,bi,bj) = 1. D0
146     ELSE
147 cnh 1.4 recip_HFacS(I,J,K,bi,bj) = 0. D0
148 adcroft 1.1 maskS(I,J,K,bi,bj) = 0. D0
149     ENDIF
150     ENDDO
151     ENDDO
152     ENDDO
153     ENDDO
154     ENDDO
155 cnh 1.4 _EXCH_XYZ_R4(recip_HFacC , myThid )
156     _EXCH_XYZ_R4(recip_HFacW , myThid )
157     _EXCH_XYZ_R4(recip_HFacS , myThid )
158 adcroft 1.1 _EXCH_XYZ_R4(maskW , myThid )
159     _EXCH_XYZ_R4(maskS , myThid )
160    
161     C Calculate recipricols grid lengths
162     DO bj = myByLo(myThid), myByHi(myThid)
163     DO bi = myBxLo(myThid), myBxHi(myThid)
164     DO J=1,sNy
165     DO I=1,sNx
166 cnh 1.4 recip_dxG(I,J,bi,bj)=1.d0/dxG(I,J,bi,bj)
167     recip_dyG(I,J,bi,bj)=1.d0/dyG(I,J,bi,bj)
168     recip_dxC(I,J,bi,bj)=1.d0/dxC(I,J,bi,bj)
169     recip_dyC(I,J,bi,bj)=1.d0/dyC(I,J,bi,bj)
170     recip_dxF(I,J,bi,bj)=1.d0/dxF(I,J,bi,bj)
171     recip_dyF(I,J,bi,bj)=1.d0/dyF(I,J,bi,bj)
172     recip_dxV(I,J,bi,bj)=1.d0/dxV(I,J,bi,bj)
173     recip_dyU(I,J,bi,bj)=1.d0/dyU(I,J,bi,bj)
174 adcroft 1.1 ENDDO
175     ENDDO
176     ENDDO
177     ENDDO
178 cnh 1.4 _EXCH_XY_R4(recip_dxG, myThid )
179     _EXCH_XY_R4(recip_dyG, myThid )
180     _EXCH_XY_R4(recip_dxC, myThid )
181     _EXCH_XY_R4(recip_dyC, myThid )
182     _EXCH_XY_R4(recip_dxF, myThid )
183     _EXCH_XY_R4(recip_dyF, myThid )
184     _EXCH_XY_R4(recip_dxV, myThid )
185     _EXCH_XY_R4(recip_dyU, myThid )
186 adcroft 1.1
187     C
188     RETURN
189     END

  ViewVC Help
Powered by ViewVC 1.1.22