/[MITgcm]/MITgcm/pkg/generic_advdiff/gad_dst2u1_adv_y.F
ViewVC logotype

Diff of /MITgcm/pkg/generic_advdiff/gad_dst2u1_adv_y.F

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

revision 1.2 by heimbach, Wed Jun 7 01:55:14 2006 UTC revision 1.7 by jmc, Wed Apr 4 01:39:06 2007 UTC
# Line 7  CBOP Line 7  CBOP
7  C !ROUTINE: GAD_DST2U1_ADV_Y  C !ROUTINE: GAD_DST2U1_ADV_Y
8    
9  C !INTERFACE: ==========================================================  C !INTERFACE: ==========================================================
10        SUBROUTINE GAD_DST2U1_ADV_Y(        SUBROUTINE GAD_DST2U1_ADV_Y(
11       I           bi,bj,k, advectionScheme, deltaTloc,       I           bi,bj,k, advectionScheme, calcCFL,
12       I           vTrans, vVel,       I           deltaTloc, vTrans, vFld,
13       I           tracer,       I           tracer,
14       O           vT,       O           vT,
15       I           myThid )       I           myThid )
16    
17  C !DESCRIPTION:  C !DESCRIPTION:
18  C  Calculates the area integrated meridional flux due to advection  C  Calculates the area integrated meridional flux due to advection
19  C  of a tracer using second-order Direct Space and Time (DST-2)  C  of a tracer using second-order Direct Space and Time (DST-2)
20  C  interpolation (=Lax-Wendroff) or simple 1rst order upwind scheme.  C  interpolation (=Lax-Wendroff) or simple 1rst order upwind scheme.
21    
22  C !USES: ===============================================================  C !USES: ===============================================================
# Line 30  C  bi,bj             :: tile indices Line 30  C  bi,bj             :: tile indices
30  C  k                 :: vertical level  C  k                 :: vertical level
31  C  advectionScheme   :: advection scheme to use: either 2nd Order DST  C  advectionScheme   :: advection scheme to use: either 2nd Order DST
32  C                                                or 1rst Order Upwind  C                                                or 1rst Order Upwind
33    C  calcCFL           :: =T: calculate CFL number ; =F: take vFld as CFL
34    C  deltaTloc         :: local time-step (s)
35  C  vTrans            :: meridional volume transport  C  vTrans            :: meridional volume transport
36  C  vVel              :: meridional flow  C  vFld              :: meridional flow / CFL number
37  C  tracer            :: tracer field  C  tracer            :: tracer field
38  C  myThid            :: thread number  C  myThid            :: thread number
39        INTEGER bi,bj, k, advectionScheme        INTEGER bi,bj, k, advectionScheme
40          LOGICAL calcCFL
41        _RL deltaTloc        _RL deltaTloc
42        _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
43        _RL vVel  (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)        _RL vFld  (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
44        _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)        _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
45        INTEGER myThid        INTEGER myThid
46    
# Line 48  C  vT                :: meridional advec Line 51  C  vT                :: meridional advec
51  C !LOCAL VARIABLES: ====================================================  C !LOCAL VARIABLES: ====================================================
52  C  i,j               :: loop indices  C  i,j               :: loop indices
53  C  yLimit            :: centered (vs upwind) fraction  C  yLimit            :: centered (vs upwind) fraction
 C  vFld              :: velocity [m/s], meridional component  
54  C  vCFL              :: Courant-Friedrich-Levy number  C  vCFL              :: Courant-Friedrich-Levy number
55        INTEGER i,j        INTEGER i,j
56        _RL vFld, vCFL, yLimit        _RL vCFL, yLimit, vAbs
57  CEOP  CEOP
58    
59        yLimit = 0. _d 0        yLimit = 0. _d 0
# Line 63  CEOP Line 65  CEOP
65        DO j=1-Oly+1,sNy+Oly        DO j=1-Oly+1,sNy+Oly
66         DO i=1-Olx,sNx+Olx         DO i=1-Olx,sNx+Olx
67    
68  c       vFld = vVel(i,j,k,bi,bj)          vCFL = vFld(i,j)
69          vFld = vTrans(i,j)*recip_dxG(i,j,bi,bj)          IF ( calcCFL ) vCFL = ABS( vFld(i,j)*deltaTloc
70       &        *recip_drF(k)*_recip_hFacS(i,j,k,bi,bj)       &                  *recip_dyC(i,j,bi,bj)*recip_deepFacC(k) )
71          vCFL = ABS(vFld*deltaTloc*recip_dyC(i,j,bi,bj))  
72    c       vT(i,j) =
73          vT(i,j) =  c    &     vTrans(i,j)*(tracer(i,j-1)+tracer(i,j))*0.5 _d 0
74       &     vTrans(i,j)*(Tracer(i,j-1)+Tracer(i,j))*0.5 _d 0  c    &   + ( 1. _d 0 - yLimit*(1. _d 0 - vCFL) )*ABS(vTrans(i,j))
75       &   + ( 1. _d 0 - yLimit*(1. _d 0 - vCFL) )*ABS(vTrans(i,j))  c    &                *(tracer(i,j-1)-tracer(i,j))*0.5 _d 0
76       &                *(tracer(i,j-1)-tracer(i,j))*0.5 _d 0  C-- above formulation produces large truncation error when:
77    C    1rst.O upWind and   v > 0 & |tracer(i,j-1)| << |tracer(i,j)|
78    C                   or   v < 0 & |tracer(i,j-1)| >> |tracer(i,j)|
79    C-- change to a more robust expression:
80            vAbs = ABS(vTrans(i,j))
81         &       *( 1. _d 0 - yLimit*(1. _d 0 - vCFL) )
82            vT(i,j) = ( vTrans(i,j)+vAbs )* 0.5 _d 0 * tracer(i,j-1)
83         &          + ( vTrans(i,j)-vAbs )* 0.5 _d 0 * tracer(i,j)
84    
85         ENDDO         ENDDO
86        ENDDO        ENDDO
87    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.22