5 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
6 |
|
|
7 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
8 |
|
C files. |
9 |
|
|
10 |
CBOP |
CBOP |
11 |
C !ROUTINE: PACKAGES_WRITE_PICKUP |
C !ROUTINE: PACKAGES_WRITE_PICKUP |
12 |
|
|
13 |
C !INTERFACE: |
C !INTERFACE: |
14 |
SUBROUTINE PACKAGES_WRITE_PICKUP( |
SUBROUTINE PACKAGES_WRITE_PICKUP( |
15 |
I modelEnd, |
I permPickup, |
16 |
I myTime, |
I myTime, myIter, myThid ) |
|
I myIter, |
|
|
I myThid ) |
|
17 |
|
|
18 |
C !DESCRIPTION: |
C !DESCRIPTION: |
19 |
C Write pickup files for each package which needs it to restart. |
C Write pickup files for each package which needs it to restart. |
20 |
C This routine (S/R PACKAGES_WRITE_PICKUP) calls per-package |
C This routine (S/R PACKAGES_WRITE_PICKUP) calls per-package |
21 |
C write-pickup (or checkpoint) routines. It writes both |
C write-pickup (or checkpoint) routines. It writes both |
22 |
C "rolling-checkpoint" files (ckptA,ckptB) and permanent checkpoint |
C "rolling-pickup" files (ckptA,ckptB) and permanent pickup. |
|
C files. |
|
23 |
|
|
24 |
C !USES: |
C !USES: |
25 |
IMPLICIT NONE |
IMPLICIT NONE |
26 |
#include "SIZE.h" |
#include "SIZE.h" |
27 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
28 |
#include "PARAMS.h" |
#include "PARAMS.h" |
29 |
|
#include "RESTART.h" |
|
LOGICAL DIFFERENT_MULTIPLE |
|
|
EXTERNAL DIFFERENT_MULTIPLE |
|
|
INTEGER IO_ERRCOUNT |
|
|
EXTERNAL IO_ERRCOUNT |
|
30 |
|
|
31 |
C !INPUT/OUTPUT PARAMETERS: |
C !INPUT/OUTPUT PARAMETERS: |
32 |
C == Routine arguments == |
C permPickup :: Is or is not a permanent pickup. |
33 |
C modelEnd :: Checkpoint call at end of model run. |
C myTime :: Current time of simulation ( s ) |
34 |
C myTime :: Current time of simulation ( s ) |
C myIter :: Iteration number |
35 |
C myIter :: Iteration number |
C myThid :: Thread number for this instance of the routine. |
36 |
C myThid :: Thread number for this instance of the routine. |
LOGICAL permPickup |
|
LOGICAL modelEnd |
|
37 |
_RL myTime |
_RL myTime |
38 |
INTEGER myIter |
INTEGER myIter |
39 |
INTEGER myThid |
INTEGER myThid |
40 |
|
|
41 |
C !LOCAL VARIABLES: |
C !LOCAL VARIABLES: |
42 |
C == Local variables == |
C == Local variables == |
43 |
C permCheckPoint :: Flag indicating whether a permanent checkpoint will |
C prec :: file precision |
44 |
C be written. |
C suffix :: pickup-name suffix |
|
C tempCheckPoint :: Flag indicating if it is time to write a non-permanent |
|
|
C checkpoint (that will be permanent if permCheckPoint=T) |
|
|
C oldPrc :: Temp. for holding I/O precision |
|
|
C fn :: Temp. for building file name string. |
|
45 |
C lgf :: Flag to indicate whether to use global file mode. |
C lgf :: Flag to indicate whether to use global file mode. |
46 |
LOGICAL permCheckPoint, tempCheckPoint |
CHARACTER*(10) suffix |
|
CEOP |
|
|
|
|
|
permCheckPoint = .FALSE. |
|
|
tempCheckPoint = .FALSE. |
|
|
permCheckPoint= |
|
|
& DIFFERENT_MULTIPLE(pChkPtFreq,myTime,deltaTClock) |
|
|
tempCheckPoint= |
|
|
& DIFFERENT_MULTIPLE( chkPtFreq,myTime,deltaTClock) |
|
|
|
|
|
#ifdef ALLOW_CAL |
|
|
IF ( useCAL ) THEN |
|
|
CALL CAL_TIME2DUMP( pChkPtFreq, deltaTClock, |
|
|
U permCheckPoint, |
|
|
I myTime, myIter, myThid ) |
|
|
CALL CAL_TIME2DUMP( chkPtFreq, deltaTClock, |
|
|
U tempCheckPoint, |
|
|
I myTime, myIter, myThid ) |
|
|
ENDIF |
|
|
#endif /* ALLOW_CAL */ |
|
|
|
|
|
IF ( |
|
|
& ( .NOT.modelEnd .AND. (permCheckPoint.OR.tempCheckPoint) ) |
|
|
& .OR. |
|
|
& ( modelEnd .AND. .NOT.(permCheckPoint.OR.tempCheckPoint) ) |
|
|
& ) THEN |
|
|
|
|
|
CALL PACKAGES_WRITE_PICKUP_NOW( |
|
|
& permCheckPoint, myTime, myIter, myThid ) |
|
|
|
|
|
ENDIF |
|
|
|
|
|
RETURN |
|
|
END |
|
|
|
|
|
|
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
|
|
CBOP |
|
|
C !ROUTINE: PACKAGES_WRITE_PICKUP_NOW |
|
|
|
|
|
C !INTERFACE: |
|
|
SUBROUTINE PACKAGES_WRITE_PICKUP_NOW( |
|
|
I permCheckPoint, |
|
|
I myTime, |
|
|
I myIter, |
|
|
I myThid ) |
|
|
|
|
|
C !DESCRIPTION: |
|
|
C Write pickup files for each package which needs it to restart and |
|
|
C do it NOW. |
|
|
|
|
|
C !USES: |
|
|
IMPLICIT NONE |
|
|
#include "SIZE.h" |
|
|
#include "EEPARAMS.h" |
|
|
#include "PARAMS.h" |
|
|
|
|
|
|
|
|
C !INPUT/OUTPUT PARAMETERS: |
|
|
C permCheckPoint :: Checkpoint is permanent |
|
|
C myTime :: Current time of simulation ( s ) |
|
|
C myIter :: Iteration number |
|
|
C myThid :: Thread number for this instance of the routine. |
|
|
LOGICAL permCheckPoint |
|
|
_RL myTime |
|
|
INTEGER myIter |
|
|
INTEGER myThid |
|
|
|
|
|
C == Common blocks == |
|
|
COMMON /PCKP_GBLFLS/ globalFile |
|
|
LOGICAL globalFile |
|
|
|
|
|
C !LOCAL VARIABLES: |
|
|
C == Local variables == |
|
|
C oldPrc :: Temp. for holding I/O precision |
|
|
C fn :: Temp. for building file name string. |
|
|
C lgf :: Flag to indicate whether to use global file mode. |
|
|
CHARACTER*(MAX_LEN_FNAM) fn |
|
47 |
INTEGER prec |
INTEGER prec |
48 |
LOGICAL lgf |
LOGICAL lgf |
49 |
CEOP |
CEOP |
50 |
|
|
51 |
C Going to really do some IO. Make everyone except master thread wait. |
C Going to really do some IO. Make everyone except master thread wait. |
52 |
_BARRIER |
_BARRIER |
|
C _BEGIN_MASTER( myThid ) |
|
53 |
|
|
54 |
prec = precFloat64 |
prec = precFloat64 |
55 |
lgf = globalFile |
lgf = globalFiles |
56 |
|
|
57 |
C Create suffix to pass on to package pickup routines |
C Create suffix to pass on to package pickup routines |
58 |
IF ( permCheckPoint ) THEN |
IF ( permPickup ) THEN |
59 |
WRITE(fn,'(I10.10)') myIter |
WRITE(suffix,'(I10.10)') myIter |
60 |
ELSE |
ELSE |
61 |
WRITE(fn,'(A)') checkPtSuff(nCheckLev) |
WRITE(suffix,'(A)') checkPtSuff(nCheckLev) |
62 |
ENDIF |
ENDIF |
63 |
|
|
64 |
|
#ifdef ALLOW_GENERIC_ADVDIFF |
65 |
|
C Write restart file for 2nd-Order moment (active) Tracers |
66 |
|
IF ( useGAD ) THEN |
67 |
|
CALL GAD_WRITE_PICKUP( |
68 |
|
I suffix, myTime, myIter, myThid ) |
69 |
|
ENDIF |
70 |
|
#endif /* ALLOW_GENERIC_ADVDIFF */ |
71 |
|
|
72 |
#ifdef ALLOW_CD_CODE |
#ifdef ALLOW_CD_CODE |
73 |
IF (useCDscheme) THEN |
IF (useCDscheme) THEN |
74 |
CALL CD_CODE_WRITE_CHECKPOINT( |
CALL CD_CODE_WRITE_PICKUP( permPickup, |
75 |
& prec, lgf, permCheckPoint, myIter, myThid) |
I suffix, myTime, myIter, myThid ) |
76 |
ENDIF |
ENDIF |
77 |
#endif /* ALLOW_CD_CODE */ |
#endif /* ALLOW_CD_CODE */ |
78 |
|
|
79 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
80 |
C SPK 4/9/01: Open boundary checkpointing |
C SPK 4/9/01: Open boundary checkpointing |
81 |
IF (useOBCS) THEN |
c IF (useOBCS) THEN |
82 |
CALL OBCS_WRITE_CHECKPOINT( |
c CALL OBCS_WRITE_CHECKPOINT( |
83 |
& prec, lgf, permCheckPoint, myIter, myThid) |
c & prec, lgf, permPickup, myIter, myThid) |
84 |
ENDIF |
c ENDIF |
85 |
#endif /* ALLOW_OBCS */ |
#endif /* ALLOW_OBCS */ |
86 |
|
|
87 |
#ifdef ALLOW_SEAICE |
#ifdef ALLOW_SEAICE |
88 |
IF ( useSEAICE ) THEN |
IF ( useSEAICE ) THEN |
89 |
CALL SEAICE_WRITE_PICKUP( |
CALL SEAICE_WRITE_PICKUP( permPickup, |
90 |
& prec, lgf, permCheckPoint, myIter, myThid) |
I suffix, myTime, myIter, myThid ) |
91 |
ENDIF |
ENDIF |
92 |
#endif /* ALLOW_SEAICE */ |
#endif /* ALLOW_SEAICE */ |
93 |
|
|
94 |
#ifdef ALLOW_THSICE |
#ifdef ALLOW_THSICE |
95 |
IF (useThSIce) THEN |
IF (useThSIce) THEN |
96 |
CALL THSICE_WRITE_PICKUP( |
CALL THSICE_WRITE_PICKUP( permPickup, |
97 |
& prec, lgf, permCheckPoint, myIter, myThid) |
I suffix, myTime, myIter, myThid ) |
98 |
ENDIF |
ENDIF |
99 |
#endif /* ALLOW_THSICE */ |
#endif /* ALLOW_THSICE */ |
100 |
|
|
101 |
#ifdef COMPONENT_MODULE |
#ifdef COMPONENT_MODULE |
102 |
IF (useCoupler) THEN |
IF (useCoupler) THEN |
103 |
CALL CPL_WRITE_PICKUP( |
CALL CPL_WRITE_PICKUP( |
104 |
& prec, lgf, permCheckPoint, myIter, myThid) |
& suffix, myTime, myIter, myThid ) |
105 |
ENDIF |
ENDIF |
106 |
#endif /* COMPONENT_MODULE */ |
#endif /* COMPONENT_MODULE */ |
107 |
|
|
115 |
#ifdef ALLOW_LAND |
#ifdef ALLOW_LAND |
116 |
C Write pickup file for Land package: |
C Write pickup file for Land package: |
117 |
IF (useLand) THEN |
IF (useLand) THEN |
118 |
CALL LAND_WRITE_PICKUP(permCheckPoint,fn, |
CALL LAND_WRITE_PICKUP( permPickup, |
119 |
& myTime,myIter,myThid) |
& suffix, myTime, myIter, myThid ) |
120 |
ENDIF |
ENDIF |
121 |
#endif |
#endif |
122 |
|
|
123 |
#ifdef ALLOW_FIZHI |
#ifdef ALLOW_FIZHI |
124 |
C Write pickup file for fizhi package |
C Write pickup file for fizhi package |
125 |
IF (usefizhi) THEN |
IF (usefizhi) THEN |
126 |
CALL FIZHI_WRITE_PICKUP(fn,myTime,myIter,myThid) |
CALL FIZHI_WRITE_PICKUP(suffix,myTime,myIter,myThid) |
127 |
CALL FIZHI_WRITE_VEGTILES(fn,0,myTime,myIter,myThid) |
CALL FIZHI_WRITE_VEGTILES(suffix,0,myTime,myIter,myThid) |
128 |
CALL FIZHI_WRITE_DATETIME(myTime,myIter,myThid) |
CALL FIZHI_WRITE_DATETIME(myTime,myIter,myThid) |
129 |
ENDIF |
ENDIF |
130 |
#endif |
#endif |
132 |
#ifdef ALLOW_DIAGNOSTICS |
#ifdef ALLOW_DIAGNOSTICS |
133 |
C Write pickup file for diagnostics package |
C Write pickup file for diagnostics package |
134 |
IF (useDiagnostics) THEN |
IF (useDiagnostics) THEN |
135 |
CALL DIAGNOSTICS_WRITE_PICKUP(permCheckPoint, |
CALL DIAGNOSTICS_WRITE_PICKUP( permPickup, |
136 |
& fn,myTime,myIter,myThid) |
I suffix, myTime, myIter, myThid ) |
137 |
ENDIF |
ENDIF |
138 |
#endif |
#endif |
139 |
|
|
140 |
#ifdef ALLOW_GGL90 |
#ifdef ALLOW_GGL90 |
141 |
IF ( useGGL90 ) THEN |
IF ( useGGL90 ) THEN |
142 |
CALL GGL90_WRITE_CHECKPOINT( |
CALL GGL90_WRITE_PICKUP( permPickup, |
143 |
& prec, lgf, permCheckPoint, myIter, myThid) |
I suffix, myTime, myIter, myThid ) |
144 |
ENDIF |
ENDIF |
145 |
#endif /* ALLOW_GGL90 */ |
#endif /* ALLOW_GGL90 */ |
146 |
|
|
147 |
#ifdef ALLOW_PTRACERS |
#ifdef ALLOW_PTRACERS |
148 |
C Write restart file for passive tracers |
C Write restart file for passive tracers |
149 |
IF (usePTRACERS) THEN |
IF (usePTRACERS) THEN |
150 |
CALL PTRACERS_WRITE_CHECKPOINT(permCheckPoint, |
CALL PTRACERS_WRITE_PICKUP( permPickup, |
151 |
& fn,myIter,myTime,myThid) |
I suffix, myTime, myIter, myThid ) |
152 |
ENDIF |
ENDIF |
153 |
#endif /* ALLOW_PTRACERS */ |
#endif /* ALLOW_PTRACERS */ |
154 |
|
|
155 |
C _END_MASTER( myThid ) |
#ifdef ALLOW_GCHEM |
156 |
_BARRIER |
C Write restart file for GCHEM pkg & GCHEM sub-packages |
157 |
|
IF ( useGCHEM ) THEN |
158 |
|
CALL DIC_WRITE_PICKUP( permPickup, |
159 |
|
I suffix, myTime, myIter, myThid ) |
160 |
|
ENDIF |
161 |
|
#endif |
162 |
|
|
163 |
#ifdef ALLOW_OFFLINE |
#ifdef ALLOW_MYPACKAGE |
164 |
C This is quick fix for A/B checkpoints since the main model |
IF (useMYPACKAGE) THEN |
165 |
C checkpoint routine will not be called in OFFLINE mode and will |
CALL MYPACKAGE_WRITE_PICKUP( permPickup, |
166 |
C thus not have the chance to set the alternating A/B suffix |
I suffix, myTime, myIter, myThid ) |
|
IF ( .NOT. permCheckPoint ) THEN |
|
|
_BEGIN_MASTER( myThid ) |
|
|
nCheckLev = MOD(nCheckLev, maxNoChkptLev)+1 |
|
|
_END_MASTER( myThid ) |
|
167 |
ENDIF |
ENDIF |
168 |
#endif /* ALLOW_OFFLINE */ |
#endif /* ALLOW_MYPACKAGE */ |
169 |
|
|
170 |
|
C-- Every one else must wait until writing is done. |
171 |
|
_BARRIER |
172 |
|
|
173 |
RETURN |
RETURN |
174 |
END |
END |