1 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/calc_common_factors.F,v 1.7 1998/08/18 16:32:41 cnh Exp $ |
2 |
|
3 |
#include "CPP_EEOPTIONS.h" |
4 |
|
5 |
CStartOfInterFace |
6 |
SUBROUTINE CALC_COMMON_FACTORS( |
7 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
8 |
O xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp, |
9 |
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 | We also think lower taxes are a good idea but we doubt | |
22 |
C | whether we'll ever get them. | |
23 |
C \==========================================================/ |
24 |
IMPLICIT NONE |
25 |
|
26 |
C == GLobal variables == |
27 |
#include "SIZE.h" |
28 |
#include "DYNVARS.h" |
29 |
#include "EEPARAMS.h" |
30 |
#include "PARAMS.h" |
31 |
#include "GRID.h" |
32 |
|
33 |
C == Routine arguments == |
34 |
C bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation |
35 |
C results will be set. |
36 |
C xA - Tracer cell face area normal to X |
37 |
C yA - Tracer cell face area normal to X |
38 |
C uTrans - Zonal volume transport through cell face |
39 |
C vTrans - Meridional volume transport through cell face |
40 |
C rTrans - R-direction volume transport through cell face |
41 |
C rVel - R-direction velocity at cell upper and lower faces |
42 |
C maskC - land/water mask for tracer points |
43 |
C maskUp - land/water mask for Wvel points (above tracer level) |
44 |
C myThid - Instance number for this innvocation of CALC_COMMON_FACTORS |
45 |
C |
46 |
INTEGER bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown |
47 |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
48 |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
49 |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
50 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
51 |
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
52 |
_RL rVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
53 |
_RS maskC (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 |
CEndOfInterface |
58 |
|
59 |
C == Local variables == |
60 |
C I, J, K - Loop counters |
61 |
C kUp, kDown, kM1 - Index for layer above and below. K_UP and K_DOWN |
62 |
C are switched with layer to be the appropriate index |
63 |
C into fluxUD. |
64 |
INTEGER i,j |
65 |
LOGICAL TOP_LAYER |
66 |
|
67 |
TOP_LAYER = K .EQ. 1 |
68 |
|
69 |
C-- Calculate tracer cell face open areas |
70 |
DO j=jMin,jMax |
71 |
DO i=iMin,iMax |
72 |
xA(i,j) = _dyG(i,j,bi,bj)*drF(k)*_hFacW(i,j,k,bi,bj) |
73 |
yA(i,j) = _dxG(i,j,bi,bj)*drF(k)*_hFacS(i,j,k,bi,bj) |
74 |
ENDDO |
75 |
ENDDO |
76 |
|
77 |
C-- Calculate velocity field "volume transports" through |
78 |
C-- tracer cell faces. |
79 |
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 |
C-- Calculate vertical "volume transport" through |
87 |
C-- tracer cell face *above* this level. |
88 |
DO j=jMin,jMax |
89 |
DO i=iMin,iMax |
90 |
rTrans(i,j) = uTrans(i,j)*recip_rkFac-uTrans(i+1,j)*recip_rkFac |
91 |
& +vTrans(i,j)*recip_rkFac-vTrans(i,j+1)*recip_rkFac |
92 |
& +rTrans(i,j) |
93 |
ENDDO |
94 |
ENDDO |
95 |
|
96 |
C-- Vertical velocity at upper face |
97 |
DO j=jMin,jMax |
98 |
DO i=iMin,iMax |
99 |
rVel(i,j,kUp) = rTrans(i,j)/_rA(i,j,bi,bj) |
100 |
ENDDO |
101 |
ENDDO |
102 |
|
103 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
104 |
DO j=jMin,jMax |
105 |
DO i=iMin,iMax |
106 |
maskC(i,j) = 1. |
107 |
if (_hFacC(i,j,k,bi,bj).eq.0.) maskC(i,j)=0. |
108 |
maskUp(i,j) = 1. |
109 |
if (_hFacC(i,j,k,bi,bj).eq.0. .or. TOP_LAYER ) maskUp(i,j)=0. |
110 |
ENDDO |
111 |
ENDDO |
112 |
|
113 |
RETURN |
114 |
END |