1 |
C $Header: /u/gcmpack/MITgcm/verification/rotating_tank/code/write_pickup.F,v 1.2 2006/08/24 20:36:31 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: WRITE_PICKUP |
8 |
C !INTERFACE: |
9 |
SUBROUTINE WRITE_PICKUP ( permCheckPoint, myTime, |
10 |
& myIter, myThid ) |
11 |
C !DESCRIPTION: \bv |
12 |
C *==========================================================* |
13 |
C | SUBROUTINE WRITE_PICKUP |
14 |
C | o Controlling routine for IO to write restart file. |
15 |
C *==========================================================* |
16 |
C | Write model checkpoint files for use in restart. |
17 |
C | This routine writes both "rolling-checkpoint" files |
18 |
C | and permanent checkpoint files. A rolling checkpoint |
19 |
C | works through a circular list of suffices. Generally the |
20 |
C | circular list has two entries so that a rolling |
21 |
C | checkpoint will overwrite the last rolling checkpoint |
22 |
C | but one. This is useful for running long jobs without |
23 |
C | filling too much disk space. |
24 |
C | In a permanent checkpoint data is written suffixed by |
25 |
C | the current timestep number. This sort of checkpoint can |
26 |
C | be used to provided a snap-shot from which the model |
27 |
C | can be rerun. |
28 |
C *==========================================================* |
29 |
C \ev |
30 |
|
31 |
C !USES: |
32 |
IMPLICIT NONE |
33 |
C == Global variables === |
34 |
#include "SIZE.h" |
35 |
#include "EEPARAMS.h" |
36 |
#include "PARAMS.h" |
37 |
#include "DYNVARS.h" |
38 |
#ifdef ALLOW_NONHYDROSTATIC |
39 |
#include "NH_VARS.h" |
40 |
#endif |
41 |
|
42 |
C !INPUT/OUTPUT PARAMETERS: |
43 |
C == Routine arguments == |
44 |
C permCheckPoint :: Flag indicating whether a permanent checkpoint will |
45 |
C be written. |
46 |
C myThid :: Thread number for this instance of the routine. |
47 |
C myIter :: Iteration number |
48 |
C myTime :: Current time of simulation ( s ) |
49 |
LOGICAL permCheckPoint |
50 |
INTEGER myThid |
51 |
INTEGER myIter |
52 |
_RL myTime |
53 |
|
54 |
C == Common blocks == |
55 |
COMMON /PCKP_GBLFLS/ globalFile |
56 |
LOGICAL globalFile |
57 |
|
58 |
C !LOCAL VARIABLES: |
59 |
C == Local variables == |
60 |
C oldPrc :: Temp. for holding I/O precision |
61 |
C fn :: Temp. for building file name string. |
62 |
C lgf :: Flag to indicate whether to use global file mode. |
63 |
CHARACTER*(MAX_LEN_FNAM) fn |
64 |
INTEGER prec |
65 |
LOGICAL lgf |
66 |
CEOP |
67 |
|
68 |
C-- Going to really do some IO. Make everyone except master thread wait. |
69 |
_BARRIER |
70 |
|
71 |
prec = precFloat64 |
72 |
lgf = globalFile |
73 |
|
74 |
C-- Write model fields |
75 |
IF ( permCheckPoint ) THEN |
76 |
WRITE(fn,'(A,I10.10)') 'pickup.',myIter |
77 |
ELSE |
78 |
WRITE(fn,'(A,A)') 'pickup.',checkPtSuff(nCheckLev) |
79 |
ENDIF |
80 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,uVel, 1,myIter,myThid) |
81 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gU, 2,myIter,myThid) |
82 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gUnm1, 3,myIter,myThid) |
83 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,vVel, 4,myIter,myThid) |
84 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gV, 5,myIter,myThid) |
85 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gVnm1, 6,myIter,myThid) |
86 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,wVel, 7,myIter,myThid) |
87 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,theta, 8,myIter,myThid) |
88 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gT, 9,myIter,myThid) |
89 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gTnm1, 10,myIter,myThid) |
90 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,salt, 11,myIter,myThid) |
91 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gS, 12,myIter,myThid) |
92 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gSnm1,13,myIter,myThid) |
93 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL', 1,etaN,13*Nr+1, |
94 |
& myIter,myThid) |
95 |
#ifdef NONLIN_FRSURF |
96 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL', 1,etaH,13*Nr+2, |
97 |
& myIter,myThid) |
98 |
#endif |
99 |
|
100 |
#ifdef ALLOW_NONHYDROSTATIC |
101 |
IF ( nonHydrostatic ) THEN |
102 |
IF ( permCheckPoint ) THEN |
103 |
WRITE(fn,'(A,I10.10)') 'pickup_nh.',myIter |
104 |
ELSE |
105 |
WRITE(fn,'(A,A)') 'pickup_nh.',checkPtSuff(nCheckLev) |
106 |
ENDIF |
107 |
WRITE(fn,'(A,I10.10)') 'pickup_nh.',myIter |
108 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,phi_nh,1,myIter,myThid) |
109 |
c CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gW, 2,myIter,myThid) |
110 |
CALL MDSWRITEFIELD(fn,prec,lgf,'RL',Nr,gWnm1,2,myIter,myThid) |
111 |
ENDIF |
112 |
#endif |
113 |
_BARRIER |
114 |
|
115 |
RETURN |
116 |
END |