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