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

Annotation of /MITgcm/model/src/calc_common_factors.F

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


Revision 1.10 - (hide annotations) (download)
Fri Nov 6 22:44:43 1998 UTC (25 years, 7 months ago) by cnh
Branch: MAIN
CVS Tags: checkpoint19, checkpoint18
Changes since 1.9: +2 -2 lines
Changes to allow for atmospheric integration builds of the code

1 cnh 1.10 C $Header: /u/gcmpack/models/MITgcmUV/model/src/calc_common_factors.F,v 1.9 1998/10/28 03:11:36 cnh Exp $
2 cnh 1.1
3 cnh 1.10 #include "CPP_OPTIONS.h"
4 cnh 1.1
5     CStartOfInterFace
6     SUBROUTINE CALC_COMMON_FACTORS(
7     I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown,
8 cnh 1.7 O xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp,
9 cnh 1.1 I myThid)
10    
11     C /==========================================================\
12     C | SUBROUTINE CALC_COMMON_FACTORS |
13     C | o Calculate common data (such as volume flux) for use |
14     C | by "Right hand side" subroutines. |
15     C |==========================================================|
16     C | Here, we calculate terms or spatially varying factors |
17     C | that are used at various points in the "RHS" subroutines.|
18     C | This reduces the amount of total work, total memory |
19     C | and therefore execution time and is generally a good |
20     C | idea. |
21     C \==========================================================/
22     IMPLICIT NONE
23    
24     C == GLobal variables ==
25     #include "SIZE.h"
26     #include "DYNVARS.h"
27     #include "EEPARAMS.h"
28     #include "PARAMS.h"
29     #include "GRID.h"
30    
31     C == Routine arguments ==
32     C bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation
33     C results will be set.
34     C xA - Tracer cell face area normal to X
35     C yA - Tracer cell face area normal to X
36     C uTrans - Zonal volume transport through cell face
37     C vTrans - Meridional volume transport through cell face
38 cnh 1.7 C rTrans - R-direction volume transport through cell face
39     C rVel - R-direction velocity at cell upper and lower faces
40 cnh 1.1 C maskC - land/water mask for tracer points
41     C maskUp - land/water mask for Wvel points (above tracer level)
42     C myThid - Instance number for this innvocation of CALC_COMMON_FACTORS
43     C
44     INTEGER bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown
45     _RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
46     _RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
47     _RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
48     _RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
49 cnh 1.7 _RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
50     _RL rVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2)
51 cnh 1.1 _RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
52     _RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
53     C
54     INTEGER myThid
55     CEndOfInterface
56    
57     C == Local variables ==
58     C I, J, K - Loop counters
59     C kUp, kDown, kM1 - Index for layer above and below. K_UP and K_DOWN
60     C are switched with layer to be the appropriate index
61     C into fluxUD.
62     INTEGER i,j
63 cnh 1.6 LOGICAL TOP_LAYER
64 cnh 1.1
65 cnh 1.6 TOP_LAYER = K .EQ. 1
66    
67     C-- Calculate tracer cell face open areas
68 cnh 1.1 DO j=jMin,jMax
69     DO i=iMin,iMax
70 cnh 1.9 xA(i,j) = _dyG(i,j,bi,bj)
71     & *drF(k)*_hFacW(i,j,k,bi,bj)
72     yA(i,j) = _dxG(i,j,bi,bj)
73     & *drF(k)*_hFacS(i,j,k,bi,bj)
74 cnh 1.1 ENDDO
75     ENDDO
76    
77 cnh 1.6 C-- Calculate velocity field "volume transports" through
78     C-- tracer cell faces.
79 cnh 1.1 DO j=jMin,jMax
80     DO i=iMin,iMax
81     uTrans(i,j) = uVel(i,j,k,bi,bj)*xA(i,j)
82     vTrans(i,j) = vVel(i,j,k,bi,bj)*yA(i,j)
83     ENDDO
84     ENDDO
85    
86 cnh 1.6 C-- Calculate vertical "volume transport" through
87     C-- tracer cell face *above* this level.
88 cnh 1.1 DO j=jMin,jMax
89     DO i=iMin,iMax
90 cnh 1.9 rTrans(i,j) =
91     & uTrans(i,j)*recip_rkFac-uTrans(i+1,j)*recip_rkFac
92     & +vTrans(i,j)*recip_rkFac-vTrans(i,j+1)*recip_rkFac
93     & +rTrans(i,j)
94 cnh 1.1 ENDDO
95     ENDDO
96    
97 cnh 1.6 C-- Vertical velocity at upper face
98     DO j=jMin,jMax
99     DO i=iMin,iMax
100 cnh 1.7 rVel(i,j,kUp) = rTrans(i,j)/_rA(i,j,bi,bj)
101 cnh 1.6 ENDDO
102     ENDDO
103    
104 cnh 1.1 C-- Calculate mask for tracer cells (0 => land, 1 => water)
105     DO j=jMin,jMax
106     DO i=iMin,iMax
107     maskC(i,j) = 1.
108 cnh 1.4 if (_hFacC(i,j,k,bi,bj).eq.0.) maskC(i,j)=0.
109 cnh 1.1 maskUp(i,j) = 1.
110 cnh 1.9 if (_hFacC(i,j,k,bi,bj).eq.0. .or. TOP_LAYER )
111     & maskUp(i,j)=0.
112 cnh 1.1 ENDDO
113     ENDDO
114    
115     RETURN
116     END

  ViewVC Help
Powered by ViewVC 1.1.22