/[MITgcm]/MITgcm/pkg/monitor/mon_ke.F
ViewVC logotype

Annotation of /MITgcm/pkg/monitor/mon_ke.F

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


Revision 1.10 - (hide annotations) (download)
Fri May 2 22:29:07 2003 UTC (21 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint50c_post, checkpoint50d_post, checkpoint50d_pre
Changes since 1.9: +45 -16 lines
add monitor diagnostic of vorticity and (barotropic) potential energy.

1 jmc 1.10 C $Header: /u/gcmpack/MITgcm/pkg/monitor/mon_ke.F,v 1.9 2002/06/15 03:14:53 jmc Exp $
2 adcroft 1.1 C $Name: $
3    
4     #include "CPP_OPTIONS.h"
5    
6     SUBROUTINE MON_KE(
7 jmc 1.10 I myIter, myThid )
8 adcroft 1.1 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 jmc 1.10 #include "SURFACE.h"
22 adcroft 1.1
23     C === Routine arguments ===
24 jmc 1.10 INTEGER myIter, myThid
25 adcroft 1.1
26     C === Local variables ====
27     INTEGER bi,bj,I,J,K
28 jmc 1.10 _RL numPnts,theVol,tmpVal,tmpVol
29     _RL theMax,theMean,theVolMean,potEnMean
30 adcroft 1.1
31 jmc 1.10 numPnts=0.
32     theVol=0.
33 adcroft 1.1 theMax=0.
34     theMean=0.
35 jmc 1.8 theVolMean=0.
36 jmc 1.10 potEnMean =0.
37 adcroft 1.1
38     DO bj=myByLo(myThid),myByHi(myThid)
39     DO bi=myBxLo(myThid),myBxHi(myThid)
40     DO K=1,Nr
41     DO J=1,sNy
42     DO I=1,sNx
43 jmc 1.9 theVol=theVol+rA(i,j,bi,bj)*drF(k)*hFacC(i,j,k,bi,bj)
44    
45     C- Vector Invariant form (like in pkg/mom_vecinv/mom_vi_calc_ke.F)
46     c tmpVal=0.25*( uVel( I , J ,K,bi,bj)*uVel( I , J ,K,bi,bj)
47     c & +uVel(I+1, J ,K,bi,bj)*uVel(I+1, J ,K,bi,bj)
48     c & +vVel( I , J ,K,bi,bj)*vVel( I , J ,K,bi,bj)
49     c & +vVel( I ,J+1,K,bi,bj)*vVel( I ,J+1,K,bi,bj) )
50     c theVolMean=theVolMean+tmpVal
51     c & *ra(i,j,bi,bj)*drf(k)*hFacC(i,j,k,bi,bj)
52    
53     C- Energy conservative form (like in pkg/mom_fluxform/mom_calc_ke.F)
54     C this is the safe way to check the energy conservation
55     C with no assumption on how grid spacing & area are defined.
56     tmpVal=0.25*(
57     & uVel( i ,j,k,bi,bj)*uVel( i ,j,k,bi,bj)
58     & *dyG( i ,j,bi,bj)*dxC( i ,j,bi,bj)*hFacW( i ,j,k,bi,bj)
59     & +uVel(i+1,j,k,bi,bj)*uVel(i+1,j,k,bi,bj)
60     & *dyG(i+1,j,bi,bj)*dxC(i+1,j,bi,bj)*hFacW(i+1,j,k,bi,bj)
61     & +vVel(i, j ,k,bi,bj)*vVel(i, j ,k,bi,bj)
62     & *dxG(i, j ,bi,bj)*dyC(i, j ,bi,bj)*hFacS(i, j ,k,bi,bj)
63     & +vVel(i,j+1,k,bi,bj)*vVel(i,j+1,k,bi,bj)
64     & *dxG(i,j+1,bi,bj)*dyC(i,j+1,bi,bj)*hFacS(i,j+1,k,bi,bj)
65     & )
66     theVolMean= theVolMean + tmpVal*drF(k)
67     tmpVal= tmpVal*recip_hFacC(i,j,k,bi,bj)*recip_rA(i,j,bi,bj)
68    
69 adcroft 1.1 theMax=max(theMax,tmpVal)
70     IF (tmpVal.NE.0.) THEN
71     theMean=theMean+tmpVal
72 jmc 1.10 numPnts=numPnts+1.
73 adcroft 1.1 ENDIF
74 jmc 1.9
75 adcroft 1.1 ENDDO
76     ENDDO
77     ENDDO
78 jmc 1.10 C- Potential Energy (external mode):
79     DO J=1,sNy
80     DO I=1,sNx
81     tmpVal = 0.5 _d 0*Bo_surf(i,j,bi,bj)
82     & *etaN(i,j,bi,bj)*etaN(i,j,bi,bj)
83     C- jmc: if geoid not flat (phi0surf), needs to add this term.
84     C not sure for atmos/ocean in P ; or atmos. loading in ocean-Z
85     tmpVal = tmpVal
86     & + phi0surf(i,j,bi,bj)*etaN(i,j,bi,bj)
87     potEnMean = potEnMean
88     & + tmpVal*rA(i,j,bi,bj)*maskH(i,j,bi,bj)
89     c tmpVal = etaN(i,j,bi,bj)
90     c & + phi0surf(i,j,bi,bj)*recip_Bo(i,j,bi,bj)
91     c potEnMean = potEnMean
92     c & + 0.5 _d 0*Bo_surf(i,j,bi,bj)*tmpVal*tmpVal
93     c & *rA(i,j,bi,bj)*maskH(i,j,bi,bj)
94     ENDDO
95     ENDDO
96     C- end bi,bj loops
97 adcroft 1.1 ENDDO
98     ENDDO
99 jmc 1.10 _GLOBAL_SUM_R8(numPnts,myThid)
100 adcroft 1.1 _GLOBAL_MAX_R8(theMax,myThid)
101     _GLOBAL_SUM_R8(theMean,myThid)
102 jmc 1.10 IF (numPnts.NE.0.) theMean=theMean/numPnts
103 jmc 1.8 _GLOBAL_SUM_R8(theVol,myThid)
104     _GLOBAL_SUM_R8(theVolMean,myThid)
105 jmc 1.10 _GLOBAL_SUM_R8(potEnMean, myThid)
106     IF (theVol.NE.0.) THEN
107     theVolMean=theVolMean/theVol
108     potEnMean = potEnMean/theVol
109     ENDIF
110    
111     C-- Print stats for (barotropic) Potential Energy:
112     CALL MON_SET_PREF('pe_b',myThid)
113     CALL MON_OUT_RL(mon_string_none,potEnMean,
114     & mon_foot_mean,myThid)
115 adcroft 1.1
116 jmc 1.10 C-- Print stats for KE
117     CALL MON_SET_PREF('ke',myThid)
118 jmc 1.8 CALL MON_OUT_RL(mon_string_none,theMax,mon_foot_max,myThid)
119 jmc 1.10 c CALL MON_OUT_RL(mon_string_none,theMean,mon_foot_mean,myThid)
120 jmc 1.8 CALL MON_OUT_RL(mon_string_none,theVolMean,
121 jmc 1.10 & mon_foot_mean,myThid)
122 jmc 1.9 CALL MON_OUT_RL(mon_string_none,theVol,
123     & mon_foot_vol,myThid)
124 adcroft 1.1
125     RETURN
126     END

  ViewVC Help
Powered by ViewVC 1.1.22