1 |
C $Header: /u/gcmpack/MITgcm/model/src/momentum_correction_step.F,v 1.11 2016/01/11 22:49:55 jmc 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 *==========================================================* |
29 |
C \ev |
30 |
|
31 |
C !USES: |
32 |
IMPLICIT NONE |
33 |
C == Global variables === |
34 |
#include "SIZE.h" |
35 |
#include "EEPARAMS.h" |
36 |
#include "PARAMS.h" |
37 |
#include "DYNVARS.h" |
38 |
|
39 |
#ifdef ALLOW_SHAP_FILT |
40 |
#include "SHAP_FILT.h" |
41 |
#endif |
42 |
#ifdef ALLOW_ZONAL_FILT |
43 |
#include "ZONAL_FILT.h" |
44 |
#endif |
45 |
|
46 |
C !INPUT/OUTPUT PARAMETERS: |
47 |
C myTime :: Current time in simulation |
48 |
C myIter :: Current iteration number in simulation |
49 |
C myThid :: my Thread Id. number |
50 |
_RL myTime |
51 |
INTEGER myIter |
52 |
INTEGER myThid |
53 |
|
54 |
C !LOCAL VARIABLES: |
55 |
_RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
56 |
_RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
57 |
INTEGER iMin, iMax |
58 |
INTEGER jMin, jMax |
59 |
INTEGER bi, bj |
60 |
INTEGER i, j |
61 |
CEOP |
62 |
|
63 |
DO bj=myByLo(myThid),myByHi(myThid) |
64 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
65 |
|
66 |
IF ( momStepping ) THEN |
67 |
C-- Set up work arrays that need valid initial values |
68 |
DO j=1-OLy,sNy+OLy |
69 |
DO i=1-OLx,sNx+OLx |
70 |
phiSurfX(i,j) = 0. |
71 |
phiSurfY(i,j) = 0. |
72 |
ENDDO |
73 |
ENDDO |
74 |
|
75 |
C Loop range: Gradients of Eta are evaluated so valid |
76 |
C range is all but first row and column in overlaps. |
77 |
iMin = 1-OLx+1 |
78 |
iMax = sNx+OLx |
79 |
jMin = 1-OLy+1 |
80 |
jMax = sNy+OLy |
81 |
|
82 |
C- Calculate gradient of surface Potentiel |
83 |
CALL CALC_GRAD_PHI_SURF( |
84 |
I bi, bj, iMin, iMax, jMin, jMax, |
85 |
I etaN, |
86 |
O phiSurfX, phiSurfY, |
87 |
I myThid ) |
88 |
|
89 |
C- Update velocity fields: V(n) = V** - dt * grad Eta |
90 |
CALL CORRECTION_STEP( |
91 |
I bi, bj, iMin, iMax, jMin, jMax, |
92 |
I phiSurfX, phiSurfY, |
93 |
I myTime, myIter, myThid ) |
94 |
ENDIF |
95 |
|
96 |
#ifdef ALLOW_OBCS |
97 |
IF ( useOBCS ) THEN |
98 |
CALL OBCS_APPLY_UV( bi, bj, 0, uVel, vVel, myThid ) |
99 |
ENDIF |
100 |
#endif /* ALLOW_OBCS */ |
101 |
|
102 |
C-- End of 1rst bi,bj loop |
103 |
ENDDO |
104 |
ENDDO |
105 |
|
106 |
C--- 2nd Part : Adjustment. |
107 |
|
108 |
C-- Filter (and exchange) |
109 |
#ifdef ALLOW_SHAP_FILT |
110 |
IF ( useSHAP_FILT ) THEN |
111 |
IF ( .NOT.shap_filt_uvStar ) THEN |
112 |
CALL TIMER_START('SHAP_FILT_UV [MOM_CORR_STEP]',myThid) |
113 |
CALL SHAP_FILT_APPLY_UV( uVel, vVel, myTime, myIter, myThid ) |
114 |
CALL TIMER_STOP ('SHAP_FILT_UV [MOM_CORR_STEP]',myThid) |
115 |
ENDIF |
116 |
ENDIF |
117 |
#endif |
118 |
#ifdef ALLOW_ZONAL_FILT |
119 |
IF ( useZONAL_FILT ) THEN |
120 |
IF ( .NOT.zonal_filt_uvStar ) THEN |
121 |
CALL TIMER_START('ZONAL_FILT_UV [MOM_CORR_STEP]',myThid) |
122 |
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
123 |
CALL TIMER_STOP ('ZONAL_FILT_UV [MOM_CORR_STEP]',myThid) |
124 |
ENDIF |
125 |
ENDIF |
126 |
#endif |
127 |
|
128 |
C-- Try to fix restart (Pb at machine trucation level accumulating in wVel): |
129 |
C Apply EXCH to horiz velocity before integrating continuity (-> wVel) |
130 |
IF ( applyExchUV_early ) |
131 |
& CALL EXCH_UV_3D_RL( uVel, vVel, .TRUE., Nr, myThid ) |
132 |
|
133 |
RETURN |
134 |
END |