/[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.6 - (hide annotations) (download)
Mon Feb 25 20:57:24 2008 UTC (16 years, 3 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint59o, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y
Changes since 1.5: +9 -2 lines
add a flag writePickupAtEnd (default=true) to be able to suppress
writing a pickup at the last timestep

1 mlosch 1.6 C $Header: /u/gcmpack/MITgcm/model/src/do_write_pickup.F,v 1.5 2007/12/04 23:43:37 jmc Exp $
2 jmc 1.1 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 jmc 1.4 #include "RESTART.h"
36 jmc 1.1 LOGICAL DIFFERENT_MULTIPLE
37     EXTERNAL DIFFERENT_MULTIPLE
38    
39     C !INPUT PARAMETERS:
40     C modelEnd :: true if call at end of model run.
41     C myTime :: Current time of simulation ( s )
42     C myIter :: Iteration number
43     C myThid :: Thread number for this instance of the routine.
44     LOGICAL modelEnd
45     INTEGER myThid
46     INTEGER myIter
47     _RL myTime
48     CEOP
49    
50     C !LOCAL VARIABLES:
51     C permPickup :: Flag indicating whether a permanent pickup will
52     C be written.
53     C tempPickup :: Flag indicating if it is time to write a non-permanent
54     C pickup (that will be permanent if permPickup=T)
55     C fn :: Temp. for building file name string.
56     C msgBuf :: message buffer
57     LOGICAL permPickup, tempPickup
58     CHARACTER*(MAX_LEN_FNAM) fn
59     CHARACTER*(MAX_LEN_MBUF) msgBuf
60    
61     permPickup = .FALSE.
62     tempPickup = .FALSE.
63     permPickup =
64     & DIFFERENT_MULTIPLE(pChkPtFreq,myTime,deltaTClock)
65     tempPickup =
66     & DIFFERENT_MULTIPLE( chkPtFreq,myTime,deltaTClock)
67    
68     #ifdef ALLOW_CAL
69     IF ( useCAL ) THEN
70     CALL CAL_TIME2DUMP( pChkPtFreq, deltaTClock,
71     U permPickup,
72     I myTime, myIter, myThid )
73     CALL CAL_TIME2DUMP( chkPtFreq, deltaTClock,
74     U tempPickup,
75     I myTime, myIter, myThid )
76     ENDIF
77     #endif
78    
79 mlosch 1.6 IF ( (modelEnd.AND.writePickupAtEnd)
80     & .OR. permPickup .OR. tempPickup ) THEN
81 jmc 1.1 C-- this is time to write pickup files
82    
83     C- write a pickup for each package which need it to restart
84     CALL PACKAGES_WRITE_PICKUP(
85     I permPickup, myTime, myIter, myThid )
86    
87     C- write main model pickup
88 jmc 1.3 IF ( .NOT.useOffLine ) THEN
89 jmc 1.1 CALL WRITE_PICKUP(
90     I permPickup, myTime, myIter, myThid )
91     ENDIF
92    
93     _BEGIN_MASTER(myThid)
94     C- Write suffix for stdout information
95     IF ( permPickup ) THEN
96     WRITE(fn,'(I10.10)') myIter
97     ELSE
98     WRITE(fn,'(A)') checkPtSuff(nCheckLev)
99     ENDIF
100    
101     C- Write information to stdout so there is a record that
102     C writing the pickup was completed
103     WRITE(msgBuf,'(A11,I10,1X,A10)')
104     & "%CHECKPOINT ",myIter,fn
105     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
106     & SQUEEZE_RIGHT, myThid )
107    
108     C- Update pickup level for the next time we write pickup
109     IF ( .NOT. permPickup ) THEN
110     nCheckLev = MOD(nCheckLev, maxNoChkptLev)+1
111     ENDIF
112     _END_MASTER(myThid)
113    
114 mlosch 1.6 ELSEIF ( modelEnd ) THEN
115     WRITE(msgBuf,'(A)')
116     & "Did not write pickup because writePickupAtEnd = FALSE"
117     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
118     & SQUEEZE_RIGHT, myThid )
119    
120 jmc 1.1 C-- time to write pickup files: end
121     ENDIF
122    
123     RETURN
124     END

  ViewVC Help
Powered by ViewVC 1.1.22