1 |
C $Header$ |
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
5 |
|
|
6 |
CStartOfInterFace |
CBOP |
7 |
|
C !ROUTINE: CALC_COMMON_FACTORS |
8 |
|
C !INTERFACE: |
9 |
SUBROUTINE CALC_COMMON_FACTORS( |
SUBROUTINE CALC_COMMON_FACTORS( |
10 |
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
I bi,bj,iMin,iMax,jMin,jMax,k, |
11 |
O xA,yA,uTrans,vTrans,rTrans,rVel,maskC,maskUp, |
O xA,yA,uTrans,vTrans,rTrans,maskUp, |
12 |
I myThid) |
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 /==========================================================\ |
C !USES: |
|
C | SUBROUTINE CALC_COMMON_FACTORS | |
|
|
C | o Calculate common data (such as volume flux) for use | |
|
|
C | by "Right hand side" subroutines. | |
|
|
C |==========================================================| |
|
|
C | Here, we calculate terms or spatially varying factors | |
|
|
C | that are used at various points in the "RHS" subroutines.| |
|
|
C | This reduces the amount of total work, total memory | |
|
|
C | and therefore execution time and is generally a good | |
|
|
C | idea. | |
|
|
C \==========================================================/ |
|
28 |
IMPLICIT NONE |
IMPLICIT NONE |
|
|
|
29 |
C == GLobal variables == |
C == GLobal variables == |
30 |
#include "SIZE.h" |
#include "SIZE.h" |
31 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
32 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
33 |
#include "PARAMS.h" |
#include "PARAMS.h" |
34 |
#include "GRID.h" |
#include "GRID.h" |
35 |
|
#ifdef ALLOW_NONHYDROSTATIC |
36 |
|
#include "GW.h" |
37 |
|
#endif |
38 |
|
|
39 |
|
C !INPUT/OUTPUT PARAMETERS: |
40 |
C == Routine arguments == |
C == Routine arguments == |
41 |
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 |
42 |
C results will be set. |
C results will be set. |
43 |
C xA - Tracer cell face area normal to X |
C xA :: Tracer cell face area normal to X |
44 |
C yA - Tracer cell face area normal to X |
C yA :: Tracer cell face area normal to X |
45 |
C uTrans - Zonal volume transport through cell face |
C uTrans :: Zonal volume transport through cell face |
46 |
C vTrans - Meridional volume transport through cell face |
C vTrans :: Meridional volume transport through cell face |
47 |
C rTrans - R-direction volume transport through cell face |
C rTrans :: R-direction volume transport through cell face |
48 |
C rVel - R-direction velocity at cell upper and lower faces |
C maskUp :: land/water mask for Wvel points (above tracer level) |
49 |
C maskC - land/water mask for tracer points |
C myThid ::Instance number for this innvocation of CALC_COMMON_FACTORS |
|
C maskUp - land/water mask for Wvel points (above tracer level) |
|
|
C myThid - Instance number for this innvocation of CALC_COMMON_FACTORS |
|
50 |
C |
C |
51 |
INTEGER bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown |
INTEGER bi,bj,iMin,iMax,jMin,jMax,k |
52 |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
53 |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
54 |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
55 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
56 |
_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) |
|
57 |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
58 |
C |
C |
59 |
INTEGER myThid |
INTEGER myThid |
|
CEndOfInterface |
|
60 |
|
|
61 |
|
C !LOCAL VARIABLES: |
62 |
C == Local variables == |
C == Local variables == |
63 |
C I, J, K - Loop counters |
C I, J :: 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. |
|
64 |
INTEGER i,j |
INTEGER i,j |
65 |
LOGICAL TOP_LAYER |
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 |
TOP_LAYER = K .EQ. 1 |
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 |
C-- Calculate tracer cell face open areas |
94 |
DO j=jMin,jMax |
DO j=jMin,jMax |
112 |
C-- Calculate vertical "volume transport" through |
C-- Calculate vertical "volume transport" through |
113 |
C-- tracer cell face *above* this level. |
C-- tracer cell face *above* this level. |
114 |
DO j=jMin,jMax |
DO j=jMin,jMax |
115 |
DO i=iMin,iMax |
DO i=iMin,iMax |
116 |
rTrans(i,j) = |
rTrans(i,j) = wVel(i,j,k,bi,bj)*rA(i,j,bi,bj) |
117 |
& 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 |
|
118 |
ENDDO |
ENDDO |
119 |
|
|
120 |
RETURN |
RETURN |