/[MITgcm]/MITgcm/diags/src/write_time_averages.F
ViewVC logotype

Annotation of /MITgcm/diags/src/write_time_averages.F

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


Revision 1.14 - (hide annotations) (download)
Thu Feb 15 19:01:39 2001 UTC (23 years, 4 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint51k_post, ecco_c44_e18, checkpoint47j_post, ecco_c44_e16, checkpoint40pre1, checkpoint36, checkpoint48d_pre, checkpoint44b_post, checkpoint51j_post, branch-exfmods-tag, checkpoint47e_post, checkpoint43a-release1mods, checkpoint44h_pre, checkpoint47i_post, ecco_c44_e19, checkpoint52e_pre, release1_p12, release1_p13, release1_p10, release1_p11, release1_p16, release1_p17, release1_p14, release1_p15, ecco_c44_e17, pre38tag1, checkpoint47f_post, checkpoint40pre9, checkpoint47c_post, checkpoint50e_post, checkpoint52e_post, checkpoint50c_post, checkpoint46i_post, checkpoint51n_pre, checkpoint47d_post, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, ecco_c44_e25, icebear5, icebear4, checkpoint44f_pre, checkpoint47a_post, icebear3, icebear2, checkpoint46f_post, checkpoint52d_pre, ecco_c50_e33a, checkpoint46d_pre, release1_p13_pre, checkpoint48e_post, checkpoint46e_post, checkpoint48d_post, checkpoint50g_post, release1-branch_tutorials, checkpoint46c_post, checkpoint44g_post, branchpoint-genmake2, checkpoint44h_post, release1_p12_pre, checkpoint44e_post, checkpoint46k_post, ecco-branch-mod1, checkpoint46e_pre, ecco-branch-mod4, ecco-branch-mod5, branch-netcdf, checkpoint48f_post, checkpoint45d_post, checkpoint51r_post, checkpoint52b_pre, checkpoint46l_post, checkpoint51o_pre, checkpoint46j_pre, checkpoint45b_post, checkpoint46b_pre, checkpoint51i_post, checkpoint46j_post, checkpoint48c_post, chkpt44a_pre, release1-branch-end, c37_adj, release1_final_v1, checkpoint51e_post, checkpoint51b_post, checkpoint46, ecco_c50_e28, checkpoint51l_pre, checkpoint51c_post, ecco_c50_e32, ecco_c50_e33, ecco_c50_e30, ecco_c50_e31, checkpoint47d_pre, checkpoint47, checkpoint44, checkpoint45, checkpoint48, checkpoint49, checkpoint44f_post, checkpoint47b_post, checkpoint40pre2, checkpoint40pre5, checkpoint51l_post, checkpoint40pre6, checkpoint48i_post, checkpoint51o_post, checkpoint40pre8, checkpoint46l_pre, checkpoint51f_pre, release1_b1, checkpoint48h_post, checkpoint51q_post, checkpoint50d_pre, ecco_c51_e34, chkpt44d_post, ecco_c50_e29, checkpoint42, release1_p9, checkpoint46h_pre, checkpoint51, checkpoint50, checkpoint47h_post, checkpoint52, release1_p8, checkpoint50d_post, checkpoint52d_post, checkpoint46g_pre, release1_p2, release1_p3, release1_p4, checkpoint51b_pre, release1_p6, checkpoint52a_post, checkpoint46a_post, checkpoint47g_post, checkpoint52b_post, chkpt44a_post, checkpoint52f_post, checkpoint44b_pre, checkpoint52c_post, release1_p1, checkpoint46m_post, checkpoint48a_post, checkpoint40pre4, checkpoint51h_pre, checkpoint46a_pre, ecco_c51_e34e, checkpoint40pre3, checkpoint50c_pre, checkpoint45c_post, checkpoint50b_pre, release1_p5, checkpoint44e_pre, checkpoint51g_post, ecco_c52_e35, release1_p7, ecco_ice2, ecco_ice1, checkpoint46b_post, checkpoint51f_post, pre38-close, checkpoint46d_post, ecco-branch-mod2, checkpoint48b_post, checkpoint50b_post, checkpoint46g_post, checkpoint45a_post, ecco_c51_e34d, ecco_c51_e34f, ecco_c51_e34g, ecco_c51_e34a, ecco_c51_e34b, ecco_c51_e34c, checkpoint50f_post, checkpoint50a_post, checkpoint46c_pre, checkpoint50f_pre, checkpoint52a_pre, ecco-branch-mod3, checkpoint43, checkpoint51d_post, checkpoint37, checkpoint40, checkpoint48c_pre, release1-branch_branchpoint, ecco_c44_e22, release1_beta1, ecco_c44_e23, checkpoint51m_post, checkpoint51t_post, ecco_c44_e20, checkpoint40pre7, checkpoint50h_post, checkpoint52i_post, checkpoint51a_post, checkpoint39, checkpoint46h_post, checkpoint50e_pre, checkpoint38, checkpoint50i_post, checkpoint51p_post, checkpoint51n_post, release1_chkpt44d_post, checkpoint48g_post, checkpoint51i_pre, chkpt44c_pre, checkpoint52i_pre, checkpoint51u_post, checkpoint52h_pre, checkpoint52f_pre, hrcube_1, hrcube_2, checkpoint41, checkpoint51s_post, chkpt44c_post
Branch point for: c24_e25_ice, netcdf-sm0, ecco-branch, release1_final, branch-genmake2, pre38, release1, branch-exfmods-curt, release1_coupled, branch-nonh, icebear, tg2-branch, checkpoint51n_branch, release1-branch, release1_50yr
Changes since 1.13: +3 -3 lines
include CPP_OPTIONS.h instead of only CPP_EEOPTIONS

1 jmc 1.14 C $Header: /u/gcmpack/models/MITgcmUV/diags/src/write_time_averages.F,v 1.13 2001/02/14 22:15:04 jmc Exp $
2     C $Name: $
3     #include "CPP_OPTIONS.h"
4 adcroft 1.1
5 jmc 1.13 SUBROUTINE WRITE_TIME_AVERAGES(myTime, myIter, myThid)
6 adcroft 1.1 C /==========================================================\
7     C | SUBROUTINE WRITE_TIME_AVERAGES |
8     C | |
9     C \==========================================================/
10 adcroft 1.6 IMPLICIT NONE
11 adcroft 1.1
12     C == Global variables ===
13     #include "SIZE.h"
14     #include "EEPARAMS.h"
15     #include "PARAMS.h"
16     #include "AVER.h"
17     #include "DYNVARS.h"
18    
19     LOGICAL DIFFERENT_MULTIPLE
20     EXTERNAL DIFFERENT_MULTIPLE
21 adcroft 1.2 INTEGER IO_ERRCOUNT
22     EXTERNAL IO_ERRCOUNT
23 adcroft 1.1
24     C == Routine arguments ==
25     C myThid - Thread number for this instance of the routine.
26     C myIter - Iteration number
27 jmc 1.13 C myTime - Current time of simulation ( s )
28 adcroft 1.1 INTEGER myThid
29     INTEGER myIter
30 jmc 1.13 _RL myTime
31 adcroft 1.1
32     C == Local variables ==
33     C suff - Hold suffix part of a filename
34     C TimeAve - total time over average
35 jmc 1.13 INTEGER prevPrec
36 adcroft 1.1 CHARACTER*(MAX_LEN_FNAM) suff
37 adcroft 1.7 _RL DDTT
38 adcroft 1.1 INTEGER bi,bj,k
39 adcroft 1.2 INTEGER beginIOErrCount
40     INTEGER endIOErrCount
41     CHARACTER*(MAX_LEN_MBUF) msgBuf
42 adcroft 1.1
43     C Final Time Averages and Dump Files if needed
44     IF ( myIter.NE.nIter0 .AND.
45 jmc 1.13 & DIFFERENT_MULTIPLE(taveFreq,myTime,myTime-deltaTClock) ) THEN
46 adcroft 1.1
47     WRITE(suff,'(I10.10)') myIter
48    
49     C Normalize by integrated time
50     DO bj = myByLo(myThid), myByHi(myThid)
51     DO bi = myBxLo(myThid), myBxHi(myThid)
52 cnh 1.4 DO k=1,Nr
53 jmc 1.13 CALL TIMEAVER_FINAL_XYZ(thetatave,TimeAve_half,bi,bj,K,myThid)
54     CALL TIMEAVER_FINAL_XYZ(salttave,TimeAve_half,bi,bj,K,myThid)
55     CALL TIMEAVER_FINAL_XYZ(uVeltave,TimeAve_half,bi,bj,K,myThid)
56     CALL TIMEAVER_FINAL_XYZ(vVeltave,TimeAve_half,bi,bj,K,myThid)
57     CALL TIMEAVER_FINAL_XYZ(uttave,TimeAve_half,bi,bj,K,myThid)
58     CALL TIMEAVER_FINAL_XYZ(vttave,TimeAve_half,bi,bj,K,myThid)
59     CALL TIMEAVER_FINAL_XYZ(wVeltave,TimeAve_full,bi,bj,K,myThid)
60     CALL TIMEAVER_FINAL_XYZ(phiHydtave,TimeAve_full,
61     & bi,bj,K,myThid)
62     CALL TIMEAVER_FINAL_XYZ(ConvectCountTave,TimeAve_full,
63 adcroft 1.8 & bi,bj,K,myThid)
64 adcroft 1.1 ENDDO
65     ENDDO
66     ENDDO
67    
68     C Write to files
69     _BARRIER
70     _BEGIN_MASTER( myThid )
71 adcroft 1.2
72     C-- Set IO "context" for writing state
73 adcroft 1.9 #ifdef USE_DFILE
74 adcroft 1.2 CALL DFILE_SET_RW
75     CALL DFILE_SET_CONT_ON_ERROR
76 adcroft 1.9 #endif
77 adcroft 1.2 C-- Read IO error counter
78     beginIOErrCount = IO_ERRCOUNT(myThid)
79 adcroft 1.1 prevPrec = writeBinaryPrec
80     writeBinaryPrec = precFloat32
81     CALL WRITE_FLD_XYZ_RL('Ttave.',suff,thetatave,myIter,myThid)
82     CALL WRITE_FLD_XYZ_RL('Stave.',suff,salttave,myIter,myThid)
83     CALL WRITE_FLD_XYZ_RL('uVeltave.',suff,uVeltave,myIter,myThid)
84     CALL WRITE_FLD_XYZ_RL('vVeltave.',suff,vVeltave,myIter,myThid)
85     CALL WRITE_FLD_XYZ_RL('UTtave.',suff,uttave,myIter,myThid)
86     CALL WRITE_FLD_XYZ_RL('VTtave.',suff,vttave,myIter,myThid)
87 jmc 1.13 CALL WRITE_FLD_XYZ_RL('wVeltave.',suff,wVeltave,myIter,myThid)
88     CALL WRITE_FLD_XYZ_RL('PhHytave.',suff,phiHydtave,myIter,myThid)
89     CALL WRITE_FLD_XYZ_RL('Convtave.',suff,ConvectCountTave,
90 adcroft 1.8 & myIter,myThid)
91 adcroft 1.1 writeBinaryPrec = prevPrec
92 adcroft 1.2 C-- Reread IO error counter
93     endIOErrCount = IO_ERRCOUNT(myThid)
94    
95     C-- Check for IO errors
96     IF ( endIOErrCount .NE. beginIOErrCount ) THEN
97     WRITE(msgBuf,'(A)') 'S/R WRITE_TIME_AVERAGES'
98     CALL PRINT_ERROR( msgBuf, 1 )
99     WRITE(msgBuf,'(A)') 'Error writing out data'
100     CALL PRINT_ERROR( msgBuf, 1 )
101     WRITE(msgBuf,'(A,I10)') 'Timestep ',myIter
102     CALL PRINT_ERROR( msgBuf, 1 )
103     ELSE
104 cnh 1.5 WRITE(msgBuf,'(A,I10)')
105     & '// Time-average data written, t-step', myIter
106     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
107     & SQUEEZE_RIGHT, 1 )
108 adcroft 1.2 WRITE(msgBuf,'(A)') ' '
109 cnh 1.5 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
110     & SQUEEZE_RIGHT, 1 )
111 adcroft 1.2 ENDIF
112    
113 adcroft 1.1 _END_MASTER( myThid )
114     _BARRIER
115    
116     DO bj = myByLo(myThid), myByHi(myThid)
117     DO bi = myBxLo(myThid), myBxHi(myThid)
118 cnh 1.4 DO k=1,Nr
119 adcroft 1.1
120     C Reset the averages to zero
121     CALL TIMEAVER_INI_XYZ(thetatave, bi,bj,K,myThid)
122     CALL TIMEAVER_INI_XYZ(salttave, bi,bj,K,myThid)
123     CALL TIMEAVER_INI_XYZ(uVeltave, bi,bj,K,myThid)
124     CALL TIMEAVER_INI_XYZ(vVeltave, bi,bj,K,myThid)
125 jmc 1.13 CALL TIMEAVER_INI_XYZ(wVeltave, bi,bj,K,myThid)
126 adcroft 1.1 CALL TIMEAVER_INI_XYZ(uttave, bi,bj,K,myThid)
127     CALL TIMEAVER_INI_XYZ(vttave, bi,bj,K,myThid)
128 jmc 1.13 CALL TIMEAVER_INI_XYZ(phiHydtave, bi,bj,K,myThid)
129 adcroft 1.8 CALL TIMEAVER_INI_XYZ(ConvectCountTave, bi,bj,K,myThid)
130 jmc 1.13 TimeAve_half(k,bi,bj)=0.
131     TimeAve_full(k,bi,bj)=0.
132 adcroft 1.1
133     C Time Averages of single fields
134     DDTT=0.5*deltaTclock
135 jmc 1.13 CALL TIMEAVER_1FLD_XYZ(theta,thetatave,DDTT, bi,bj,K,myThid)
136     CALL TIMEAVER_1FLD_XYZ(salt, salttave, DDTT, bi,bj,K,myThid)
137     CALL TIMEAVER_1FLD_XYZ(uVel, uVeltave, DDTT, bi,bj,K,myThid)
138     CALL TIMEAVER_1FLD_XYZ(vVel, vVeltave, DDTT, bi,bj,K,myThid)
139 adcroft 1.1
140     C Time Averages of "double" fields
141 cnh 1.5 CALL TIMEAVER_2FLD_XYZ(theta, uVel, uttave, 1, DDTT,
142     & bi,bj,K,myThid)
143     CALL TIMEAVER_2FLD_XYZ(theta, vVel, vttave, 2, DDTT,
144     & bi,bj,K,myThid)
145 adcroft 1.1
146     C Keep record of how much time has been integrated over
147 jmc 1.13 TimeAve_half(k,bi,bj)=TimeAve_half(k,bi,bj)+DDTT
148 adcroft 1.1
149     ENDDO
150     ENDDO
151     ENDDO
152    
153     ENDIF
154    
155     RETURN
156     END

  ViewVC Help
Powered by ViewVC 1.1.22