1 |
C $Header: $ |
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 |
|
48 |
C !INPUT/OUTPUT PARAMETERS: |
49 |
C == Routine arguments == |
50 |
C myTime - Current time in simulation |
51 |
C myIter - Current iteration number in simulation |
52 |
C myThid - Thread number for this instance of the routine. |
53 |
_RL myTime |
54 |
INTEGER myIter |
55 |
INTEGER myThid |
56 |
|
57 |
C !LOCAL VARIABLES: |
58 |
C == Local variables |
59 |
_RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
60 |
_RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
61 |
INTEGER iMin,iMax |
62 |
INTEGER jMin,jMax |
63 |
INTEGER bi,bj |
64 |
INTEGER k,i,j |
65 |
|
66 |
CEOP |
67 |
|
68 |
DO bj=myByLo(myThid),myByHi(myThid) |
69 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
70 |
|
71 |
C-- Set up work arrays that need valid initial values |
72 |
DO j=1-OLy,sNy+OLy |
73 |
DO i=1-OLx,sNx+OLx |
74 |
phiSurfX(i,j)=0. |
75 |
phiSurfY(i,j)=0. |
76 |
ENDDO |
77 |
ENDDO |
78 |
|
79 |
C Loop range: Gradients of Eta are evaluated so valid |
80 |
C range is all but first row and column in overlaps. |
81 |
iMin = 1-OLx+1 |
82 |
iMax = sNx+OLx |
83 |
jMin = 1-OLy+1 |
84 |
jMax = sNy+OLy |
85 |
|
86 |
C- Calculate gradient of surface Potentiel |
87 |
CALL CALC_GRAD_PHI_SURF( |
88 |
I bi,bj,iMin,iMax,jMin,jMax, |
89 |
I etaN, |
90 |
O phiSurfX,phiSurfY, |
91 |
I myThid ) |
92 |
|
93 |
C-- Loop over all layers, top to bottom |
94 |
DO K=1,Nr |
95 |
|
96 |
C- Update velocity fields: V(n) = V** - dt * grad Eta |
97 |
IF (momStepping) |
98 |
& CALL CORRECTION_STEP( |
99 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
100 |
I phiSurfX,phiSurfY,myTime,myThid ) |
101 |
|
102 |
#ifdef ALLOW_OBCS |
103 |
IF (useOBCS) THEN |
104 |
CALL OBCS_APPLY_UV(bi,bj,K,uVel,vVel,myThid) |
105 |
ENDIF |
106 |
#endif /* ALLOW_OBCS */ |
107 |
|
108 |
C-- End DO K=1,Nr |
109 |
ENDDO |
110 |
|
111 |
C-- End of 1rst bi,bj loop |
112 |
ENDDO |
113 |
ENDDO |
114 |
|
115 |
C--- 2nd Part : Adjustment. |
116 |
|
117 |
C-- Filter (and exchange) |
118 |
#ifdef ALLOW_SHAP_FILT |
119 |
IF (useSHAP_FILT) THEN |
120 |
IF ( .NOT.shap_filt_uvStar ) |
121 |
& CALL SHAP_FILT_APPLY_UV( uVel, vVel, myTime, myIter, myThid ) |
122 |
ENDIF |
123 |
#endif |
124 |
#ifdef ALLOW_ZONAL_FILT |
125 |
IF (useZONAL_FILT) THEN |
126 |
IF ( .NOT.zonal_filt_uvStar ) |
127 |
& CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
128 |
ENDIF |
129 |
#endif |
130 |
|
131 |
DO bj=myByLo(myThid),myByHi(myThid) |
132 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
133 |
|
134 |
C-- Integrate continuity vertically |
135 |
C-- for vertical velocity and "etaN" (exact volume conservation) : |
136 |
CALL INTEGR_CONTINUITY( bi, bj, uVel, vVel, |
137 |
I myTime, myIter, myThid ) |
138 |
|
139 |
C-- End of 2nd bi,bj loop |
140 |
ENDDO |
141 |
ENDDO |
142 |
|
143 |
IF ( exactConserv .AND. implicDiv2Dflow .NE. 0. _d 0) |
144 |
& _EXCH_XY_R8( etaN , myThid ) |
145 |
|
146 |
RETURN |
147 |
END |