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

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

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


Revision 1.3 - (show annotations) (download)
Wed Apr 29 21:31:09 1998 UTC (26 years, 1 month ago) by adcroft
Branch: MAIN
CVS Tags: kloop1
Changes since 1.2: +46 -11 lines
Moved the K loops from convect(), find_rho() and calc_ph() up to
this level (dynamics).

1 C $Header: /u/gcmpack/models/MITgcmUV/model/src/dynamics.F,v 1.2 1998/04/24 02:05:40 cnh Exp $
2
3 #include "CPP_EEOPTIONS.h"
4
5 SUBROUTINE DYNAMICS(myThid)
6 C /==========================================================\
7 C | SUBROUTINE DYNAMICS |
8 C | o Controlling routine for the explicit part of the model |
9 C | dynamics. |
10 C |==========================================================|
11 C | This routine evaluates the "dynamics" terms for each |
12 C | block of ocean in turn. Because the blocks of ocean have |
13 C | overlap regions they are independent of one another. |
14 C | If terms involving lateral integrals are needed in this |
15 C | routine care will be needed. Similarly finite-difference |
16 C | operations with stencils wider than the overlap region |
17 C | require special consideration. |
18 C | Notes |
19 C | ===== |
20 C | C*P* comments indicating place holders for which code is |
21 C | presently being developed. |
22 C \==========================================================/
23
24 C == Global variables ===
25 #include "SIZE.h"
26 #include "EEPARAMS.h"
27 #include "CG2D.h"
28 #include "DYNVARS.h"
29
30 C == Routine arguments ==
31 C myThid - Thread number for this instance of the routine.
32 INTEGER myThid
33
34 C == Local variables
35 C xA, yA - Per block temporaries holding face areas
36 C uTrans, vTrans, wTrans - Per block temporaries holding flow transport
37 C o uTrans: Zonal transport
38 C o vTrans: Meridional transport
39 C o wTrans: Vertical transport
40 C maskC,maskUp o maskC: land/water mask for tracer cells
41 C o maskUp: land/water mask for W points
42 C aTerm, xTerm, cTerm - Work arrays for holding separate terms in
43 C mTerm, pTerm, tendency equations.
44 C fZon, fMer, fVer[STUV] o aTerm: Advection term
45 C o xTerm: Mixing term
46 C o cTerm: Coriolis term
47 C o mTerm: Metric term
48 C o pTerm: Pressure term
49 C o fZon: Zonal flux term
50 C o fMer: Meridional flux term
51 C o fVer: Vertical flux term - note fVer
52 C is "pipelined" in the vertical
53 C so we need an fVer for each
54 C variable.
55 C iMin, iMax - Ranges and sub-block indices on which calculations
56 C jMin, jMax are applied.
57 C bi, bj
58 C k, kUp, kDown, kM1 - Index for layer above and below. kUp and kDown
59 C are switched with layer to be the appropriate index
60 C into fVerTerm
61 _RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
62 _RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
63 _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
64 _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
65 _RL wTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
66 _RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
67 _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
68 _RL aTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
69 _RL xTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
70 _RL cTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
71 _RL mTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
72 _RL pTerm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
73 _RL fZon (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
74 _RL fMer (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
75 _RL fVerT (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
76 _RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
77 _RL fVerU (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
78 _RL fVerV (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
79 _RL pH (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nz)
80 _RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
81 _RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
82 INTEGER iMin, iMax
83 INTEGER jMin, jMax
84 INTEGER bi, bj
85 INTEGER i, j
86 INTEGER k, kM1, kUp, kDown
87
88 C-- Set up work arrays with valid (i.e. not NaN) values
89 C These inital values do not alter the numerical results. They
90 C just ensure that all memory references are to valid floating
91 C point numbers. This prevents spurious hardware signals due to
92 C uninitialised but inert locations.
93 DO j=1-OLy,sNy+OLy
94 DO i=1-OLx,sNx+OLx
95 xA(i,j) = 0.*1. _d 37
96 yA(i,j) = 0.*1. _d 37
97 uTrans(i,j) = 0.*1. _d 37
98 vTrans(i,j) = 0.*1. _d 37
99 aTerm(i,j) = 0.*1. _d 37
100 xTerm(i,j) = 0.*1. _d 37
101 cTerm(i,j) = 0.*1. _d 37
102 mTerm(i,j) = 0.*1. _d 37
103 pTerm(i,j) = 0.*1. _d 37
104 fZon(i,j) = 0.*1. _d 37
105 fMer(i,j) = 0.*1. _d 37
106 DO K=1,nZ
107 pH (i,j,k) = 0.*1. _d 37
108 ENDDO
109 rhokm1(i,j) = 0. _d 0
110 rhokp1(i,j) = 0. _d 0
111 ENDDO
112 ENDDO
113 C-- Set up work arrays that need valid initial values
114 DO j=1-OLy,sNy+OLy
115 DO i=1-OLx,sNx+OLx
116 wTrans(i,j) = 0. _d 0
117 fVerT(i,j,1) = 0. _d 0
118 fVerT(i,j,2) = 0. _d 0
119 fVerS(i,j,1) = 0. _d 0
120 fVerS(i,j,2) = 0. _d 0
121 fVerU(i,j,1) = 0. _d 0
122 fVerU(i,j,2) = 0. _d 0
123 fVerV(i,j,1) = 0. _d 0
124 fVerV(i,j,2) = 0. _d 0
125 ENDDO
126 ENDDO
127
128 DO bj=myByLo(myThid),myByHi(myThid)
129 DO bi=myBxLo(myThid),myBxHi(myThid)
130
131 C-- Boundary condition on hydrostatic pressure is pH(z=0)=0
132 DO j=1-OLy,sNy+OLy
133 DO i=1-OLx,sNx+OLx
134 pH(i,j,1) = 0. _d 0
135 ENDDO
136 ENDDO
137
138 iMin = 1-OLx+1
139 iMax = sNx+OLx
140 jMin = 1-OLy+1
141 jMax = sNy+OLy
142
143 C-- Update fields according to tendency terms
144 CALL TIMESTEP(
145 I bi,bj,iMin,iMax,jMin,jMax,myThid)
146
147 DO K=2,Nz
148 C Density of K-1 level (above W(K)) reference to K level
149 CALL FIND_RHO(
150 I bi, bj, iMin, iMax, jMin, jMax, K-1, K, 'LINEAR',
151 O rhoKm1,
152 I myThid )
153 C Density of K level (below W(K)) reference to K level
154 CALL FIND_RHO(
155 I bi, bj, iMin, iMax, jMin, jMax, K, K, 'LINEAR',
156 O rhoKp1,
157 I myThid )
158 C-- Calculate static stability and mix where convectively unstable
159 CALL CONVECT(
160 I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,myThid)
161 C Density of K-1 level (above W(K)) reference to K-1 level
162 CALL FIND_RHO(
163 I bi, bj, iMin, iMax, jMin, jMax, K-1, K-1, 'LINEAR',
164 O rhoKm1,
165 I myThid )
166 C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0
167 CALL CALC_PH(
168 I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,
169 U pH,
170 I myThid )
171 ENDDO ! K
172
173 C Density of Nz level (bottom level) reference to Nz level
174 CALL FIND_RHO(
175 I bi, bj, iMin, iMax, jMin, jMax, Nz, Nz, 'LINEAR',
176 O rhoKm1,
177 I myThid )
178 C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0
179 CALL CALC_PH(
180 I bi,bj,iMin,iMax,jMin,jMax,Nz+1,rhoKm1,
181 U pH,
182 I myThid )
183
184 DO K = Nz, 1, -1
185 kM1 =max(1,k-1) ! Points to level above k (=k-1)
186 kUp =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above
187 kDown=1+MOD(k,2) ! Cycles through 2,1 to point to current layer
188 iMin = 1-OLx+2
189 iMax = sNx+OLx-1
190 jMin = 1-OLy+2
191 jMax = sNy+OLy-1
192
193 C-- Get temporary terms used by tendency routines
194 CALL CALC_COMMON_FACTORS (
195 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
196 O xA,yA,uTrans,vTrans,wTrans,maskC,maskUp,
197 I myThid)
198
199 C-- Calculate accelerations in the momentum equations
200 CALL CALC_MOM_RHS(
201 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
202 I xA,yA,uTrans,vTrans,wTrans,maskC,
203 I pH,
204 U aTerm,xTerm,cTerm,mTerm,pTerm,
205 U fZon, fMer, fVerU, fVerV,
206 I myThid)
207
208 C-- Calculate active tracer tendencies
209 CALL CALC_GT(
210 I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
211 I xA,yA,uTrans,vTrans,wTrans,maskUp,
212 U aTerm,xTerm,fZon,fMer,fVerT,
213 I myThid)
214 Cdbg CALL CALC_GS(
215 Cdbg I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
216 Cdbg I xA,yA,uTrans,vTrans,wTrans,maskUp,
217 Cdbg U aTerm,xTerm,fZon,fMer,fVerS,
218 Cdbg I myThid)
219
220 ENDDO
221
222 ENDDO
223 ENDDO
224
225 RETURN
226 END

  ViewVC Help
Powered by ViewVC 1.1.22