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

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

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


Revision 1.6 - (hide annotations) (download)
Fri Jun 12 19:33:33 1998 UTC (25 years, 11 months ago) by cnh
Branch: MAIN
Changes since 1.5: +4 -2 lines
Chages to make default setup correct for 4 degreee global comparison

1 cnh 1.6 C $Header: /u/gcmpack/models/MITgcmUV/model/src/ini_depths.F,v 1.5 1998/06/10 01:44:03 cnh Exp $
2 cnh 1.1
3     #include "CPP_EEOPTIONS.h"
4    
5     CStartOfInterface
6     SUBROUTINE INI_DEPTHS( myThid )
7     C /==========================================================\
8     C | SUBROUTINE INI_DEPTHS |
9     C | o Initialise map of model depths |
10     C |==========================================================|
11     C | The depths of the bottom of the model is specified in |
12     C | terms of an XY map with one depth for each column of |
13     C | grid cells. Depths do not have to coincide with the |
14     C | model levels. The model's lopping algorithm makes it |
15     C | possible to represent arbitrary depths. |
16     C | The mode depths map also influences the models topology |
17     C | By default the model domain wraps around in X and Y. |
18     C | This default doubly periodic topology is "supressed" |
19     C | if a depth map is defined which closes off all wrap |
20     C | around flow. |
21     C \==========================================================/
22    
23     C === Global variables ===
24     #include "SIZE.h"
25     #include "EEPARAMS.h"
26     #include "PARAMS.h"
27     #include "GRID.h"
28    
29     C == Routine arguments ==
30     C myThid - Number of this instance of INI_DEPTHS
31     INTEGER myThid
32     CEndOfInterface
33    
34     C == Local variables ==
35     C xG, yG - Global coordinate location.
36     C zG
37     C zUpper - Work arrays for upper and lower
38     C zLower cell-face heights.
39     C phi - Temporary scalar
40     C iG, jG - Global coordinate index
41     C bi,bj - Loop counters
42     C zUpper - Temporary arrays holding z coordinates of
43     C zLower upper and lower faces.
44     C I,J,K
45     _RL xG, yG, zG
46     _RL phi
47     _RL zUpper(Nz), zLower(Nz)
48     INTEGER iG, jG
49     INTEGER bi, bj
50     INTEGER I, J, K
51    
52     _BARRIER
53 cnh 1.4 IF ( bathyFile .EQ. ' ' ) THEN
54     C Set up a flat bottom box with doubly periodic topology.
55     C H is the basic variable from which other terms are derived. It
56     C is the term that would be set from an external file for a
57     C realistic problem.
58     phi = 0. D0
59     DO K=1,Nz
60     phi = phi+delZ(K)
61     ENDDO
62     DO bj = myByLo(myThid), myByHi(myThid)
63     DO bi = myBxLo(myThid), myBxHi(myThid)
64     DO j=1,sNy
65     DO i=1,sNx
66     iG = myXGlobalLo-1+(bi-1)*sNx+I
67     jG = myYGlobalLo-1+(bj-1)*sNy+J
68     C Default depth of full domain
69     H(i,j,bi,bj) = phi
70     C Test for eastern edge
71     IF ( iG .EQ. nX ) H(i,j,bi,bj) = 0.
72     C Test for northern edge
73     IF ( jG .EQ. nY ) H(i,j,bi,bj) = 0.
74     C Island
75     IF ( iG .EQ. 1 .AND.
76     & jG .EQ. 24 ) H(i,j,bi,bj) = 0.75*phi
77     ENDDO
78 cnh 1.1 ENDDO
79     ENDDO
80     ENDDO
81 cnh 1.4 ELSE
82     _BEGIN_MASTER( myThid )
83     CALL READ_FLD_XY_RS( bathyFile, ' ', H, 0, myThid )
84     _END_MASTER(myThid)
85     ENDIF
86     _EXCH_XY_R4( H, myThid )
87    
88     C-- Cacluate quantities derived from XY depth map
89 cnh 1.1 DO bj = myByLo(myThid), myByHi(myThid)
90     DO bi = myBxLo(myThid), myBxHi(myThid)
91     DO J=1,sNy
92     DO I=1,sNx
93     C Inverse of depth
94     IF ( h(i,j,bi,bj) .EQ. 0. _d 0 ) THEN
95     rH(i,j,bi,bj) = 0. _d 0
96     ELSE
97     rH(i,j,bi,bj) = 1. _d 0 / h(i,j,bi,bj)
98     ENDIF
99     ENDDO
100     ENDDO
101     ENDDO
102     ENDDO
103     _EXCH_XY_R4( rH, myThid )
104    
105     C-- Now calculate "lopping" factors hFac.
106     zG = delZ(1)*0.5 D0
107     zFace(1) = 0
108 cnh 1.6 dzC(1) = delz(1)/2. _d 0
109 cnh 1.1 rDzC(1) = 2. _d 0/delZ(1)
110     DO K=1,Nz-1
111     saFac(K) = 1. D0
112     zC(K) = zG
113     zG = zG + (delZ(K)+delZ(K+1))*0.5 D0
114     zFace(K+1) = zFace(K)+delZ(K)
115     rDzC(K+1) = 2. _d 0/(delZ(K)+delZ(K+1))
116 cnh 1.6 dzC(K+1) = (delZ(K)+delZ(K+1))/2. _d 0
117 cnh 1.1 ENDDO
118     zC(Nz) = zG
119     zFace(Nz+1) = zFace(Nz)+delZ(Nz)
120     DO K=1,Nz
121     zUpper(K) = zFace(K)
122     zLower(K) = zFace(K+1)
123     dzF(K) = delz(K)
124     rdzF(K) = 1.d0/dzF(K)
125     ENDDO
126     DO bj=myByLo(myThid), myByHi(myThid)
127     DO bi=myBxLo(myThid), myBxHi(myThid)
128     DO K=1, Nz
129     DO J=1,sNy
130     DO I=1,sNx
131     hFacC(I,J,K,bi,bj) = 1.
132     IF ( H(I,J,bi,bj) .LE. zUpper(K) ) THEN
133     C Below base of domain
134     hFacC(I,J,K,bi,bj) = 0.
135     ELSEIF ( H(I,J,bi,bj) .GT. zLower(K) ) THEN
136     C Base of domain is below this cell
137     hFacC(I,J,K,bi,bj) = 1.
138     ELSE
139     C Base of domain is in this cell
140     C Set hFac tp the fraction of the cell that is open.
141     phi = zUpper(K)-H(I,J,bi,bj)
142     hFacC(I,J,K,bi,bj) = phi/(zUpper(K)-zLower(K))
143     ENDIF
144     ENDDO
145     ENDDO
146     ENDDO
147     ENDDO
148     ENDDO
149     _EXCH_XYZ_R4(hFacC , myThid )
150    
151     DO bj=myByLo(myThid), myByHi(myThid)
152     DO bi=myBxLo(myThid), myBxHi(myThid)
153     DO K=1, Nz
154     DO J=1,sNy
155     DO I=1,sNx
156     hFacW(I,J,K,bi,bj)=
157     & MIN(hFacC(I,J,K,bi,bj),hFacC(I-1,J,K,bi,bj))
158     hFacS(I,J,K,bi,bj)=
159     & MIN(hFacC(I,J,K,bi,bj),hFacC(I,J-1,K,bi,bj))
160     ENDDO
161     ENDDO
162     ENDDO
163     ENDDO
164     ENDDO
165     _EXCH_XYZ_R4(hFacW , myThid )
166     _EXCH_XYZ_R4(hFacS , myThid )
167    
168     C-- Calculate recipricols of hFacC, hFacW and hFacS
169     DO bj=myByLo(myThid), myByHi(myThid)
170     DO bi=myBxLo(myThid), myBxHi(myThid)
171     DO K=1, Nz
172     DO J=1,sNy
173     DO I=1,sNx
174     rhFacC(I,J,K,bi,bj)=0. D0
175     if (hFacC(I,J,K,bi,bj).ne.0.)
176     & rhFacC(I,J,K,bi,bj)=1. D0 /hFacC(I,J,K,bi,bj)
177     rhFacW(I,J,K,bi,bj)=0. D0
178     if (hFacW(I,J,K,bi,bj).ne.0.)
179     & rhFacW(I,J,K,bi,bj)=1. D0 /hFacW(I,J,K,bi,bj)
180     rhFacS(I,J,K,bi,bj)=0. D0
181     if (hFacS(I,J,K,bi,bj).ne.0.)
182     & rhFacS(I,J,K,bi,bj)=1. D0 /hFacS(I,J,K,bi,bj)
183     ENDDO
184     ENDDO
185     ENDDO
186     ENDDO
187     ENDDO
188     _EXCH_XYZ_R4(rhFacC , myThid )
189     _EXCH_XYZ_R4(rhFacW , myThid )
190     _EXCH_XYZ_R4(rhFacS , myThid )
191 cnh 1.5
192     C
193 cnh 1.6 CALL PLOT_FIELD_XYR8( H, 'Model depths' , 1, myThid )
194 cnh 1.1 C
195     RETURN
196     END

  ViewVC Help
Powered by ViewVC 1.1.22