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

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

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


Revision 1.11 - (hide annotations) (download)
Tue Apr 10 22:35:26 2001 UTC (23 years, 1 month ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint38, checkpoint39
Changes since 1.10: +7 -8 lines
See doc/tag-index and doc/notes_c37_adj.txt
Preparation for stand-alone autodifferentiability.

1 heimbach 1.11 C $Header: /u/gcmpack/models/MITgcmUV/model/src/write_state.F,v 1.10 2001/03/08 20:07:43 jmc Exp $
2     C $Name: checkpoint37 $
3 adcroft 1.1 #include "CPP_OPTIONS.h"
4    
5     C-- File read_write.F: Routines to handle mid-level I/O interface.
6     C-- o WRITE_STATE - Write out model state.
7    
8 adcroft 1.5 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 adcroft 1.1 CStartofinterface
41 heimbach 1.11 SUBROUTINE WRITE_STATE ( myCurrentTime, myIter, myThid )
42 adcroft 1.1 C /==========================================================\
43     C | SUBROUTINE WRITE_STATE |
44     C | o Controlling routine for IO to dump model state. |
45     C |==========================================================|
46     C | Write model state files for post-processing. This file |
47     C | includes code for diagnosing W and RHO for output. |
48     C \==========================================================/
49     IMPLICIT NONE
50    
51     C == Global variables ===
52     #include "SIZE.h"
53     #include "EEPARAMS.h"
54     #include "PARAMS.h"
55     #include "DYNVARS.h"
56     #ifdef ALLOW_NONHYDROSTATIC
57     #include "CG3D.h"
58     #include "GW.h"
59     #endif
60    
61     LOGICAL DIFFERENT_MULTIPLE
62     EXTERNAL DIFFERENT_MULTIPLE
63     INTEGER IO_ERRCOUNT
64     EXTERNAL IO_ERRCOUNT
65    
66     C == Routine arguments ==
67     C myThid - Thread number for this instance of the routine.
68     C myIter - Iteration number
69     C myCurrentTime - Current time of simulation ( s )
70 adcroft 1.2 _RL myCurrentTime
71 adcroft 1.1 INTEGER myThid
72     INTEGER myIter
73     CEndofinterface
74    
75     C == Local variables ==
76 adcroft 1.5 CHARACTER*(MAX_LEN_MBUF) suff
77 heimbach 1.4 INTEGER iRec
78 adcroft 1.1
79     IF (
80 heimbach 1.11 & DIFFERENT_MULTIPLE(dumpFreq,myCurrentTime,
81     & myCurrentTime-deltaTClock) .OR.
82     & myCurrentTime.EQ.endTime .OR.
83     & myCurrentTime.EQ.startTime
84 heimbach 1.4 & ) THEN
85     iRec = int ( (myCurrentTime-startTime) / dumpFreq +1.5 )
86    
87     C-- Going to really do some IO. Make everyone except master thread wait.
88     _BARRIER
89     _BEGIN_MASTER( myThid )
90 adcroft 1.1
91     C-- Write model fields
92 adcroft 1.5 #ifdef MULTIPLE_RECORD_STATE_FILES
93     C Write each snap-shot as a new record in one file per variable
94     C - creates relatively few files but these files can become huge
95 heimbach 1.4 CALL WRITE_REC_XYZ_RL( 'U', uVel,iRec,myIter,myThid)
96     CALL WRITE_REC_XYZ_RL( 'V', vVel,iRec,myIter,myThid)
97     CALL WRITE_REC_XYZ_RL( 'T', theta,iRec,myIter,myThid)
98     CALL WRITE_REC_XYZ_RL( 'S', salt,iRec,myIter,myThid)
99 jmc 1.10 CALL WRITE_REC_XY_RL('Eta',etaN,iRec,myIter,myThid)
100 adcroft 1.7 CALL WRITE_REC_XYZ_RL( 'W',wVel,iRec,myIter,myThid)
101 adcroft 1.1 #ifdef ALLOW_NONHYDROSTATIC
102     IF (nonHydroStatic) THEN
103 heimbach 1.4 CALL WRITE_REC_XYZ_RL( 'PNH',cg3d_x,iRec,myIter,myThid)
104 adcroft 1.1 ENDIF
105 adcroft 1.5 #endif /* ALLOW_NONHYDROSTATIC */
106     #else
107     C Write each snap-shot as a new file (original and default method)
108     C - creates many files but for large configurations is easier to
109     C transfer analyse a particular snap-shots
110     WRITE(suff,'(I10.10)') myIter
111     CALL WRITE_FLD_XYZ_RL( 'U.',suff,uVel,myIter,myThid)
112     CALL WRITE_FLD_XYZ_RL( 'V.',suff,vVel,myIter,myThid)
113     CALL WRITE_FLD_XYZ_RL( 'T.',suff,theta,myIter,myThid)
114     CALL WRITE_FLD_XYZ_RL( 'S.',suff,salt,myIter,myThid)
115 jmc 1.10 CALL WRITE_FLD_XY_RL('Eta.',suff,etaN,myIter,myThid)
116 adcroft 1.7 CALL WRITE_FLD_XYZ_RL( 'W.',suff,wVel,myIter,myThid)
117 adcroft 1.5 #ifdef ALLOW_NONHYDROSTATIC
118     IF (nonHydroStatic) THEN
119     CALL WRITE_FLD_XYZ_RL( 'PNH.',suff,cg3d_x,myIter,myThid)
120     ENDIF
121     #endif /* ALLOW_NONHYDROSTATIC */
122     #endif /* MULTIPLE_RECORD_STATE_FILES */
123 adcroft 1.1
124 heimbach 1.4 _END_MASTER( myThid )
125     _BARRIER
126 adcroft 1.1
127     ENDIF
128    
129     RETURN
130     END

  ViewVC Help
Powered by ViewVC 1.1.22