1 |
C $Header: /u/gcmpack/MITgcm/model/src/the_correction_step.F,v 1.28 2004/12/03 00:26:54 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: THE_CORRECTION_STEP |
9 |
C !INTERFACE: |
10 |
SUBROUTINE THE_CORRECTION_STEP(myTime, myIter, myThid) |
11 |
C !DESCRIPTION: \bv |
12 |
C *==========================================================* |
13 |
C | SUBROUTINE THE_CORRECTION_STEP |
14 |
C *==========================================================* |
15 |
C |1rst Part : Update U,V,T,S. |
16 |
C | |
17 |
C | The arrays used for time stepping are cycled. |
18 |
C | Tracers: |
19 |
C | T(n) = Gt(n) |
20 |
C | Momentum: |
21 |
C | V(n) = Gv(n) - dt * grad Eta |
22 |
C | |
23 |
C |part1: update U,V,T,S |
24 |
C | U*,V* (contained in gU,gV) have the surface |
25 |
C | pressure gradient term added and the result stored |
26 |
C | in U,V (contained in uVel, vVel) |
27 |
C | T* (contained in gT) is copied to T (theta) |
28 |
C | S* (contained in gS) is copied to S (salt) |
29 |
C | |
30 |
C |part2: Adjustments & Diagnostics |
31 |
C | o Convective Adjustment |
32 |
C *==========================================================* |
33 |
C \ev |
34 |
|
35 |
C !USES: |
36 |
IMPLICIT NONE |
37 |
C == Global variables === |
38 |
#include "SIZE.h" |
39 |
#include "EEPARAMS.h" |
40 |
#include "PARAMS.h" |
41 |
#include "DYNVARS.h" |
42 |
|
43 |
C !INPUT/OUTPUT PARAMETERS: |
44 |
C == Routine arguments == |
45 |
C myTime - Current time in simulation |
46 |
C myIter - Current iteration number in simulation |
47 |
C myThid - Thread number for this instance of the routine. |
48 |
_RL myTime |
49 |
INTEGER myIter |
50 |
INTEGER myThid |
51 |
|
52 |
C !LOCAL VARIABLES: |
53 |
C == Local variables |
54 |
_RL phiSurfX(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
55 |
_RL phiSurfY(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
56 |
INTEGER iMin,iMax |
57 |
INTEGER jMin,jMax |
58 |
INTEGER bi,bj |
59 |
INTEGER k,i,j |
60 |
|
61 |
CEOP |
62 |
|
63 |
DO bj=myByLo(myThid),myByHi(myThid) |
64 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
65 |
|
66 |
C-- Set up work arrays that need valid initial values |
67 |
DO j=1-OLy,sNy+OLy |
68 |
DO i=1-OLx,sNx+OLx |
69 |
phiSurfX(i,j)=0. |
70 |
phiSurfY(i,j)=0. |
71 |
ENDDO |
72 |
ENDDO |
73 |
|
74 |
C Loop range: Gradients of Eta are evaluated so valid |
75 |
C range is all but first row and column in overlaps. |
76 |
iMin = 1-OLx+1 |
77 |
iMax = sNx+OLx |
78 |
jMin = 1-OLy+1 |
79 |
jMax = sNy+OLy |
80 |
|
81 |
C- Calculate gradient of surface Potentiel |
82 |
CALL CALC_GRAD_PHI_SURF( |
83 |
I bi,bj,iMin,iMax,jMin,jMax, |
84 |
I etaN, |
85 |
O phiSurfX,phiSurfY, |
86 |
I myThid ) |
87 |
|
88 |
C-- Loop over all layers, top to bottom |
89 |
DO K=1,Nr |
90 |
|
91 |
C- Update velocity fields: V(n) = V** - dt * grad Eta |
92 |
IF (momStepping) |
93 |
& CALL CORRECTION_STEP( |
94 |
I bi,bj,iMin,iMax,jMin,jMax,K, |
95 |
I phiSurfX,phiSurfY,myTime,myThid ) |
96 |
|
97 |
C- Update tracer fields: T(n) = T** |
98 |
IF (tempStepping) |
99 |
& CALL CYCLE_TRACER( |
100 |
I bi,bj,K, |
101 |
U theta,gT, |
102 |
I myTime,myIter,myThid ) |
103 |
IF (saltStepping) |
104 |
& CALL CYCLE_TRACER( |
105 |
I bi,bj,K, |
106 |
U salt,gS, |
107 |
I myTime,myIter,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--- 2nd Part : Adjustment. |
119 |
C |
120 |
C Static stability is calculated and the tracers are |
121 |
C convective adjusted where statically unstable. |
122 |
|
123 |
C-- Convectively adjust new fields to be statically stable |
124 |
iMin = 1 |
125 |
iMax = sNx |
126 |
jMin = 1 |
127 |
jMax = sNy |
128 |
CALL CONVECTIVE_ADJUSTMENT( |
129 |
I bi, bj, iMin, iMax, jMin, jMax, |
130 |
I myTime, myIter, myThid ) |
131 |
|
132 |
C-- End of 1rst bi,bj loop |
133 |
ENDDO |
134 |
ENDDO |
135 |
|
136 |
RETURN |
137 |
END |