1 |
adcroft |
1.2 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/Attic/integrate_for_w.F,v 1.1.2.1 2001/01/08 20:41:31 adcroft Exp $ |
2 |
|
|
|
3 |
|
|
#include "CPP_OPTIONS.h" |
4 |
|
|
|
5 |
|
|
CStartOfInterFace |
6 |
|
|
SUBROUTINE INTEGRATE_FOR_W( |
7 |
|
|
I bi,bj,k,uFld,vFld, |
8 |
|
|
O wFld, |
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 \==========================================================/ |
22 |
|
|
IMPLICIT NONE |
23 |
|
|
|
24 |
|
|
C == GLobal variables == |
25 |
|
|
#include "SIZE.h" |
26 |
|
|
#include "EEPARAMS.h" |
27 |
|
|
#include "PARAMS.h" |
28 |
|
|
#include "GRID.h" |
29 |
|
|
|
30 |
|
|
C == Routine arguments == |
31 |
|
|
INTEGER bi,bj,k |
32 |
|
|
_RL uFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
33 |
|
|
_RL vFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
34 |
|
|
_RL wFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
35 |
|
|
INTEGER myThid |
36 |
|
|
CEndOfInterface |
37 |
|
|
|
38 |
|
|
C == Local variables == |
39 |
|
|
INTEGER i,j |
40 |
|
|
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
41 |
|
|
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
42 |
|
|
|
43 |
|
|
C-- Calculate velocity field "volume transports" through |
44 |
|
|
C tracer cell faces. |
45 |
|
|
DO j=1-Oly,sNy+Oly |
46 |
|
|
DO i=1-Olx,sNx+Olx |
47 |
|
|
uTrans(i,j) = uFld(i,j,k,bi,bj)* |
48 |
|
|
& _dyG(i,j,bi,bj) |
49 |
|
|
& *drF(k)*_hFacW(i,j,k,bi,bj) |
50 |
|
|
vTrans(i,j) = vFld(i,j,k,bi,bj)* |
51 |
|
|
& _dxG(i,j,bi,bj) |
52 |
|
|
& *drF(k)*_hFacS(i,j,k,bi,bj) |
53 |
|
|
ENDDO |
54 |
|
|
ENDDO |
55 |
|
|
|
56 |
|
|
C-- Calculate vertical "volume transport" through |
57 |
|
|
C tracer cell face *above* this level. |
58 |
|
|
IF (k.eq.1 .AND. rigidLid) THEN |
59 |
|
|
DO j=1-Oly,sNy+Oly-1 |
60 |
|
|
DO i=1-Olx,sNx+Olx-1 |
61 |
|
|
wFld(i,j,k,bi,bj) = 0. |
62 |
|
|
ENDDO |
63 |
|
|
ENDDO |
64 |
|
|
ELSEIF (k.eq.Nr) THEN |
65 |
|
|
DO j=1-Oly,sNy+Oly-1 |
66 |
|
|
DO i=1-Olx,sNx+Olx-1 |
67 |
|
|
wFld(i,j,k,bi,bj) = |
68 |
|
|
& -( |
69 |
|
|
& uTrans(i+1,j)-uTrans(i,j) |
70 |
|
|
& +vTrans(i,j+1)-vTrans(i,j) |
71 |
|
|
& )/rA(i,j,bi,bj) |
72 |
|
|
ENDDO |
73 |
|
|
ENDDO |
74 |
|
|
ELSE |
75 |
|
|
DO j=1-Oly,sNy+Oly-1 |
76 |
|
|
DO i=1-Olx,sNx+Olx-1 |
77 |
|
|
wFld(i,j,k,bi,bj) = wFld(i,j,k+1,bi,bj) |
78 |
|
|
& -( |
79 |
|
|
& uTrans(i+1,j)-uTrans(i,j) |
80 |
|
|
& +vTrans(i,j+1)-vTrans(i,j) |
81 |
|
|
& )/rA(i,j,bi,bj) |
82 |
|
|
ENDDO |
83 |
|
|
ENDDO |
84 |
|
|
ENDIF |
85 |
|
|
|
86 |
|
|
RETURN |
87 |
|
|
END |