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

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

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


Revision 1.7 - (show annotations) (download)
Tue Apr 28 18:01:14 2009 UTC (15 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62m, checkpoint62l, checkpoint61n, checkpoint61o, checkpoint61m, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.6: +3 -3 lines
change macros (EXCH & GLOBAL_SUM/MAX) sufix _R4/_R8 to _RS/_RL
 when applied to _RS/_RL variable

1 C $Header: /u/gcmpack/MITgcm/model/src/momentum_correction_step.F,v 1.6 2009/02/13 21:56:48 heimbach Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: MOMENTUM_CORRECTION_STEP
9 C !INTERFACE:
10 SUBROUTINE MOMENTUM_CORRECTION_STEP(myTime, myIter, myThid)
11 C !DESCRIPTION: \bv
12 C *==========================================================*
13 C | SUBROUTINE MOMENTUM_CORRECTION_STEP
14 C *==========================================================*
15 C |1rst Part : Update U,V.
16 C |
17 C | The arrays used for time stepping are cycled.
18 C | Momentum:
19 C | V(n) = Gv(n) - dt * grad Eta
20 C |
21 C |part1: update U,V
22 C | U*,V* (contained in gU,gV) have the surface
23 C | pressure gradient term added and the result stored
24 C | in U,V (contained in uVel, vVel)
25 C |
26 C |part2: Adjustments
27 C | o Filter U,V (Shapiro Filter, Zonal_Filter)
28 C | o Compute again Eta (exact volume conservation)
29 C | o Compute vertical velocity
30 C *==========================================================*
31 C \ev
32
33 C !USES:
34 IMPLICIT NONE
35 C == Global variables ===
36 #include "SIZE.h"
37 #include "EEPARAMS.h"
38 #include "PARAMS.h"
39 #include "DYNVARS.h"
40
41 #ifdef ALLOW_SHAP_FILT
42 #include "SHAP_FILT.h"
43 #endif
44 #ifdef ALLOW_ZONAL_FILT
45 #include "ZONAL_FILT.h"
46 #endif
47 #ifdef ALLOW_AUTODIFF_TAMC
48 #include "tamc.h"
49 #include "tamc_keys.h"
50 # ifdef NONLIN_FRSURF
51 # include "SURFACE.h"
52 # endif
53 #endif
54
55 C !INPUT/OUTPUT PARAMETERS:
56 C == Routine arguments ==
57 C myTime - Current time in simulation
58 C myIter - Current iteration number in simulation
59 C myThid - Thread number for this instance of the routine.
60 _RL myTime
61 INTEGER myIter
62 INTEGER myThid
63
64 C !LOCAL VARIABLES:
65 C == Local variables
66 _RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
67 _RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
68 INTEGER iMin,iMax
69 INTEGER jMin,jMax
70 INTEGER bi,bj
71 INTEGER k,i,j
72
73 CEOP
74
75 DO bj=myByLo(myThid),myByHi(myThid)
76 DO bi=myBxLo(myThid),myBxHi(myThid)
77
78 C-- Set up work arrays that need valid initial values
79 DO j=1-OLy,sNy+OLy
80 DO i=1-OLx,sNx+OLx
81 phiSurfX(i,j)=0.
82 phiSurfY(i,j)=0.
83 ENDDO
84 ENDDO
85
86 C Loop range: Gradients of Eta are evaluated so valid
87 C range is all but first row and column in overlaps.
88 iMin = 1-OLx+1
89 iMax = sNx+OLx
90 jMin = 1-OLy+1
91 jMax = sNy+OLy
92
93 C- Calculate gradient of surface Potentiel
94 CALL CALC_GRAD_PHI_SURF(
95 I bi,bj,iMin,iMax,jMin,jMax,
96 I etaN,
97 O phiSurfX,phiSurfY,
98 I myThid )
99
100 C-- Loop over all layers, top to bottom
101 DO K=1,Nr
102
103 C- Update velocity fields: V(n) = V** - dt * grad Eta
104 IF (momStepping)
105 & CALL CORRECTION_STEP(
106 I bi,bj,iMin,iMax,jMin,jMax,K,
107 I phiSurfX,phiSurfY,myTime,myThid )
108
109 #ifdef ALLOW_OBCS
110 IF (useOBCS) THEN
111 CALL OBCS_APPLY_UV(bi,bj,K,uVel,vVel,myThid)
112 ENDIF
113 #endif /* ALLOW_OBCS */
114
115 C-- End DO K=1,Nr
116 ENDDO
117
118 C-- End of 1rst bi,bj loop
119 ENDDO
120 ENDDO
121
122 C--- 2nd Part : Adjustment.
123
124 C-- Filter (and exchange)
125 #ifdef ALLOW_SHAP_FILT
126 IF (useSHAP_FILT) THEN
127 IF ( .NOT.shap_filt_uvStar ) THEN
128 CALL TIMER_START('SHAP_FILT_UV [MOM_CORR_STEP]',myThid)
129 CALL SHAP_FILT_APPLY_UV( uVel, vVel, myTime, myIter, myThid )
130 CALL TIMER_STOP ('SHAP_FILT_UV [MOM_CORR_STEP]',myThid)
131 ENDIF
132 ENDIF
133 #endif
134 #ifdef ALLOW_ZONAL_FILT
135 IF (useZONAL_FILT) THEN
136 IF ( .NOT.zonal_filt_uvStar ) THEN
137 CALL TIMER_START('ZONAL_FILT_UV [MOM_CORR_STEP]',myThid)
138 CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid )
139 CALL TIMER_STOP ('ZONAL_FILT_UV [MOM_CORR_STEP]',myThid)
140 ENDIF
141 ENDIF
142 #endif
143
144 #ifdef ALLOW_AUTODIFF_TAMC
145 # ifdef NONLIN_FRSURF
146 CADJ STORE uvel, vvel = comlev1, key = ikey_dynamics, byte = isbyte
147 # endif
148 #endif
149 DO bj=myByLo(myThid),myByHi(myThid)
150 DO bi=myBxLo(myThid),myBxHi(myThid)
151
152 #ifdef ALLOW_AUTODIFF_TAMC
153 act1 = bi - myBxLo(myThid)
154 max1 = myBxHi(myThid) - myBxLo(myThid) + 1
155 act2 = bj - myByLo(myThid)
156 max2 = myByHi(myThid) - myByLo(myThid) + 1
157 act3 = myThid - 1
158 max3 = nTx*nTy
159 act4 = ikey_dynamics - 1
160 idynkey = (act1 + 1) + act2*max1
161 & + act3*max1*max2
162 & + act4*max1*max2*max3
163 # ifdef NONLIN_FRSURF
164 # ifndef DISABLE_RSTAR_CODE
165 cph-test
166 CADJ STORE detahdt(:,:,bi,bj) = comlev1_bibj, key = idynkey, byte = isbyte
167 CADJ STORE etan(:,:,bi,bj) = comlev1_bibj, key = idynkey, byte = isbyte
168 CADJ STORE rstardhcdt(:,:,bi,bj) = comlev1_bibj, key = idynkey, byte = isbyte
169 # endif
170 # endif
171 #endif
172
173 C-- Integrate continuity vertically
174 C-- for vertical velocity and "etaN" (exact volume conservation) :
175 CALL INTEGR_CONTINUITY( bi, bj, uVel, vVel,
176 I myTime, myIter, myThid )
177
178 C-- End of 2nd bi,bj loop
179 ENDDO
180 ENDDO
181
182 IF ( exactConserv .AND. implicDiv2Dflow .NE. 0. _d 0)
183 & _EXCH_XY_RL( etaN , myThid )
184 IF ( implicitIntGravWave )
185 & _EXCH_XYZ_RL( wVel , myThid )
186
187 RETURN
188 END

  ViewVC Help
Powered by ViewVC 1.1.22