1 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/calc_common_factors.F,v 1.17 2001/07/30 20:20:43 heimbach 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 |
#ifdef ALLOW_NONHYDROSTATIC |
36 |
#include "GW.h" |
37 |
#endif |
38 |
|
39 |
C !INPUT/OUTPUT PARAMETERS: |
40 |
C == Routine arguments == |
41 |
C bi, bj, iMin, iMax, jMin, jMax :: Range of points for which calculation |
42 |
C results will be set. |
43 |
C xA :: Tracer cell face area normal to X |
44 |
C yA :: Tracer cell face area normal to X |
45 |
C uTrans :: Zonal volume transport through cell face |
46 |
C vTrans :: Meridional volume transport through cell face |
47 |
C rTrans :: R-direction volume transport through cell face |
48 |
C maskUp :: land/water mask for Wvel points (above tracer level) |
49 |
C myThid ::Instance number for this innvocation of CALC_COMMON_FACTORS |
50 |
C |
51 |
INTEGER bi,bj,iMin,iMax,jMin,jMax,k |
52 |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
53 |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
54 |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
55 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
56 |
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
57 |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
58 |
C |
59 |
INTEGER myThid |
60 |
|
61 |
C !LOCAL VARIABLES: |
62 |
C == Local variables == |
63 |
C I, J :: Loop counters |
64 |
INTEGER i,j |
65 |
CEOP |
66 |
|
67 |
C-- Initialisation |
68 |
DO j=1-OLy,sNy+OLy |
69 |
DO i=1-OLx,sNx+OLx |
70 |
xA(i,j) = 0. _d 0 |
71 |
yA(i,j) = 0. _d 0 |
72 |
uTrans(i,j) = 0. _d 0 |
73 |
vTrans(i,j) = 0. _d 0 |
74 |
rTrans(i,j) = 0. _d 0 |
75 |
ENDDO |
76 |
ENDDO |
77 |
|
78 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
79 |
IF (K .EQ. 1) THEN |
80 |
DO j=jMin,jMax |
81 |
DO i=iMin,iMax |
82 |
maskUp(i,j) = 0. |
83 |
ENDDO |
84 |
ENDDO |
85 |
ELSE |
86 |
DO j=jMin,jMax |
87 |
DO i=iMin,iMax |
88 |
maskUp(i,j) = maskC(i,j,k-1,bi,bj)*maskC(i,j,k,bi,bj) |
89 |
ENDDO |
90 |
ENDDO |
91 |
ENDIF |
92 |
|
93 |
C-- Calculate tracer cell face open areas |
94 |
DO j=jMin,jMax |
95 |
DO i=iMin,iMax |
96 |
xA(i,j) = _dyG(i,j,bi,bj) |
97 |
& *drF(k)*_hFacW(i,j,k,bi,bj) |
98 |
yA(i,j) = _dxG(i,j,bi,bj) |
99 |
& *drF(k)*_hFacS(i,j,k,bi,bj) |
100 |
ENDDO |
101 |
ENDDO |
102 |
|
103 |
C-- Calculate velocity field "volume transports" through |
104 |
C-- tracer cell faces. |
105 |
DO j=jMin,jMax |
106 |
DO i=iMin,iMax |
107 |
uTrans(i,j) = uVel(i,j,k,bi,bj)*xA(i,j) |
108 |
vTrans(i,j) = vVel(i,j,k,bi,bj)*yA(i,j) |
109 |
ENDDO |
110 |
ENDDO |
111 |
|
112 |
C-- Calculate vertical "volume transport" through |
113 |
C-- tracer cell face *above* this level. |
114 |
DO j=jMin,jMax |
115 |
DO i=iMin,iMax |
116 |
rTrans(i,j) = wVel(i,j,k,bi,bj)*rA(i,j,bi,bj) |
117 |
ENDDO |
118 |
ENDDO |
119 |
|
120 |
RETURN |
121 |
END |