/[MITgcm]/MITgcm/pkg/ebm/ebm_zonalmean.F
ViewVC logotype

Contents of /MITgcm/pkg/ebm/ebm_zonalmean.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Tue Apr 28 18:42:56 2009 UTC (15 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint63a, checkpoint62, checkpoint63, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61n, checkpoint61o, checkpoint61m, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.3: +3 -3 lines
change macros (EXCH & GLOBAL_SUM/MAX) sufix _R4/_R8 to _RS/_RL
 when applied to _RS/_RL variable
BUG to fix: global_sum of var in common block (EBM.h) is wrong (multi-threaded)

1 C $Header: /u/gcmpack/MITgcm/pkg/ebm/ebm_zonalmean.F,v 1.3 2004/05/21 21:45:35 heimbach Exp $
2 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 #ifdef ALLOW_AUTODIFF_TAMC
23 # include "tamc.h"
24 # include "tamc_keys.h"
25 #endif
26
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 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 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 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 ENDDO
73 ENDDO
74 ENDDO
75
76 DO bj=myByLo(myThid),myByHi(myThid)
77 DO j=1-OLy,sNy+OLy
78 _GLOBAL_SUM_RL( CountX(j,bj), myThid )
79 _GLOBAL_SUM_RL( ZonalMeanSST(j,bj), myThid )
80 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 IF ( CountX(j,bj) .GT. 0.0) THEN
89 ZonalMeanSST(j,bj) = ZonalMeanSST(j,bj)/CountX(j,bj)
90 ENDIF
91 ENDDO
92 ENDDO
93
94 #endif /* ALLOW_EBM */
95
96 RETURN
97 END
98
99
100

  ViewVC Help
Powered by ViewVC 1.1.22