/[MITgcm]/MITgcm/model/src/calc_gs.F
ViewVC logotype

Annotation of /MITgcm/model/src/calc_gs.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.41 - (hide annotations) (download)
Sun Nov 6 22:19:08 2005 UTC (18 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57x_post, checkpoint57y_pre
Changes since 1.40: +33 -9 lines
Allow to apply AB on T,S rather than on AB(gT,gS):
 - implemented within #ifdef ALLOW_ADAMSBASHFORTH_3
 - use the same arrays (gtNm,gsNm) to hold tracer field at previous
   time-steps (if AB(T,S)) and tendencies (if AB(gT,gS)).

1 jmc 1.41 C $Header: /u/gcmpack/MITgcm/model/src/calc_gs.F,v 1.40 2005/04/15 14:18:50 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 #ifdef ALLOW_GENERIC_ADVDIFF
52 adcroft 1.30 #include "GAD.h"
53 jmc 1.39 #endif
54 cnh 1.1
55 cnh 1.32 C !INPUT/OUTPUT PARAMETERS:
56 cnh 1.1 C == Routine arguments ==
57 cnh 1.32 C fVerS :: Flux of salt (S) in the vertical
58 cnh 1.1 C direction at the upper(U) and lower(D) faces of a cell.
59 cnh 1.32 C maskUp :: Land mask used to denote base of the domain.
60     C xA :: Tracer cell face area normal to X
61     C yA :: Tracer cell face area normal to X
62     C uTrans :: Zonal volume transport through cell face
63     C vTrans :: Meridional volume transport through cell face
64 jmc 1.35 C rTrans :: Vertical volume transport at interface k
65     C rTransKp1 :: Vertical volume transport at inteface k+1
66 cnh 1.32 C bi, bj, iMin, iMax, jMin, jMax :: Range of points for which calculation
67 cnh 1.1 C results will be set.
68 cnh 1.32 C myThid :: Instance number for this innvocation of CALC_GT
69 cnh 1.1 _RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
70     _RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
71     _RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
72     _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
73     _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
74 cnh 1.12 _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
75 jmc 1.35 _RL rTransKp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
76 cnh 1.1 _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
77 jmc 1.38 _RL KappaRS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
78 adcroft 1.7 INTEGER k,kUp,kDown,kM1
79 cnh 1.1 INTEGER bi,bj,iMin,iMax,jMin,jMax
80 adcroft 1.31 _RL myTime
81     INTEGER myIter
82 cnh 1.1 INTEGER myThid
83    
84 cnh 1.32 CEOP
85 heimbach 1.20
86 jmc 1.39 #ifdef ALLOW_GENERIC_ADVDIFF
87 jmc 1.33 C === Local variables ===
88     LOGICAL calcAdvection
89 jmc 1.40 INTEGER iterNb
90 jmc 1.41 #ifdef ALLOW_ADAMSBASHFORTH_3
91     INTEGER m1, m2
92     #endif
93 jmc 1.33
94 heimbach 1.20 #ifdef ALLOW_AUTODIFF_TAMC
95     C-- only the kUp part of fverS is set in this subroutine
96     C-- the kDown is still required
97     fVerS(1,1,kDown) = fVerS(1,1,kDown)
98 adcroft 1.27 #endif
99 cnh 1.1
100 jmc 1.41 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
101    
102 jmc 1.33 calcAdvection = saltAdvection .AND. .NOT.saltMultiDimAdvec
103 jmc 1.41 iterNb = myIter
104     IF (staggerTimeStep) iterNb = myIter - 1
105    
106     #ifdef ALLOW_ADAMSBASHFORTH_3
107     IF ( AdamsBashforth_S ) THEN
108     m1 = 1 + MOD(iterNb+1,2)
109     m2 = 1 + MOD( iterNb ,2)
110     CALL GAD_CALC_RHS(
111 adcroft 1.30 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
112 jmc 1.35 I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,
113     I uVel, vVel, wVel,
114 jmc 1.41 I diffKhS, diffK4S, KappaRS,
115     I gsNm(1-Olx,1-Oly,1,1,1,m2), salt,
116 jmc 1.36 I GAD_SALINITY, saltAdvScheme, saltVertAdvScheme,
117 jmc 1.35 I calcAdvection, saltImplVertAdv,
118 adcroft 1.30 U fVerS, gS,
119 jmc 1.37 I myTime, myIter, myThid )
120 jmc 1.41 ELSE
121     #endif /* ALLOW_ADAMSBASHFORTH_3 */
122     CALL GAD_CALC_RHS(
123     I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
124     I xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,
125     I uVel, vVel, wVel,
126     I diffKhS, diffK4S, KappaRS, salt, salt,
127     I GAD_SALINITY, saltAdvScheme, saltVertAdvScheme,
128     I calcAdvection, saltImplVertAdv,
129     U fVerS, gS,
130     I myTime, myIter, myThid )
131     #ifdef ALLOW_ADAMSBASHFORTH_3
132     ENDIF
133     #endif
134 cnh 1.1
135 jmc 1.33 C-- External salinity forcing term(s) inside Adams-Bashforth:
136     IF ( saltForcing .AND. forcing_In_AB )
137     & CALL EXTERNAL_FORCING_S(
138 cnh 1.16 I iMin,iMax,jMin,jMax,bi,bj,k,
139 adcroft 1.31 I myTime,myThid)
140    
141 jmc 1.41 IF ( AdamsBashforthGs ) THEN
142 jmc 1.40 #ifdef ALLOW_ADAMSBASHFORTH_3
143     CALL ADAMS_BASHFORTH3(
144     I bi, bj, k,
145     U gS, gsNm,
146 jmc 1.41 I saltStartAB, iterNb, myThid )
147 jmc 1.40 #else
148 adcroft 1.31 CALL ADAMS_BASHFORTH2(
149 jmc 1.40 I bi, bj, k,
150     U gS, gsNm1,
151     I iterNb, myThid )
152     #endif
153 adcroft 1.31 ENDIF
154 jmc 1.33
155     C-- External salinity forcing term(s) outside Adams-Bashforth:
156     IF ( saltForcing .AND. .NOT.forcing_In_AB )
157     & CALL EXTERNAL_FORCING_S(
158     I iMin,iMax,jMin,jMax,bi,bj,k,
159     I myTime,myThid)
160 adcroft 1.31
161     #ifdef NONLIN_FRSURF
162     IF (nonlinFreeSurf.GT.0) THEN
163     CALL FREESURF_RESCALE_G(
164 jmc 1.40 I bi, bj, k,
165 adcroft 1.31 U gS,
166 jmc 1.34 I myThid )
167 jmc 1.41 IF ( AdamsBashforthGs ) THEN
168 jmc 1.40 #ifdef ALLOW_ADAMSBASHFORTH_3
169     CALL FREESURF_RESCALE_G(
170     I bi, bj, k,
171     U gsNm(1-OLx,1-OLy,1,1,1,1),
172     I myThid )
173     CALL FREESURF_RESCALE_G(
174     I bi, bj, k,
175     U gsNm(1-OLx,1-OLy,1,1,1,2),
176 adcroft 1.31 I myThid )
177 jmc 1.40 #else
178     CALL FREESURF_RESCALE_G(
179     I bi, bj, k,
180     U gsNm1,
181     I myThid )
182     #endif
183     ENDIF
184 adcroft 1.31 ENDIF
185     #endif /* NONLIN_FRSURF */
186 cnh 1.1
187 jmc 1.39 #endif /* ALLOW_GENERIC_ADVDIFF */
188    
189 cnh 1.1 RETURN
190     END

  ViewVC Help
Powered by ViewVC 1.1.22