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

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

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

revision 1.44 by jmc, Wed Mar 1 03:08:50 2006 UTC revision 1.52 by heimbach, Wed Sep 15 03:41:59 2010 UTC
# Line 7  C $Name$ Line 7  C $Name$
7  CBOP  CBOP
8  C     !ROUTINE: CALC_GS  C     !ROUTINE: CALC_GS
9  C     !INTERFACE:  C     !INTERFACE:
10        SUBROUTINE CALC_GS(        SUBROUTINE CALC_GS(
11       I           bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I           bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
12       I           xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,       I           xA, yA, maskUp, uFld, vFld, wFld,
13         I           uTrans, vTrans, rTrans, rTransKp1,
14       I           KappaRS,       I           KappaRS,
15       U           fVerS,       U           fVerS,
16       I           myTime,myIter,myThid )       I           myTime,myIter,myThid )
17  C     !DESCRIPTION: \bv  C     !DESCRIPTION: \bv
18  C     *==========================================================*  C     *==========================================================*
19  C     | SUBROUTINE CALC_GS                                          C     | SUBROUTINE CALC_GS
20  C     | o Calculate the salt tendency terms.                        C     | o Calculate the salt tendency terms.
21  C     *==========================================================*  C     *==========================================================*
22  C     | A procedure called EXTERNAL_FORCING_S is called from        C     | A procedure called EXTERNAL_FORCING_S is called from
23  C     | here. These procedures can be used to add per problem      C     | here. These procedures can be used to add per problem
24  C     | E-P  flux source terms.                                    C     | E-P  flux source terms.
25  C     | Note: Although it is slightly counter-intuitive the        C     | Note: Although it is slightly counter-intuitive the
26  C     |       EXTERNAL_FORCING routine is not the place to put      C     |       EXTERNAL_FORCING routine is not the place to put
27  C     |       file I/O. Instead files that are required to          C     |       file I/O. Instead files that are required to
28  C     |       calculate the external source terms are generally    C     |       calculate the external source terms are generally
29  C     |       read during the model main loop. This makes the      C     |       read during the model main loop. This makes the
30  C     |       logisitics of multi-processing simpler and also      C     |       logisitics of multi-processing simpler and also
31  C     |       makes the adjoint generation simpler. It also        C     |       makes the adjoint generation simpler. It also
32  C     |       allows for I/O to overlap computation where that      C     |       allows for I/O to overlap computation where that
33  C     |       is supported by hardware.                            C     |       is supported by hardware.
34  C     | Aside from the problem specific term the code here          C     | Aside from the problem specific term the code here
35  C     | forms the tendency terms due to advection and mixing        C     | forms the tendency terms due to advection and mixing
36  C     | The baseline implementation here uses a centered            C     | The baseline implementation here uses a centered
37  C     | difference form for the advection term and a tensorial      C     | difference form for the advection term and a tensorial
38  C     | divergence of a flux form for the diffusive term. The      C     | divergence of a flux form for the diffusive term. The
39  C     | diffusive term is formulated so that isopycnal mixing and  C     | diffusive term is formulated so that isopycnal mixing and
40  C     | GM-style subgrid-scale terms can be incorporated b simply  C     | GM-style subgrid-scale terms can be incorporated b simply
41  C     | setting the diffusion tensor terms appropriately.          C     | setting the diffusion tensor terms appropriately.
42  C     *==========================================================*  C     *==========================================================*
43  C     \ev  C     \ev
44    
# Line 48  C     == GLobal variables == Line 49  C     == GLobal variables ==
49  #include "DYNVARS.h"  #include "DYNVARS.h"
50  #include "EEPARAMS.h"  #include "EEPARAMS.h"
51  #include "PARAMS.h"  #include "PARAMS.h"
52    #include "RESTART.h"
53  #ifdef ALLOW_GENERIC_ADVDIFF  #ifdef ALLOW_GENERIC_ADVDIFF
54  #include "GAD.h"  #include "GAD.h"
55  #endif  #endif
# Line 58  C     == GLobal variables == Line 60  C     == GLobal variables ==
60    
61  C     !INPUT/OUTPUT PARAMETERS:  C     !INPUT/OUTPUT PARAMETERS:
62  C     == Routine arguments ==  C     == Routine arguments ==
63  C     fVerS   :: Flux of salt (S) in the vertical  C     bi, bj,   :: tile indices
64  C               direction at the upper(U) and lower(D) faces of a cell.  C     iMin,iMax, jMin,jMax :: Range of points for which calculation
65  C     maskUp  :: Land mask used to denote base of the domain.  C                                       results will be set.
66  C     xA      :: Tracer cell face area normal to X  C     k         :: vertical index
67  C     yA      :: Tracer cell face area normal to X  C     kM1       :: =k-1 for k>1, =1 for k=1
68  C     uTrans  :: Zonal volume transport through cell face  C     kUp       :: index into 2 1/2D array, toggles between 1|2
69  C     vTrans  :: Meridional volume transport through cell face  C     kDown     :: index into 2 1/2D array, toggles between 2|1
70  C     rTrans  ::   Vertical volume transport at interface k  C     xA        :: Tracer cell face area normal to X
71    C     yA        :: Tracer cell face area normal to X
72    C     maskUp    :: Land mask used to denote base of the domain.
73    C     uFld,vFld :: Local copy of horizontal velocity field
74    C     wFld      :: Local copy of vertical velocity field
75    C     uTrans    :: Zonal volume transport through cell face
76    C     vTrans    :: Meridional volume transport through cell face
77    C     rTrans    ::   Vertical volume transport at interface k
78  C     rTransKp1 :: Vertical volume transport at inteface k+1  C     rTransKp1 :: Vertical volume transport at inteface k+1
79  C     bi, bj, iMin, iMax, jMin, jMax :: Range of points for which calculation  C     KappaRS   :: Vertical diffusion for Salinity
80  C                                      results will be set.  C     fVerS     :: Flux of salt (S) in the vertical direction
81  C     myThid :: Instance number for this innvocation of CALC_GT  C                  at the upper(U) and lower(D) faces of a cell.
82        _RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)  C     myTime    :: current time
83        _RS xA    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  C     myIter    :: current iteration number
84        _RS yA    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)  C     myThid    :: my Thread Id. number
85        _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
86        _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        INTEGER bi,bj,iMin,iMax,jMin,jMax
87        _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        INTEGER k,kUp,kDown,kM1
88          _RS xA     (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
89          _RS yA     (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
90          _RS maskUp (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
91          _RL uFld   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
92          _RL vFld   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
93          _RL wFld   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
94          _RL uTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
95          _RL vTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
96          _RL rTrans (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
97        _RL rTransKp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL rTransKp1(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
       _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)  
98        _RL KappaRS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL KappaRS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
99        INTEGER k,kUp,kDown,kM1        _RL fVerS  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
       INTEGER bi,bj,iMin,iMax,jMin,jMax  
100        _RL     myTime        _RL     myTime
101        INTEGER myIter        INTEGER myIter
102        INTEGER myThid        INTEGER myThid
   
103  CEOP  CEOP
104    
105  #ifdef ALLOW_GENERIC_ADVDIFF  #ifdef ALLOW_GENERIC_ADVDIFF
# Line 114  C--   only the kUp part of fverS is set Line 129  C--   only the kUp part of fverS is set
129  C--   the kDown is still required  C--   the kDown is still required
130        fVerS(1,1,kDown) = fVerS(1,1,kDown)        fVerS(1,1,kDown) = fVerS(1,1,kDown)
131  # ifdef NONLIN_FRSURF  # ifdef NONLIN_FRSURF
132  CADJ STORE fVerS(:,:,:) = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ STORE fVerS(:,:,:) =
133    CADJ &     comlev1_bibj_k, key=kkey, byte=isbyte,
134    CADJ &     kind = isbyte
135    #  ifndef ALLOW_ADAMSBASHFORTH_3
136    CADJ STORE gsNm1(:,:,k,bi,bj) =
137    CADJ &     comlev1_bibj_k, key=kkey, byte=isbyte,
138    CADJ &     kind = isbyte
139    #  else
140    CADJ STORE gs(:,:,k,bi,bj) =
141    CADJ &     comlev1_bibj_k, key=kkey, byte=isbyte,
142    CADJ &     kind = isbyte
143    CADJ STORE gsNm(:,:,k,bi,bj,1) =
144    CADJ &     comlev1_bibj_k, key=kkey, byte=isbyte,
145    CADJ &     kind = isbyte
146    CADJ STORE gsNm(:,:,k,bi,bj,2) =
147    CADJ &     comlev1_bibj_k, key=kkey, byte=isbyte,
148    CADJ &     kind = isbyte
149    #  endif
150  # endif  # endif
151  #endif  #endif
152    
# Line 129  C---+----1----+----2----+----3----+----4 Line 161  C---+----1----+----2----+----3----+----4
161          m2 = 1 + MOD( iterNb ,2)          m2 = 1 + MOD( iterNb ,2)
162          CALL GAD_CALC_RHS(          CALL GAD_CALC_RHS(
163       I           bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I           bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
164       I           xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,       I           xA, yA, maskUp, uFld, vFld, wFld,
165       I           uVel, vVel, wVel,       I           uTrans, vTrans, rTrans, rTransKp1,
166       I           diffKhS, diffK4S, KappaRS,       I           diffKhS, diffK4S, KappaRS,
167       I           gsNm(1-Olx,1-Oly,1,1,1,m2), salt,       I           gsNm(1-Olx,1-Oly,1,1,1,m2), salt, dTtracerLev,
168       I           GAD_SALINITY, saltAdvScheme, saltVertAdvScheme,       I           GAD_SALINITY, saltAdvScheme, saltVertAdvScheme,
169       I           calcAdvection, saltImplVertAdv, AdamsBashforth_S,       I           calcAdvection, saltImplVertAdv, AdamsBashforth_S,
170         I           useGMRedi, useKPP,
171       U           fVerS, gS,       U           fVerS, gS,
172       I           myTime, myIter, myThid )       I           myTime, myIter, myThid )
173  #else /* ALLOW_ADAMSBASHFORTH_3 */  #else /* ALLOW_ADAMSBASHFORTH_3 */
174          CALL GAD_CALC_RHS(          CALL GAD_CALC_RHS(
175       I           bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I           bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
176       I           xA,yA,uTrans,vTrans,rTrans,rTransKp1,maskUp,       I           xA, yA, maskUp, uFld, vFld, wFld,
177       I           uVel, vVel, wVel,       I           uTrans, vTrans, rTrans, rTransKp1,
178       I           diffKhS, diffK4S, KappaRS, gsNm1, salt,       I           diffKhS, diffK4S, KappaRS, gsNm1, salt, dTtracerLev,
179       I           GAD_SALINITY, saltAdvScheme, saltVertAdvScheme,       I           GAD_SALINITY, saltAdvScheme, saltVertAdvScheme,
180       I           calcAdvection, saltImplVertAdv, AdamsBashforth_S,       I           calcAdvection, saltImplVertAdv, AdamsBashforth_S,
181         I           useGMRedi, useKPP,
182       U           fVerS, gS,       U           fVerS, gS,
183       I           myTime, myIter, myThid )       I           myTime, myIter, myThid )
184  #endif /* ALLOW_ADAMSBASHFORTH_3 */  #endif /* ALLOW_ADAMSBASHFORTH_3 */
185    
186  C--   External salinity forcing term(s) inside Adams-Bashforth:  C--   External salinity forcing term(s) inside Adams-Bashforth:
187        IF ( saltForcing .AND. forcing_In_AB )        IF ( saltForcing .AND. tracForcingOutAB.NE.1 )
188       & CALL EXTERNAL_FORCING_S(       & CALL EXTERNAL_FORCING_S(
189       I     iMin,iMax,jMin,jMax,bi,bj,k,       I     iMin,iMax,jMin,jMax,bi,bj,k,
190       I     myTime,myThid)       I     myTime,myThid)
# Line 165  C--   External salinity forcing term(s) Line 199  C--   External salinity forcing term(s)
199          CALL ADAMS_BASHFORTH2(          CALL ADAMS_BASHFORTH2(
200       I                        bi, bj, k,       I                        bi, bj, k,
201       U                        gS, gsNm1,       U                        gS, gsNm1,
202       I                        iterNb, myThid )       I                        saltStartAB, iterNb, myThid )
203  #endif  #endif
204        ENDIF        ENDIF
205    
206  C--   External salinity forcing term(s) outside Adams-Bashforth:  C--   External salinity forcing term(s) outside Adams-Bashforth:
207        IF ( saltForcing .AND. .NOT.forcing_In_AB )        IF ( saltForcing .AND. tracForcingOutAB.EQ.1 )
208       & CALL EXTERNAL_FORCING_S(       & CALL EXTERNAL_FORCING_S(
209       I     iMin,iMax,jMin,jMax,bi,bj,k,       I     iMin,iMax,jMin,jMax,bi,bj,k,
210       I     myTime,myThid)       I     myTime,myThid)
# Line 183  C--   External salinity forcing term(s) Line 217  C--   External salinity forcing term(s)
217       I                          myThid )       I                          myThid )
218          IF ( AdamsBashforthGs ) THEN          IF ( AdamsBashforthGs ) THEN
219  #ifdef ALLOW_ADAMSBASHFORTH_3  #ifdef ALLOW_ADAMSBASHFORTH_3
220    # ifdef ALLOW_AUTODIFF_TAMC
221    CADJ STORE gsNm(:,:,k,bi,bj,1) =
222    CADJ &     comlev1_bibj_k, key=kkey, byte=isbyte,
223    CADJ &     kind = isbyte
224    CADJ STORE gsNm(:,:,k,bi,bj,2) =
225    CADJ &     comlev1_bibj_k, key=kkey, byte=isbyte,
226    CADJ &     kind = isbyte
227    # endif
228          CALL FREESURF_RESCALE_G(          CALL FREESURF_RESCALE_G(
229       I                          bi, bj, k,       I                          bi, bj, k,
230       U                          gsNm(1-OLx,1-OLy,1,1,1,1),       U                          gsNm(1-OLx,1-OLy,1,1,1,1),

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.52

  ViewVC Help
Powered by ViewVC 1.1.22