1 |
C $Header: /u/gcmpack/MITgcm/model/src/calc_common_factors.F,v 1.21 2006/06/18 23:20:35 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: CALC_COMMON_FACTORS |
8 |
C !INTERFACE: |
9 |
SUBROUTINE CALC_COMMON_FACTORS( |
10 |
I uVel, vVel, |
11 |
O uFld, vFld, uTrans, vTrans, xA, yA, |
12 |
I k,bi,bj, 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 !USES: |
28 |
IMPLICIT NONE |
29 |
C == GLobal variables == |
30 |
#include "SIZE.h" |
31 |
#include "EEPARAMS.h" |
32 |
#include "PARAMS.h" |
33 |
#include "GRID.h" |
34 |
|
35 |
C !INPUT/OUTPUT PARAMETERS: |
36 |
C == Routine arguments == |
37 |
C uVel :: velocity, zonal component |
38 |
C vVel :: velocity, meridional component |
39 |
C uFld :: 2-D local copy of horizontal velocity, zonal component |
40 |
C vFld :: 2-D local copy of horizontal velocity, merid. component |
41 |
C uTrans :: Zonal volume transport through cell face |
42 |
C vTrans :: Meridional volume transport through cell face |
43 |
C xA :: Tracer cell face area normal to X |
44 |
C yA :: Tracer cell face area normal to X |
45 |
C k,bi,bj :: vertical & tile indices for this calculation |
46 |
C myThid :: my Thread Id. number |
47 |
|
48 |
_RL uVel (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
49 |
_RL vVel (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
50 |
_RL uFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
51 |
_RL vFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
52 |
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
53 |
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
54 |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
55 |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
56 |
INTEGER k,bi,bj |
57 |
INTEGER myThid |
58 |
|
59 |
C !LOCAL VARIABLES: |
60 |
C == Local variables == |
61 |
C i, j :: Loop counters |
62 |
INTEGER i,j |
63 |
CEOP |
64 |
|
65 |
C-- Initialisation |
66 |
c DO j=1-OLy,sNy+OLy |
67 |
c DO i=1-OLx,sNx+OLx |
68 |
c xA(i,j) = 0. _d 0 |
69 |
c yA(i,j) = 0. _d 0 |
70 |
c uFld(i,j) = 0. _d 0 |
71 |
c vFld(i,j) = 0. _d 0 |
72 |
c uTrans(i,j) = 0. _d 0 |
73 |
c vTrans(i,j) = 0. _d 0 |
74 |
c ENDDO |
75 |
c ENDDO |
76 |
|
77 |
C-- Calculate tracer cell face open areas |
78 |
DO j=1-OLy,sNy+OLy |
79 |
DO i=1-OLx,sNx+OLx |
80 |
xA(i,j) = _dyG(i,j,bi,bj)*deepFacC(k) |
81 |
& *drF(k)*_hFacW(i,j,k,bi,bj) |
82 |
yA(i,j) = _dxG(i,j,bi,bj)*deepFacC(k) |
83 |
& *drF(k)*_hFacS(i,j,k,bi,bj) |
84 |
ENDDO |
85 |
ENDDO |
86 |
|
87 |
C-- Make a local copy of velocity component : |
88 |
DO j=1-OLy,sNy+OLy |
89 |
DO i=1-OLx,sNx+OLx |
90 |
uFld(i,j) = uVel(i,j,k,bi,bj) |
91 |
vFld(i,j) = vVel(i,j,k,bi,bj) |
92 |
ENDDO |
93 |
ENDDO |
94 |
|
95 |
C-- Calculate "volume transports" through tracer cell faces. |
96 |
C anelastic: scaled by rhoFacC (~ mass transport) |
97 |
DO j=1-OLy,sNy+OLy |
98 |
DO i=1-OLx,sNx+OLx |
99 |
uTrans(i,j) = uFld(i,j)*xA(i,j)*rhoFacC(k) |
100 |
vTrans(i,j) = vFld(i,j)*yA(i,j)*rhoFacC(k) |
101 |
ENDDO |
102 |
ENDDO |
103 |
|
104 |
RETURN |
105 |
END |