1 |
C $Header: calc_common_factors.F,v 1.1.1.1 1998/04/22 19:15:30 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,wTrans,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 wTrans - Vertical volume transport through cell face |
41 |
C maskC - land/water mask for tracer points |
42 |
C maskUp - land/water mask for Wvel points (above tracer level) |
43 |
C myThid - Instance number for this innvocation of CALC_COMMON_FACTORS |
44 |
C |
45 |
INTEGER bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown |
46 |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
47 |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
48 |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
49 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
50 |
_RL wTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
51 |
_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 |
|
64 |
C-- Calculate tracer cell face open areas |
65 |
DO j=jMin,jMax |
66 |
DO i=iMin,iMax |
67 |
xA(i,j) = dyG(i,j,bi,bj)*dzF(k)*hFacW(i,j,k,bi,bj) |
68 |
yA(i,j) = dxG(i,j,bi,bj)*dzF(k)*hFacS(i,j,k,bi,bj) |
69 |
ENDDO |
70 |
ENDDO |
71 |
|
72 |
C-- Calculate velocity field "volume transports" through |
73 |
C-- tracer cell faces. |
74 |
DO j=jMin,jMax |
75 |
DO i=iMin,iMax |
76 |
uTrans(i,j) = uVel(i,j,k,bi,bj)*xA(i,j) |
77 |
vTrans(i,j) = vVel(i,j,k,bi,bj)*yA(i,j) |
78 |
ENDDO |
79 |
ENDDO |
80 |
|
81 |
C-- Calculate vertical "volume transport" through |
82 |
C-- tracer cell face *above* this level. |
83 |
DO j=jMin,jMax |
84 |
DO i=iMin,iMax |
85 |
wTrans(i,j) = uTrans(i,j)-uTrans(i+1,j) |
86 |
& +vTrans(i,j)-vTrans(i,j+1) |
87 |
& +wTrans(i,j) |
88 |
ENDDO |
89 |
ENDDO |
90 |
|
91 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
92 |
DO j=jMin,jMax |
93 |
DO i=iMin,iMax |
94 |
maskC(i,j) = 1. |
95 |
if (hFacC(i,j,k,bi,bj).eq.0.) maskC(i,j)=0. |
96 |
maskUp(i,j) = 1. |
97 |
if (hFacC(i,j,kM1,bi,bj).eq.0.) maskUp(i,j)=0. |
98 |
ENDDO |
99 |
ENDDO |
100 |
|
101 |
RETURN |
102 |
END |