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

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

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

revision 1.33 by mlosch, Tue Feb 7 11:47:49 2006 UTC revision 1.39 by heimbach, Fri Feb 13 21:56:48 2009 UTC
# Line 12  C     !INTERFACE: Line 12  C     !INTERFACE:
12       I                         tFld, sFld,       I                         tFld, sFld,
13       U                         phiHydF,       U                         phiHydF,
14       O                         phiHydC, dPhiHydX, dPhiHydY,       O                         phiHydC, dPhiHydX, dPhiHydY,
15       I                         myTime, myIter, myThid)       I                         myTime, myIter, myThid )
16  C     !DESCRIPTION: \bv  C     !DESCRIPTION: \bv
17  C     *==========================================================*  C     *==========================================================*
18  C     | SUBROUTINE CALC_PHI_HYD                                  |  C     | SUBROUTINE CALC_PHI_HYD                                  |
19  C     | o Integrate the hydrostatic relation to find the Hydros. |  C     | o Integrate the hydrostatic relation to find the Hydros. |
20  C     *==========================================================*  C     *==========================================================*
21  C     |    Potential (ocean: Pressure/rho ; atmos = geopotential)  C     |    Potential (ocean: Pressure/rho ; atmos = geopotential)
22  C     | On entry:  C     | On entry:
23  C     |   tFld,sFld     are the current thermodynamics quantities  C     |   tFld,sFld     are the current thermodynamics quantities
24  C     |                 (unchanged on exit)  C     |                 (unchanged on exit)
25  C     |   phiHydF(i,j) is the hydrostatic Potential anomaly  C     |   phiHydF(i,j) is the hydrostatic Potential anomaly
26  C     |                at middle between tracer points k-1,k  C     |                at middle between tracer points k-1,k
27  C     | On exit:  C     | On exit:
28  C     |   phiHydC(i,j) is the hydrostatic Potential anomaly  C     |   phiHydC(i,j) is the hydrostatic Potential anomaly
29  C     |                at cell centers (tracer points), level k  C     |                at cell centers (tracer points), level k
30  C     |   phiHydF(i,j) is the hydrostatic Potential anomaly  C     |   phiHydF(i,j) is the hydrostatic Potential anomaly
31  C     |                at middle between tracer points k,k+1  C     |                at middle between tracer points k,k+1
32  C     |   dPhiHydX,Y   hydrostatic Potential gradient (X&Y dir)  C     |   dPhiHydX,Y   hydrostatic Potential gradient (X&Y dir)
33  C     |                at cell centers (tracer points), level k  C     |                at cell centers (tracer points), level k
34  C     | integr_GeoPot allows to select one integration method  C     | integr_GeoPot allows to select one integration method
# Line 51  C     == Global variables == Line 51  C     == Global variables ==
51    
52  C     !INPUT/OUTPUT PARAMETERS:  C     !INPUT/OUTPUT PARAMETERS:
53  C     == Routine arguments ==  C     == Routine arguments ==
54  C     bi, bj, k  :: tile and level indices  C     bi, bj, k  :: tile and level indices
55  C     iMin,iMax,jMin,jMax :: computational domain  C     iMin,iMax,jMin,jMax :: computational domain
56  C     tFld       :: potential temperature  C     tFld       :: potential temperature
57  C     sFld       :: salinity  C     sFld       :: salinity
# Line 72  c     _RL phiHyd(1-OLx:sNx+OLx,1-OLy:sNy Line 72  c     _RL phiHyd(1-OLx:sNx+OLx,1-OLy:sNy
72        _RL dPhiHydY(1-Olx:sNx+Olx,1-Oly:sNy+Oly)        _RL dPhiHydY(1-Olx:sNx+Olx,1-Oly:sNy+Oly)
73        _RL myTime        _RL myTime
74        INTEGER myIter, myThid        INTEGER myIter, myThid
75          
76  #ifdef INCLUDE_PHIHYD_CALCULATION_CODE  #ifdef INCLUDE_PHIHYD_CALCULATION_CODE
77    
78  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
# Line 83  C     == Local variables == Line 83  C     == Local variables ==
83        _RL dRlocM,dRlocP, ddRloc, locAlpha        _RL dRlocM,dRlocP, ddRloc, locAlpha
84        _RL ddPIm, ddPIp, rec_dRm, rec_dRp        _RL ddPIm, ddPIp, rec_dRm, rec_dRp
85        _RL surfPhiFac        _RL surfPhiFac
       INTEGER iMnLoc,jMnLoc  
86        PARAMETER ( zero= 0. _d 0 , one= 1. _d 0 , half= .5 _d 0 )        PARAMETER ( zero= 0. _d 0 , one= 1. _d 0 , half= .5 _d 0 )
87        LOGICAL useDiagPhiRlow, addSurfPhiAnom        LOGICAL useDiagPhiRlow, addSurfPhiAnom
88  CEOP  CEOP
# Line 93  CEOP Line 92  CEOP
92        IF (addSurfPhiAnom) surfPhiFac = 1.        IF (addSurfPhiAnom) surfPhiFac = 1.
93    
94  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
95  C  Atmosphere:    C  Atmosphere:
96  C integr_GeoPot => select one option for the integration of the Geopotential:  C integr_GeoPot => select one option for the integration of the Geopotential:
97  C   = 0 : Energy Conserving Form, accurate with Topo full cell;  C   = 0 : Energy Conserving Form, accurate with Topo full cell;
98  C   = 1 : Finite Volume Form, with Part-Cell, linear in P by Half level;  C   = 1 : Finite Volume Form, with Part-Cell, linear in P by Half level;
99  C   =2,3: Finite Difference Form, with Part-Cell,  C   =2,3: Finite Difference Form, with Part-Cell,
100  C         linear in P between 2 Tracer levels.  C         linear in P between 2 Tracer levels.
101  C       can handle both cases: Tracer lev at the middle of InterFace_W  C       can handle both cases: Tracer lev at the middle of InterFace_W
102  C                          and InterFace_W at the middle of Tracer lev;  C                          and InterFace_W at the middle of Tracer lev;
103  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
104    
# Line 120  C---+----1----+----2----+----3----+----4 Line 119  C---+----1----+----2----+----3----+----4
119       &                      + act4*max1*max2*max3       &                      + act4*max1*max2*max3
120  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
121    
122  C--   Initialize phiHydF to zero :  C--   Initialize phiHydF to zero :
123  C     note: atmospheric_loading or Phi_topo anomaly are incorporated  C     note: atmospheric_loading or Phi_topo anomaly are incorporated
124  C           later in S/R calc_grad_phi_hyd  C           later in S/R calc_grad_phi_hyd
125        IF (k.EQ.1) THEN        IF (k.EQ.1) THEN
# Line 136  C---+----1----+----2----+----3----+----4 Line 135  C---+----1----+----2----+----3----+----4
135  C       This is the hydrostatic pressure calculation for the Ocean  C       This is the hydrostatic pressure calculation for the Ocean
136  C       which uses the FIND_RHO() routine to calculate density  C       which uses the FIND_RHO() routine to calculate density
137  C       before integrating g*rho over the current layer/interface  C       before integrating g*rho over the current layer/interface
138  #ifdef      ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
139  CADJ GENERAL  CADJ GENERAL
140  #endif      /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
141    
142            IF ( implicitIntGravWave .OR. myIter.LT.0 ) THEN
143  C---    Calculate density  C---    Calculate density
144  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
145          kkey = (ikey-1)*Nr + k            kkey = (ikey-1)*Nr + k
146  CADJ STORE tFld (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ STORE tFld (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte,
147  CADJ STORE sFld (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ &     kind = isbyte
148    CADJ STORE sFld (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte,
149    CADJ &     kind = isbyte
150  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
151          CALL FIND_RHO( bi, bj, iMin, iMax, jMin, jMax, k, k,            CALL FIND_RHO_2D(
152       &                 tFld, sFld,       I              iMin, iMax, jMin, jMax, k,
153       &                 alphaRho, myThid)       I              tFld(1-OLx,1-OLy,k,bi,bj),
154         I              sFld(1-OLx,1-OLy,k,bi,bj),
155         O              alphaRho,
156         I              k, bi, bj, myThid )
157            ELSE
158              DO j=jMin,jMax
159               DO i=iMin,iMax
160                 alphaRho(i,j) = rhoInSitu(i,j,k,bi,bj)
161               ENDDO
162              ENDDO
163            ENDIF
164    
165  #ifdef ALLOW_SHELFICE  #ifdef ALLOW_SHELFICE
166  C     mask rho, so that there is no contribution of phiHyd from  C     mask rho, so that there is no contribution of phiHyd from
167  C     overlying shelfice (whose density we do not know)  C     overlying shelfice (whose density we do not know)
168          IF ( useShelfIce ) THEN          IF ( useShelfIce .AND. useDOWN_SLOPE ) THEN
169    C- note: does not work for down_slope pkg which needs rho below the bottom.
170    C    setting rho=0 above the ice-shelf base is enough (and works in both cases)
171    C    but might be slower (--> keep original masking if not using down_slope pkg)
172             DO j=jMin,jMax
173              DO i=iMin,iMax
174               IF ( k.LT.kSurfC(i,j,bi,bj) ) alphaRho(i,j) = 0. _d 0
175              ENDDO
176             ENDDO
177            ELSEIF ( useShelfIce ) THEN
178           DO j=jMin,jMax           DO j=jMin,jMax
179            DO i=iMin,iMax            DO i=iMin,iMax
180             alphaRho(i,j) = alphaRho(i,j)*maskC(i,j,k,bi,bj)             alphaRho(i,j) = alphaRho(i,j)*maskC(i,j,k,bi,bj)
# Line 161  C     overlying shelfice (whose density Line 183  C     overlying shelfice (whose density
183          ENDIF          ENDIF
184  #endif /* ALLOW_SHELFICE */  #endif /* ALLOW_SHELFICE */
185    
186  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_MOM_COMMON
         IF ( useDiagnostics )  
      &   CALL DIAGNOSTICS_FILL(alphaRho,'RHOAnoma',k,1,2,bi,bj,myThid)  
 #endif  
   
187  C Quasi-hydrostatic terms are added in as if they modify the buoyancy  C Quasi-hydrostatic terms are added in as if they modify the buoyancy
188          IF (quasiHydrostatic) THEN          IF (quasiHydrostatic) THEN
189           CALL QUASIHYDROSTATICTERMS(bi,bj,k,alphaRho,myThid)           CALL MOM_QUASIHYDROSTATIC(bi,bj,k,uVel,vVel,alphaRho,myThid)
190          ENDIF          ENDIF
191    #endif /* ALLOW_MOM_COMMON */
192    
193  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
194          IF (k.EQ.1 .AND. addSurfPhiAnom) THEN          IF (k.EQ.1 .AND. addSurfPhiAnom) THEN
# Line 227  C Line 246  C
246    
247  C  --  end if integr_GeoPot = ...  C  --  end if integr_GeoPot = ...
248         ENDIF         ENDIF
249            
250  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
251        ELSEIF ( buoyancyRelation .EQ. 'OCEANICP' ) THEN        ELSEIF ( buoyancyRelation .EQ. 'OCEANICP' ) THEN
252  C       This is the hydrostatic pressure calculation for the Ocean  C       This is the hydrostatic pressure calculation for the Ocean
# Line 237  C       before integrating (1/rho)'*dp o Line 256  C       before integrating (1/rho)'*dp o
256  CADJ GENERAL  CADJ GENERAL
257  #endif      /* ALLOW_AUTODIFF_TAMC */  #endif      /* ALLOW_AUTODIFF_TAMC */
258    
259            IF ( implicitIntGravWave .OR. myIter.LT.0 ) THEN
260  C--     Calculate density  C--     Calculate density
261  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
262              kkey = (ikey-1)*Nr + k            kkey = (ikey-1)*Nr + k
263  CADJ STORE tFld (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ STORE tFld (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte,
264  CADJ STORE sFld (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ &     kind = isbyte
265    CADJ STORE sFld (:,:,k,bi,bj) = comlev1_bibj_k, key=kkey, byte=isbyte,
266    CADJ &     kind = isbyte
267  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
268          CALL FIND_RHO( bi, bj, iMin, iMax, jMin, jMax, k, k,            CALL FIND_RHO_2D(
269       &                 tFld, sFld,       I              iMin, iMax, jMin, jMax, k,
270       &                 alphaRho, myThid)       I              tFld(1-OLx,1-OLy,k,bi,bj),
271         I              sFld(1-OLx,1-OLy,k,bi,bj),
272         O              alphaRho,
273         I              k, bi, bj, myThid )
274  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
275  CADJ STORE alphaRho (:,:) = comlev1_bibj_k, key=kkey, byte=isbyte  CADJ STORE alphaRho (:,:) = comlev1_bibj_k, key=kkey, byte=isbyte,
276    CADJ &     kind = isbyte
277  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
278            ELSE
279  #ifdef ALLOW_DIAGNOSTICS            DO j=jMin,jMax
280          IF ( useDiagnostics )             DO i=iMin,iMax
281       &   CALL DIAGNOSTICS_FILL(alphaRho,'RHOAnoma',k,1,2,bi,bj,myThid)               alphaRho(i,j) = rhoInSitu(i,j,k,bi,bj)
282  #endif             ENDDO
283              ENDDO
284            ENDIF
285    
286  C--     Calculate specific volume anomaly : alpha' = 1/rho - alpha_Cst  C--     Calculate specific volume anomaly : alpha' = 1/rho - alpha_Cst
287          DO j=jMin,jMax          DO j=jMin,jMax
# Line 276  C---------- This discretization is the " Line 304  C---------- This discretization is the "
304  C           which has not been used to date since it does not  C           which has not been used to date since it does not
305  C           conserve KE+PE exactly even though it is more natural  C           conserve KE+PE exactly even though it is more natural
306  C  C
307             IF (k.EQ.ksurfC(i,j,bi,bj)) THEN             IF (k.EQ.kSurfC(i,j,bi,bj)) THEN
308               ddRloc = Ro_surf(i,j,bi,bj)-rC(k)               ddRloc = Ro_surf(i,j,bi,bj)-rC(k)
309  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
310               ddRloc = ddRloc + surfPhiFac*etaH(i,j,bi,bj)               ddRloc = ddRloc + surfPhiFac*etaH(i,j,bi,bj)
311  #endif  #endif
312               phiHydC(i,j) = ddRloc*alphaRho(i,j)               phiHydC(i,j) = ddRloc*alphaRho(i,j)
313  c--to reproduce results of c48d_post: uncomment those 4+1 lines  c--to reproduce results of c48d_post: uncomment those 4+1 lines
314  c            phiHydC(i,j)=phiHydF(i,j)  c            phiHydC(i,j)=phiHydF(i,j)
315  c    &          +(hFacC(i,j,k,bi,bj)-half)*drF(k)*alphaRho(i,j)  c    &          +(hFacC(i,j,k,bi,bj)-half)*drF(k)*alphaRho(i,j)
316  c            phiHydF(i,j)=phiHydF(i,j)  c            phiHydF(i,j)=phiHydF(i,j)
# Line 315  C  --  Finite Difference Form, with Part Line 343  C  --  Finite Difference Form, with Part
343    
344  C---------- This discretization is the "energy conserving" form  C---------- This discretization is the "energy conserving" form
345    
346             IF (k.EQ.ksurfC(i,j,bi,bj)) THEN             IF (k.EQ.kSurfC(i,j,bi,bj)) THEN
347               ddRloc = Ro_surf(i,j,bi,bj)-rC(k)               ddRloc = Ro_surf(i,j,bi,bj)-rC(k)
348  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
349               ddRloc = ddRloc + surfPhiFac*etaH(i,j,bi,bj)               ddRloc = ddRloc + surfPhiFac*etaH(i,j,bi,bj)
# Line 343  C--     virtual potential temperature an Line 371  C--     virtual potential temperature an
371          DO j=jMin,jMax          DO j=jMin,jMax
372           DO i=iMin,iMax           DO i=iMin,iMax
373            alphaRho(i,j)=maskC(i,j,k,bi,bj)            alphaRho(i,j)=maskC(i,j,k,bi,bj)
374       &             *( tFld(i,j,k,bi,bj)*(sFld(i,j,k,bi,bj)*atm_Rq+one)       &             *( tFld(i,j,k,bi,bj)*(sFld(i,j,k,bi,bj)*atm_Rq+one)
375       &               -tRef(k) )       &               -tRef(k) )
376           ENDDO           ENDDO
377          ENDDO          ENDDO
# Line 354  C---    Integrate d Phi / d pi Line 382  C---    Integrate d Phi / d pi
382  C  --  Energy Conserving Form, accurate with Full cell topo  --  C  --  Energy Conserving Form, accurate with Full cell topo  --
383  C------------ The integration for the first level phi(k=1) is the same  C------------ The integration for the first level phi(k=1) is the same
384  C             for both the "finite volume" and energy conserving methods.  C             for both the "finite volume" and energy conserving methods.
385  C    *NOTE* o Working with geopotential Anomaly, the geopotential boundary  C    *NOTE* o Working with geopotential Anomaly, the geopotential boundary
386  C             condition is simply Phi-prime(Ro_surf)=0.  C             condition is simply Phi-prime(Ro_surf)=0.
387  C           o convention ddPI > 0 (same as drF & drC)  C           o convention ddPI > 0 (same as drF & drC)
388  C-----------------------------------------------------------------------  C-----------------------------------------------------------------------
# Line 370  C--------------------------------------- Line 398  C---------------------------------------
398       &                   -((rF(k+1)/atm_Po)**atm_kappa) )       &                   -((rF(k+1)/atm_Po)**atm_kappa) )
399           ELSE           ELSE
400             ddPIp=atm_Cp*( ((rC( k )/atm_Po)**atm_kappa)             ddPIp=atm_Cp*( ((rC( k )/atm_Po)**atm_kappa)
401       &                   -((rC(k+1)/atm_Po)**atm_kappa) )*half       &                   -((rC(k+1)/atm_Po)**atm_kappa) )*half
402           ENDIF           ENDIF
403  C-------- This discretization is the energy conserving form  C-------- This discretization is the energy conserving form
404           DO j=jMin,jMax           DO j=jMin,jMax
# Line 389  C  Finite Volume formulation consistent Line 417  C  Finite Volume formulation consistent
417  C   Note: a true Finite Volume form should be linear between 2 Interf_W :  C   Note: a true Finite Volume form should be linear between 2 Interf_W :
418  C     phi_C = (phi_W_k+ phi_W_k+1)/2 ; but not accurate in Stratosphere (low p)  C     phi_C = (phi_W_k+ phi_W_k+1)/2 ; but not accurate in Stratosphere (low p)
419  C   also: if Interface_W at the middle between tracer levels, this form  C   also: if Interface_W at the middle between tracer levels, this form
420  C     is close to the Energy Cons. form in the Interior, except for the  C     is close to the Energy Cons. form in the Interior, except for the
421  C     non-linearity in PI(p)  C     non-linearity in PI(p)
422  C---------  C---------
423             ddPIm=atm_Cp*( ((rF( k )/atm_Po)**atm_kappa)             ddPIm=atm_Cp*( ((rF( k )/atm_Po)**atm_kappa)
# Line 398  C--------- Line 426  C---------
426       &                   -((rF(k+1)/atm_Po)**atm_kappa) )       &                   -((rF(k+1)/atm_Po)**atm_kappa) )
427           DO j=jMin,jMax           DO j=jMin,jMax
428            DO i=iMin,iMax            DO i=iMin,iMax
429             IF (k.EQ.ksurfC(i,j,bi,bj)) THEN             IF (k.EQ.kSurfC(i,j,bi,bj)) THEN
430               ddRloc = Ro_surf(i,j,bi,bj)-rC(k)               ddRloc = Ro_surf(i,j,bi,bj)-rC(k)
431  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
432               ddRloc = ddRloc + surfPhiFac*etaH(i,j,bi,bj)               ddRloc = ddRloc + surfPhiFac*etaH(i,j,bi,bj)
# Line 416  C--------------------------------------- Line 444  C---------------------------------------
444    
445         ELSEIF ( integr_GeoPot.EQ.2         ELSEIF ( integr_GeoPot.EQ.2
446       &     .OR. integr_GeoPot.EQ.3 ) THEN       &     .OR. integr_GeoPot.EQ.3 ) THEN
447  C  --  Finite Difference Form, with Part-Cell Topo,  C  --  Finite Difference Form, with Part-Cell Topo,
448  C       works with Interface_W  at the middle between 2.Tracer_Level  C       works with Interface_W  at the middle between 2.Tracer_Level
449  C        and  with Tracer_Level at the middle between 2.Interface_W.  C        and  with Tracer_Level at the middle between 2.Interface_W.
450  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
451  C  Finite Difference formulation consistent with Partial Cell,  C  Finite Difference formulation consistent with Partial Cell,
452  C   Valid & accurate if Interface_W at middle between tracer levels  C   Valid & accurate if Interface_W at middle between tracer levels
453  C   linear in p between 2 Tracer levels ; conserve energy in the Interior  C   linear in p between 2 Tracer levels ; conserve energy in the Interior
454  C---------  C---------
455           IF (k.EQ.1) THEN           IF (k.EQ.1) THEN
456             ddPIm=atm_Cp*( ((rF( k )/atm_Po)**atm_kappa)             ddPIm=atm_Cp*( ((rF( k )/atm_Po)**atm_kappa)
# Line 436  C--------- Line 464  C---------
464       &                   -((rF(k+1)/atm_Po)**atm_kappa) )       &                   -((rF(k+1)/atm_Po)**atm_kappa) )
465           ELSE           ELSE
466             ddPIp=atm_Cp*( ((rC( k )/atm_Po)**atm_kappa)             ddPIp=atm_Cp*( ((rC( k )/atm_Po)**atm_kappa)
467       &                   -((rC(k+1)/atm_Po)**atm_kappa) )*half       &                   -((rC(k+1)/atm_Po)**atm_kappa) )*half
468           ENDIF           ENDIF
469           rec_dRm = one/(rF(k)-rC(k))           rec_dRm = one/(rF(k)-rC(k))
470           rec_dRp = one/(rC(k)-rF(k+1))           rec_dRp = one/(rC(k)-rF(k+1))
471           DO j=jMin,jMax           DO j=jMin,jMax
472            DO i=iMin,iMax            DO i=iMin,iMax
473             IF (k.EQ.ksurfC(i,j,bi,bj)) THEN             IF (k.EQ.kSurfC(i,j,bi,bj)) THEN
474               ddRloc = Ro_surf(i,j,bi,bj)-rC(k)               ddRloc = Ro_surf(i,j,bi,bj)-rC(k)
475  #ifdef NONLIN_FRSURF  #ifdef NONLIN_FRSURF
476               ddRloc = ddRloc + surfPhiFac*etaH(i,j,bi,bj)               ddRloc = ddRloc + surfPhiFac*etaH(i,j,bi,bj)
# Line 476  C       = Top atmosphere height (Atmos, Line 504  C       = Top atmosphere height (Atmos,
504          CALL DIAGS_PHI_RLOW(          CALL DIAGS_PHI_RLOW(
505       I                      k, bi, bj, iMin,iMax, jMin,jMax,       I                      k, bi, bj, iMin,iMax, jMin,jMax,
506       I                      phiHydF, phiHydC, alphaRho, tFld, sFld,       I                      phiHydF, phiHydC, alphaRho, tFld, sFld,
507       I                      myTime, myIter, myThid)         I                      myTime, myIter, myThid)
508        ENDIF        ENDIF
509    
510  C---   Diagnose Full Hydrostatic Potential at cell center level  C---   Diagnose Full Hydrostatic Potential at cell center level
# Line 485  C---   Diagnose Full Hydrostatic Potenti Line 513  C---   Diagnose Full Hydrostatic Potenti
513       I                      phiHydC,       I                      phiHydC,
514       I                      myTime, myIter, myThid)       I                      myTime, myIter, myThid)
515    
516        IF (momPressureForcing) THEN        IF (momPressureForcing) THEN
         iMnLoc = MAX(1-Olx+1,iMin)  
         jMnLoc = MAX(1-Oly+1,jMin)  
517          CALL CALC_GRAD_PHI_HYD(          CALL CALC_GRAD_PHI_HYD(
518       I                         k, bi, bj, iMnLoc,iMax, jMnLoc,jMax,       I                         k, bi, bj, iMin,iMax, jMin,jMax,
519       I                         phiHydC, alphaRho, tFld, sFld,       I                         phiHydC, alphaRho, tFld, sFld,
520       O                         dPhiHydX, dPhiHydY,       O                         dPhiHydX, dPhiHydY,
521       I                         myTime, myIter, myThid)         I                         myTime, myIter, myThid)
522        ENDIF        ENDIF
523    
524  #endif /* INCLUDE_PHIHYD_CALCULATION_CODE */  #endif /* INCLUDE_PHIHYD_CALCULATION_CODE */

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.39

  ViewVC Help
Powered by ViewVC 1.1.22