1 |
C $Header: /u/gcmpack/MITgcm/model/src/momentum_correction_step.F,v 1.9 2011/05/23 00:41:09 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 == Routine arguments == |
48 |
C myTime :: Current time in simulation |
49 |
C myIter :: Current iteration number in simulation |
50 |
C myThid :: my Thread Id. number |
51 |
_RL myTime |
52 |
INTEGER myIter |
53 |
INTEGER myThid |
54 |
|
55 |
C !LOCAL VARIABLES: |
56 |
C == Local variables |
57 |
_RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
58 |
_RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
59 |
INTEGER iMin,iMax |
60 |
INTEGER jMin,jMax |
61 |
INTEGER bi,bj |
62 |
INTEGER k,i,j |
63 |
CEOP |
64 |
|
65 |
DO bj=myByLo(myThid),myByHi(myThid) |
66 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
67 |
|
68 |
C-- Set up work arrays that need valid initial values |
69 |
DO j=1-OLy,sNy+OLy |
70 |
DO i=1-OLx,sNx+OLx |
71 |
phiSurfX(i,j)=0. |
72 |
phiSurfY(i,j)=0. |
73 |
ENDDO |
74 |
ENDDO |
75 |
|
76 |
C Loop range: Gradients of Eta are evaluated so valid |
77 |
C range is all but first row and column in overlaps. |
78 |
iMin = 1-OLx+1 |
79 |
iMax = sNx+OLx |
80 |
jMin = 1-OLy+1 |
81 |
jMax = sNy+OLy |
82 |
|
83 |
C- Calculate gradient of surface Potentiel |
84 |
CALL CALC_GRAD_PHI_SURF( |
85 |
I bi,bj,iMin,iMax,jMin,jMax, |
86 |
I etaN, |
87 |
O phiSurfX,phiSurfY, |
88 |
I myThid ) |
89 |
|
90 |
IF (momStepping) THEN |
91 |
C-- Loop over all layers, top to bottom |
92 |
DO k=1,Nr |
93 |
C- Update velocity fields: V(n) = V** - dt * grad Eta |
94 |
CALL CORRECTION_STEP( |
95 |
I bi,bj,iMin,iMax,jMin,jMax,k, |
96 |
I phiSurfX,phiSurfY,myTime,myThid ) |
97 |
ENDDO |
98 |
ENDIF |
99 |
|
100 |
#ifdef ALLOW_OBCS |
101 |
IF (useOBCS) THEN |
102 |
CALL OBCS_APPLY_UV( bi, bj, 0, uVel, vVel, myThid ) |
103 |
ENDIF |
104 |
#endif /* ALLOW_OBCS */ |
105 |
|
106 |
C-- End of 1rst bi,bj loop |
107 |
ENDDO |
108 |
ENDDO |
109 |
|
110 |
C--- 2nd Part : Adjustment. |
111 |
|
112 |
C-- Filter (and exchange) |
113 |
#ifdef ALLOW_SHAP_FILT |
114 |
IF (useSHAP_FILT) THEN |
115 |
IF ( .NOT.shap_filt_uvStar ) THEN |
116 |
CALL TIMER_START('SHAP_FILT_UV [MOM_CORR_STEP]',myThid) |
117 |
CALL SHAP_FILT_APPLY_UV( uVel, vVel, myTime, myIter, myThid ) |
118 |
CALL TIMER_STOP ('SHAP_FILT_UV [MOM_CORR_STEP]',myThid) |
119 |
ENDIF |
120 |
ENDIF |
121 |
#endif |
122 |
#ifdef ALLOW_ZONAL_FILT |
123 |
IF (useZONAL_FILT) THEN |
124 |
IF ( .NOT.zonal_filt_uvStar ) THEN |
125 |
CALL TIMER_START('ZONAL_FILT_UV [MOM_CORR_STEP]',myThid) |
126 |
CALL ZONAL_FILT_APPLY_UV( uVel, vVel, myThid ) |
127 |
CALL TIMER_STOP ('ZONAL_FILT_UV [MOM_CORR_STEP]',myThid) |
128 |
ENDIF |
129 |
ENDIF |
130 |
#endif |
131 |
|
132 |
RETURN |
133 |
END |