/[MITgcm]/MITgcm/pkg/ptracers/ptracers_integrate.F
ViewVC logotype

Diff of /MITgcm/pkg/ptracers/ptracers_integrate.F

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

revision 1.34 by jmc, Fri Oct 19 14:43:50 2007 UTC revision 1.41 by heimbach, Tue Jan 18 19:37:41 2011 UTC
# Line 25  C !USES: =============================== Line 25  C !USES: ===============================
25  #include "EEPARAMS.h"  #include "EEPARAMS.h"
26  #include "PARAMS.h"  #include "PARAMS.h"
27  #include "DYNVARS.h"  #include "DYNVARS.h"
28    #ifdef ALLOW_LONGSTEP
29    #include "LONGSTEP_PARAMS.h"
30    #endif
31  #include "PTRACERS_SIZE.h"  #include "PTRACERS_SIZE.h"
32  #include "PTRACERS.h"  #include "PTRACERS_PARAMS.h"
33    #include "PTRACERS_RESTART.h"
34    #include "PTRACERS_FIELDS.h"
35  #include "GAD.h"  #include "GAD.h"
36  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
37  # include "tamc.h"  # include "tamc.h"
# Line 44  C  uTrans               :: zonal transpo Line 49  C  uTrans               :: zonal transpo
49  C  vTrans               :: meridional transport in level k  C  vTrans               :: meridional transport in level k
50  C  rTrans               :: vertical volume transport at interface k  C  rTrans               :: vertical volume transport at interface k
51  C  rTransKp1            :: vertical volume transport at interface k+1  C  rTransKp1            :: vertical volume transport at interface k+1
52  C  KappaRtr             :: vertical diffusion of passive tracers, interf k  C  KappaRtr             :: vertical diffusion of passive tracers, interf k
53  C  rFlx                 :: vertical flux  C  rFlx                 :: vertical flux
54  C  myTime               :: model time  C  myTime               :: model time
55  C  myIter               :: time-step number  C  myIter               :: time-step number
56  C  myThid               :: thread number  C  myThid               :: thread number
# Line 82  C  GAD_TR               :: passive trace Line 87  C  GAD_TR               :: passive trace
87        INTEGER kUp,kDown,km1        INTEGER kUp,kDown,km1
88        INTEGER GAD_TR        INTEGER GAD_TR
89        LOGICAL calcAdvection        LOGICAL calcAdvection
90        INTEGER iterNb, startAB        INTEGER iterNb
91  CEOP  CEOP
92    
93  C Loop ranges for daughter routines  C Loop ranges for daughter routines
# Line 119  C Loop over tracers Line 124  C Loop over tracers
124  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
125        rFlx(1,1,kDown,iTracer) = rFlx(1,1,kDown,iTracer)        rFlx(1,1,kDown,iTracer) = rFlx(1,1,kDown,iTracer)
126  c  c
127  CADJ STORE ptracer(:,:,k,bi,bj,iTracer)  CADJ STORE pTracer(:,:,k,bi,bj,iTracer)
128    CADJ &      = comlev1_bibj_k_ptracers, key=kkey, byte=isbyte
129    CADJ STORE gpTrNm1(:,:,k,bi,bj,iTracer)
130    CADJ &      = comlev1_bibj_k_ptracers, key=kkey, byte=isbyte
131    # ifdef NONLIN_FRSURF
132    CADJ STORE gpTr(:,:,k,bi,bj,iTracer)
133  CADJ &      = comlev1_bibj_k_ptracers, key=kkey, byte=isbyte  CADJ &      = comlev1_bibj_k_ptracers, key=kkey, byte=isbyte
134  CADJ STORE gPtrnm1(:,:,k,bi,bj,iTracer)  CADJ STORE rFlx(:,:,k,iTracer)
135  CADJ &      = comlev1_bibj_k_ptracers, key=kkey, byte=isbyte  CADJ &      = comlev1_bibj_k_ptracers, key=kkey, byte=isbyte
136    # endif
137  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
138    
139  C Calculate active tracer tendencies (gPtr) due to internal processes  C Calculate active tracer tendencies (gPtr) due to internal processes
140  C (advection, [explicit] diffusion, parameterizations,...)  C (advection, [explicit] diffusion, parameterizations,...)
141         calcAdvection = .NOT.multiDimAdvection         calcAdvection = .NOT.PTRACERS_MultiDimAdv(iTracer)
      &      .OR. PTRACERS_advScheme(iTracer).EQ.ENUM_CENTERED_2ND  
      &      .OR. PTRACERS_advScheme(iTracer).EQ.ENUM_UPWIND_3RD  
      &      .OR. PTRACERS_advScheme(iTracer).EQ.ENUM_CENTERED_4TH  
142         GAD_TR = GAD_TR1 + iTracer - 1         GAD_TR = GAD_TR1 + iTracer - 1
143         CALL GAD_CALC_RHS(         CALL GAD_CALC_RHS(
144       I                   bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,       I                   bi,bj,iMin,iMax,jMin,jMax,k,km1,kUp,kDown,
145       I                   xA, yA, maskUp, uFld, vFld, wFld,       I                   xA, yA, maskUp, uFld, vFld, wFld,
146       I                   uTrans, vTrans, rTrans, rTransKp1,       I                   uTrans, vTrans, rTrans, rTransKp1,
147       I                   PTRACERS_diffKh(iTracer),       I                   PTRACERS_diffKh(iTracer),
148       I                   PTRACERS_diffK4(iTracer),       I                   PTRACERS_diffK4(iTracer),
149       I                   KappaRtr(1-Olx,1-Oly,iTracer),       I                   KappaRtr(1-Olx,1-Oly,iTracer),
150       I                   gPtrNm1(1-Olx,1-Oly,1,1,1,iTracer),       I                   gpTrNm1(1-Olx,1-Oly,1,1,1,iTracer),
151       I                   pTracer(1-Olx,1-Oly,1,1,1,iTracer),       I                   pTracer(1-Olx,1-Oly,1,1,1,iTracer),
152       I                   GAD_TR,       I                   PTRACERS_dTLev, GAD_TR,
153       I                   PTRACERS_advScheme(iTracer),       I                   PTRACERS_advScheme(iTracer),
154       I                   PTRACERS_advScheme(iTracer),       I                   PTRACERS_advScheme(iTracer),
155       I                   calcAdvection, PTRACERS_ImplVertAdv(iTracer),       I                   calcAdvection, PTRACERS_ImplVertAdv(iTracer),
# Line 157  C External forcing term(s) Line 165  C External forcing term(s)
165       &   CALL PTRACERS_FORCING(       &   CALL PTRACERS_FORCING(
166       I                      bi,bj,iMin,iMax,jMin,jMax,k,iTracer,       I                      bi,bj,iMin,iMax,jMin,jMax,k,iTracer,
167       U                      gPtr(1-Olx,1-Oly,1,1,1,iTracer),       U                      gPtr(1-Olx,1-Oly,1,1,1,iTracer),
168       I                      surfaceForcingPtr(1-Olx,1-Oly,1,1,iTracer),       I                      surfaceForcingPTr(1-Olx,1-Oly,1,1,iTracer),
169       I                      myIter,myTime,myThid)       I                      myIter,myTime,myThid)
170    
171  C If using Adams-Bashforth II, then extrapolate tendencies  C If using Adams-Bashforth II, then extrapolate tendencies
172  C gPtr is now the tracer tendency for explicit advection/diffusion  C gPtr is now the tracer tendency for explicit advection/diffusion
173        IF ( PTRACERS_advScheme(iTracer).EQ.ENUM_CENTERED_2ND        IF ( PTRACERS_AdamsBashGtr(iTracer) ) THEN
      & .OR.PTRACERS_advScheme(iTracer).EQ.ENUM_UPWIND_3RD  
      & .OR.PTRACERS_advScheme(iTracer).EQ.ENUM_CENTERED_4TH ) THEN  
174  #ifdef ALLOW_MATRIX  #ifdef ALLOW_MATRIX
175  C  If matrix is being computed, block call to S/R ADAMS_BASHFORTH2 to  C  If matrix is being computed, block call to S/R ADAMS_BASHFORTH2 to
176  C  prevent gPtr from being replaced by the average of gPtr and gPtrNm1.  C  prevent gPtr from being replaced by the average of gPtr and gpTrNm1.
177          IF (.NOT.useMATRIX) THEN          IF (.NOT.useMATRIX) THEN
178  #endif  #endif
179    C       compute iter at beginning of ptracer time step
180    #ifdef ALLOW_LONGSTEP
181            iterNb = myIter - LS_nIter + 1
182            IF (LS_whenToSample.GE.2) iterNb = myIter - LS_nIter
183    #else
184          iterNb = myIter          iterNb = myIter
185          IF (staggerTimeStep) iterNb = myIter - 1          IF (staggerTimeStep) iterNb = myIter - 1
186          startAB = nIter0 - PTRACERS_Iter0  #endif
187          CALL ADAMS_BASHFORTH2(          CALL ADAMS_BASHFORTH2(
188       I                        bi,bj,K,       I                      bi,bj,K,
189       U                        gPtr(1-Olx,1-Oly,1,1,1,iTracer),       U                      gPtr(1-Olx,1-Oly,1,1,1,iTracer),
190       U                        gPtrNm1(1-Olx,1-Oly,1,1,1,iTracer),       U                      gpTrNm1(1-Olx,1-Oly,1,1,1,iTracer),
191       I                        startAB, iterNb, myThid )       I                      PTRACERS_startAB(iTracer), iterNb, myThid )
192  #ifdef ALLOW_MATRIX  #ifdef ALLOW_MATRIX
193          ENDIF          ENDIF
194  #endif  #endif
# Line 188  C External forcing term(s) Line 199  C External forcing term(s)
199       &   CALL PTRACERS_FORCING(       &   CALL PTRACERS_FORCING(
200       I                      bi,bj,iMin,iMax,jMin,jMax,k,iTracer,       I                      bi,bj,iMin,iMax,jMin,jMax,k,iTracer,
201       U                      gPtr(1-Olx,1-Oly,1,1,1,iTracer),       U                      gPtr(1-Olx,1-Oly,1,1,1,iTracer),
202       I                      surfaceForcingPtr(1-Olx,1-Oly,1,1,iTracer),       I                      surfaceForcingPTr(1-Olx,1-Oly,1,1,iTracer),
203       I                      myIter,myTime,myThid)       I                      myIter,myTime,myThid)
204    
205  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
# Line 198  C Account for change in level thickness Line 209  C Account for change in level thickness
209       I                          bi,bj,K,       I                          bi,bj,K,
210       U                          gPtr(1-Olx,1-Oly,1,1,1,iTracer),       U                          gPtr(1-Olx,1-Oly,1,1,1,iTracer),
211       I                          myThid )       I                          myThid )
212          IF ( PTRACERS_advScheme(iTracer).EQ.ENUM_CENTERED_2ND          IF ( PTRACERS_AdamsBashGtr(iTracer) )
      &   .OR.PTRACERS_advScheme(iTracer).EQ.ENUM_UPWIND_3RD  
      &   .OR.PTRACERS_advScheme(iTracer).EQ.ENUM_CENTERED_4TH )  
213       &  CALL FREESURF_RESCALE_G(       &  CALL FREESURF_RESCALE_G(
214       I                          bi,bj,K,       I                          bi,bj,K,
215       U                          gPtrNm1(1-Olx,1-Oly,1,1,1,iTracer),       U                          gpTrNm1(1-Olx,1-Oly,1,1,1,iTracer),
216       I                          myThid )       I                          myThid )
217        ENDIF        ENDIF
218  #endif /* NONLIN_FRSURF */  #endif /* NONLIN_FRSURF */
# Line 212  C Integrate forward in time, storing in Line 221  C Integrate forward in time, storing in
221           CALL TIMESTEP_TRACER(           CALL TIMESTEP_TRACER(
222       I                        bi,bj,iMin,iMax,jMin,jMax,k,       I                        bi,bj,iMin,iMax,jMin,jMax,k,
223       I                        PTRACERS_advScheme(iTracer),       I                        PTRACERS_advScheme(iTracer),
224         I                        PTRACERS_dTLev(k),
225       I                        pTracer(1-Olx,1-Oly,1,1,1,iTracer),       I                        pTracer(1-Olx,1-Oly,1,1,1,iTracer),
226       I                        gPtr(1-Olx,1-Oly,1,1,1,iTracer),       I                        gPtr(1-Olx,1-Oly,1,1,1,iTracer),
227       I                        myIter,myThid )       I                        myIter,myThid )
228    
 #ifdef   ALLOW_OBCS  
 C Apply open boundary conditions  
          IF (useOBCS) THEN  
           CALL OBCS_APPLY_PTRACER(  
      I         bi, bj, k, iTracer,  
      U         gPtr(1-Olx,1-Oly,k,bi,bj,iTracer),  
      I         myThid )  
          END IF  
 #endif   /* ALLOW_OBCS */  
229  C end of tracer loop  C end of tracer loop
230        ENDDO        ENDDO
231    

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.41

  ViewVC Help
Powered by ViewVC 1.1.22