1 |
jmc |
1.9 |
C $Header: /u/gcmpack/MITgcm/pkg/monitor/mon_ke.F,v 1.8 2001/11/08 16:47:34 jmc Exp $ |
2 |
adcroft |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "CPP_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
SUBROUTINE MON_KE( |
7 |
|
|
I myThid ) |
8 |
|
|
C /==========================================================\ |
9 |
|
|
C | SUBROUTINE MON_KE | |
10 |
|
|
C | o Calculates stats for Kinetic energy | |
11 |
|
|
C |==========================================================| |
12 |
|
|
C \==========================================================/ |
13 |
|
|
IMPLICIT NONE |
14 |
|
|
|
15 |
|
|
C === Global data === |
16 |
|
|
#include "SIZE.h" |
17 |
|
|
#include "EEPARAMS.h" |
18 |
|
|
#include "DYNVARS.h" |
19 |
cnh |
1.5 |
#include "MONITOR.h" |
20 |
jmc |
1.8 |
#include "GRID.h" |
21 |
adcroft |
1.1 |
|
22 |
|
|
C === Routine arguments === |
23 |
|
|
INTEGER myThid |
24 |
|
|
|
25 |
|
|
C === Local variables ==== |
26 |
|
|
INTEGER bi,bj,I,J,K |
27 |
jmc |
1.9 |
_RL tmpVal,tmpVol,theMax,theMean,theVolMean,theVol |
28 |
adcroft |
1.1 |
INTEGER numPnts |
29 |
|
|
|
30 |
|
|
theMax=0. |
31 |
jmc |
1.8 |
numPnts=0 |
32 |
adcroft |
1.1 |
theMean=0. |
33 |
jmc |
1.8 |
theVolMean=0. |
34 |
|
|
theVol=0. |
35 |
adcroft |
1.1 |
|
36 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
37 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
38 |
|
|
DO K=1,Nr |
39 |
|
|
DO J=1,sNy |
40 |
|
|
DO I=1,sNx |
41 |
jmc |
1.9 |
theVol=theVol+rA(i,j,bi,bj)*drF(k)*hFacC(i,j,k,bi,bj) |
42 |
|
|
|
43 |
|
|
C- Vector Invariant form (like in pkg/mom_vecinv/mom_vi_calc_ke.F) |
44 |
|
|
c tmpVal=0.25*( uVel( I , J ,K,bi,bj)*uVel( I , J ,K,bi,bj) |
45 |
|
|
c & +uVel(I+1, J ,K,bi,bj)*uVel(I+1, J ,K,bi,bj) |
46 |
|
|
c & +vVel( I , J ,K,bi,bj)*vVel( I , J ,K,bi,bj) |
47 |
|
|
c & +vVel( I ,J+1,K,bi,bj)*vVel( I ,J+1,K,bi,bj) ) |
48 |
|
|
c theVolMean=theVolMean+tmpVal |
49 |
|
|
c & *ra(i,j,bi,bj)*drf(k)*hFacC(i,j,k,bi,bj) |
50 |
|
|
|
51 |
|
|
C- Energy conservative form (like in pkg/mom_fluxform/mom_calc_ke.F) |
52 |
|
|
C this is the safe way to check the energy conservation |
53 |
|
|
C with no assumption on how grid spacing & area are defined. |
54 |
|
|
tmpVal=0.25*( |
55 |
|
|
& uVel( i ,j,k,bi,bj)*uVel( i ,j,k,bi,bj) |
56 |
|
|
& *dyG( i ,j,bi,bj)*dxC( i ,j,bi,bj)*hFacW( i ,j,k,bi,bj) |
57 |
|
|
& +uVel(i+1,j,k,bi,bj)*uVel(i+1,j,k,bi,bj) |
58 |
|
|
& *dyG(i+1,j,bi,bj)*dxC(i+1,j,bi,bj)*hFacW(i+1,j,k,bi,bj) |
59 |
|
|
& +vVel(i, j ,k,bi,bj)*vVel(i, j ,k,bi,bj) |
60 |
|
|
& *dxG(i, j ,bi,bj)*dyC(i, j ,bi,bj)*hFacS(i, j ,k,bi,bj) |
61 |
|
|
& +vVel(i,j+1,k,bi,bj)*vVel(i,j+1,k,bi,bj) |
62 |
|
|
& *dxG(i,j+1,bi,bj)*dyC(i,j+1,bi,bj)*hFacS(i,j+1,k,bi,bj) |
63 |
|
|
& ) |
64 |
|
|
theVolMean= theVolMean + tmpVal*drF(k) |
65 |
|
|
tmpVal= tmpVal*recip_hFacC(i,j,k,bi,bj)*recip_rA(i,j,bi,bj) |
66 |
|
|
|
67 |
adcroft |
1.1 |
theMax=max(theMax,tmpVal) |
68 |
|
|
IF (tmpVal.NE.0.) THEN |
69 |
|
|
theMean=theMean+tmpVal |
70 |
|
|
numPnts=numPnts+1 |
71 |
|
|
ENDIF |
72 |
jmc |
1.9 |
|
73 |
adcroft |
1.1 |
ENDDO |
74 |
|
|
ENDDO |
75 |
|
|
ENDDO |
76 |
|
|
ENDDO |
77 |
|
|
ENDDO |
78 |
|
|
_GLOBAL_MAX_R8(theMax,myThid) |
79 |
|
|
_GLOBAL_SUM_R8(theMean,myThid) |
80 |
|
|
tmpVal=float(numPnts) |
81 |
|
|
_GLOBAL_SUM_R8(tmpVal,myThid) |
82 |
adcroft |
1.6 |
IF (tmpVal.NE.0.) theMean=theMean/tmpVal |
83 |
jmc |
1.8 |
_GLOBAL_SUM_R8(theVol,myThid) |
84 |
|
|
_GLOBAL_SUM_R8(theVolMean,myThid) |
85 |
adcroft |
1.1 |
|
86 |
jmc |
1.8 |
CALL MON_OUT_RL(mon_string_none,theMax,mon_foot_max,myThid) |
87 |
|
|
CALL MON_OUT_RL(mon_string_none,theMean,mon_foot_mean,myThid) |
88 |
|
|
CALL MON_OUT_RL(mon_string_none,theVolMean, |
89 |
|
|
& mon_foot_volint,myThid) |
90 |
|
|
IF (theVol.NE.0.) theVolMean=theVolMean/theVol |
91 |
|
|
CALL MON_OUT_RL(mon_string_none,theVolMean, |
92 |
|
|
& mon_foot_volmean,myThid) |
93 |
jmc |
1.9 |
CALL MON_OUT_RL(mon_string_none,theVol, |
94 |
|
|
& mon_foot_vol,myThid) |
95 |
adcroft |
1.1 |
|
96 |
|
|
RETURN |
97 |
|
|
END |