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

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

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

revision 1.4 by adcroft, Wed Jun 6 14:50:23 2001 UTC revision 1.10 by jmc, Fri May 2 22:29:07 2003 UTC
# Line 4  C $Name$ Line 4  C $Name$
4  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
5    
6        SUBROUTINE MON_KE(        SUBROUTINE MON_KE(
7       I                myThid )       I                  myIter, myThid )
8  C     /==========================================================\  C     /==========================================================\
9  C     | SUBROUTINE MON_KE                                        |  C     | SUBROUTINE MON_KE                                        |
10  C     | o Calculates stats for Kinetic energy                    |  C     | o Calculates stats for Kinetic energy                    |
# Line 16  C     === Global data === Line 16  C     === Global data ===
16  #include "SIZE.h"  #include "SIZE.h"
17  #include "EEPARAMS.h"  #include "EEPARAMS.h"
18  #include "DYNVARS.h"  #include "DYNVARS.h"
19    #include "MONITOR.h"
20    #include "GRID.h"
21    #include "SURFACE.h"
22    
23  C     === Routine arguments ===  C     === Routine arguments ===
24        INTEGER myThid        INTEGER myIter, myThid
25    
26  C     === Local variables ====  C     === Local variables ====
27        INTEGER bi,bj,I,J,K        INTEGER bi,bj,I,J,K
28        _RL tmpVal,theMax,theMean        _RL numPnts,theVol,tmpVal,tmpVol
29        INTEGER numPnts        _RL theMax,theMean,theVolMean,potEnMean
30    
31          numPnts=0.
32          theVol=0.
33        theMax=0.        theMax=0.
34        theMean=0.        theMean=0.
35        numPnts=0        theVolMean=0.
36          potEnMean =0.
37    
38        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
39         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
40          DO K=1,Nr          DO K=1,Nr
41           DO J=1,sNy           DO J=1,sNy
42            DO I=1,sNx            DO I=1,sNx
43             tmpVal=0.25*( uVel( I , J ,K,bi,bj)*uVel( I , J ,K,bi,bj)             theVol=theVol+rA(i,j,bi,bj)*drF(k)*hFacC(i,j,k,bi,bj)
44       &                  +uVel(I+1, J ,K,bi,bj)*uVel(I+1, J ,K,bi,bj)  
45       &                  +vVel( I , J ,K,bi,bj)*vVel( I , J ,K,bi,bj)  C- Vector Invariant form (like in pkg/mom_vecinv/mom_vi_calc_ke.F)
46       &                  +vVel( I ,J+1,K,bi,bj)*vVel( I ,J+1,K,bi,bj) )  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             theMax=max(theMax,tmpVal)             theMax=max(theMax,tmpVal)
70             IF (tmpVal.NE.0.) THEN             IF (tmpVal.NE.0.) THEN
71              theMean=theMean+tmpVal              theMean=theMean+tmpVal
72              numPnts=numPnts+1              numPnts=numPnts+1.
73             ENDIF             ENDIF
74    
75            ENDDO            ENDDO
76           ENDDO           ENDDO
77          ENDDO          ENDDO
78    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         ENDDO         ENDDO
98        ENDDO        ENDDO
99          _GLOBAL_SUM_R8(numPnts,myThid)
100        _GLOBAL_MAX_R8(theMax,myThid)        _GLOBAL_MAX_R8(theMax,myThid)
101        _GLOBAL_SUM_R8(theMean,myThid)        _GLOBAL_SUM_R8(theMean,myThid)
102        tmpVal=float(numPnts)        IF (numPnts.NE.0.) theMean=theMean/numPnts
103        _GLOBAL_SUM_R8(tmpVal,myThid)        _GLOBAL_SUM_R8(theVol,myThid)
104        IF (tmpVal.NE.0.) theMean=theMean*tmpVal        _GLOBAL_SUM_R8(theVolMean,myThid)
105          _GLOBAL_SUM_R8(potEnMean, myThid)
106        _BEGIN_MASTER( myThid )        IF (theVol.NE.0.) THEN
107        WRITE(*,'(A,29x,A,1PE22.14)')          theVolMean=theVolMean/theVol
108       &      'MON_KE: ',' KE max=',theMax          potEnMean = potEnMean/theVol
109        WRITE(*,'(A,29x,A,1PE22.14)')        ENDIF
110       &      'MON_KE: ','KE mean=',theMean  
111        _END_MASTER( )  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    
116    C--   Print stats for KE
117          CALL MON_SET_PREF('ke',myThid)
118          CALL MON_OUT_RL(mon_string_none,theMax,mon_foot_max,myThid)
119    c     CALL MON_OUT_RL(mon_string_none,theMean,mon_foot_mean,myThid)
120          CALL MON_OUT_RL(mon_string_none,theVolMean,
121         &         mon_foot_mean,myThid)
122          CALL MON_OUT_RL(mon_string_none,theVol,
123         &         mon_foot_vol,myThid)
124    
125        RETURN        RETURN
126        END        END

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.22