1 |
heimbach |
1.15 |
C $Header: /u/gcmpack/MITgcm/pkg/monitor/mon_ke.F,v 1.14 2005/11/04 01:33:05 jmc Exp $ |
2 |
adcroft |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
adcroft |
1.11 |
#include "MONITOR_OPTIONS.h" |
5 |
adcroft |
1.1 |
|
6 |
edhill |
1.12 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
7 |
|
|
CBOP |
8 |
|
|
C !ROUTINE: MON_KE |
9 |
|
|
|
10 |
|
|
C !INTERFACE: |
11 |
adcroft |
1.1 |
SUBROUTINE MON_KE( |
12 |
edhill |
1.12 |
I myIter, myThid ) |
13 |
|
|
|
14 |
|
|
C !DESCRIPTION: |
15 |
|
|
C Calculates stats for Kinetic energy |
16 |
|
|
|
17 |
|
|
C !USES: |
18 |
adcroft |
1.1 |
IMPLICIT NONE |
19 |
|
|
#include "SIZE.h" |
20 |
|
|
#include "EEPARAMS.h" |
21 |
|
|
#include "DYNVARS.h" |
22 |
cnh |
1.5 |
#include "MONITOR.h" |
23 |
jmc |
1.8 |
#include "GRID.h" |
24 |
jmc |
1.10 |
#include "SURFACE.h" |
25 |
adcroft |
1.1 |
|
26 |
edhill |
1.12 |
C !INPUT PARAMETERS: |
27 |
jmc |
1.10 |
INTEGER myIter, myThid |
28 |
edhill |
1.12 |
CEOP |
29 |
adcroft |
1.1 |
|
30 |
edhill |
1.12 |
C !LOCAL VARIABLES: |
31 |
adcroft |
1.1 |
INTEGER bi,bj,I,J,K |
32 |
jmc |
1.14 |
_RL numPnts,theVol,tmpVal |
33 |
jmc |
1.10 |
_RL theMax,theMean,theVolMean,potEnMean |
34 |
jmc |
1.13 |
_RL meanTile, volMeanTile, potEnMnTile, volTile |
35 |
adcroft |
1.1 |
|
36 |
jmc |
1.10 |
numPnts=0. |
37 |
|
|
theVol=0. |
38 |
adcroft |
1.1 |
theMax=0. |
39 |
|
|
theMean=0. |
40 |
jmc |
1.8 |
theVolMean=0. |
41 |
jmc |
1.10 |
potEnMean =0. |
42 |
adcroft |
1.1 |
|
43 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
44 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
45 |
jmc |
1.13 |
volTile = 0. _d 0 |
46 |
|
|
meanTile = 0. _d 0 |
47 |
|
|
volMeanTile = 0. _d 0 |
48 |
|
|
potEnMnTile = 0. _d 0 |
49 |
adcroft |
1.1 |
DO K=1,Nr |
50 |
|
|
DO J=1,sNy |
51 |
|
|
DO I=1,sNx |
52 |
heimbach |
1.15 |
volTile=volTile+rA(i,j,bi,bj)*drF(k)*_hFacC(i,j,k,bi,bj) |
53 |
jmc |
1.9 |
|
54 |
|
|
C- Vector Invariant form (like in pkg/mom_vecinv/mom_vi_calc_ke.F) |
55 |
|
|
c tmpVal=0.25*( uVel( I , J ,K,bi,bj)*uVel( I , J ,K,bi,bj) |
56 |
|
|
c & +uVel(I+1, J ,K,bi,bj)*uVel(I+1, J ,K,bi,bj) |
57 |
|
|
c & +vVel( I , J ,K,bi,bj)*vVel( I , J ,K,bi,bj) |
58 |
|
|
c & +vVel( I ,J+1,K,bi,bj)*vVel( I ,J+1,K,bi,bj) ) |
59 |
jmc |
1.13 |
c volMeanTile=volMeanTile+tmpVal |
60 |
jmc |
1.9 |
c & *ra(i,j,bi,bj)*drf(k)*hFacC(i,j,k,bi,bj) |
61 |
|
|
|
62 |
|
|
C- Energy conservative form (like in pkg/mom_fluxform/mom_calc_ke.F) |
63 |
|
|
C this is the safe way to check the energy conservation |
64 |
|
|
C with no assumption on how grid spacing & area are defined. |
65 |
|
|
tmpVal=0.25*( |
66 |
|
|
& uVel( i ,j,k,bi,bj)*uVel( i ,j,k,bi,bj) |
67 |
heimbach |
1.15 |
& *dyG( i ,j,bi,bj)*dxC( i ,j,bi,bj)*_hFacW( i ,j,k,bi,bj) |
68 |
jmc |
1.9 |
& +uVel(i+1,j,k,bi,bj)*uVel(i+1,j,k,bi,bj) |
69 |
heimbach |
1.15 |
& *dyG(i+1,j,bi,bj)*dxC(i+1,j,bi,bj)*_hFacW(i+1,j,k,bi,bj) |
70 |
jmc |
1.9 |
& +vVel(i, j ,k,bi,bj)*vVel(i, j ,k,bi,bj) |
71 |
heimbach |
1.15 |
& *dxG(i, j ,bi,bj)*dyC(i, j ,bi,bj)*_hFacS(i, j ,k,bi,bj) |
72 |
jmc |
1.9 |
& +vVel(i,j+1,k,bi,bj)*vVel(i,j+1,k,bi,bj) |
73 |
heimbach |
1.15 |
& *dxG(i,j+1,bi,bj)*dyC(i,j+1,bi,bj)*_hFacS(i,j+1,k,bi,bj) |
74 |
jmc |
1.9 |
& ) |
75 |
jmc |
1.13 |
volMeanTile= volMeanTile + tmpVal*drF(k) |
76 |
heimbach |
1.15 |
tmpVal= tmpVal*_recip_hFacC(i,j,k,bi,bj)*recip_rA(i,j,bi,bj) |
77 |
jmc |
1.9 |
|
78 |
adcroft |
1.1 |
theMax=max(theMax,tmpVal) |
79 |
|
|
IF (tmpVal.NE.0.) THEN |
80 |
jmc |
1.13 |
meanTile=meanTile+tmpVal |
81 |
jmc |
1.10 |
numPnts=numPnts+1. |
82 |
adcroft |
1.1 |
ENDIF |
83 |
jmc |
1.9 |
|
84 |
adcroft |
1.1 |
ENDDO |
85 |
|
|
ENDDO |
86 |
|
|
ENDDO |
87 |
jmc |
1.10 |
C- Potential Energy (external mode): |
88 |
|
|
DO J=1,sNy |
89 |
|
|
DO I=1,sNx |
90 |
|
|
tmpVal = 0.5 _d 0*Bo_surf(i,j,bi,bj) |
91 |
|
|
& *etaN(i,j,bi,bj)*etaN(i,j,bi,bj) |
92 |
|
|
C- jmc: if geoid not flat (phi0surf), needs to add this term. |
93 |
|
|
C not sure for atmos/ocean in P ; or atmos. loading in ocean-Z |
94 |
|
|
tmpVal = tmpVal |
95 |
|
|
& + phi0surf(i,j,bi,bj)*etaN(i,j,bi,bj) |
96 |
jmc |
1.13 |
potEnMnTile = potEnMnTile |
97 |
jmc |
1.10 |
& + tmpVal*rA(i,j,bi,bj)*maskH(i,j,bi,bj) |
98 |
|
|
c tmpVal = etaN(i,j,bi,bj) |
99 |
|
|
c & + phi0surf(i,j,bi,bj)*recip_Bo(i,j,bi,bj) |
100 |
jmc |
1.13 |
c potEnMnTile = potEnMnTile |
101 |
jmc |
1.10 |
c & + 0.5 _d 0*Bo_surf(i,j,bi,bj)*tmpVal*tmpVal |
102 |
|
|
c & *rA(i,j,bi,bj)*maskH(i,j,bi,bj) |
103 |
|
|
ENDDO |
104 |
|
|
ENDDO |
105 |
jmc |
1.13 |
theMean = theMean + meanTile |
106 |
|
|
theVol = theVol + volTile |
107 |
|
|
theVolMean = theVolMean + volMeanTile |
108 |
|
|
potEnMean = potEnMean + potEnMnTile |
109 |
jmc |
1.10 |
C- end bi,bj loops |
110 |
adcroft |
1.1 |
ENDDO |
111 |
|
|
ENDDO |
112 |
jmc |
1.10 |
_GLOBAL_SUM_R8(numPnts,myThid) |
113 |
adcroft |
1.1 |
_GLOBAL_MAX_R8(theMax,myThid) |
114 |
|
|
_GLOBAL_SUM_R8(theMean,myThid) |
115 |
jmc |
1.10 |
IF (numPnts.NE.0.) theMean=theMean/numPnts |
116 |
jmc |
1.8 |
_GLOBAL_SUM_R8(theVol,myThid) |
117 |
|
|
_GLOBAL_SUM_R8(theVolMean,myThid) |
118 |
jmc |
1.10 |
_GLOBAL_SUM_R8(potEnMean, myThid) |
119 |
|
|
IF (theVol.NE.0.) THEN |
120 |
|
|
theVolMean=theVolMean/theVol |
121 |
|
|
potEnMean = potEnMean/theVol |
122 |
|
|
ENDIF |
123 |
|
|
|
124 |
|
|
C-- Print stats for (barotropic) Potential Energy: |
125 |
|
|
CALL MON_SET_PREF('pe_b',myThid) |
126 |
|
|
CALL MON_OUT_RL(mon_string_none,potEnMean, |
127 |
|
|
& mon_foot_mean,myThid) |
128 |
adcroft |
1.1 |
|
129 |
jmc |
1.10 |
C-- Print stats for KE |
130 |
|
|
CALL MON_SET_PREF('ke',myThid) |
131 |
jmc |
1.8 |
CALL MON_OUT_RL(mon_string_none,theMax,mon_foot_max,myThid) |
132 |
jmc |
1.10 |
c CALL MON_OUT_RL(mon_string_none,theMean,mon_foot_mean,myThid) |
133 |
jmc |
1.8 |
CALL MON_OUT_RL(mon_string_none,theVolMean, |
134 |
jmc |
1.10 |
& mon_foot_mean,myThid) |
135 |
jmc |
1.9 |
CALL MON_OUT_RL(mon_string_none,theVol, |
136 |
|
|
& mon_foot_vol,myThid) |
137 |
adcroft |
1.1 |
|
138 |
|
|
RETURN |
139 |
|
|
END |
140 |
edhill |
1.12 |
|
141 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |