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

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

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


Revision 1.5 - (hide annotations) (download)
Mon May 4 16:32:10 1998 UTC (26 years ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint1
Changes since 1.4: +33 -27 lines
Changed the descretization of hydrostatic pressure (now barZ(dz)*barZ(rho) )
to conserve potential energy. This was the original discretization but
when I (AJA) made the outer K loop I changed the discretization. Sorry.

1 adcroft 1.5 C $Header: /u/gcmpack/models/MITgcmUV/model/src/dynamics.F,v 1.4 1998/04/30 14:03:28 adcroft Exp $
2 cnh 1.1
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 adcroft 1.3 #include "DYNVARS.h"
29 cnh 1.1
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 adcroft 1.3 _RL rhokm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
81     _RL rhokp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
82 adcroft 1.4 _RL pSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
83     _RL pSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
84 cnh 1.1 INTEGER iMin, iMax
85     INTEGER jMin, jMax
86     INTEGER bi, bj
87     INTEGER i, j
88     INTEGER k, kM1, kUp, kDown
89    
90     C-- Set up work arrays with valid (i.e. not NaN) values
91     C These inital values do not alter the numerical results. They
92     C just ensure that all memory references are to valid floating
93     C point numbers. This prevents spurious hardware signals due to
94     C uninitialised but inert locations.
95     DO j=1-OLy,sNy+OLy
96     DO i=1-OLx,sNx+OLx
97 adcroft 1.5 xA(i,j) = 0. _d 0
98     yA(i,j) = 0. _d 0
99     uTrans(i,j) = 0. _d 0
100     vTrans(i,j) = 0. _d 0
101     aTerm(i,j) = 0. _d 0
102     xTerm(i,j) = 0. _d 0
103     cTerm(i,j) = 0. _d 0
104     mTerm(i,j) = 0. _d 0
105     pTerm(i,j) = 0. _d 0
106     fZon(i,j) = 0. _d 0
107     fMer(i,j) = 0. _d 0
108 cnh 1.1 DO K=1,nZ
109 adcroft 1.5 pH (i,j,k) = 0. _d 0
110 cnh 1.1 ENDDO
111 adcroft 1.5 rhokm1(i,j) = 0. _d 0
112     rhokp1(i,j) = 0. _d 0
113 cnh 1.1 ENDDO
114     ENDDO
115     C-- Set up work arrays that need valid initial values
116     DO j=1-OLy,sNy+OLy
117     DO i=1-OLx,sNx+OLx
118     wTrans(i,j) = 0. _d 0
119     fVerT(i,j,1) = 0. _d 0
120     fVerT(i,j,2) = 0. _d 0
121     fVerS(i,j,1) = 0. _d 0
122     fVerS(i,j,2) = 0. _d 0
123     fVerU(i,j,1) = 0. _d 0
124     fVerU(i,j,2) = 0. _d 0
125     fVerV(i,j,1) = 0. _d 0
126     fVerV(i,j,2) = 0. _d 0
127     ENDDO
128     ENDDO
129    
130     DO bj=myByLo(myThid),myByHi(myThid)
131     DO bi=myBxLo(myThid),myBxHi(myThid)
132    
133 adcroft 1.3 C-- Boundary condition on hydrostatic pressure is pH(z=0)=0
134     DO j=1-OLy,sNy+OLy
135     DO i=1-OLx,sNx+OLx
136     pH(i,j,1) = 0. _d 0
137     ENDDO
138     ENDDO
139    
140 cnh 1.1 iMin = 1-OLx+1
141     iMax = sNx+OLx
142     jMin = 1-OLy+1
143     jMax = sNy+OLy
144    
145 adcroft 1.4 C-- Calculate gradient of surface pressure
146     CALL GRAD_PSURF(
147     I bi,bj,iMin,iMax,jMin,jMax,
148     O pSurfX,pSurfY,
149     I myThid)
150    
151     C-- Update fields in top level according to tendency terms
152 cnh 1.1 CALL TIMESTEP(
153 adcroft 1.4 I bi,bj,iMin,iMax,jMin,jMax,1,pSurfX,pSurfY,myThid)
154 cnh 1.1
155 adcroft 1.5 C Density of 1st level (below W(1)) reference to level 1
156     CALL FIND_RHO(
157     I bi, bj, iMin, iMax, jMin, jMax, 1, 1, 'LINEAR',
158     O rhoKm1,
159     I myThid )
160     C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0
161     CALL CALC_PH(
162     I bi,bj,iMin,iMax,jMin,jMax,1,rhoKm1,rhoKm1,
163     U pH,
164     I myThid )
165    
166 adcroft 1.3 DO K=2,Nz
167 adcroft 1.4 C-- Update fields in Kth level according to tendency terms
168     CALL TIMESTEP(
169     I bi,bj,iMin,iMax,jMin,jMax,K,pSurfX,pSurfY,myThid)
170 adcroft 1.3 C Density of K-1 level (above W(K)) reference to K level
171     CALL FIND_RHO(
172     I bi, bj, iMin, iMax, jMin, jMax, K-1, K, 'LINEAR',
173     O rhoKm1,
174     I myThid )
175     C Density of K level (below W(K)) reference to K level
176     CALL FIND_RHO(
177     I bi, bj, iMin, iMax, jMin, jMax, K, K, 'LINEAR',
178     O rhoKp1,
179     I myThid )
180 cnh 1.1 C-- Calculate static stability and mix where convectively unstable
181 adcroft 1.3 CALL CONVECT(
182     I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,myThid)
183     C Density of K-1 level (above W(K)) reference to K-1 level
184     CALL FIND_RHO(
185     I bi, bj, iMin, iMax, jMin, jMax, K-1, K-1, 'LINEAR',
186     O rhoKm1,
187     I myThid )
188 adcroft 1.5 C Density of K level (below W(K)) referenced to K level
189 adcroft 1.3 CALL FIND_RHO(
190 adcroft 1.5 I bi, bj, iMin, iMax, jMin, jMax, K, K, 'LINEAR',
191     O rhoKp1,
192 adcroft 1.3 I myThid )
193 cnh 1.1 C-- Integrate hydrostatic balance for pH with BC of pH(z=0)=0
194 adcroft 1.3 CALL CALC_PH(
195 adcroft 1.5 I bi,bj,iMin,iMax,jMin,jMax,K,rhoKm1,rhoKp1,
196 adcroft 1.3 U pH,
197 cnh 1.1 I myThid )
198    
199 adcroft 1.5 ENDDO ! K
200    
201 cnh 1.1 DO K = Nz, 1, -1
202     kM1 =max(1,k-1) ! Points to level above k (=k-1)
203     kUp =1+MOD(k+1,2) ! Cycles through 1,2 to point to layer above
204     kDown=1+MOD(k,2) ! Cycles through 2,1 to point to current layer
205     iMin = 1-OLx+2
206     iMax = sNx+OLx-1
207     jMin = 1-OLy+2
208     jMax = sNy+OLy-1
209    
210     C-- Get temporary terms used by tendency routines
211     CALL CALC_COMMON_FACTORS (
212     I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
213     O xA,yA,uTrans,vTrans,wTrans,maskC,maskUp,
214     I myThid)
215    
216     C-- Calculate accelerations in the momentum equations
217     CALL CALC_MOM_RHS(
218     I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
219     I xA,yA,uTrans,vTrans,wTrans,maskC,
220     I pH,
221     U aTerm,xTerm,cTerm,mTerm,pTerm,
222     U fZon, fMer, fVerU, fVerV,
223     I myThid)
224    
225     C-- Calculate active tracer tendencies
226     CALL CALC_GT(
227     I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
228     I xA,yA,uTrans,vTrans,wTrans,maskUp,
229     U aTerm,xTerm,fZon,fMer,fVerT,
230     I myThid)
231     Cdbg CALL CALC_GS(
232     Cdbg I bi,bj,iMin,iMax,jMin,jMax, k,kM1,kUp,kDown,
233     Cdbg I xA,yA,uTrans,vTrans,wTrans,maskUp,
234     Cdbg U aTerm,xTerm,fZon,fMer,fVerS,
235     Cdbg I myThid)
236    
237 adcroft 1.5 ENDDO ! K
238 cnh 1.1
239     ENDDO
240     ENDDO
241    
242     RETURN
243     END

  ViewVC Help
Powered by ViewVC 1.1.22