/[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.3 - (hide annotations) (download)
Wed Jul 29 18:33:47 1998 UTC (25 years, 10 months ago) by adcroft
Branch: MAIN
Changes since 1.2: +24 -9 lines
Changed Z co-ordinate and lopping code:
o Z now increases upwards (ie. for the ocean, z<0)
  This needed changes only in ini_vertical_grid() where zC and zFace
  are calculated and in ini_masks_etc() where hFacC is calculated
  using IF's (eg. IF H(i,j,bi,bj).LT.zFace(K) ...).
o The lopping code needed a correction to the hydrostatic pressure
  calculation.
o Two new parameters control the lopping:
  hFacMin   - is the lower limit for water fraction in a cell
  hFacMinDz - is the lower limit for water thickness in lopped cells
  Both default to 0 so that pure lopping is the default.
  To force full cells, using continuous bathymetry, set hFacMin=1

1 adcroft 1.3 C $Header: /u/gcmpack/models/MITgcmUV/model/src/ini_masks_etc.F,v 1.2 1998/07/02 15:46:21 adcroft 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     C myThid - Number of this instance of INI_CARTESIAN_GRID
26     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     rH(i,j,bi,bj) = 0. _d 0
43     ELSE
44 adcroft 1.3 rH(i,j,bi,bj) = 1. _d 0 / abs( H(i,j,bi,bj) )
45 adcroft 1.1 ENDIF
46     ENDDO
47     ENDDO
48     ENDDO
49     ENDDO
50     _EXCH_XY_R4( rH, myThid )
51 adcroft 1.2
52     C Calculate lopping factor hFacC
53     DO bj=myByLo(myThid), myByHi(myThid)
54     DO bi=myBxLo(myThid), myBxHi(myThid)
55     DO K=1, Nz
56     DO J=1,sNy
57     DO I=1,sNx
58 adcroft 1.3 IF ( H(I,J,bi,bj) .GE. zFace(K) ) THEN
59     C Top of cell is below base of domain
60 adcroft 1.2 hFacC(I,J,K,bi,bj) = 0.
61 adcroft 1.3 ELSEIF ( H(I,J,bi,bj) .LE. zFace(K+1) ) THEN
62     C Base of domain is below bottom of this cell
63 adcroft 1.2 hFacC(I,J,K,bi,bj) = 1.
64     ELSE
65     C Base of domain is in this cell
66 adcroft 1.3 C Set hFac to the fraction of the cell that is open.
67     hFacC(I,J,K,bi,bj) = (zFace(K)-H(I,J,bi,bj))*rdzF(K)
68     ENDIF
69     C Impose minimum fraction
70     IF (hFacC(I,J,K,bi,bj).LT.hFacMin) THEN
71     IF (hFacC(I,J,K,bi,bj).LT.hFacMin*0.5) THEN
72     hFacC(I,J,K,bi,bj)=0.
73     ELSE
74     hFacC(I,J,K,bi,bj)=hFacMin
75     ENDIF
76     ENDIF
77     C Impose minimum size (dimensional)
78     IF (dzF(k)*hFacC(I,J,K,bi,bj).LT.hFacMinDz) THEN
79     IF (dzF(k)*hFacC(I,J,K,bi,bj).LT.hFacMinDz*0.5) THEN
80     hFacC(I,J,K,bi,bj)=0.
81     ELSE
82     hFacC(I,J,K,bi,bj)=hFacMinDz*rDzF(k)
83     ENDIF
84 adcroft 1.2 ENDIF
85     ENDDO
86     ENDDO
87     ENDDO
88     ENDDO
89     ENDDO
90     _EXCH_XYZ_R4(hFacC , myThid )
91 adcroft 1.1
92     C hFacW and hFacS (at U and V points)
93     DO bj=myByLo(myThid), myByHi(myThid)
94     DO bi=myBxLo(myThid), myBxHi(myThid)
95     DO K=1, Nz
96     DO J=1,sNy
97     DO I=1,sNx
98     hFacW(I,J,K,bi,bj)=
99     & MIN(hFacC(I,J,K,bi,bj),hFacC(I-1,J,K,bi,bj))
100     hFacS(I,J,K,bi,bj)=
101     & MIN(hFacC(I,J,K,bi,bj),hFacC(I,J-1,K,bi,bj))
102     ENDDO
103     ENDDO
104     ENDDO
105     ENDDO
106     ENDDO
107     _EXCH_XYZ_R4(hFacW , myThid )
108     _EXCH_XYZ_R4(hFacS , myThid )
109    
110     C Masks and reciprocals of hFac[CWS]
111     DO bj = myByLo(myThid), myByHi(myThid)
112     DO bi = myBxLo(myThid), myBxHi(myThid)
113     DO K=1,Nz
114     DO J=1,sNy
115     DO I=1,sNx
116     IF (HFacC(I,J,K,bi,bj) .NE. 0. D0 ) THEN
117     rHFacC(I,J,K,bi,bj) = 1. D0 / HFacC(I,J,K,bi,bj)
118     ELSE
119     rHFacC(I,J,K,bi,bj) = 0. D0
120     ENDIF
121     IF (HFacW(I,J,K,bi,bj) .NE. 0. D0 ) THEN
122     rHFacW(I,J,K,bi,bj) = 1. D0 / HFacW(I,J,K,bi,bj)
123     maskW(I,J,K,bi,bj) = 1. D0
124     ELSE
125     rHFacW(I,J,K,bi,bj) = 0. D0
126     maskW(I,J,K,bi,bj) = 0.0 D0
127     ENDIF
128     IF (HFacS(I,J,K,bi,bj) .NE. 0. D0 ) THEN
129     rHFacS(I,J,K,bi,bj) = 1. D0 / HFacS(I,J,K,bi,bj)
130     maskS(I,J,K,bi,bj) = 1. D0
131     ELSE
132     rHFacS(I,J,K,bi,bj) = 0. D0
133     maskS(I,J,K,bi,bj) = 0. D0
134     ENDIF
135     ENDDO
136     ENDDO
137     ENDDO
138     ENDDO
139     ENDDO
140     _EXCH_XYZ_R4(rHFacC , myThid )
141     _EXCH_XYZ_R4(rHFacW , myThid )
142     _EXCH_XYZ_R4(rHFacS , myThid )
143     _EXCH_XYZ_R4(maskW , myThid )
144     _EXCH_XYZ_R4(maskS , myThid )
145    
146     C Calculate recipricols grid lengths
147     DO bj = myByLo(myThid), myByHi(myThid)
148     DO bi = myBxLo(myThid), myBxHi(myThid)
149     DO J=1,sNy
150     DO I=1,sNx
151     rDxG(I,J,bi,bj)=1.d0/dxG(I,J,bi,bj)
152     rDyG(I,J,bi,bj)=1.d0/dyG(I,J,bi,bj)
153     rDxC(I,J,bi,bj)=1.d0/dxC(I,J,bi,bj)
154     rDyC(I,J,bi,bj)=1.d0/dyC(I,J,bi,bj)
155     rDxF(I,J,bi,bj)=1.d0/dxF(I,J,bi,bj)
156     rDyF(I,J,bi,bj)=1.d0/dyF(I,J,bi,bj)
157     rDxV(I,J,bi,bj)=1.d0/dxV(I,J,bi,bj)
158     rDyU(I,J,bi,bj)=1.d0/dyU(I,J,bi,bj)
159     ENDDO
160     ENDDO
161     ENDDO
162     ENDDO
163     _EXCH_XY_R4(rDxG, myThid )
164     _EXCH_XY_R4(rDyG, myThid )
165     _EXCH_XY_R4(rDxC, myThid )
166     _EXCH_XY_R4(rDyC, myThid )
167     _EXCH_XY_R4(rDxF, myThid )
168     _EXCH_XY_R4(rDyF, myThid )
169     _EXCH_XY_R4(rDxV, myThid )
170     _EXCH_XY_R4(rDyU, myThid )
171    
172     C
173     RETURN
174     END

  ViewVC Help
Powered by ViewVC 1.1.22