1 |
cnh |
1.5 |
C $Header: $ |
2 |
|
|
C $Name: $ |
3 |
adcroft |
1.1 |
#include "CPP_EEOPTIONS.h" |
4 |
|
|
|
5 |
|
|
CStartofinterface |
6 |
|
|
SUBROUTINE TIMEAVER_2FLD_XYZ( fld1, fld2, fldtave, dir, deltaT, |
7 |
|
|
I bi, bj, K, myThid ) |
8 |
|
|
C /==========================================================\ |
9 |
|
|
C | SUBROUTINE TIMEAVER_2FLD_XYZ | |
10 |
|
|
C | o Sum over time a product of two arrays depending on the | |
11 |
|
|
C | type of the second array (tracer_grid, u_grid, v_grid) | |
12 |
|
|
C | The first array must be on tracer_grid | |
13 |
|
|
C \==========================================================/ |
14 |
adcroft |
1.3 |
IMPLICIT NONE |
15 |
adcroft |
1.1 |
|
16 |
|
|
C == Global variables === |
17 |
|
|
#include "SIZE.h" |
18 |
|
|
#include "EEPARAMS.h" |
19 |
|
|
#include "AVER.h" |
20 |
|
|
|
21 |
|
|
C == Routine arguments == |
22 |
|
|
C myThid - Thread number for this instance of the routine. |
23 |
|
|
C dir - type of grid for 2nd array (0: tracer, 1: zonal, 2 merid) |
24 |
|
|
C fld - Input Field |
25 |
|
|
C fldtave - time averaged Field |
26 |
cnh |
1.2 |
_RL fld1(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
27 |
|
|
_RL fld2(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
28 |
|
|
_RL fldtave(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
29 |
adcroft |
1.1 |
INTEGER dir |
30 |
adcroft |
1.4 |
_RL deltaT |
31 |
adcroft |
1.1 |
INTEGER bi, bj, K, myThid |
32 |
|
|
|
33 |
|
|
CEndofinterface |
34 |
|
|
|
35 |
|
|
C == Local variables == |
36 |
|
|
C i,j,k,bi,bj - Loop counters |
37 |
|
|
INTEGER i, j |
38 |
|
|
|
39 |
|
|
IF ( dir.eq.0 ) THEN |
40 |
|
|
|
41 |
|
|
C DO bj = myByLo(myThid), myByHi(myThid) |
42 |
|
|
C DO bi = myBxLo(myThid), myBxHi(myThid) |
43 |
cnh |
1.2 |
C DO k=1,Nr |
44 |
adcroft |
1.1 |
DO j=1,sNy |
45 |
|
|
DO i=1,sNx |
46 |
|
|
fldtave(i,j,k,bi,bj)= fldtave(i,j,k,bi,bj) |
47 |
|
|
& + fld1(i,j,k,bi,bj)*fld2(i,j,k,bi,bj)*deltaT |
48 |
|
|
ENDDO |
49 |
|
|
ENDDO |
50 |
|
|
C ENDDO |
51 |
|
|
C ENDDO |
52 |
|
|
C ENDDO |
53 |
|
|
|
54 |
|
|
ELSEIF ( dir.eq.1 ) THEN |
55 |
|
|
|
56 |
|
|
C DO bj = myByLo(myThid), myByHi(myThid) |
57 |
|
|
C DO bi = myBxLo(myThid), myBxHi(myThid) |
58 |
cnh |
1.2 |
C DO k=1,Nr |
59 |
adcroft |
1.1 |
DO j=1,sNy |
60 |
|
|
DO i=1,sNx |
61 |
|
|
fldtave(i,j,k,bi,bj)= fldtave(i,j,k,bi,bj) |
62 |
|
|
& + .5 * ( fld1(i-1,j,k,bi,bj) + fld1(i,j,k,bi,bj) ) |
63 |
|
|
& * fld2(i,j,k,bi,bj) |
64 |
|
|
& * deltaT |
65 |
|
|
ENDDO |
66 |
|
|
ENDDO |
67 |
|
|
C ENDDO |
68 |
|
|
C ENDDO |
69 |
|
|
C ENDDO |
70 |
|
|
|
71 |
|
|
ELSEIF ( dir.eq.2 ) THEN |
72 |
|
|
|
73 |
|
|
C DO bj = myByLo(myThid), myByHi(myThid) |
74 |
|
|
C DO bi = myBxLo(myThid), myBxHi(myThid) |
75 |
cnh |
1.2 |
C DO k=1,Nr |
76 |
adcroft |
1.1 |
DO j=1,sNy |
77 |
|
|
DO i=1,sNx |
78 |
|
|
fldtave(i,j,k,bi,bj)= fldtave(i,j,k,bi,bj) |
79 |
|
|
& + .5 * ( fld1(i,j-1,k,bi,bj) + fld1(i,j,k,bi,bj) ) |
80 |
|
|
& * fld2(i,j,k,bi,bj) |
81 |
|
|
& * deltaT |
82 |
|
|
ENDDO |
83 |
|
|
ENDDO |
84 |
|
|
C ENDDO |
85 |
|
|
C ENDDO |
86 |
|
|
C ENDDO |
87 |
|
|
|
88 |
|
|
ENDIF |
89 |
|
|
|
90 |
|
|
RETURN |
91 |
|
|
END |