/[MITgcm]/MITgcm/verification/global_ocean_pressure/code/remove_mean_rl.F
ViewVC logotype

Contents of /MITgcm/verification/global_ocean_pressure/code/remove_mean_rl.F

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


Revision 1.2 - (show annotations) (download)
Fri Feb 10 07:58:57 2006 UTC (18 years, 2 months ago) by mlosch
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
o remove_mean_rl is now in new routine remove_mean and no longer need

1 C $Header:
2 C $Name:
3
4 #include "CPP_OPTIONS.h"
5
6 SUBROUTINE REMOVE_MEAN_RL(
7 I myNr, arr, arrMask, arrhFac, arrArea, arrDr,
8 I arrName,
9 I myThid )
10 C /==========================================================\
11 C | SUBROUTINE REMOVE_MEAN_RL |
12 C | o Calculate mean of global array "_RL arr" and substract |
13 C | it from the array |
14 C |==========================================================|
15 C \==========================================================/
16 IMPLICIT NONE
17
18 C === Global data ===
19 #include "SIZE.h"
20 #include "EEPARAMS.h"
21
22 C === Routine arguments ===
23 INTEGER myNr
24 _RL arr(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
25 _RS arrMask(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
26 _RS arrhFac(1-OLx:sNx+OLx,1-OLy:sNy+OLy,myNr,nSx,nSy)
27 _RS arrArea(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
28 _RS arrDr(myNr)
29 CHARACTER*(*) arrName
30 INTEGER myThid
31
32 C === Local variables ====
33 INTEGER bi,bj,I,J,K
34 _RL tmpVal
35 _RL theMean
36 _RL theVol
37 _RL tmpVol
38 CHARACTER*(max_len_mbuf) msgbuf
39
40 theMean=0.
41 theVol=0.
42
43 DO bj=myByLo(myThid),myByHi(myThid)
44 DO bi=myBxLo(myThid),myBxHi(myThid)
45 DO K=1,myNr
46 DO J=1,sNy
47 DO I=1,sNx
48 tmpVal=arr(I,J,K,bi,bj)
49 IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
50 tmpVol = arrArea(I,J,bi,bj)*arrhFac(I,J,K,bi,bj)*arrDr(K)
51 theVol = theVol + tmpVol
52 theMean = theMean + tmpVol*tmpVal
53 ENDIF
54 ENDDO
55 ENDDO
56 ENDDO
57 ENDDO
58 ENDDO
59
60 _GLOBAL_SUM_R8(theVol,myThid)
61 _GLOBAL_SUM_R8(theMean,myThid)
62
63 IF (theVol.GT.0.) THEN
64 theMean=theMean/theVol
65
66 DO bj=myByLo(myThid),myByHi(myThid)
67 DO bi=myBxLo(myThid),myBxHi(myThid)
68 DO K=1,myNr
69 DO J=1,sNy
70 DO I=1,sNx
71 IF (arrMask(I,J,K,bi,bj).NE.0.) THEN
72 arr(I,J,K,bi,bj) = arr(I,J,K,bi,bj) - theMean
73 ENDIF
74 ENDDO
75 ENDDO
76 ENDDO
77 ENDDO
78 ENDDO
79
80 ENDIF
81
82 C Print the global mean to standard output, this is a measure for
83 C the drift of the array arr
84 WRITE(msgbuf,'(a,a,a,e24.17)')
85 & '%GM: Global mean of ', arrName, ' = ', theMean
86 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
87 & SQUEEZE_RIGHT , 1)
88
89
90 RETURN
91 END

  ViewVC Help
Powered by ViewVC 1.1.22