/[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.23 - (hide annotations) (download)
Tue Oct 7 16:21:12 2003 UTC (20 years, 8 months ago) by stephd
Branch: MAIN
CVS Tags: checkpoint51j_post, checkpoint51i_pre
Changes since 1.22: +6 -1 lines
fix bug in ptracers time averaging if gchem forcing is done separately
(ie #define PTRACERS_SEPARATE_FORCING)

1 stephd 1.23 C $Header: /u/gcmpack/MITgcm/model/src/the_correction_step.F,v 1.22 2003/06/25 21:06:35 stephd Exp $
2 jmc 1.13 C Tag $Name: $
3 adcroft 1.2
4     #include "CPP_OPTIONS.h"
5 stephd 1.23 #ifdef ALLOW_GCHEM
6     #include "GCHEM_OPTIONS.h"
7     #endif
8 adcroft 1.2
9 cnh 1.14 CBOP
10     C !ROUTINE: THE_CORRECTION_STEP
11     C !INTERFACE:
12 adcroft 1.2 SUBROUTINE THE_CORRECTION_STEP(myTime, myIter, myThid)
13 cnh 1.14 C !DESCRIPTION: \bv
14     C *==========================================================*
15     C | SUBROUTINE THE_CORRECTION_STEP
16     C *==========================================================*
17     C |1rst Part : Update U,V,T,S.
18     C |
19     C | The arrays used for time stepping are cycled.
20     C | Tracers:
21 jmc 1.21 C | T(n) = Gt(n)
22 cnh 1.14 C | Momentum:
23 jmc 1.21 C | V(n) = Gv(n) - dt * grad Eta
24 cnh 1.14 C |
25     C |part1: update U,V,T,S
26 jmc 1.21 C | U*,V* (contained in gU,gV) have the surface
27 cnh 1.14 C | pressure gradient term added and the result stored
28     C | in U,V (contained in uVel, vVel)
29 jmc 1.19 C | T* (contained in gT) is copied to T (theta)
30     C | S* (contained in gS) is copied to S (salt)
31 cnh 1.14 C |
32 jmc 1.19 C |part2: Adjustments & Diagnostics
33 cnh 1.14 C | o Filter U,V,T,S (Shapiro Filter, Zonal_Filter)
34     C | o Convective Adjustment
35 jmc 1.19 C | o Compute again Eta (exact volume conservation)
36     C | o Compute vertical velocity
37 cnh 1.14 C | o Diagmnostic of state variables (Time average)
38     C *==========================================================*
39     C \ev
40    
41     C !USES:
42 adcroft 1.2 IMPLICIT NONE
43     C == Global variables ===
44     #include "SIZE.h"
45     #include "EEPARAMS.h"
46     #include "PARAMS.h"
47     #include "DYNVARS.h"
48 heimbach 1.12 #ifdef ALLOW_PASSIVE_TRACER
49 heimbach 1.11 #include "TR1.h"
50 heimbach 1.12 #endif
51 jmc 1.16
52     #ifdef ALLOW_SHAP_FILT
53     #include "SHAP_FILT.h"
54     #endif
55     #ifdef ALLOW_ZONAL_FILT
56     #include "ZONAL_FILT.h"
57     #endif
58    
59 cnh 1.14 C !INPUT/OUTPUT PARAMETERS:
60 adcroft 1.2 C == Routine arguments ==
61     C myTime - Current time in simulation
62     C myIter - Current iteration number in simulation
63     C myThid - Thread number for this instance of the routine.
64     _RL myTime
65     INTEGER myIter
66     INTEGER myThid
67    
68 cnh 1.14 C !LOCAL VARIABLES:
69 adcroft 1.2 C == Local variables
70 jmc 1.6 _RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
71     _RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
72 adcroft 1.2 INTEGER iMin,iMax
73     INTEGER jMin,jMax
74     INTEGER bi,bj
75     INTEGER k,i,j
76    
77 cnh 1.14 CEOP
78 adcroft 1.9
79 adcroft 1.2 DO bj=myByLo(myThid),myByHi(myThid)
80     DO bi=myBxLo(myThid),myBxHi(myThid)
81 heimbach 1.7
82 adcroft 1.2 C-- Set up work arrays that need valid initial values
83     DO j=1-OLy,sNy+OLy
84     DO i=1-OLx,sNx+OLx
85 jmc 1.6 phiSurfX(i,j)=0.
86     phiSurfY(i,j)=0.
87 adcroft 1.2 ENDDO
88     ENDDO
89    
90     C Loop range: Gradients of Eta are evaluated so valid
91     C range is all but first row and column in overlaps.
92     iMin = 1-OLx+1
93     iMax = sNx+OLx
94     jMin = 1-OLy+1
95     jMax = sNy+OLy
96    
97 jmc 1.6 C- Calculate gradient of surface Potentiel
98     CALL CALC_GRAD_PHI_SURF(
99 adcroft 1.2 I bi,bj,iMin,iMax,jMin,jMax,
100 jmc 1.5 I etaN,
101 jmc 1.6 O phiSurfX,phiSurfY,
102 adcroft 1.2 I myThid )
103    
104     C-- Loop over all layers, top to bottom
105     DO K=1,Nr
106    
107     C- Update velocity fields: V(n) = V** - dt * grad Eta
108 adcroft 1.3 IF (momStepping)
109     & CALL CORRECTION_STEP(
110 adcroft 1.2 I bi,bj,iMin,iMax,jMin,jMax,K,
111 jmc 1.6 I phiSurfX,phiSurfY,myTime,myThid )
112 adcroft 1.2
113     C- Update tracer fields: T(n) = T**, Gt(n-1) = Gt(n)
114     IF (tempStepping)
115     & CALL CYCLE_TRACER(
116     I bi,bj,iMin,iMax,jMin,jMax,K,
117     U theta,gT,gTNm1,
118     I myTime,myThid )
119     IF (saltStepping)
120     & CALL CYCLE_TRACER(
121     I bi,bj,iMin,iMax,jMin,jMax,K,
122     U salt,gS,gSNm1,
123 heimbach 1.11 I myTime,myThid )
124 heimbach 1.12 #ifdef ALLOW_PASSIVE_TRACER
125 heimbach 1.11 IF (tr1Stepping)
126     & CALL CYCLE_TRACER(
127     I bi,bj,iMin,iMax,jMin,jMax,K,
128     U Tr1,gTr1,gTr1Nm1,
129 adcroft 1.2 I myTime,myThid )
130 heimbach 1.12 #endif
131 adcroft 1.18 #ifdef ALLOW_PTRACERS
132     C- Update passive tracer fields: T(n) = T**, Gt(n-1) = Gt(n)
133     IF (usePTRACERS)
134     & CALL PTRACERS_CYCLE(bi,bj,k,myIter,myTime,myThid)
135     #endif /* ALLOW_PTRACERS */
136    
137 adcroft 1.2
138     #ifdef ALLOW_OBCS
139     IF (useOBCS) THEN
140     CALL OBCS_APPLY_UV(bi,bj,K,uVel,vVel,myThid)
141     ENDIF
142     #endif /* ALLOW_OBCS */
143    
144     C-- End DO K=1,Nr
145     ENDDO
146    
147 adcroft 1.9 C-- End of 1rst bi,bj loop
148     ENDDO
149     ENDDO
150    
151     C--- 2nd Part : Adjustment.
152     C
153     C Static stability is calculated and the tracers are
154     C convective adjusted where statically unstable.
155    
156 jmc 1.16 C-- Filter (and exchange)
157 adcroft 1.9 #ifdef ALLOW_SHAP_FILT
158     IF (useSHAP_FILT) THEN
159 jmc 1.16 IF ( .NOT.shap_filt_uvStar )
160     & CALL SHAP_FILT_APPLY_UV( uVel, vVel, myTime, myIter, myThid )
161    
162     IF ( .NOT.(staggerTimeStep .AND. shap_filt_TrStagg) )
163     & CALL SHAP_FILT_APPLY_TS( theta,salt, myTime, myIter, myThid )
164 adcroft 1.9 ENDIF
165     #endif
166 jmc 1.16 #ifdef ALLOW_ZONAL_FILT
167     IF (useZONAL_FILT) THEN
168     IF ( .NOT.zonal_filt_uvStar )
169     & CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid )
170    
171     IF ( .NOT.(staggerTimeStep .AND. zonal_filt_TrStagg) )
172     & CALL ZONAL_FILT_APPLY_TS( theta, salt, myThid )
173 adcroft 1.9
174     ENDIF
175     #endif
176    
177     DO bj=myByLo(myThid),myByHi(myThid)
178     DO bi=myBxLo(myThid),myBxHi(myThid)
179    
180 adcroft 1.2 C-- Convectively adjust new fields to be statically stable
181 mlosch 1.20 iMin = 1
182     iMax = sNx
183     jMin = 1
184     jMax = sNy
185 adcroft 1.2 CALL CONVECTIVE_ADJUSTMENT(
186     I bi, bj, iMin, iMax, jMin, jMax,
187     I myTime, myIter, myThid )
188 jmc 1.4
189 jmc 1.19 C-- Integrate continuity vertically
190     C-- for vertical velocity and "etaN" (exact volume conservation) :
191     CALL INTEGR_CONTINUITY( bi, bj, uVel, vVel,
192     I myTime, myIter, myThid )
193 adcroft 1.9
194 jmc 1.5 #ifdef ALLOW_TIMEAVE
195 jmc 1.4 IF (taveFreq.GT.0.) THEN
196 jmc 1.5 CALL TIMEAVE_STATVARS(myTime, myIter, bi, bj, myThid)
197 jmc 1.4 ENDIF
198 stephd 1.22 cswdptr -- add ---
199     #ifdef ALLOW_PTRACERS
200 stephd 1.23 #ifndef PTRACERS_SEPARATE_FORCING
201 stephd 1.22 CALL PTRACERS_STATVARS(myTime, myIter, bi, bj, myThid)
202 stephd 1.23 #endif
203 stephd 1.22 #endif
204     cswdptr -- end add ---
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    
211     RETURN
212     END

  ViewVC Help
Powered by ViewVC 1.1.22