/[MITgcm]/MITgcm/model/src/write_state.F
ViewVC logotype

Diff of /MITgcm/model/src/write_state.F

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

revision 1.4 by heimbach, Mon Nov 13 16:32:58 2000 UTC revision 1.9 by jmc, Tue Mar 6 16:51:02 2001 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2    C $Name$
3  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
4    
5  C--  File read_write.F: Routines to handle mid-level I/O interface.  C--  File read_write.F: Routines to handle mid-level I/O interface.
 C--   Contents  
6  C--   o WRITE_STATE - Write out model state.  C--   o WRITE_STATE - Write out model state.
7    
8    C The following CPP flag (MULTIPLE_RECORD_STATE_FILES) is
9    C #define/#undefed here since it is specific to this routine and
10    C very user-preference specific.
11    C
12    C If #undefed (default) the state files are written as in all versions
13    C prior to checkpoint32, where a file is created per variable, per time
14    C and per tile. This *has* to be the default because most users use this
15    C mode and all utilities and scripts (diagnostic) assume this form.
16    C It is also robust, as explained below.
17    C
18    C If #defined, subsequent snap-shots are written as records in the
19    C same file (no iteration number in filenames).
20    C Advantages: - fewer files
21    C             - for small problems, is easy to copy the output around
22    C Disadvantages:
23    C             - breaks a lot of diagnostic scripts
24    C             - for large or long problems this creates huge files
25    C             - is an unexpected, unsolicited change in behaviour which came
26    C               as a surprise (in c32) and inconvenience to several users
27    C             - can not accomodate changing the frequency of output
28    C               after a pickup (this is trivial in previous method
29    C               but needs new code and parameters in this new method)
30    C Known Bugs:
31    C             - if the length of integration is not exactly an integer
32    C               times the output frequency then the last record written
33    C               (at end of integration) overwrites a previously written
34    C               record corresponding to an earier time. *BE WARNED*
35    
36    #undef  MULTIPLE_RECORD_STATE_FILES
37      
38    
39    
40  CStartofinterface  CStartofinterface
41        SUBROUTINE WRITE_STATE ( forceOutput, myCurrentTime,        SUBROUTINE WRITE_STATE ( forceOutput, myCurrentTime,
42       &    myIter, myThid )       &    myIter, myThid )
# Line 22  C     == Global variables === Line 54  C     == Global variables ===
54  #include "EEPARAMS.h"  #include "EEPARAMS.h"
55  #include "PARAMS.h"  #include "PARAMS.h"
56  #include "DYNVARS.h"  #include "DYNVARS.h"
 #include "CG2D.h"  
57  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
58  #include "CG3D.h"  #include "CG3D.h"
59  #include "GW.h"  #include "GW.h"
# Line 44  C     myCurrentTime - Current time of si Line 75  C     myCurrentTime - Current time of si
75  CEndofinterface  CEndofinterface
76    
77  C     == Local variables ==  C     == Local variables ==
78          CHARACTER*(MAX_LEN_MBUF) suff
79        INTEGER iRec        INTEGER iRec
80    
81        IF (        IF (
82       &     ( DIFFERENT_MULTIPLE(dumpFreq,myCurrentTime,       &     ( DIFFERENT_MULTIPLE(dumpFreq,myCurrentTime,
83       &     myCurrentTime-deltaTClock) .AND. myCurrentTime.NE.startTime )       &     myCurrentTime-deltaTClock) .AND. myCurrentTime.NE.endTime )
84       &     .OR. forceOutput       &     .OR. forceOutput
85       &     ) THEN       &     ) THEN
86           iRec = int ( (myCurrentTime-startTime) / dumpFreq +1.5 )           iRec = int ( (myCurrentTime-startTime) / dumpFreq +1.5 )
# Line 58  C--   Going to really do some IO. Make e Line 90  C--   Going to really do some IO. Make e
90           _BEGIN_MASTER( myThid )           _BEGIN_MASTER( myThid )
91    
92  C--     Write model fields  C--     Write model fields
93    #ifdef MULTIPLE_RECORD_STATE_FILES
94    C       Write each snap-shot as a new record in one file per variable
95    C       - creates relatively few files but these files can become huge
96          CALL WRITE_REC_XYZ_RL( 'U',  uVel,iRec,myIter,myThid)          CALL WRITE_REC_XYZ_RL( 'U',  uVel,iRec,myIter,myThid)
97          CALL WRITE_REC_XYZ_RL( 'V',  vVel,iRec,myIter,myThid)          CALL WRITE_REC_XYZ_RL( 'V',  vVel,iRec,myIter,myThid)
98          CALL WRITE_REC_XYZ_RL( 'T', theta,iRec,myIter,myThid)          CALL WRITE_REC_XYZ_RL( 'T', theta,iRec,myIter,myThid)
99          CALL WRITE_REC_XYZ_RL( 'S',  salt,iRec,myIter,myThid)          CALL WRITE_REC_XYZ_RL( 'S',  salt,iRec,myIter,myThid)
100          CALL WRITE_REC_XY_RL ('PS',cg2d_x,iRec,myIter,myThid)          CALL WRITE_REC_XY_RL ('PS',etaN,iRec,myIter,myThid)
101            CALL WRITE_REC_XYZ_RL( 'W',wVel,iRec,myIter,myThid)
102  #ifdef ALLOW_NONHYDROSTATIC  #ifdef ALLOW_NONHYDROSTATIC
103          IF (nonHydroStatic) THEN          IF (nonHydroStatic) THEN
104           CALL WRITE_REC_XYZ_RL( 'PNH',cg3d_x,iRec,myIter,myThid)           CALL WRITE_REC_XYZ_RL( 'PNH',cg3d_x,iRec,myIter,myThid)
105          ENDIF          ENDIF
106          CALL WRITE_REC_XYZ_RL( 'W',wVel,iRec,myIter,myThid)  #endif /* ALLOW_NONHYDROSTATIC */
107  #endif  #else
108    C       Write each snap-shot as a new file (original and default method)
109    C       - creates many files but for large configurations is easier to
110    C         transfer analyse a particular snap-shots
111            WRITE(suff,'(I10.10)') myIter
112            CALL WRITE_FLD_XYZ_RL( 'U.',suff,uVel,myIter,myThid)
113            CALL WRITE_FLD_XYZ_RL( 'V.',suff,vVel,myIter,myThid)
114            CALL WRITE_FLD_XYZ_RL( 'T.',suff,theta,myIter,myThid)
115            CALL WRITE_FLD_XYZ_RL( 'S.',suff,salt,myIter,myThid)
116            CALL WRITE_FLD_XY_RL( 'PS.',suff,etaN,myIter,myThid)
117            CALL WRITE_FLD_XYZ_RL( 'W.',suff,wVel,myIter,myThid)
118    #ifdef ALLOW_NONHYDROSTATIC
119            IF (nonHydroStatic) THEN
120             CALL WRITE_FLD_XYZ_RL( 'PNH.',suff,cg3d_x,myIter,myThid)
121            ENDIF
122    #endif /* ALLOW_NONHYDROSTATIC */
123    #endif /* MULTIPLE_RECORD_STATE_FILES */
124    
125           _END_MASTER( myThid )           _END_MASTER( myThid )
126           _BARRIER           _BARRIER

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

  ViewVC Help
Powered by ViewVC 1.1.22