1 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/calc_common_factors.F,v 1.16 2001/05/29 14:01:36 adcroft Exp $ |
2 |
C $Name: checkpoint40pre2 $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CStartOfInterFace |
7 |
SUBROUTINE CALC_COMMON_FACTORS( |
8 |
I bi,bj,iMin,iMax,jMin,jMax,k, |
9 |
O xA,yA,uTrans,vTrans,rTrans,maskUp, |
10 |
I myThid) |
11 |
|
12 |
C /==========================================================\ |
13 |
C | SUBROUTINE CALC_COMMON_FACTORS | |
14 |
C | o Calculate common data (such as volume flux) for use | |
15 |
C | by "Right hand side" subroutines. | |
16 |
C |==========================================================| |
17 |
C | Here, we calculate terms or spatially varying factors | |
18 |
C | that are used at various points in the "RHS" subroutines.| |
19 |
C | This reduces the amount of total work, total memory | |
20 |
C | and therefore execution time and is generally a good | |
21 |
C | idea. | |
22 |
C \==========================================================/ |
23 |
IMPLICIT NONE |
24 |
|
25 |
C == GLobal variables == |
26 |
#include "SIZE.h" |
27 |
#include "DYNVARS.h" |
28 |
#include "EEPARAMS.h" |
29 |
#include "PARAMS.h" |
30 |
#include "GRID.h" |
31 |
#ifdef ALLOW_NONHYDROSTATIC |
32 |
#include "GW.h" |
33 |
#endif |
34 |
|
35 |
C == Routine arguments == |
36 |
C bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation |
37 |
C results will be set. |
38 |
C xA - Tracer cell face area normal to X |
39 |
C yA - Tracer cell face area normal to X |
40 |
C uTrans - Zonal volume transport through cell face |
41 |
C vTrans - Meridional volume transport through cell face |
42 |
C rTrans - R-direction volume transport through cell face |
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 |
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 |
_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 |
INTEGER i,j |
60 |
|
61 |
C-- Initialisation |
62 |
DO j=1-OLy,sNy+OLy |
63 |
DO i=1-OLx,sNx+OLx |
64 |
xA(i,j) = 0. _d 0 |
65 |
yA(i,j) = 0. _d 0 |
66 |
uTrans(i,j) = 0. _d 0 |
67 |
vTrans(i,j) = 0. _d 0 |
68 |
rTrans(i,j) = 0. _d 0 |
69 |
ENDDO |
70 |
ENDDO |
71 |
|
72 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
73 |
IF (K .EQ. 1) THEN |
74 |
DO j=jMin,jMax |
75 |
DO i=iMin,iMax |
76 |
maskUp(i,j) = 0. |
77 |
ENDDO |
78 |
ENDDO |
79 |
ELSE |
80 |
DO j=jMin,jMax |
81 |
DO i=iMin,iMax |
82 |
maskUp(i,j) = maskC(i,j,k-1,bi,bj)*maskC(i,j,k,bi,bj) |
83 |
ENDDO |
84 |
ENDDO |
85 |
ENDIF |
86 |
|
87 |
C-- Calculate tracer cell face open areas |
88 |
DO j=jMin,jMax |
89 |
DO i=iMin,iMax |
90 |
xA(i,j) = _dyG(i,j,bi,bj) |
91 |
& *drF(k)*_hFacW(i,j,k,bi,bj) |
92 |
yA(i,j) = _dxG(i,j,bi,bj) |
93 |
& *drF(k)*_hFacS(i,j,k,bi,bj) |
94 |
ENDDO |
95 |
ENDDO |
96 |
|
97 |
C-- Calculate velocity field "volume transports" through |
98 |
C-- tracer cell faces. |
99 |
DO j=jMin,jMax |
100 |
DO i=iMin,iMax |
101 |
uTrans(i,j) = uVel(i,j,k,bi,bj)*xA(i,j) |
102 |
vTrans(i,j) = vVel(i,j,k,bi,bj)*yA(i,j) |
103 |
ENDDO |
104 |
ENDDO |
105 |
|
106 |
C-- Calculate vertical "volume transport" through |
107 |
C-- tracer cell face *above* this level. |
108 |
DO j=jMin,jMax |
109 |
DO i=iMin,iMax |
110 |
rTrans(i,j) = wVel(i,j,k,bi,bj)*rA(i,j,bi,bj) |
111 |
ENDDO |
112 |
ENDDO |
113 |
|
114 |
RETURN |
115 |
END |