/[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.13 - (hide annotations) (download)
Wed Dec 9 16:11:52 1998 UTC (25 years, 5 months ago) by adcroft
Branch: MAIN
Changes since 1.12: +2 -1 lines
Added IMPLICIT NONE in a lot of subroutines.
Also corrected the recip_Rhonil bug: we didn't set it in ini_parms.F

1 adcroft 1.13 C $Header: /u/gcmpack/models/MITgcmUV/model/src/ini_masks_etc.F,v 1.12 1998/12/08 18:01:52 adcroft Exp $
2 adcroft 1.1
3 cnh 1.11 #include "CPP_OPTIONS.h"
4 adcroft 1.1
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 adcroft 1.13 IMPLICIT NONE
18 adcroft 1.1
19     C === Global variables ===
20     #include "SIZE.h"
21     #include "EEPARAMS.h"
22     #include "PARAMS.h"
23     #include "GRID.h"
24    
25     C == Routine arguments ==
26 cnh 1.6 C myThid - Number of this instance of INI_MASKS_ETC
27 adcroft 1.1 INTEGER myThid
28     CEndOfInterface
29    
30     C == Local variables ==
31     C bi,bj - Loop counters
32     C I,J,K
33     INTEGER bi, bj
34     INTEGER I, J, K
35    
36     C Calculate quantities derived from XY depth map
37     DO bj = myByLo(myThid), myByHi(myThid)
38     DO bi = myBxLo(myThid), myBxHi(myThid)
39     DO J=1,sNy
40     DO I=1,sNx
41     C Inverse of depth
42     IF ( h(i,j,bi,bj) .EQ. 0. _d 0 ) THEN
43 cnh 1.4 recip_H(i,j,bi,bj) = 0. _d 0
44 adcroft 1.1 ELSE
45 cnh 1.4 recip_H(i,j,bi,bj) = 1. _d 0 / abs( H(i,j,bi,bj) )
46 adcroft 1.1 ENDIF
47 cnh 1.7 depthInK(i,j,bi,bj) = 0.
48 adcroft 1.1 ENDDO
49     ENDDO
50     ENDDO
51     ENDDO
52 cnh 1.4 _EXCH_XY_R4( recip_H, myThid )
53 cnh 1.8 IF ( myThid .EQ. 1 ) WRITE(0,*) 'AAAA'
54 adcroft 1.2
55     C Calculate lopping factor hFacC
56     DO bj=myByLo(myThid), myByHi(myThid)
57     DO bi=myBxLo(myThid), myBxHi(myThid)
58 cnh 1.4 DO K=1, Nr
59 adcroft 1.2 DO J=1,sNy
60     DO I=1,sNx
61 cnh 1.7 C Round depths within a small fraction of layer depth to that
62     C layer depth.
63 cnh 1.9 IF ( ABS(H(I,J,bi,bj)-rF(K)) .LT.
64     & 1. _d -6*ABS(rF(K)) .AND.
65     & ABS(H(I,J,bi,bj)-rF(K)) .LT.
66     & 1. _d -6*ABS(H(I,J,bi,bj)) )THEN
67 cnh 1.7 H(I,J,bi,bj) = rF(K)
68     ENDIF
69 cnh 1.6 IF ( H(I,J,bi,bj)*rkFac .GE. rF(K)*rkFac ) THEN
70 adcroft 1.3 C Top of cell is below base of domain
71 adcroft 1.2 hFacC(I,J,K,bi,bj) = 0.
72 cnh 1.6 ELSEIF ( H(I,J,bi,bj)*rkFac .LE. rF(K+1)*rkFac ) THEN
73 adcroft 1.3 C Base of domain is below bottom of this cell
74 adcroft 1.2 hFacC(I,J,K,bi,bj) = 1.
75     ELSE
76     C Base of domain is in this cell
77 adcroft 1.3 C Set hFac to the fraction of the cell that is open.
78 adcroft 1.12 hFacC(I,J,K,bi,bj) = (rF(K)*rkFac-H(I,J,bi,bj)*rkFac)*recip_drF(K)
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.9 depthInK(i,j,bi,bj) = depthInK(i,j,bi,bj)
97     & +hFacC(i,j,k,bi,bj)
98 adcroft 1.2 ENDDO
99     ENDDO
100     ENDDO
101     ENDDO
102     ENDDO
103 cnh 1.8 IF ( myThid .EQ. 1 ) WRITE(0,*) 'BBBB'
104 adcroft 1.2 _EXCH_XYZ_R4(hFacC , myThid )
105 cnh 1.8 IF ( myThid .EQ. 1 ) WRITE(0,*) 'CCCC'
106 cnh 1.7 _EXCH_XY_R4( depthInK, myThid )
107    
108 cnh 1.8 IF ( myThid .EQ. 1 ) WRITE(0,*) 'DDDD'
109 cnh 1.9 CALL PLOT_FIELD_XYRS( depthInK,
110     & 'Model Depths K Index' , 1, myThid )
111 adcroft 1.1
112     C hFacW and hFacS (at U and V points)
113     DO bj=myByLo(myThid), myByHi(myThid)
114     DO bi=myBxLo(myThid), myBxHi(myThid)
115 cnh 1.4 DO K=1, Nr
116 adcroft 1.1 DO J=1,sNy
117     DO I=1,sNx
118     hFacW(I,J,K,bi,bj)=
119     & MIN(hFacC(I,J,K,bi,bj),hFacC(I-1,J,K,bi,bj))
120     hFacS(I,J,K,bi,bj)=
121     & MIN(hFacC(I,J,K,bi,bj),hFacC(I,J-1,K,bi,bj))
122     ENDDO
123     ENDDO
124     ENDDO
125     ENDDO
126     ENDDO
127     _EXCH_XYZ_R4(hFacW , myThid )
128     _EXCH_XYZ_R4(hFacS , myThid )
129    
130     C Masks and reciprocals of hFac[CWS]
131     DO bj = myByLo(myThid), myByHi(myThid)
132     DO bi = myBxLo(myThid), myBxHi(myThid)
133 cnh 1.4 DO K=1,Nr
134 adcroft 1.1 DO J=1,sNy
135     DO I=1,sNx
136 cnh 1.10 IF (HFacC(I,J,K,bi,bj) .NE. 0. _d 0 ) THEN
137     recip_HFacC(I,J,K,bi,bj) = 1. _d 0 / HFacC(I,J,K,bi,bj)
138 adcroft 1.1 ELSE
139 cnh 1.10 recip_HFacC(I,J,K,bi,bj) = 0. _d 0
140 adcroft 1.1 ENDIF
141 cnh 1.10 IF (HFacW(I,J,K,bi,bj) .NE. 0. _d 0 ) THEN
142     recip_HFacW(I,J,K,bi,bj) = 1. _d 0 / HFacW(I,J,K,bi,bj)
143     maskW(I,J,K,bi,bj) = 1. _d 0
144 adcroft 1.1 ELSE
145 cnh 1.10 recip_HFacW(I,J,K,bi,bj) = 0. _d 0
146     maskW(I,J,K,bi,bj) = 0.0 _d 0
147 adcroft 1.1 ENDIF
148 cnh 1.10 IF (HFacS(I,J,K,bi,bj) .NE. 0. _d 0 ) THEN
149     recip_HFacS(I,J,K,bi,bj) = 1. _d 0 / HFacS(I,J,K,bi,bj)
150     maskS(I,J,K,bi,bj) = 1. _d 0
151 adcroft 1.1 ELSE
152 cnh 1.10 recip_HFacS(I,J,K,bi,bj) = 0. _d 0
153     maskS(I,J,K,bi,bj) = 0. _d 0
154 adcroft 1.1 ENDIF
155     ENDDO
156     ENDDO
157     ENDDO
158     ENDDO
159     ENDDO
160 cnh 1.4 _EXCH_XYZ_R4(recip_HFacC , myThid )
161     _EXCH_XYZ_R4(recip_HFacW , myThid )
162     _EXCH_XYZ_R4(recip_HFacS , myThid )
163 adcroft 1.1 _EXCH_XYZ_R4(maskW , myThid )
164     _EXCH_XYZ_R4(maskS , myThid )
165    
166     C Calculate recipricols grid lengths
167     DO bj = myByLo(myThid), myByHi(myThid)
168     DO bi = myBxLo(myThid), myBxHi(myThid)
169     DO J=1,sNy
170     DO I=1,sNx
171 cnh 1.4 recip_dxG(I,J,bi,bj)=1.d0/dxG(I,J,bi,bj)
172     recip_dyG(I,J,bi,bj)=1.d0/dyG(I,J,bi,bj)
173     recip_dxC(I,J,bi,bj)=1.d0/dxC(I,J,bi,bj)
174     recip_dyC(I,J,bi,bj)=1.d0/dyC(I,J,bi,bj)
175     recip_dxF(I,J,bi,bj)=1.d0/dxF(I,J,bi,bj)
176     recip_dyF(I,J,bi,bj)=1.d0/dyF(I,J,bi,bj)
177     recip_dxV(I,J,bi,bj)=1.d0/dxV(I,J,bi,bj)
178     recip_dyU(I,J,bi,bj)=1.d0/dyU(I,J,bi,bj)
179 adcroft 1.1 ENDDO
180     ENDDO
181     ENDDO
182     ENDDO
183 cnh 1.4 _EXCH_XY_R4(recip_dxG, myThid )
184     _EXCH_XY_R4(recip_dyG, myThid )
185     _EXCH_XY_R4(recip_dxC, myThid )
186     _EXCH_XY_R4(recip_dyC, myThid )
187     _EXCH_XY_R4(recip_dxF, myThid )
188     _EXCH_XY_R4(recip_dyF, myThid )
189     _EXCH_XY_R4(recip_dxV, myThid )
190     _EXCH_XY_R4(recip_dyU, myThid )
191 adcroft 1.1
192     C
193     RETURN
194     END

  ViewVC Help
Powered by ViewVC 1.1.22