1 |
jmc |
1.4 |
C $Header: /u/gcmpack/MITgcm/pkg/ebm/ebm_zonalmean.F,v 1.3 2004/05/21 21:45:35 heimbach Exp $ |
2 |
heimbach |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "EBM_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
SUBROUTINE EBM_ZONALMEAN( myTime, myIter, myThid ) |
7 |
|
|
C |==========================================================| |
8 |
|
|
C | S/R CALCULATE ZONAL MEAN TEMPERATURE | |
9 |
|
|
C |==========================================================| |
10 |
|
|
|
11 |
|
|
IMPLICIT NONE |
12 |
|
|
|
13 |
|
|
C === Global variables === |
14 |
|
|
#include "SIZE.h" |
15 |
|
|
#include "EEPARAMS.h" |
16 |
|
|
#include "PARAMS.h" |
17 |
|
|
#include "DYNVARS.h" |
18 |
|
|
#include "GRID.h" |
19 |
|
|
#ifdef ALLOW_EBM |
20 |
|
|
# include "EBM.h" |
21 |
|
|
#endif |
22 |
heimbach |
1.3 |
#ifdef ALLOW_AUTODIFF_TAMC |
23 |
|
|
# include "tamc.h" |
24 |
|
|
# include "tamc_keys.h" |
25 |
|
|
#endif |
26 |
heimbach |
1.1 |
|
27 |
|
|
C === Routine arguments === |
28 |
|
|
C myThid - Instance number for this innvocation |
29 |
|
|
INTEGER myThid |
30 |
|
|
INTEGER myIter |
31 |
|
|
_RL myTime |
32 |
|
|
|
33 |
|
|
CEndOfInterface |
34 |
|
|
C == Local variables == |
35 |
|
|
C I, J, K - Loop counters |
36 |
|
|
C CountX_tile - number of ocean points in each latitude band on each tile |
37 |
|
|
C maskC - Land/Ocean mask |
38 |
|
|
C ZonalMean_tile - zonal temperature average on each tile |
39 |
|
|
|
40 |
|
|
#ifdef ALLOW_EBM |
41 |
|
|
|
42 |
|
|
INTEGER i, j, k, bi, bj |
43 |
|
|
_RL CountX_tile(1-OLy:sNy+OLy,nSx,nSy) |
44 |
|
|
_RL ZonalMean_tile(1-OLy:sNy+OLy, nSx, nSy) |
45 |
|
|
|
46 |
|
|
C-- Top layer only |
47 |
|
|
k = 1 |
48 |
|
|
|
49 |
|
|
c-- Initialise |
50 |
heimbach |
1.2 |
DO bj=myByLo(myThid),myByHi(myThid) |
51 |
|
|
DO j=1-OLy,sNy+OLy |
52 |
|
|
ZonalMeanSST(j,bj) = 0.0 |
53 |
|
|
CountX(j,bj) = 0.0 |
54 |
|
|
ENDDO |
55 |
heimbach |
1.1 |
ENDDO |
56 |
|
|
|
57 |
|
|
C-- Calculate the zonal mean |
58 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
59 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
60 |
|
|
DO j = 1-OLy, sNy+OLy |
61 |
|
|
CountX_tile(j,bi,bj) = 0.0 |
62 |
|
|
ZonalMean_tile(j,bi,bj) = 0.0 |
63 |
|
|
DO i=1,sNx |
64 |
|
|
ZonalMean_tile(j,bi,bj) = ZonalMean_tile(j,bi,bj) + |
65 |
|
|
& theta(i,j,k,bi,bj) |
66 |
|
|
CountX_tile(j,bi,bj) = CountX_tile(j,bi,bj) + |
67 |
|
|
& maskC(i,j,k,bi,bj) |
68 |
|
|
ENDDO |
69 |
heimbach |
1.3 |
ZonalMeanSST(j,bj) = ZonalMeanSST(j,bj) + |
70 |
|
|
& ZonalMean_tile(j,bi,bj) |
71 |
|
|
CountX(j,bj) = CountX(j,bj) + CountX_tile(j,bi,bj) |
72 |
heimbach |
1.1 |
ENDDO |
73 |
|
|
ENDDO |
74 |
|
|
ENDDO |
75 |
|
|
|
76 |
heimbach |
1.2 |
DO bj=myByLo(myThid),myByHi(myThid) |
77 |
|
|
DO j=1-OLy,sNy+OLy |
78 |
jmc |
1.4 |
_GLOBAL_SUM_RL( CountX(j,bj), myThid ) |
79 |
|
|
_GLOBAL_SUM_RL( ZonalMeanSST(j,bj), myThid ) |
80 |
heimbach |
1.3 |
ENDDO |
81 |
|
|
ENDDO |
82 |
|
|
|
83 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
84 |
|
|
CADJ STORE CountX = comlev1, key = ikey_dynamics |
85 |
|
|
#endif |
86 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
87 |
|
|
DO j=1-OLy,sNy+OLy |
88 |
heimbach |
1.2 |
IF ( CountX(j,bj) .GT. 0.0) THEN |
89 |
|
|
ZonalMeanSST(j,bj) = ZonalMeanSST(j,bj)/CountX(j,bj) |
90 |
|
|
ENDIF |
91 |
|
|
ENDDO |
92 |
heimbach |
1.1 |
ENDDO |
93 |
|
|
|
94 |
|
|
#endif /* ALLOW_EBM */ |
95 |
|
|
|
96 |
|
|
RETURN |
97 |
|
|
END |
98 |
|
|
|
99 |
|
|
|
100 |
|
|
|