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

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

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


Revision 1.12 - (hide annotations) (download)
Mon Jul 30 20:23:09 2001 UTC (22 years, 11 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint40pre7, checkpoint40pre6, checkpoint40pre9, checkpoint40pre8, checkpoint40pre5, checkpoint40pre4
Changes since 1.11: +6 -2 lines
Added CPP option ALLOW_PASSIVE_TRACER for TR1.h related fields.

1 heimbach 1.12 C $Header: /u/gcmpack/models/MITgcmUV/model/src/the_correction_step.F,v 1.11 2001/07/13 14:26:57 heimbach Exp $
2     C Tag $Name: checkpoint40pre2 $
3 adcroft 1.2
4     #include "CPP_OPTIONS.h"
5    
6     SUBROUTINE THE_CORRECTION_STEP(myTime, myIter, myThid)
7     C /==========================================================\
8     C | SUBROUTINE THE_CORRECTION_STEP |
9     C |==========================================================|
10 adcroft 1.9 C |part1: update U,V,T,S |
11     C | U*,V* (contained in gUnm1,gVnm1) have the surface |
12     C | pressure gradient term added and the result stored |
13     C | in U,V (contained in uVel, vVel) |
14     C | T* (contained in gTnm1) is copied to T (theta) |
15     C | S* (contained in gSnm1) is copied to S (salt) |
16 adcroft 1.2 C | |
17 adcroft 1.9 C |part2: Adjustments. |
18     C | o Filter U,V,T,S (Shapiro Filter, Zonal_Filter) |
19     C | o Convective Adjustment |
20     C | o Compute again Eta (exact volume conservation) |
21     C | o Diagmnostic of state variables (Time average) |
22 adcroft 1.2 C \==========================================================/
23     IMPLICIT NONE
24    
25     C == Global variables ===
26     #include "SIZE.h"
27     #include "EEPARAMS.h"
28     #include "PARAMS.h"
29     #include "DYNVARS.h"
30 heimbach 1.12 #ifdef ALLOW_PASSIVE_TRACER
31 heimbach 1.11 #include "TR1.h"
32 heimbach 1.12 #endif
33 adcroft 1.2
34 heimbach 1.7 #ifdef ALLOW_AUTODIFF_TAMC
35     #include "tamc.h"
36     #include "tamc_keys.h"
37     #endif /* ALLOW_AUTODIFF_TAMC */
38    
39 adcroft 1.2 C == Routine arguments ==
40     C myTime - Current time in simulation
41     C myIter - Current iteration number in simulation
42     C myThid - Thread number for this instance of the routine.
43     _RL myTime
44     INTEGER myIter
45     INTEGER myThid
46    
47     C == Local variables
48 jmc 1.6 _RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
49     _RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
50 adcroft 1.2 INTEGER iMin,iMax
51     INTEGER jMin,jMax
52     INTEGER bi,bj
53     INTEGER k,i,j
54    
55 adcroft 1.9 C--- 1rst Part : Update U,V,T,S.
56     C
57     C The arrays used for time stepping are cycled.
58     C Tracers:
59     C T(n) = Gt(n-1)
60     C Gt(n-1) = Gt(n)
61     C Momentum:
62     C V(n) = Gv(n-1) - dt * grad Eta
63     C Gv(n-1) = Gv(n)
64     C
65    
66 adcroft 1.2 DO bj=myByLo(myThid),myByHi(myThid)
67     DO bi=myBxLo(myThid),myBxHi(myThid)
68 heimbach 1.7
69     #ifdef ALLOW_AUTODIFF_TAMC
70     act1 = bi - myBxLo(myThid)
71     max1 = myBxHi(myThid) - myBxLo(myThid) + 1
72    
73     act2 = bj - myByLo(myThid)
74     max2 = myByHi(myThid) - myByLo(myThid) + 1
75    
76     act3 = myThid - 1
77     max3 = nTx*nTy
78    
79     act4 = ikey_dynamics - 1
80    
81     ikey = (act1 + 1) + act2*max1
82     & + act3*max1*max2
83     & + act4*max1*max2*max3
84     #endif /* ALLOW_AUTODIFF_TAMC */
85 adcroft 1.2
86     C-- Set up work arrays that need valid initial values
87     DO j=1-OLy,sNy+OLy
88     DO i=1-OLx,sNx+OLx
89 jmc 1.6 phiSurfX(i,j)=0.
90     phiSurfY(i,j)=0.
91 adcroft 1.2 ENDDO
92     ENDDO
93    
94     C Loop range: Gradients of Eta are evaluated so valid
95     C range is all but first row and column in overlaps.
96     iMin = 1-OLx+1
97     iMax = sNx+OLx
98     jMin = 1-OLy+1
99     jMax = sNy+OLy
100    
101 jmc 1.6 C- Calculate gradient of surface Potentiel
102     CALL CALC_GRAD_PHI_SURF(
103 adcroft 1.2 I bi,bj,iMin,iMax,jMin,jMax,
104 jmc 1.5 I etaN,
105 jmc 1.6 O phiSurfX,phiSurfY,
106 adcroft 1.2 I myThid )
107    
108     C-- Loop over all layers, top to bottom
109     DO K=1,Nr
110    
111 heimbach 1.8 #ifdef ALLOW_AUTODIFF_TAMC
112     kkey = (ikey-1)*Nr + k
113     #endif
114    
115 adcroft 1.2 C- Update velocity fields: V(n) = V** - dt * grad Eta
116 adcroft 1.3 IF (momStepping)
117     & CALL CORRECTION_STEP(
118 adcroft 1.2 I bi,bj,iMin,iMax,jMin,jMax,K,
119 jmc 1.6 I phiSurfX,phiSurfY,myTime,myThid )
120 adcroft 1.2
121     C- Update tracer fields: T(n) = T**, Gt(n-1) = Gt(n)
122     IF (tempStepping)
123     & CALL CYCLE_TRACER(
124     I bi,bj,iMin,iMax,jMin,jMax,K,
125     U theta,gT,gTNm1,
126     I myTime,myThid )
127     IF (saltStepping)
128     & CALL CYCLE_TRACER(
129     I bi,bj,iMin,iMax,jMin,jMax,K,
130     U salt,gS,gSNm1,
131 heimbach 1.11 I myTime,myThid )
132 heimbach 1.12 #ifdef ALLOW_PASSIVE_TRACER
133 heimbach 1.11 IF (tr1Stepping)
134     & CALL CYCLE_TRACER(
135     I bi,bj,iMin,iMax,jMin,jMax,K,
136     U Tr1,gTr1,gTr1Nm1,
137 adcroft 1.2 I myTime,myThid )
138 heimbach 1.12 #endif
139 adcroft 1.2
140     #ifdef ALLOW_OBCS
141     #ifdef ALLOW_AUTODIFF_TAMC
142 heimbach 1.8 CADJ STORE uvel (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte
143     CADJ STORE vvel (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte
144     CADJ STORE theta(:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte
145     CADJ STORE salt (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte
146 adcroft 1.2 #endif /* ALLOW_AUTODIFF_TAMC */
147     IF (useOBCS) THEN
148     CALL OBCS_APPLY_UV(bi,bj,K,uVel,vVel,myThid)
149     ENDIF
150     #endif /* ALLOW_OBCS */
151    
152     C-- End DO K=1,Nr
153     ENDDO
154    
155 adcroft 1.9 C-- End of 1rst bi,bj loop
156     ENDDO
157     ENDDO
158    
159     C--- 2nd Part : Adjustment.
160     C
161     C Static stability is calculated and the tracers are
162     C convective adjusted where statically unstable.
163    
164     #ifdef ALLOW_SHAP_FILT
165     IF (useSHAP_FILT) THEN
166     C-- Filter (and exchange).
167     CALL SHAP_FILT_APPLY(
168     I uVel, vVel, theta, salt,
169     I myTime, myIter, myThid )
170     ENDIF
171     #endif
172    
173     #ifdef ALLOW_ZONAL_FILT
174     IF (zonal_filt_lat.LT.90.) THEN
175     CALL ZONAL_FILT_APPLY(
176     U uVel, vVel, theta, salt,
177     I myThid )
178     ENDIF
179     #endif
180    
181     DO bj=myByLo(myThid),myByHi(myThid)
182     DO bi=myBxLo(myThid),myBxHi(myThid)
183    
184 adcroft 1.2 C-- Convectively adjust new fields to be statically stable
185 adcroft 1.9 iMin = 1-OLx+1
186     iMax = sNx+OLx
187     jMin = 1-OLy+1
188     jMax = sNy+OLy
189 adcroft 1.2 CALL CONVECTIVE_ADJUSTMENT(
190     I bi, bj, iMin, iMax, jMin, jMax,
191     I myTime, myIter, myThid )
192 jmc 1.4
193 adcroft 1.9 #ifdef EXACT_CONSERV
194     IF (exactConserv) THEN
195     C-- Compute again "eta" to satisfy exactly the total Volume Conservation :
196     CALL CALC_EXACT_ETA( bi,bj, uVel,vVel,
197     I myTime, myIter, myThid )
198     ENDIF
199     #endif /* EXACT_CONSERV */
200    
201 jmc 1.5 #ifdef ALLOW_TIMEAVE
202 jmc 1.4 IF (taveFreq.GT.0.) THEN
203 jmc 1.5 CALL TIMEAVE_STATVARS(myTime, myIter, bi, bj, myThid)
204 jmc 1.4 ENDIF
205 jmc 1.5 #endif /* ALLOW_TIMEAVE */
206 adcroft 1.2
207 adcroft 1.9 C-- End of 2nd bi,bj loop
208 adcroft 1.2 ENDDO
209     ENDDO
210 adcroft 1.9
211     #ifdef EXACT_CONSERV
212     IF (exactConserv) _EXCH_XY_R8(etaN, myThid )
213     #endif /* EXACT_CONSERV */
214 adcroft 1.2
215     RETURN
216     END

  ViewVC Help
Powered by ViewVC 1.1.22