1 |
C $Header: /u/gcmpack/MITgcm/pkg/atm2d/atm2d_write_pickup.F,v 1.2 2007/10/08 23:48:28 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "ctrparam.h" |
5 |
#include "ATM2D_OPTIONS.h" |
6 |
SUBROUTINE ATM2D_WRITE_PICKUP( |
7 |
I modelEnd, |
8 |
I myTime, |
9 |
I myIter, |
10 |
I myThid ) |
11 |
|
12 |
C *==========================================================* |
13 |
C | Write pickup files for atm2d package which needs it to | |
14 |
C |restart. It writes both "rolling-checkpoint" files (ckptA,| |
15 |
C |ckptB) and permanent checkpoint files. NOT called from | |
16 |
C |the usual MITGCM WRITE_PICKUP routine in forward step, as | |
17 |
C |NORM_OCN_FLUXES must be done before these fluxes are ready| |
18 |
C *==========================================================* |
19 |
|
20 |
C Note this routine was pilfered from the MITGCM code prior to |
21 |
C JMC's changes in 8/06. |
22 |
|
23 |
C !USES: |
24 |
IMPLICIT NONE |
25 |
#include "SIZE.h" |
26 |
#include "EEPARAMS.h" |
27 |
#include "PARAMS.h" |
28 |
#include "RESTART.h" |
29 |
|
30 |
LOGICAL DIFFERENT_MULTIPLE |
31 |
EXTERNAL DIFFERENT_MULTIPLE |
32 |
INTEGER IO_ERRCOUNT |
33 |
EXTERNAL IO_ERRCOUNT |
34 |
|
35 |
C !INPUT/OUTPUT PARAMETERS: |
36 |
C == Routine arguments == |
37 |
C modelEnd :: Checkpoint call at end of model run. |
38 |
C myThid :: Thread number for this instance of the routine. |
39 |
C myIter :: Iteration number |
40 |
C myTime :: Current time of simulation ( s ) |
41 |
LOGICAL modelEnd |
42 |
INTEGER myThid |
43 |
INTEGER myIter |
44 |
_RL myTime |
45 |
|
46 |
C !LOCAL VARIABLES: |
47 |
C == Local variables == |
48 |
C permCheckPoint :: Flag indicating whether a permanent checkpoint will |
49 |
C be written. |
50 |
C tempCheckPoint :: Flag indicating if it is time to write a non-permanent |
51 |
C checkpoint (that will be permanent if permCheckPoint=T) |
52 |
C oldPrc :: Temp. for holding I/O precision |
53 |
C fn :: Temp. for building file name string. |
54 |
C lgf :: Flag to indicate whether to use global file mode. |
55 |
LOGICAL permCheckPoint, tempCheckPoint |
56 |
CEOP |
57 |
|
58 |
permCheckPoint = .FALSE. |
59 |
tempCheckPoint = .FALSE. |
60 |
permCheckPoint= |
61 |
& DIFFERENT_MULTIPLE(pChkPtFreq,myTime,deltaTClock) |
62 |
tempCheckPoint= |
63 |
& DIFFERENT_MULTIPLE( chkPtFreq,myTime,deltaTClock) |
64 |
|
65 |
#ifdef ALLOW_CAL |
66 |
IF ( useCAL ) THEN |
67 |
CALL CAL_TIME2DUMP( pChkPtFreq, deltaTClock, |
68 |
U permCheckPoint, |
69 |
I myTime, myIter, myThid ) |
70 |
CALL CAL_TIME2DUMP( chkPtFreq, deltaTClock, |
71 |
U tempCheckPoint, |
72 |
I myTime, myIter, myThid ) |
73 |
ENDIF |
74 |
#endif /* ALLOW_CAL */ |
75 |
|
76 |
IF ( |
77 |
& ( .NOT.modelEnd .AND. (permCheckPoint.OR.tempCheckPoint) ) |
78 |
& .OR. |
79 |
& ( modelEnd .AND. .NOT.(permCheckPoint.OR.tempCheckPoint) ) |
80 |
& ) THEN |
81 |
|
82 |
IF (tempCheckPoint) !toggle was done prematurely... |
83 |
& nCheckLev = MOD(nCheckLev, maxNoChkptLev)+1 |
84 |
|
85 |
CALL ATM2D_WRITE_PICKUP_NOW( |
86 |
& permCheckPoint, myTime, myIter, myThid ) |
87 |
|
88 |
IF (tempCheckPoint) !note this works for A/B chpt only |
89 |
& nCheckLev = MOD(nCheckLev, maxNoChkptLev)+1 |
90 |
|
91 |
ENDIF |
92 |
|
93 |
RETURN |
94 |
END |
95 |
|
96 |
|
97 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
98 |
#include "ctrparam.h" |
99 |
#include "ATM2D_OPTIONS.h" |
100 |
CBOP |
101 |
C !ROUTINE: ATM2D_WRITE_PICKUP_NOW |
102 |
|
103 |
C !INTERFACE: |
104 |
SUBROUTINE ATM2D_WRITE_PICKUP_NOW( |
105 |
I permCheckPoint, |
106 |
I myTime, |
107 |
I myIter, |
108 |
I myThid ) |
109 |
|
110 |
C !DESCRIPTION: |
111 |
C Write pickup files for atm2d package which needs it to restart and |
112 |
C do it NOW. |
113 |
|
114 |
C !USES: |
115 |
IMPLICIT NONE |
116 |
#include "ATMSIZE.h" |
117 |
#include "SIZE.h" |
118 |
#include "EEPARAMS.h" |
119 |
#include "PARAMS.h" |
120 |
#include "THSICE_VARS.h" |
121 |
#include "ATM2D_VARS.h" |
122 |
|
123 |
|
124 |
C !INPUT/OUTPUT PARAMETERS: |
125 |
C permCheckPoint :: Checkpoint is permanent |
126 |
C myThid :: Thread number for this instance of the routine. |
127 |
C myIter :: Iteration number |
128 |
C myTime :: Current time of simulation ( s ) |
129 |
LOGICAL permCheckPoint |
130 |
INTEGER myThid |
131 |
INTEGER myIter |
132 |
_RL myTime |
133 |
|
134 |
C == Common blocks == |
135 |
COMMON /PCKP_GBLFLS/ globalFile |
136 |
LOGICAL globalFile |
137 |
|
138 |
C !LOCAL VARIABLES: |
139 |
C == Local variables == |
140 |
C oldPrc :: Temp. for holding I/O precision |
141 |
C fn :: Temp. for building file name string. |
142 |
C lgf :: Flag to indicate whether to use global file mode. |
143 |
CHARACTER*(MAX_LEN_FNAM) fn |
144 |
INTEGER prec, i,j |
145 |
LOGICAL lgf |
146 |
CEOP |
147 |
|
148 |
C Going to really do some IO. Make everyone except master thread wait. |
149 |
C _BARRIER |
150 |
C _BEGIN_MASTER( myThid ) |
151 |
|
152 |
prec = precFloat64 |
153 |
lgf = globalFile |
154 |
|
155 |
C Create suffix to pass on to package pickup routines |
156 |
IF ( permCheckPoint ) THEN |
157 |
WRITE(fn,'(A,I10.10)') 'pickup_atm2d.',myIter |
158 |
ELSE |
159 |
WRITE(fn,'(A,A)') 'pickup_atm2d.',checkPtSuff(nCheckLev) |
160 |
ENDIF |
161 |
|
162 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_slp, |
163 |
& 1,myIter,myThid) |
164 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_qnet, |
165 |
& 2,myIter,myThid) |
166 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_solarnet, |
167 |
& 3,myIter,myThid) |
168 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_fu, |
169 |
& 4,myIter,myThid) |
170 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_fv, |
171 |
& 5,myIter,myThid) |
172 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_precip, |
173 |
& 6,myIter,myThid) |
174 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_evap, |
175 |
& 7,myIter,myThid) |
176 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_runoff, |
177 |
& 8,myIter,myThid) |
178 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_wspeed, |
179 |
& 9,myIter,myThid) |
180 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_pCO2, |
181 |
& 10,myIter,myThid) |
182 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_sIceLoad, |
183 |
& 11,myIter,myThid) |
184 |
|
185 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,sHeating, |
186 |
& 12,myIter,myThid) |
187 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,flxCndBt, |
188 |
& 13,myIter,myThid) |
189 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,pass_prcAtm, |
190 |
& 14,myIter,myThid) |
191 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,snowPrc, |
192 |
& 15,myIter,myThid) |
193 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,icFrwAtm, |
194 |
& 16,myIter,myThid) |
195 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,icFlxSw, |
196 |
& 17,myIter,myThid) |
197 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',1,siceAlb, |
198 |
& 18,myIter,myThid) |
199 |
|
200 |
C _END_MASTER( myThid ) |
201 |
C _BARRIER |
202 |
|
203 |
RETURN |
204 |
END |
205 |
|