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

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

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


Revision 1.1 - (hide annotations) (download)
Thu Aug 24 01:08:34 2006 UTC (17 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint58o_post
controling S/R for writing pickup file (was done before separately in old
 packages_write_pickup & write_checkpoint): decide when to write pickup-files

1 jmc 1.1 C $Header: /u/gcmpack/MITgcm/model/src/checkpoint.F,v 1.67 2006/08/09 02:23:13 jmc Exp $
2     C $Name: $
3    
4     #include "PACKAGES_CONFIG.h"
5     #include "CPP_OPTIONS.h"
6    
7     C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
8     CBOP
9     C !ROUTINE: DO_WRITE_PICKUP
10     C !INTERFACE:
11     SUBROUTINE DO_WRITE_PICKUP(
12     I modelEnd,
13     I myTime, myIter, myThid )
14    
15     C !DESCRIPTION:
16     C This is the controlling routine that decides when to write restart
17     C (or "pickup" or "checkpoint" ) files. Then it calls 2 subroutines
18     C to write the main-model pickup and each package pickup files.
19     C
20     C Both ``rolling-pickup'' files and permanent pickup files
21     C are written from here. A rolling pickup works through a circular
22     C list of suffices. Generally the circular list has two entries so
23     C that a rolling pickup will overwrite the last rolling
24     C pickup but one. This is useful for running long jobs without
25     C filling too much disk space. In a permanent pickup, data is
26     C written suffixed by the current timestep number. Permanent
27     C pickups can be used to provide snap-shots from which the
28     C model can be restarted.
29    
30     C !USES:
31     IMPLICIT NONE
32     #include "SIZE.h"
33     #include "EEPARAMS.h"
34     #include "PARAMS.h"
35     LOGICAL DIFFERENT_MULTIPLE
36     EXTERNAL DIFFERENT_MULTIPLE
37    
38     C !INPUT PARAMETERS:
39     C modelEnd :: true if call at end of model run.
40     C myTime :: Current time of simulation ( s )
41     C myIter :: Iteration number
42     C myThid :: Thread number for this instance of the routine.
43     LOGICAL modelEnd
44     INTEGER myThid
45     INTEGER myIter
46     _RL myTime
47     CEOP
48    
49     C !LOCAL VARIABLES:
50     C permPickup :: Flag indicating whether a permanent pickup will
51     C be written.
52     C tempPickup :: Flag indicating if it is time to write a non-permanent
53     C pickup (that will be permanent if permPickup=T)
54     C fn :: Temp. for building file name string.
55     C msgBuf :: message buffer
56     LOGICAL permPickup, tempPickup
57     CHARACTER*(MAX_LEN_FNAM) fn
58     CHARACTER*(MAX_LEN_MBUF) msgBuf
59    
60     permPickup = .FALSE.
61     tempPickup = .FALSE.
62     permPickup =
63     & DIFFERENT_MULTIPLE(pChkPtFreq,myTime,deltaTClock)
64     tempPickup =
65     & DIFFERENT_MULTIPLE( chkPtFreq,myTime,deltaTClock)
66    
67     #ifdef ALLOW_CAL
68     IF ( useCAL ) THEN
69     CALL CAL_TIME2DUMP( pChkPtFreq, deltaTClock,
70     U permPickup,
71     I myTime, myIter, myThid )
72     CALL CAL_TIME2DUMP( chkPtFreq, deltaTClock,
73     U tempPickup,
74     I myTime, myIter, myThid )
75     ENDIF
76     #endif
77    
78     IF (
79     & ( .NOT.modelEnd .AND. (permPickup.OR.tempPickup) )
80     & .OR.
81     & ( modelEnd .AND. .NOT.(permPickup.OR.tempPickup) )
82     & ) THEN
83     C-- this is time to write pickup files
84    
85     C- write a pickup for each package which need it to restart
86     CALL PACKAGES_WRITE_PICKUP(
87     I permPickup, myTime, myIter, myThid )
88    
89     C- write main model pickup
90     IF ( .NOT.useOffLine ) THEN
91     CALL WRITE_PICKUP(
92     I permPickup, myTime, myIter, myThid )
93     ENDIF
94    
95     _BEGIN_MASTER(myThid)
96     C- Write suffix for stdout information
97     IF ( permPickup ) THEN
98     WRITE(fn,'(I10.10)') myIter
99     ELSE
100     WRITE(fn,'(A)') checkPtSuff(nCheckLev)
101     ENDIF
102    
103     C- Write information to stdout so there is a record that
104     C writing the pickup was completed
105     WRITE(msgBuf,'(A11,I10,1X,A10)')
106     & "%CHECKPOINT ",myIter,fn
107     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
108     & SQUEEZE_RIGHT, myThid )
109    
110     C- Update pickup level for the next time we write pickup
111     IF ( .NOT. permPickup ) THEN
112     nCheckLev = MOD(nCheckLev, maxNoChkptLev)+1
113     ENDIF
114     _END_MASTER(myThid)
115    
116     C-- time to write pickup files: end
117     ENDIF
118    
119     RETURN
120     END

  ViewVC Help
Powered by ViewVC 1.1.22