1 |
jmc |
1.40 |
C $Header: /u/gcmpack/MITgcm/model/src/calc_gs.F,v 1.39 2004/12/03 15:39:11 jmc Exp $ |
2 |
adcroft |
1.31 |
C $Name: $ |
3 |
cnh |
1.1 |
|
4 |
jmc |
1.39 |
#include "PACKAGES_CONFIG.h" |
5 |
cnh |
1.17 |
#include "CPP_OPTIONS.h" |
6 |
cnh |
1.1 |
|
7 |
cnh |
1.32 |
CBOP |
8 |
|
|
C !ROUTINE: CALC_GS |
9 |
|
|
C !INTERFACE: |
10 |
cnh |
1.1 |
SUBROUTINE CALC_GS( |
11 |
|
|
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
12 |
jmc |
1.35 |
I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp, |
13 |
adcroft |
1.21 |
I KappaRS, |
14 |
adcroft |
1.23 |
U fVerS, |
15 |
adcroft |
1.31 |
I myTime,myIter,myThid ) |
16 |
cnh |
1.32 |
C !DESCRIPTION: \bv |
17 |
|
|
C *==========================================================* |
18 |
|
|
C | SUBROUTINE CALC_GS |
19 |
|
|
C | o Calculate the salt tendency terms. |
20 |
|
|
C *==========================================================* |
21 |
|
|
C | A procedure called EXTERNAL_FORCING_S is called from |
22 |
|
|
C | here. These procedures can be used to add per problem |
23 |
|
|
C | E-P flux source terms. |
24 |
|
|
C | Note: Although it is slightly counter-intuitive the |
25 |
|
|
C | EXTERNAL_FORCING routine is not the place to put |
26 |
|
|
C | file I/O. Instead files that are required to |
27 |
|
|
C | calculate the external source terms are generally |
28 |
|
|
C | read during the model main loop. This makes the |
29 |
|
|
C | logisitics of multi-processing simpler and also |
30 |
|
|
C | makes the adjoint generation simpler. It also |
31 |
|
|
C | allows for I/O to overlap computation where that |
32 |
|
|
C | is supported by hardware. |
33 |
|
|
C | Aside from the problem specific term the code here |
34 |
|
|
C | forms the tendency terms due to advection and mixing |
35 |
|
|
C | The baseline implementation here uses a centered |
36 |
|
|
C | difference form for the advection term and a tensorial |
37 |
|
|
C | divergence of a flux form for the diffusive term. The |
38 |
|
|
C | diffusive term is formulated so that isopycnal mixing and |
39 |
|
|
C | GM-style subgrid-scale terms can be incorporated b simply |
40 |
|
|
C | setting the diffusion tensor terms appropriately. |
41 |
|
|
C *==========================================================* |
42 |
|
|
C \ev |
43 |
|
|
|
44 |
|
|
C !USES: |
45 |
cnh |
1.1 |
IMPLICIT NONE |
46 |
|
|
C == GLobal variables == |
47 |
|
|
#include "SIZE.h" |
48 |
|
|
#include "DYNVARS.h" |
49 |
|
|
#include "EEPARAMS.h" |
50 |
|
|
#include "PARAMS.h" |
51 |
jmc |
1.39 |
#include "PACKAGES_CONFIG.h" |
52 |
|
|
#ifdef ALLOW_GENERIC_ADVDIFF |
53 |
adcroft |
1.30 |
#include "GAD.h" |
54 |
jmc |
1.39 |
#endif |
55 |
cnh |
1.1 |
|
56 |
cnh |
1.32 |
C !INPUT/OUTPUT PARAMETERS: |
57 |
cnh |
1.1 |
C == Routine arguments == |
58 |
cnh |
1.32 |
C fVerS :: Flux of salt (S) in the vertical |
59 |
cnh |
1.1 |
C direction at the upper(U) and lower(D) faces of a cell. |
60 |
cnh |
1.32 |
C maskUp :: Land mask used to denote base of the domain. |
61 |
|
|
C xA :: Tracer cell face area normal to X |
62 |
|
|
C yA :: Tracer cell face area normal to X |
63 |
|
|
C uTrans :: Zonal volume transport through cell face |
64 |
|
|
C vTrans :: Meridional volume transport through cell face |
65 |
jmc |
1.35 |
C rTrans :: Vertical volume transport at interface k |
66 |
|
|
C rTransKp1 :: Vertical volume transport at inteface k+1 |
67 |
cnh |
1.32 |
C bi, bj, iMin, iMax, jMin, jMax :: Range of points for which calculation |
68 |
cnh |
1.1 |
C results will be set. |
69 |
cnh |
1.32 |
C myThid :: Instance number for this innvocation of CALC_GT |
70 |
cnh |
1.1 |
_RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
71 |
|
|
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
72 |
|
|
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
73 |
|
|
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
74 |
|
|
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
75 |
cnh |
1.12 |
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
76 |
jmc |
1.35 |
_RL rTransKp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
77 |
cnh |
1.1 |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
78 |
jmc |
1.38 |
_RL KappaRS(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
79 |
adcroft |
1.7 |
INTEGER k,kUp,kDown,kM1 |
80 |
cnh |
1.1 |
INTEGER bi,bj,iMin,iMax,jMin,jMax |
81 |
adcroft |
1.31 |
_RL myTime |
82 |
|
|
INTEGER myIter |
83 |
cnh |
1.1 |
INTEGER myThid |
84 |
|
|
|
85 |
cnh |
1.32 |
CEOP |
86 |
heimbach |
1.20 |
|
87 |
jmc |
1.39 |
#ifdef ALLOW_GENERIC_ADVDIFF |
88 |
jmc |
1.33 |
C === Local variables === |
89 |
|
|
LOGICAL calcAdvection |
90 |
jmc |
1.40 |
INTEGER iterNb |
91 |
jmc |
1.33 |
|
92 |
heimbach |
1.20 |
#ifdef ALLOW_AUTODIFF_TAMC |
93 |
|
|
C-- only the kUp part of fverS is set in this subroutine |
94 |
|
|
C-- the kDown is still required |
95 |
|
|
fVerS(1,1,kDown) = fVerS(1,1,kDown) |
96 |
adcroft |
1.27 |
#endif |
97 |
cnh |
1.1 |
|
98 |
jmc |
1.33 |
calcAdvection = saltAdvection .AND. .NOT.saltMultiDimAdvec |
99 |
adcroft |
1.30 |
CALL GAD_CALC_RHS( |
100 |
|
|
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
101 |
jmc |
1.35 |
I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp, |
102 |
|
|
I uVel, vVel, wVel, |
103 |
adcroft |
1.30 |
I diffKhS, diffK4S, KappaRS, Salt, |
104 |
jmc |
1.36 |
I GAD_SALINITY, saltAdvScheme, saltVertAdvScheme, |
105 |
jmc |
1.35 |
I calcAdvection, saltImplVertAdv, |
106 |
adcroft |
1.30 |
U fVerS, gS, |
107 |
jmc |
1.37 |
I myTime, myIter, myThid ) |
108 |
cnh |
1.1 |
|
109 |
jmc |
1.33 |
C-- External salinity forcing term(s) inside Adams-Bashforth: |
110 |
|
|
IF ( saltForcing .AND. forcing_In_AB ) |
111 |
|
|
& CALL EXTERNAL_FORCING_S( |
112 |
cnh |
1.16 |
I iMin,iMax,jMin,jMax,bi,bj,k, |
113 |
adcroft |
1.31 |
I myTime,myThid) |
114 |
|
|
|
115 |
jmc |
1.33 |
IF ( saltAdamsBashforth ) THEN |
116 |
jmc |
1.40 |
iterNb = myIter |
117 |
|
|
IF (staggerTimeStep) iterNb = myIter - 1 |
118 |
|
|
#ifdef ALLOW_ADAMSBASHFORTH_3 |
119 |
|
|
CALL ADAMS_BASHFORTH3( |
120 |
|
|
I bi, bj, k, |
121 |
|
|
U gS, gsNm, |
122 |
|
|
I iterNb, myThid ) |
123 |
|
|
#else |
124 |
adcroft |
1.31 |
CALL ADAMS_BASHFORTH2( |
125 |
jmc |
1.40 |
I bi, bj, k, |
126 |
|
|
U gS, gsNm1, |
127 |
|
|
I iterNb, myThid ) |
128 |
|
|
#endif |
129 |
adcroft |
1.31 |
ENDIF |
130 |
jmc |
1.33 |
|
131 |
|
|
C-- External salinity forcing term(s) outside Adams-Bashforth: |
132 |
|
|
IF ( saltForcing .AND. .NOT.forcing_In_AB ) |
133 |
|
|
& CALL EXTERNAL_FORCING_S( |
134 |
|
|
I iMin,iMax,jMin,jMax,bi,bj,k, |
135 |
|
|
I myTime,myThid) |
136 |
adcroft |
1.31 |
|
137 |
|
|
#ifdef NONLIN_FRSURF |
138 |
|
|
IF (nonlinFreeSurf.GT.0) THEN |
139 |
|
|
CALL FREESURF_RESCALE_G( |
140 |
jmc |
1.40 |
I bi, bj, k, |
141 |
adcroft |
1.31 |
U gS, |
142 |
jmc |
1.34 |
I myThid ) |
143 |
jmc |
1.40 |
IF ( saltAdamsBashforth ) THEN |
144 |
|
|
#ifdef ALLOW_ADAMSBASHFORTH_3 |
145 |
|
|
CALL FREESURF_RESCALE_G( |
146 |
|
|
I bi, bj, k, |
147 |
|
|
U gsNm(1-OLx,1-OLy,1,1,1,1), |
148 |
|
|
I myThid ) |
149 |
|
|
CALL FREESURF_RESCALE_G( |
150 |
|
|
I bi, bj, k, |
151 |
|
|
U gsNm(1-OLx,1-OLy,1,1,1,2), |
152 |
adcroft |
1.31 |
I myThid ) |
153 |
jmc |
1.40 |
#else |
154 |
|
|
CALL FREESURF_RESCALE_G( |
155 |
|
|
I bi, bj, k, |
156 |
|
|
U gsNm1, |
157 |
|
|
I myThid ) |
158 |
|
|
#endif |
159 |
|
|
ENDIF |
160 |
adcroft |
1.31 |
ENDIF |
161 |
|
|
#endif /* NONLIN_FRSURF */ |
162 |
cnh |
1.1 |
|
163 |
jmc |
1.39 |
#endif /* ALLOW_GENERIC_ADVDIFF */ |
164 |
|
|
|
165 |
cnh |
1.1 |
RETURN |
166 |
|
|
END |