File indexing completed on 2018-03-02 18:44:37 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
6d54cf9ca1 Ed H*0001 #include "TIMEAVE_OPTIONS.h"
a1ce33233d Jean*0002
a30418b6b9 Ed H*0003
0004
0005
0006
20a558736b Jean*0007 SUBROUTINE TIMEAVE_STATV_WRITE( myTime, myIter, myThid )
a1ce33233d Jean*0008
a30418b6b9 Ed H*0009
0010
0011
0012
0013
0014 IMPLICIT NONE
a1ce33233d Jean*0015 #include "SIZE.h"
0016 #include "EEPARAMS.h"
0017 #include "PARAMS.h"
0018 #include "DYNVARS.h"
aa7db3783b Jean*0019 #include "GRID.h"
a1ce33233d Jean*0020 #include "TIMEAVE_STATV.h"
20a558736b Jean*0021 #ifdef ALLOW_MNC
0022 #include "MNC_PARAMS.h"
0023 #endif
a1ce33233d Jean*0024
a30418b6b9 Ed H*0025
9a31010562 Jean*0026
0027
0028
a1ce33233d Jean*0029 _RL myTime
9a31010562 Jean*0030 INTEGER myIter
0031 INTEGER myThid
a30418b6b9 Ed H*0032
a1ce33233d Jean*0033
742cf4499c Jean*0034 #ifdef ALLOW_TIMEAVE
9a31010562 Jean*0035
20a558736b Jean*0036 LOGICAL DIFFERENT_MULTIPLE
0037 EXTERNAL DIFFERENT_MULTIPLE
0038 INTEGER IO_ERRCOUNT
0039 EXTERNAL IO_ERRCOUNT
0040
a30418b6b9 Ed H*0041
0042
0043
0044
91c19e3986 Jean*0045 LOGICAL useVariableK
af20bc5e19 Jean*0046 CHARACTER*(10) suff
0047 INTEGER bi, bj
a1ce33233d Jean*0048 INTEGER beginIOErrCount
0049 INTEGER endIOErrCount
0050 CHARACTER*(MAX_LEN_MBUF) msgBuf
fc64655a31 Dimi*0051 LOGICAL dumpFiles
2cf110c259 Jean*0052 #ifdef ALLOW_MNC
b22b541fe9 Ed H*0053 CHARACTER*(1) pf
2cf110c259 Jean*0054 #endif
b22b541fe9 Ed H*0055
9a31010562 Jean*0056
0057
a30418b6b9 Ed H*0058
742cf4499c Jean*0059 dumpFiles = DIFFERENT_MULTIPLE(taveFreq,myTime,deltaTClock)
fc64655a31 Dimi*0060 #ifdef ALLOW_CAL
742cf4499c Jean*0061 IF ( useCAL ) THEN
7a31080eb8 Jean*0062 CALL CAL_TIME2DUMP( zeroRL, taveFreq, deltaTClock,
742cf4499c Jean*0063 U dumpFiles,
0064 I myTime, myIter, myThid )
fc64655a31 Dimi*0065 ENDIF
0066 #endif
a1ce33233d Jean*0067
fc64655a31 Dimi*0068 IF (dumpFiles) THEN
316355e015 Mart*0069 useVariableK = useKPP .OR. usePP81 .OR. useMY82 .OR. useGGL90
0070 & .OR. useGMredi .OR. ivdc_kappa.NE.0.
af20bc5e19 Jean*0071 IF ( rwSuffixType.EQ.0 ) THEN
0072 WRITE(suff,'(I10.10)') myIter
0073 ELSE
0074 CALL RW_GET_SUFFIX( suff, myTime, myIter, myThid )
0075 ENDIF
a1ce33233d Jean*0076
a30418b6b9 Ed H*0077 DO bj = myByLo(myThid), myByHi(myThid)
20a558736b Jean*0078 DO bi = myBxLo(myThid), myBxHi(myThid)
a30418b6b9 Ed H*0079
0080
9a31010562 Jean*0081 CALL TIMEAVE_NORMALIZE(uFluxtave,timeAve_full,1 ,bi,bj,myThid)
0082 CALL TIMEAVE_NORMALIZE(vFluxtave,timeAve_full,1 ,bi,bj,myThid)
0083 CALL TIMEAVE_NORMALIZE(tFluxtave,timeAve_full,1 ,bi,bj,myThid)
0084 CALL TIMEAVE_NORMALIZE(sFluxtave,timeAve_full,1 ,bi,bj,myThid)
0085 CALL TIMEAVE_NORMALIZE(etatave, timeAve_half,1 ,bi,bj,myThid)
0086 CALL TIMEAVE_NORMALIZE(thetatave,timeAve_half,Nr,bi,bj,myThid)
0087 CALL TIMEAVE_NORMALIZE(salttave, timeAve_half,Nr,bi,bj,myThid)
0088 CALL TIMEAVE_NORMALIZE(uVeltave, timeAve_half,Nr,bi,bj,myThid)
0089 CALL TIMEAVE_NORMALIZE(vVeltave, timeAve_half,Nr,bi,bj,myThid)
0090 CALL TIMEAVE_NORMALIZE(wVeltave, timeAve_half,Nr,bi,bj,myThid)
0091 CALL TIMEAVE_NORMALIZE(phiHydLowtave,timeAve_full,1,
52dd3ef4ea Dimi*0092 & bi,bj,myThid)
9a31010562 Jean*0093 CALL TIMEAVE_NORMALIZE(UTtave, timeAve_half,Nr,bi,bj,myThid)
0094 CALL TIMEAVE_NORMALIZE(VTtave, timeAve_half,Nr,bi,bj,myThid)
0095 CALL TIMEAVE_NORMALIZE(WTtave, timeAve_half,Nr,bi,bj,myThid)
0096 CALL TIMEAVE_NORMALIZE(UStave, timeAve_half,Nr,bi,bj,myThid)
0097 CALL TIMEAVE_NORMALIZE(VStave, timeAve_half,Nr,bi,bj,myThid)
0098 CALL TIMEAVE_NORMALIZE(WStave, timeAve_half,Nr,bi,bj,myThid)
0099 CALL TIMEAVE_NORMALIZE(Eta2tave, timeAve_half,1 ,bi,bj,myThid)
0100 CALL TIMEAVE_NORMALIZE(TTtave, timeAve_half,Nr,bi,bj,myThid)
0101 CALL TIMEAVE_NORMALIZE(UUtave, timeAve_half,Nr,bi,bj,myThid)
0102 CALL TIMEAVE_NORMALIZE(VVtave, timeAve_half,Nr,bi,bj,myThid)
0103 CALL TIMEAVE_NORMALIZE(UVtave, timeAve_half,Nr,bi,bj,myThid)
0104
aa7db3783b Jean*0105 #ifdef NONLIN_FRSURF
a30418b6b9 Ed H*0106
9a31010562 Jean*0107 CALL TIMEAVE_NORMALIZE(hUtave, timeAve_half,Nr,bi,bj,myThid)
0108 CALL TIMEAVE_NORMALIZE(hVtave, timeAve_half,Nr,bi,bj,myThid)
0109
0110
0111
742cf4499c Jean*0112 #endif /* NONLIN_FRSURF */
a1ce33233d Jean*0113
9a31010562 Jean*0114 CALL TIMEAVE_NORMALIZE(TdiffRtave,timeAve_full,Nr,
a30418b6b9 Ed H*0115 & bi,bj,myThid)
99bc607d7a Ed H*0116 #ifdef ALLOW_MOM_VECINV
9a31010562 Jean*0117 CALL TIMEAVE_NORMALIZE(uZetatave,timeAve_full,Nr,bi,bj,myThid)
0118 CALL TIMEAVE_NORMALIZE(vZetatave,timeAve_full,Nr,bi,bj,myThid)
6add245ab0 Jean*0119 #endif
9a31010562 Jean*0120 CALL TIMEAVE_NORMALIZE(phiHydtave,timeAve_full,Nr,
a30418b6b9 Ed H*0121 & bi,bj,myThid)
9a31010562 Jean*0122 CALL TIMEAVE_NORMALIZE(phiHydLow2Tave,timeAve_full,1,
a30418b6b9 Ed H*0123 & bi,bj,myThid)
9a31010562 Jean*0124 CALL TIMEAVE_NORMALIZE(ConvectCountTave,timeAve_full,Nr,
a30418b6b9 Ed H*0125 & bi,bj,myThid)
20a558736b Jean*0126 ENDDO
a30418b6b9 Ed H*0127 ENDDO
a1ce33233d Jean*0128
a30418b6b9 Ed H*0129
0130 _BARRIER
a1ce33233d Jean*0131
a30418b6b9 Ed H*0132 IF (timeave_mdsio) THEN
742cf4499c Jean*0133
a30418b6b9 Ed H*0134
0135 beginIOErrCount = IO_ERRCOUNT(myThid)
0136 CALL WRITE_FLD_XY_RL('ETAtave.' ,suff,etatave ,myIter,myThid)
0137 CALL WRITE_FLD_XYZ_RL('Ttave.',suff,thetatave,myIter,myThid)
0138 CALL WRITE_FLD_XYZ_RL('Stave.',suff,salttave,myIter,myThid)
0139 CALL WRITE_FLD_XYZ_RL('uVeltave.',suff,uVeltave,myIter,myThid)
0140 CALL WRITE_FLD_XYZ_RL('vVeltave.',suff,vVeltave,myIter,myThid)
0141 CALL WRITE_FLD_XYZ_RL('wVeltave.',suff,wVeltave,myIter,myThid)
52dd3ef4ea Dimi*0142 CALL WRITE_FLD_XY_RL('Eta2tave.',suff,Eta2tave ,myIter,myThid)
a30418b6b9 Ed H*0143 CALL WRITE_FLD_XYZ_RL('UTtave.',suff,UTtave,myIter,myThid)
0144 CALL WRITE_FLD_XYZ_RL('VTtave.',suff,VTtave,myIter,myThid)
0145 CALL WRITE_FLD_XYZ_RL('WTtave.',suff,WTtave,myIter,myThid)
0146 CALL WRITE_FLD_XYZ_RL('UStave.',suff,UStave,myIter,myThid)
0147 CALL WRITE_FLD_XYZ_RL('VStave.',suff,VStave,myIter,myThid)
0148 CALL WRITE_FLD_XYZ_RL('WStave.',suff,WStave,myIter,myThid)
0149 CALL WRITE_FLD_XYZ_RL('TTtave.',suff,TTtave,myIter,myThid)
0150 CALL WRITE_FLD_XYZ_RL('UUtave.',suff,UUtave,myIter,myThid)
0151 CALL WRITE_FLD_XYZ_RL('VVtave.',suff,VVtave,myIter,myThid)
0152 CALL WRITE_FLD_XYZ_RL('UVtave.',suff,UVtave,myIter,myThid)
0153
742cf4499c Jean*0154
a30418b6b9 Ed H*0155 IF (useVariableK)
0156 & CALL WRITE_FLD_XYZ_RL('Tdiftave.',suff,TdiffRtave,
0157 & myIter,myThid)
99bc607d7a Ed H*0158 #ifdef ALLOW_MOM_VECINV
a30418b6b9 Ed H*0159 IF (vectorInvariantMomentum) THEN
0160 CALL WRITE_FLD_XYZ_RL('uZtave.',suff,uZetatave,
0161 & myIter,myThid)
0162 CALL WRITE_FLD_XYZ_RL('vZtave.',suff,vZetatave,
0163 & myIter,myThid)
0164 ENDIF
e7f0a9dbe1 Dimi*0165 #endif /* ALLOW_MOM_VECINV */
a30418b6b9 Ed H*0166 CALL WRITE_FLD_XYZ_RL('PhHytave.',suff,phiHydtave,
0167 & myIter,myThid)
9669509dca Jean*0168 IF ( fluidIsWater ) THEN
a30418b6b9 Ed H*0169 CALL WRITE_FLD_XY_RL('PHLtave.',suff,phiHydLowtave,
0170 & myIter,myThid)
0171 CALL WRITE_FLD_XY_RL('uFluxtave.',suff,uFluxtave,
0172 & myIter,myThid)
0173 CALL WRITE_FLD_XY_RL('vFluxtave.',suff,vFluxtave,
0174 & myIter,myThid)
0175 CALL WRITE_FLD_XY_RL('tFluxtave.',suff,tFluxtave,
0176 & myIter,myThid)
0177 CALL WRITE_FLD_XY_RL('sFluxtave.',suff,sFluxtave,
0178 & myIter,myThid)
52dd3ef4ea Dimi*0179 CALL WRITE_FLD_XY_RL('PHL2tave.',suff,phiHydLow2tave,
0180 & myIter,myThid)
0181 CALL WRITE_FLD_XYZ_RL('Convtave.',suff,ConvectCountTave,
0182 & myIter,myThid)
a30418b6b9 Ed H*0183 ENDIF
742cf4499c Jean*0184
aa7db3783b Jean*0185 #ifdef NONLIN_FRSURF
a30418b6b9 Ed H*0186 CALL WRITE_FLD_XYZ_RL('hUtave.',suff,hUtave,myIter,myThid)
0187 CALL WRITE_FLD_XYZ_RL('hVtave.',suff,hVtave,myIter,myThid)
0188
0189
0190
742cf4499c Jean*0191 #endif /* NONLIN_FRSURF */
0192
a30418b6b9 Ed H*0193
0194 endIOErrCount = IO_ERRCOUNT(myThid)
aa7db3783b Jean*0195
a30418b6b9 Ed H*0196
0197 IF ( endIOErrCount .NE. beginIOErrCount ) THEN
20a558736b Jean*0198
a30418b6b9 Ed H*0199 WRITE(msgBuf,'(A)') 'S/R WRITE_TIME_AVERAGES'
20a558736b Jean*0200 CALL PRINT_ERROR( msgBuf, myThid )
a30418b6b9 Ed H*0201 WRITE(msgBuf,'(A)') 'Error writing out data'
20a558736b Jean*0202 CALL PRINT_ERROR( msgBuf, myThid )
a30418b6b9 Ed H*0203 WRITE(msgBuf,'(A,I10)') 'Timestep ',myIter
20a558736b Jean*0204 CALL PRINT_ERROR( msgBuf, myThid )
a30418b6b9 Ed H*0205 ELSE
20a558736b Jean*0206
0207 _BEGIN_MASTER( myThid )
742cf4499c Jean*0208 WRITE(msgBuf,'(A,I10)')
a30418b6b9 Ed H*0209 & '// Time-average data written, t-step', myIter
742cf4499c Jean*0210 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
20a558736b Jean*0211 & SQUEEZE_RIGHT, myThid )
a30418b6b9 Ed H*0212 WRITE(msgBuf,'(A)') ' '
742cf4499c Jean*0213 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
20a558736b Jean*0214 & SQUEEZE_RIGHT, myThid )
0215 _END_MASTER( myThid )
a30418b6b9 Ed H*0216 ENDIF
742cf4499c Jean*0217
a30418b6b9 Ed H*0218 ENDIF
a1ce33233d Jean*0219
742cf4499c Jean*0220 #ifdef ALLOW_MNC
1f94a06e82 Ed H*0221 IF (useMNC .AND. timeave_mnc) THEN
742cf4499c Jean*0222
b22b541fe9 Ed H*0223 IF ( writeBinaryPrec .EQ. precFloat64 ) THEN
0224 pf(1:1) = 'D'
0225 ELSE
0226 pf(1:1) = 'R'
0227 ENDIF
0228
a30418b6b9 Ed H*0229 CALL MNC_CW_SET_UDIM('tave', -1, myThid)
987ff12cb6 Ed H*0230 CALL MNC_CW_RL_W_S('D','tave',0,0,'T', myTime, myThid)
a30418b6b9 Ed H*0231 CALL MNC_CW_SET_UDIM('tave', 0, myThid)
987ff12cb6 Ed H*0232 CALL MNC_CW_I_W_S('I','tave',0,0,'iter', myIter, myThid)
b22b541fe9 Ed H*0233
0234 CALL MNC_CW_RL_W(pf,'tave',0,0,'ETAtave',etatave,myThid)
d84c8c290e Davi*0235 CALL MNC_CW_RL_W(pf,'tave',0,0,'Eta2tave',Eta2tave,myThid)
b22b541fe9 Ed H*0236 CALL MNC_CW_RL_W(pf,'tave',0,0,'Ttave',thetatave,myThid)
0237 CALL MNC_CW_RL_W(pf,'tave',0,0,'Stave',salttave,myThid)
0238 CALL MNC_CW_RL_W(pf,'tave',0,0,'uVeltave',uVeltave,myThid)
0239 CALL MNC_CW_RL_W(pf,'tave',0,0,'vVeltave',vVeltave,myThid)
0240 CALL MNC_CW_RL_W(pf,'tave',0,0,'wVeltave',wVeltave,myThid)
0241 CALL MNC_CW_RL_W(pf,'tave',0,0,'UTtave',UTtave,myThid)
0242 CALL MNC_CW_RL_W(pf,'tave',0,0,'VTtave',VTtave,myThid)
0243 CALL MNC_CW_RL_W(pf,'tave',0,0,'WTtave',WTtave,myThid)
0244 CALL MNC_CW_RL_W(pf,'tave',0,0,'UStave',UStave,myThid)
0245 CALL MNC_CW_RL_W(pf,'tave',0,0,'VStave',VStave,myThid)
0246 CALL MNC_CW_RL_W(pf,'tave',0,0,'WStave',WStave,myThid)
0247 CALL MNC_CW_RL_W(pf,'tave',0,0,'TTtave',TTtave,myThid)
0248 CALL MNC_CW_RL_W(pf,'tave',0,0,'UUtave',UUtave,myThid)
0249 CALL MNC_CW_RL_W(pf,'tave',0,0,'VVtave',VVtave,myThid)
0250 CALL MNC_CW_RL_W(pf,'tave',0,0,'UVtave',UVtave,myThid)
0251
a30418b6b9 Ed H*0252 IF (useVariableK) THEN
b22b541fe9 Ed H*0253 CALL MNC_CW_RL_W(pf,'tave',0,0,'Tdiftave',
a30418b6b9 Ed H*0254 & TdiffRtave,myThid)
0255 ENDIF
0256 #ifdef ALLOW_MOM_VECINV
0257 IF (vectorInvariantMomentum) THEN
b22b541fe9 Ed H*0258 CALL MNC_CW_RL_W(pf,'tave',0,0,'uZtave',uZetatave,myThid)
0259 CALL MNC_CW_RL_W(pf,'tave',0,0,'vZtave',vZetatave,myThid)
a30418b6b9 Ed H*0260 ENDIF
0261 #endif /* ALLOW_MOM_VECINV */
b22b541fe9 Ed H*0262 CALL MNC_CW_RL_W(pf,'tave',0,0,'PhHytave',
a30418b6b9 Ed H*0263 & phiHydtave,myThid)
9669509dca Jean*0264 IF ( fluidIsWater ) THEN
b22b541fe9 Ed H*0265 CALL MNC_CW_RL_W(pf,'tave',0,0,'PHLtave',
a30418b6b9 Ed H*0266 & phiHydLowtave,myThid)
b22b541fe9 Ed H*0267 CALL MNC_CW_RL_W(pf,'tave',0,0,'PHL2tave',
a30418b6b9 Ed H*0268 & phiHydLow2tave,myThid)
b22b541fe9 Ed H*0269 CALL MNC_CW_RL_W(pf,'tave',0,0,'Convtave',
a30418b6b9 Ed H*0270 & ConvectCountTave,myThid)
b22b541fe9 Ed H*0271 CALL MNC_CW_RL_W(pf,'tave',0,0,'uFluxtave',
a30418b6b9 Ed H*0272 & uFluxtave,myThid)
b22b541fe9 Ed H*0273 CALL MNC_CW_RL_W(pf,'tave',0,0,'vFluxtave',
a30418b6b9 Ed H*0274 & vFluxtave,myThid)
b22b541fe9 Ed H*0275 CALL MNC_CW_RL_W(pf,'tave',0,0,'tFluxtave',
a30418b6b9 Ed H*0276 & tFluxtave,myThid)
b22b541fe9 Ed H*0277 CALL MNC_CW_RL_W(pf,'tave',0,0,'sFluxtave',
a30418b6b9 Ed H*0278 & sFluxtave,myThid)
0279 ENDIF
a1ce33233d Jean*0280
a30418b6b9 Ed H*0281 #ifdef NONLIN_FRSURF
b22b541fe9 Ed H*0282 CALL MNC_CW_RL_W(pf,'tave',0,0,'hUtave',hUtave,myThid)
0283 CALL MNC_CW_RL_W(pf,'tave',0,0,'hVtave',hVtave,myThid)
0284
0285
0286
742cf4499c Jean*0287 #endif /* NONLIN_FRSURF */
a1ce33233d Jean*0288
a30418b6b9 Ed H*0289 ENDIF
0290 #endif /* ALLOW_MNC */
0291
0292 _BARRIER
742cf4499c Jean*0293
a30418b6b9 Ed H*0294 DO bj = myByLo(myThid), myByHi(myThid)
0295 DO bi = myBxLo(myThid), myBxHi(myThid)
742cf4499c Jean*0296
a30418b6b9 Ed H*0297
0298
0299
0300
742cf4499c Jean*0301
a30418b6b9 Ed H*0302 CALL TIMEAVE_STATVARS(myTime, nIter0, bi, bj, myThid)
742cf4499c Jean*0303
a30418b6b9 Ed H*0304 ENDDO
0305 ENDDO
742cf4499c Jean*0306
a1ce33233d Jean*0307 ENDIF
742cf4499c Jean*0308
aa7db3783b Jean*0309 #endif /* ALLOW_TIMEAVE */
0310
a1ce33233d Jean*0311 RETURN
0312 END