12 |
I myIter, myThid ) |
I myIter, myThid ) |
13 |
|
|
14 |
C !DESCRIPTION: |
C !DESCRIPTION: |
15 |
C Calculates stats for Kinetic energy |
C Calculates stats for Kinetic energy |
16 |
|
|
17 |
C !USES: |
C !USES: |
18 |
IMPLICIT NONE |
IMPLICIT NONE |
19 |
#include "SIZE.h" |
#include "SIZE.h" |
20 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
21 |
|
#include "PARAMS.h" |
22 |
#include "DYNVARS.h" |
#include "DYNVARS.h" |
23 |
#include "MONITOR.h" |
#include "MONITOR.h" |
24 |
#include "GRID.h" |
#include "GRID.h" |
29 |
CEOP |
CEOP |
30 |
|
|
31 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
32 |
INTEGER bi,bj,I,J,K |
INTEGER bi,bj,i,j,k |
33 |
_RL numPnts,theVol,tmpVal |
_RL numPnts,theVol,tmpVal |
34 |
_RL theMax,theMean,theVolMean,potEnMean |
_RL theMax,theMean,theVolMean,potEnMean |
35 |
_RL meanTile, volMeanTile, potEnMnTile, volTile |
_RL tileMean(nSx,nSy) |
36 |
|
_RL tileVlAv(nSx,nSy) |
37 |
|
_RL tilePEav(nSx,nSy) |
38 |
|
_RL tileVol (nSx,nSy) |
39 |
|
|
40 |
numPnts=0. |
numPnts=0. |
41 |
theVol=0. |
theVol=0. |
46 |
|
|
47 |
DO bj=myByLo(myThid),myByHi(myThid) |
DO bj=myByLo(myThid),myByHi(myThid) |
48 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
DO bi=myBxLo(myThid),myBxHi(myThid) |
49 |
volTile = 0. _d 0 |
tileVol(bi,bj) = 0. _d 0 |
50 |
meanTile = 0. _d 0 |
tileMean(bi,bj) = 0. _d 0 |
51 |
volMeanTile = 0. _d 0 |
tileVlAv(bi,bj) = 0. _d 0 |
52 |
potEnMnTile = 0. _d 0 |
tilePEav(bi,bj) = 0. _d 0 |
53 |
DO K=1,Nr |
DO k=1,Nr |
54 |
DO J=1,sNy |
DO j=1,sNy |
55 |
DO I=1,sNx |
DO i=1,sNx |
56 |
volTile=volTile+rA(i,j,bi,bj)*drF(k)*_hFacC(i,j,k,bi,bj) |
tileVol(bi,bj) = tileVol(bi,bj) |
57 |
|
& + rA(i,j,bi,bj)*deepFac2C(k) |
58 |
|
& *rhoFacC(k)*drF(k)*_hFacC(i,j,k,bi,bj) |
59 |
|
|
60 |
C- Vector Invariant form (like in pkg/mom_vecinv/mom_vi_calc_ke.F) |
C- Vector Invariant form (like in pkg/mom_vecinv/mom_vi_calc_ke.F) |
61 |
c tmpVal=0.25*( uVel( I , J ,K,bi,bj)*uVel( I , J ,K,bi,bj) |
c tmpVal=0.25*( uVel( i , j ,k,bi,bj)*uVel( i , j ,k,bi,bj) |
62 |
c & +uVel(I+1, J ,K,bi,bj)*uVel(I+1, J ,K,bi,bj) |
c & +uVel(i+1, j ,k,bi,bj)*uVel(i+1, j ,k,bi,bj) |
63 |
c & +vVel( I , J ,K,bi,bj)*vVel( I , J ,K,bi,bj) |
c & +vVel( i , j ,k,bi,bj)*vVel( i , j ,k,bi,bj) |
64 |
c & +vVel( I ,J+1,K,bi,bj)*vVel( I ,J+1,K,bi,bj) ) |
c & +vVel( i ,j+1,k,bi,bj)*vVel( i ,j+1,k,bi,bj) ) |
65 |
c volMeanTile=volMeanTile+tmpVal |
c tileVlAv(bi,bj) = tileVlAv(bi,bj) |
66 |
c & *ra(i,j,bi,bj)*drf(k)*hFacC(i,j,k,bi,bj) |
c & +tmpVal*rA(i,j,bi,bj)*drF(k)*hFacC(i,j,k,bi,bj) |
67 |
|
|
68 |
C- Energy conservative form (like in pkg/mom_fluxform/mom_calc_ke.F) |
C- Energy conservative form (like in pkg/mom_fluxform/mom_calc_ke.F) |
69 |
C this is the safe way to check the energy conservation |
C this is the safe way to check the energy conservation |
78 |
& +vVel(i,j+1,k,bi,bj)*vVel(i,j+1,k,bi,bj) |
& +vVel(i,j+1,k,bi,bj)*vVel(i,j+1,k,bi,bj) |
79 |
& *dxG(i,j+1,bi,bj)*dyC(i,j+1,bi,bj)*_hFacS(i,j+1,k,bi,bj) |
& *dxG(i,j+1,bi,bj)*dyC(i,j+1,bi,bj)*_hFacS(i,j+1,k,bi,bj) |
80 |
& ) |
& ) |
81 |
volMeanTile= volMeanTile + tmpVal*drF(k) |
tileVlAv(bi,bj) = tileVlAv(bi,bj) |
82 |
|
& + tmpVal*deepFac2C(k)*rhoFacC(k)*drF(k) |
83 |
tmpVal= tmpVal*_recip_hFacC(i,j,k,bi,bj)*recip_rA(i,j,bi,bj) |
tmpVal= tmpVal*_recip_hFacC(i,j,k,bi,bj)*recip_rA(i,j,bi,bj) |
84 |
|
|
85 |
theMax=max(theMax,tmpVal) |
theMax=MAX(theMax,tmpVal) |
86 |
IF (tmpVal.NE.0.) THEN |
IF (tmpVal.NE.0.) THEN |
87 |
meanTile=meanTile+tmpVal |
tileMean(bi,bj)=tileMean(bi,bj)+tmpVal |
88 |
numPnts=numPnts+1. |
numPnts=numPnts+1. |
89 |
ENDIF |
ENDIF |
90 |
|
|
92 |
ENDDO |
ENDDO |
93 |
ENDDO |
ENDDO |
94 |
C- Potential Energy (external mode): |
C- Potential Energy (external mode): |
95 |
DO J=1,sNy |
DO j=1,sNy |
96 |
DO I=1,sNx |
DO i=1,sNx |
97 |
tmpVal = 0.5 _d 0*Bo_surf(i,j,bi,bj) |
tmpVal = 0.5 _d 0*Bo_surf(i,j,bi,bj) |
98 |
& *etaN(i,j,bi,bj)*etaN(i,j,bi,bj) |
& *etaN(i,j,bi,bj)*etaN(i,j,bi,bj) |
99 |
C- jmc: if geoid not flat (phi0surf), needs to add this term. |
C- jmc: if geoid not flat (phi0surf), needs to add this term. |
100 |
C not sure for atmos/ocean in P ; or atmos. loading in ocean-Z |
C not sure for atmos/ocean in P ; or atmos. loading in ocean-Z |
101 |
tmpVal = tmpVal |
tmpVal = tmpVal |
102 |
& + phi0surf(i,j,bi,bj)*etaN(i,j,bi,bj) |
& + phi0surf(i,j,bi,bj)*etaN(i,j,bi,bj) |
103 |
potEnMnTile = potEnMnTile |
tilePEav(bi,bj) = tilePEav(bi,bj) |
104 |
& + tmpVal*rA(i,j,bi,bj)*maskH(i,j,bi,bj) |
& + tmpVal*rA(i,j,bi,bj)*deepFac2F(1)*maskH(i,j,bi,bj) |
105 |
c tmpVal = etaN(i,j,bi,bj) |
c tmpVal = etaN(i,j,bi,bj) |
106 |
c & + phi0surf(i,j,bi,bj)*recip_Bo(i,j,bi,bj) |
c & + phi0surf(i,j,bi,bj)*recip_Bo(i,j,bi,bj) |
107 |
c potEnMnTile = potEnMnTile |
c tilePEav(bi,bj) = tilePEav(bi,bj) |
108 |
c & + 0.5 _d 0*Bo_surf(i,j,bi,bj)*tmpVal*tmpVal |
c & + 0.5 _d 0*Bo_surf(i,j,bi,bj)*tmpVal*tmpVal |
109 |
c & *rA(i,j,bi,bj)*maskH(i,j,bi,bj) |
c & *rA(i,j,bi,bj)*maskH(i,j,bi,bj) |
110 |
ENDDO |
ENDDO |
111 |
ENDDO |
ENDDO |
112 |
theMean = theMean + meanTile |
c theMean = theMean + tileMean(bi,bj) |
113 |
theVol = theVol + volTile |
c theVol = theVol + tileVol(bi,bj) |
114 |
theVolMean = theVolMean + volMeanTile |
c theVolMean = theVolMean + tileVlAv(bi,bj) |
115 |
potEnMean = potEnMean + potEnMnTile |
c potEnMean = potEnMean + tilePEav(bi,bj) |
116 |
C- end bi,bj loops |
C- end bi,bj loops |
117 |
ENDDO |
ENDDO |
118 |
ENDDO |
ENDDO |
119 |
_GLOBAL_SUM_R8(numPnts,myThid) |
_GLOBAL_SUM_R8(numPnts,myThid) |
120 |
_GLOBAL_MAX_R8(theMax,myThid) |
_GLOBAL_MAX_R8(theMax,myThid) |
121 |
_GLOBAL_SUM_R8(theMean,myThid) |
c _GLOBAL_SUM_R8(theMean,myThid) |
122 |
|
c _GLOBAL_SUM_R8(theVol,myThid) |
123 |
|
c _GLOBAL_SUM_R8(theVolMean,myThid) |
124 |
|
c _GLOBAL_SUM_R8(potEnMean, myThid) |
125 |
|
CALL GLOBAL_SUM_TILE_RL( tileMean, theMean , myThid ) |
126 |
|
CALL GLOBAL_SUM_TILE_RL( tileVol , theVol , myThid ) |
127 |
|
CALL GLOBAL_SUM_TILE_RL( tileVlAv, theVolMean, myThid ) |
128 |
|
CALL GLOBAL_SUM_TILE_RL( tilePEav, potEnMean , myThid ) |
129 |
IF (numPnts.NE.0.) theMean=theMean/numPnts |
IF (numPnts.NE.0.) theMean=theMean/numPnts |
|
_GLOBAL_SUM_R8(theVol,myThid) |
|
|
_GLOBAL_SUM_R8(theVolMean,myThid) |
|
|
_GLOBAL_SUM_R8(potEnMean, myThid) |
|
130 |
IF (theVol.NE.0.) THEN |
IF (theVol.NE.0.) THEN |
131 |
theVolMean=theVolMean/theVol |
theVolMean=theVolMean/theVol |
132 |
potEnMean = potEnMean/theVol |
potEnMean = potEnMean/theVol |