forked from altMITgcm/MITgcm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gchem_surfmean.F
59 lines (49 loc) · 1.61 KB
/
gchem_surfmean.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
C $Header: /u/gcmpack/MITgcm/pkg/gchem/gchem_surfmean.F,v 1.1 2014/05/06 20:46:53 jahn Exp $
C $Name: $
#include "GCHEM_OPTIONS.h"
C !INTERFACE: ==========================================================
SUBROUTINE GCHEM_SURFMEAN(
I tracer,
O gsm_tracer,
I myThid )
C !DESCRIPTION:
C Calculate surface mean of tracer
C !USES: ===============================================================
IMPLICIT NONE
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "GRID.h"
C !INPUT PARAMETERS: ===================================================
C myThid :: thread number
INTEGER myThid
_RL tracer (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
C !OUTPUT PARAMETERS: ===================================================
C gcm_tracer :: surface mean of tracer
_RL gsm_tracer
C !LOCAL VARIABLES: ====================================================
INTEGER i,j,bi,bj
INTEGER ks
_RL sumTracerTile(nSx,nSy)
_RL sumTracer
CEOP
IF ( usingPCoords ) THEN
ks = Nr
ELSE
ks = 1
ENDIF
DO bj=myByLo(myThid),myByHi(myThid)
DO bi=myBxLo(myThid),myBxHi(myThid)
sumTracerTile(bi,bj) = 0. _d 0
DO j=1,sNy
DO i=1,sNx
sumTracerTile(bi,bj) = sumTracerTile(bi,bj)
& + tracer(i,j,ks,bi,bj)*rA(i,j,bi,bj)*maskInC(i,j,bi,bj)
ENDDO
ENDDO
ENDDO
ENDDO
CALL GLOBAL_SUM_TILE_RL(sumTracerTile,sumTracer,myThid)
gsm_tracer = sumTracer/globalArea
RETURN
END