/[MITgcm]/MITgcm_contrib/ocean_inversion_project/code_bombC14/write_state.F
ViewVC logotype

Annotation of /MITgcm_contrib/ocean_inversion_project/code_bombC14/write_state.F

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


Revision 1.1 - (hide annotations) (download)
Thu May 25 17:23:20 2006 UTC (19 years, 2 months ago) by dimitri
Branch: MAIN
Configuring bomb C14 experiment

1 dimitri 1.1 C $Header: /u/gcmpack/MITgcm/model/src/write_state.F,v 1.15.4.4 2003/05/02 14:25:29 dimitri Exp $
2     C $Name: release1_50yr $
3     #include "CPP_OPTIONS.h"
4    
5     #undef MULTIPLE_RECORD_STATE_FILES
6    
7     CBOP
8     C !ROUTINE: WRITE_STATE
9     C !INTERFACE:
10     SUBROUTINE WRITE_STATE ( myCurrentTime, myIter, myThid )
11     C !DESCRIPTION: \bv
12     C *==========================================================*
13     C | SUBROUTINE WRITE_STATE
14     C | o Controlling routine for IO to dump model state.
15     C *==========================================================*
16     C | Write model state files for post-processing. This file
17     C | includes code for diagnosing W and RHO for output.
18     C | File write_state.F: Routines to handle mid-level I/O
19     C | interface.
20     C | o WRITE_STATE - Write out model state.
21     C | The following CPP flag (MULTIPLE_RECORD_STATE_FILES) is
22     C | #define/#undefed here since it is specific to this routine
23     C | and very user-preference specific.
24     C |
25     C | If #undefed (default) the state files are written as in all versions
26     C | prior to checkpoint32, where a file is created per variable, per time
27     C | and per tile. This *has* to be the default because most users use this
28     C | mode and all utilities and scripts (diagnostic) assume this form.
29     C | It is also robust, as explained below.
30     C |
31     C | If #defined, subsequent snap-shots are written as records in the
32     C | same file (no iteration number in filenames).
33     C | Advantages: - fewer files
34     C | - for small problems, is easy to copy the output around
35     C | Disadvantages:
36     C | - breaks a lot of diagnostic scripts
37     C | - for large or long problems this creates huge files
38     C | - is an unexpected, unsolicited change in behaviour which came
39     C | as a surprise (in c32) and inconvenience to several users
40     C | - can not accomodate changing the frequency of output
41     C | after a pickup (this is trivial in previous method
42     C | but needs new code and parameters in this new method)
43     C | Known Bugs:
44     C | - if the length of integration is not exactly an integer
45     C | times the output frequency then the last record written
46     C | (at end of integration) overwrites a previously written
47     C | record corresponding to an earier time. *BE WARNED*
48     C *==========================================================*
49     C \ev
50    
51     C !USES:
52     IMPLICIT NONE
53     C == Global variables ===
54     #include "SIZE.h"
55     #include "EEPARAMS.h"
56     #include "PARAMS.h"
57     #include "DYNVARS.h"
58     #include "GRID.h"
59     #ifdef ALLOW_PASSIVE_TRACER
60     #include "TR1.h"
61     #endif
62     LOGICAL DIFFERENT_MULTIPLE
63     EXTERNAL DIFFERENT_MULTIPLE
64     INTEGER IO_ERRCOUNT
65     EXTERNAL IO_ERRCOUNT
66    
67     C !INPUT/OUTPUT PARAMETERS:
68     C == Routine arguments ==
69     C myThid - Thread number for this instance of the routine.
70     C myIter - Iteration number
71     C myCurrentTime - Current time of simulation ( s )
72     _RL myCurrentTime
73     INTEGER myThid
74     INTEGER myIter
75    
76     C !LOCAL VARIABLES:
77     C == Local variables ==
78     CHARACTER*(MAX_LEN_MBUF) suff
79     INTEGER iRec
80     CEOP
81    
82     IF (
83     & DIFFERENT_MULTIPLE(dumpFreq,myCurrentTime,
84     & myCurrentTime-deltaTClock) .OR.
85     & myCurrentTime.EQ.endTime .OR.
86     & myCurrentTime.EQ.startTime
87     & ) THEN
88     IF ( dumpFreq .EQ. 0.0 ) THEN
89     iRec = 1
90     ELSE
91     iRec = int ( (myCurrentTime-startTime) / dumpFreq +1.5 )
92     ENDIF
93    
94     C-- Going to really do some IO. Make everyone except master thread wait.
95     _BARRIER
96     _BEGIN_MASTER( myThid )
97    
98     C-- Write model fields
99    
100     #ifdef MULTIPLE_RECORD_STATE_FILES
101    
102     C Write each snap-shot as a new record in one file per variable
103     C - creates relatively few files but these files can become huge
104     CALL WRITE_REC_XYZ_RL( 'U', uVel,iRec,myIter,myThid)
105     CALL WRITE_REC_XYZ_RL( 'V', vVel,iRec,myIter,myThid)
106     CALL WRITE_REC_XYZ_RL( 'T', theta,iRec,myIter,myThid)
107     CALL WRITE_REC_XYZ_RL( 'S', salt,iRec,myIter,myThid)
108     CALL WRITE_REC_XY_RL('Eta',etaN,iRec,myIter,myThid)
109     CALL WRITE_REC_XYZ_RL( 'W',wVel,iRec,myIter,myThid)
110     #ifdef ALLOW_PASSIVE_TRACER
111     CALL WRITE_REC_XYZ_RL( 'TR1',tr1,iRec,myIter,myThid)
112     CALL WRITE_REC_XY_RL ('gTR1',surfaceTendencyTr1,
113     & iRec,myIter,myThid)
114     #endif
115     #ifdef ALLOW_NONHYDROSTATIC
116     IF (nonHydroStatic) THEN
117     CALL WRITE_REC_XYZ_RL( 'PNH',phi_nh,iRec,myIter,myThid)
118     ENDIF
119     #endif /* ALLOW_NONHYDROSTATIC */
120     #ifdef NONLIN_FRSURF
121     CALL WRITE_REC_XYZ_RS('hFacC.',hFacC,iRec,myIter,myThid)
122     CALL WRITE_FLD_XYZ_RS('hFacW.',hFacW,iRec,myIter,myThid)
123     CALL WRITE_FLD_XYZ_RS('hFacS.',hFacS,iRec,myIter,myThid)
124     #endif /* NONLIN_FRSURF */
125    
126     #else /* MULTIPLE_RECORD_STATE_FILES */
127    
128     C Write each snap-shot as a new file (original and default method)
129     C - creates many files but for large configurations is easier to
130     C transfer analyse a particular snap-shots
131     WRITE(suff,'(I10.10)') myIter
132     #ifdef DUMP_UVTSW_SNAPSHOTS
133     CALL WRITE_FLD_XYZ_RL( 'U.',suff,uVel,myIter,myThid)
134     CALL WRITE_FLD_XYZ_RL( 'V.',suff,vVel,myIter,myThid)
135     CALL WRITE_FLD_XYZ_RL( 'T.',suff,theta,myIter,myThid)
136     CALL WRITE_FLD_XYZ_RL( 'S.',suff,salt,myIter,myThid)
137     CALL WRITE_FLD_XYZ_RL( 'W.',suff,wVel,myIter,myThid)
138     #endif /* DUMP_STUVW_SNAPSHOTS */
139     CALL WRITE_FLD_XY_RL('Eta.',suff,etaN,myIter,myThid)
140     #ifdef ALLOW_NONHYDROSTATIC
141     IF (nonHydroStatic) THEN
142     CALL WRITE_FLD_XYZ_RL( 'PNH.',suff,phi_nh,myIter,myThid)
143     ENDIF
144     #endif /* ALLOW_NONHYDROSTATIC */
145     #ifdef NONLIN_FRSURF
146     CALL WRITE_FLD_XYZ_RS('hFacC.',suff,hFacC,myIter,myThid)
147     CALL WRITE_FLD_XYZ_RS('hFacW.',suff,hFacW,myIter,myThid)
148     CALL WRITE_FLD_XYZ_RS('hFacS.',suff,hFacS,myIter,myThid)
149     #endif /* NONLIN_FRSURF */
150    
151     #endif /* MULTIPLE_RECORD_STATE_FILES */
152    
153     _END_MASTER( myThid )
154     _BARRIER
155    
156     ENDIF
157    
158     #ifdef ALLOW_PASSIVE_TRACER
159     IF (
160     & DIFFERENT_MULTIPLE(tr1dumpFreq,myCurrentTime,
161     & myCurrentTime-deltaTClock) .OR.
162     & myCurrentTime.EQ.endTime .OR.
163     & myCurrentTime.EQ.startTime
164     & ) THEN
165     _BARRIER
166     _BEGIN_MASTER( myThid )
167     WRITE(suff,'(I10.10)') myIter
168     CALL WRITE_FLD_XYZ_RL( 'TR1.',suff,tr1,myIter,myThid)
169     _END_MASTER( myThid )
170     _BARRIER
171     ENDIF
172     #endif
173    
174     RETURN
175     END

  ViewVC Help
Powered by ViewVC 1.1.22