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