/[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.47 - (hide annotations) (download)
Sun Jun 18 23:22:43 2006 UTC (17 years, 11 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint59, checkpoint58y_post, checkpoint58t_post, checkpoint58m_post, checkpoint58w_post, checkpoint58o_post, checkpoint58p_post, checkpoint58q_post, mitgcm_mapl_00, checkpoint58r_post, checkpoint58n_post, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint58k_post, checkpoint58v_post, checkpoint58l_post, checkpoint58x_post, checkpoint58u_post, checkpoint58s_post
Changes since 1.46: +64 -50 lines
make a local copy of velocity to pass (like u,v,r_Trans) to tracer advection S/R

1 jmc 1.47 C $Header: /u/gcmpack/MITgcm/model/src/calc_gs.F,v 1.46 2006/03/07 15:28:02 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 jmc 1.47 SUBROUTINE CALC_GS(
11 cnh 1.1 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
12 jmc 1.47 I xA, yA, maskUp, uFld, vFld, wFld,
13     I uTrans, vTrans, rTrans, rTransKp1,
14 adcroft 1.21 I KappaRS,
15 adcroft 1.23 U fVerS,
16 adcroft 1.31 I myTime,myIter,myThid )
17 cnh 1.32 C !DESCRIPTION: \bv
18     C *==========================================================*
19 jmc 1.47 C | SUBROUTINE CALC_GS
20     C | o Calculate the salt tendency terms.
21 cnh 1.32 C *==========================================================*
22 jmc 1.47 C | A procedure called EXTERNAL_FORCING_S is called from
23     C | here. These procedures can be used to add per problem
24     C | E-P flux source terms.
25     C | Note: Although it is slightly counter-intuitive the
26     C | EXTERNAL_FORCING routine is not the place to put
27     C | file I/O. Instead files that are required to
28     C | calculate the external source terms are generally
29     C | read during the model main loop. This makes the
30     C | logisitics of multi-processing simpler and also
31     C | makes the adjoint generation simpler. It also
32     C | allows for I/O to overlap computation where that
33     C | is supported by hardware.
34     C | Aside from the problem specific term the code here
35     C | forms the tendency terms due to advection and mixing
36     C | The baseline implementation here uses a centered
37     C | difference form for the advection term and a tensorial
38     C | divergence of a flux form for the diffusive term. The
39     C | diffusive term is formulated so that isopycnal mixing and
40     C | GM-style subgrid-scale terms can be incorporated b simply
41     C | setting the diffusion tensor terms appropriately.
42 cnh 1.32 C *==========================================================*
43     C \ev
44    
45     C !USES:
46 cnh 1.1 IMPLICIT NONE
47     C == GLobal variables ==
48     #include "SIZE.h"
49     #include "DYNVARS.h"
50     #include "EEPARAMS.h"
51     #include "PARAMS.h"
52 jmc 1.39 #ifdef ALLOW_GENERIC_ADVDIFF
53 adcroft 1.30 #include "GAD.h"
54 jmc 1.39 #endif
55 heimbach 1.42 #ifdef ALLOW_AUTODIFF_TAMC
56     # include "tamc.h"
57     # include "tamc_keys.h"
58     #endif
59 cnh 1.1
60 cnh 1.32 C !INPUT/OUTPUT PARAMETERS:
61 cnh 1.1 C == Routine arguments ==
62 jmc 1.47 C bi, bj, :: tile indices
63     C iMin,iMax, jMin,jMax :: Range of points for which calculation
64     C results will be set.
65     C k :: vertical index
66     C kM1 :: =k-1 for k>1, =1 for k=1
67     C kUp :: index into 2 1/2D array, toggles between 1|2
68     C kDown :: index into 2 1/2D array, toggles between 2|1
69     C xA :: Tracer cell face area normal to X
70     C yA :: Tracer cell face area normal to X
71     C maskUp :: Land mask used to denote base of the domain.
72     C uFld,vFld :: Local copy of horizontal velocity field
73     C wFld :: Local copy of vertical velocity field
74     C uTrans :: Zonal volume transport through cell face
75     C vTrans :: Meridional volume transport through cell face
76     C rTrans :: Vertical volume transport at interface k
77 jmc 1.35 C rTransKp1 :: Vertical volume transport at inteface k+1
78 jmc 1.47 C KappaRS :: Vertical diffusion for Salinity
79     C fVerS :: Flux of salt (S) in the vertical direction
80     C at the upper(U) and lower(D) faces of a cell.
81     C myTime :: current time
82     C myIter :: current iteration number
83     C myThid :: my Thread Id. number
84    
85     INTEGER bi,bj,iMin,iMax,jMin,jMax
86     INTEGER k,kUp,kDown,kM1
87     _RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
88     _RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
89     _RS maskUp (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
90     _RL uFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
91     _RL vFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
92     _RL wFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
93     _RL uTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
94     _RL vTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
95     _RL rTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
96 jmc 1.35 _RL rTransKp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
97 jmc 1.38 _RL KappaRS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
98 jmc 1.47 _RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
99 adcroft 1.31 _RL myTime
100     INTEGER myIter
101 cnh 1.1 INTEGER myThid
102 cnh 1.32 CEOP
103 heimbach 1.20
104 jmc 1.39 #ifdef ALLOW_GENERIC_ADVDIFF
105 jmc 1.33 C === Local variables ===
106     LOGICAL calcAdvection
107 jmc 1.40 INTEGER iterNb
108 jmc 1.41 #ifdef ALLOW_ADAMSBASHFORTH_3
109     INTEGER m1, m2
110     #endif
111 jmc 1.33
112 heimbach 1.20 #ifdef ALLOW_AUTODIFF_TAMC
113 heimbach 1.42 act1 = bi - myBxLo(myThid)
114     max1 = myBxHi(myThid) - myBxLo(myThid) + 1
115     act2 = bj - myByLo(myThid)
116     max2 = myByHi(myThid) - myByLo(myThid) + 1
117     act3 = myThid - 1
118     max3 = nTx*nTy
119     act4 = ikey_dynamics - 1
120     itdkey = (act1 + 1) + act2*max1
121     & + act3*max1*max2
122     & + act4*max1*max2*max3
123     kkey = (itdkey-1)*Nr + k
124     #endif /* ALLOW_AUTODIFF_TAMC */
125    
126     #ifdef ALLOW_AUTODIFF_TAMC
127 heimbach 1.20 C-- only the kUp part of fverS is set in this subroutine
128     C-- the kDown is still required
129     fVerS(1,1,kDown) = fVerS(1,1,kDown)
130 heimbach 1.42 # ifdef NONLIN_FRSURF
131 heimbach 1.45 CADJ STORE fVerS(:,:,:) =
132     CADJ & comlev1_bibj_k, key=kkey, byte=isbyte
133     CADJ STORE gsNm1(:,:,k,bi,bj) =
134     CADJ & comlev1_bibj_k, key=kkey, byte=isbyte
135 heimbach 1.42 # endif
136 adcroft 1.27 #endif
137 cnh 1.1
138 jmc 1.41 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
139    
140 jmc 1.33 calcAdvection = saltAdvection .AND. .NOT.saltMultiDimAdvec
141 jmc 1.41 iterNb = myIter
142     IF (staggerTimeStep) iterNb = myIter - 1
143    
144     #ifdef ALLOW_ADAMSBASHFORTH_3
145     m1 = 1 + MOD(iterNb+1,2)
146     m2 = 1 + MOD( iterNb ,2)
147     CALL GAD_CALC_RHS(
148 adcroft 1.30 I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
149 jmc 1.47 I xA, yA, maskUp, uFld, vFld, wFld,
150     I uTrans, vTrans, rTrans, rTransKp1,
151 jmc 1.41 I diffKhS, diffK4S, KappaRS,
152     I gsNm(1-Olx,1-Oly,1,1,1,m2), salt,
153 jmc 1.36 I GAD_SALINITY, saltAdvScheme, saltVertAdvScheme,
154 jmc 1.44 I calcAdvection, saltImplVertAdv, AdamsBashforth_S,
155 adcroft 1.30 U fVerS, gS,
156 jmc 1.37 I myTime, myIter, myThid )
157 jmc 1.43 #else /* ALLOW_ADAMSBASHFORTH_3 */
158     CALL GAD_CALC_RHS(
159     I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
160 jmc 1.47 I xA, yA, maskUp, uFld, vFld, wFld,
161     I uTrans, vTrans, rTrans, rTransKp1,
162 jmc 1.43 I diffKhS, diffK4S, KappaRS, gsNm1, salt,
163     I GAD_SALINITY, saltAdvScheme, saltVertAdvScheme,
164 jmc 1.44 I calcAdvection, saltImplVertAdv, AdamsBashforth_S,
165 jmc 1.43 U fVerS, gS,
166     I myTime, myIter, myThid )
167     #endif /* ALLOW_ADAMSBASHFORTH_3 */
168 cnh 1.1
169 jmc 1.33 C-- External salinity forcing term(s) inside Adams-Bashforth:
170 jmc 1.46 IF ( saltForcing .AND. tracForcingOutAB.NE.1 )
171 jmc 1.33 & CALL EXTERNAL_FORCING_S(
172 cnh 1.16 I iMin,iMax,jMin,jMax,bi,bj,k,
173 adcroft 1.31 I myTime,myThid)
174    
175 jmc 1.41 IF ( AdamsBashforthGs ) THEN
176 jmc 1.40 #ifdef ALLOW_ADAMSBASHFORTH_3
177     CALL ADAMS_BASHFORTH3(
178     I bi, bj, k,
179     U gS, gsNm,
180 jmc 1.41 I saltStartAB, iterNb, myThid )
181 jmc 1.40 #else
182 adcroft 1.31 CALL ADAMS_BASHFORTH2(
183 jmc 1.40 I bi, bj, k,
184     U gS, gsNm1,
185     I iterNb, myThid )
186     #endif
187 adcroft 1.31 ENDIF
188 jmc 1.33
189     C-- External salinity forcing term(s) outside Adams-Bashforth:
190 jmc 1.46 IF ( saltForcing .AND. tracForcingOutAB.EQ.1 )
191 jmc 1.33 & CALL EXTERNAL_FORCING_S(
192     I iMin,iMax,jMin,jMax,bi,bj,k,
193     I myTime,myThid)
194 adcroft 1.31
195     #ifdef NONLIN_FRSURF
196     IF (nonlinFreeSurf.GT.0) THEN
197     CALL FREESURF_RESCALE_G(
198 jmc 1.40 I bi, bj, k,
199 adcroft 1.31 U gS,
200 jmc 1.34 I myThid )
201 jmc 1.41 IF ( AdamsBashforthGs ) THEN
202 jmc 1.40 #ifdef ALLOW_ADAMSBASHFORTH_3
203     CALL FREESURF_RESCALE_G(
204     I bi, bj, k,
205     U gsNm(1-OLx,1-OLy,1,1,1,1),
206     I myThid )
207     CALL FREESURF_RESCALE_G(
208     I bi, bj, k,
209     U gsNm(1-OLx,1-OLy,1,1,1,2),
210 adcroft 1.31 I myThid )
211 jmc 1.40 #else
212     CALL FREESURF_RESCALE_G(
213     I bi, bj, k,
214     U gsNm1,
215     I myThid )
216     #endif
217     ENDIF
218 adcroft 1.31 ENDIF
219     #endif /* NONLIN_FRSURF */
220 cnh 1.1
221 jmc 1.39 #endif /* ALLOW_GENERIC_ADVDIFF */
222    
223 cnh 1.1 RETURN
224     END

  ViewVC Help
Powered by ViewVC 1.1.22