1 |
C $Header$ |
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
5 |
|
|
6 |
CStartOfInterFace |
CStartOfInterFace |
7 |
SUBROUTINE CALC_COMMON_FACTORS( |
SUBROUTINE CALC_COMMON_FACTORS( |
8 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k, |
9 |
O xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp, |
O xA,yA,uTrans,vTrans,rTrans,maskUp, |
10 |
I myThid) |
I myThid) |
11 |
|
|
12 |
C /==========================================================\ |
C /==========================================================\ |
28 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
29 |
#include "PARAMS.h" |
#include "PARAMS.h" |
30 |
#include "GRID.h" |
#include "GRID.h" |
31 |
|
#ifdef ALLOW_NONHYDROSTATIC |
32 |
|
#include "GW.h" |
33 |
|
#endif |
34 |
|
|
35 |
C == Routine arguments == |
C == Routine arguments == |
36 |
C bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation |
C bi, bj, iMin, iMax, jMin, jMax - Range of points for which calculation |
40 |
C uTrans - Zonal volume transport through cell face |
C uTrans - Zonal volume transport through cell face |
41 |
C vTrans - Meridional volume transport through cell face |
C vTrans - Meridional volume transport through cell face |
42 |
C rTrans - R-direction volume transport through cell face |
C rTrans - R-direction volume transport through cell face |
|
C rVel - R-direction velocity at cell upper and lower faces |
|
|
C maskC - land/water mask for tracer points |
|
43 |
C maskUp - land/water mask for Wvel points (above tracer level) |
C maskUp - land/water mask for Wvel points (above tracer level) |
44 |
C myThid - Instance number for this innvocation of CALC_COMMON_FACTORS |
C myThid - Instance number for this innvocation of CALC_COMMON_FACTORS |
45 |
C |
C |
46 |
INTEGER bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown |
INTEGER bi,bj,iMin,iMax,jMin,jMax,k |
47 |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
48 |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
49 |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
50 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
51 |
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
_RL rVel (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
|
|
_RS maskC (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
|
52 |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
53 |
C |
C |
54 |
INTEGER myThid |
INTEGER myThid |
56 |
|
|
57 |
C == Local variables == |
C == Local variables == |
58 |
C I, J, K - Loop counters |
C I, J, K - Loop counters |
|
C kUp, kDown, kM1 - Index for layer above and below. K_UP and K_DOWN |
|
|
C are switched with layer to be the appropriate index |
|
|
C into fluxUD. |
|
59 |
INTEGER i,j |
INTEGER i,j |
|
LOGICAL TOP_LAYER |
|
60 |
|
|
61 |
TOP_LAYER = K .EQ. 1 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
62 |
|
IF (K .EQ. 1) THEN |
63 |
|
DO j=jMin,jMax |
64 |
|
DO i=iMin,iMax |
65 |
|
maskUp(i,j) = 0. |
66 |
|
ENDDO |
67 |
|
ENDDO |
68 |
|
ELSE |
69 |
|
DO j=jMin,jMax |
70 |
|
DO i=iMin,iMax |
71 |
|
maskUp(i,j) = maskC(i,j,k-1,bi,bj)*maskC(i,j,k,bi,bj) |
72 |
|
ENDDO |
73 |
|
ENDDO |
74 |
|
ENDIF |
75 |
|
|
76 |
C-- Calculate tracer cell face open areas |
C-- Calculate tracer cell face open areas |
77 |
DO j=jMin,jMax |
DO j=jMin,jMax |
95 |
C-- Calculate vertical "volume transport" through |
C-- Calculate vertical "volume transport" through |
96 |
C-- tracer cell face *above* this level. |
C-- tracer cell face *above* this level. |
97 |
DO j=jMin,jMax |
DO j=jMin,jMax |
98 |
DO i=iMin,iMax |
DO i=iMin,iMax |
99 |
rTrans(i,j) = |
rTrans(i,j) = wVel(i,j,k,bi,bj)*rA(i,j,bi,bj) |
100 |
& uTrans(i,j)*recip_rkFac-uTrans(i+1,j)*recip_rkFac |
ENDDO |
|
& +vTrans(i,j)*recip_rkFac-vTrans(i,j+1)*recip_rkFac |
|
|
& +rTrans(i,j) |
|
|
ENDDO |
|
|
ENDDO |
|
|
|
|
|
C-- Vertical velocity at upper face |
|
|
DO j=jMin,jMax |
|
|
DO i=iMin,iMax |
|
|
rVel(i,j,kUp) = rTrans(i,j)/_rA(i,j,bi,bj) |
|
|
ENDDO |
|
|
ENDDO |
|
|
|
|
|
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
|
|
DO j=jMin,jMax |
|
|
DO i=iMin,iMax |
|
|
maskC(i,j) = 1. |
|
|
if (_hFacC(i,j,k,bi,bj).eq.0.) maskC(i,j)=0. |
|
|
maskUp(i,j) = 1. |
|
|
if (_hFacC(i,j,k,bi,bj).eq.0. .or. TOP_LAYER ) |
|
|
& maskUp(i,j)=0. |
|
|
ENDDO |
|
101 |
ENDDO |
ENDDO |
102 |
|
|
103 |
RETURN |
RETURN |