1 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_write_pickup.F,v 1.16 2013/01/13 22:46:38 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "SEAICE_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: SEAICE_WRITE_PICKUP |
8 |
C !INTERFACE: |
9 |
SUBROUTINE SEAICE_WRITE_PICKUP ( permPickup, suff, |
10 |
I myTime, myIter, myThid ) |
11 |
|
12 |
C !DESCRIPTION: \bv |
13 |
C *==========================================================* |
14 |
C | SUBROUTINE SEAICE_WRITE_PICKUP |
15 |
C | o Write sea ice pickup file for restarting. |
16 |
C *==========================================================* |
17 |
C \ev |
18 |
|
19 |
C !USES: |
20 |
IMPLICIT NONE |
21 |
|
22 |
C == Global variables === |
23 |
#include "SIZE.h" |
24 |
#include "EEPARAMS.h" |
25 |
#include "PARAMS.h" |
26 |
#include "SEAICE_SIZE.h" |
27 |
#include "SEAICE_PARAMS.h" |
28 |
#include "SEAICE.h" |
29 |
#include "SEAICE_TRACER.h" |
30 |
|
31 |
C !INPUT/OUTPUT PARAMETERS: |
32 |
C == Routine arguments == |
33 |
C permPickup :: write a permanent pickup |
34 |
C suff :: suffix for pickup file (eg. ckptA or 0000000010) |
35 |
C myTime :: Current time in simulation |
36 |
C myIter :: Current iteration number in simulation |
37 |
C myThid :: My Thread Id number |
38 |
LOGICAL permPickup |
39 |
CHARACTER*(*) suff |
40 |
_RL myTime |
41 |
INTEGER myIter |
42 |
INTEGER myThid |
43 |
|
44 |
C !LOCAL VARIABLES: |
45 |
C == Local variables == |
46 |
C fp :: pickup-file precision ( precFloat64 ) |
47 |
C glf :: local flag for "globalFiles" |
48 |
C fn :: Temp. for building file name. |
49 |
C nWrFlds :: number of fields being written |
50 |
C listDim :: dimension of "wrFldList" local array |
51 |
C wrFldList :: list of written fields |
52 |
C j :: loop index / field number |
53 |
C nj :: record number |
54 |
C msgBuf :: Informational/error message buffer |
55 |
INTEGER fp |
56 |
LOGICAL glf |
57 |
_RL timList(1) |
58 |
CHARACTER*(MAX_LEN_FNAM) fn |
59 |
INTEGER listDim, nWrFlds |
60 |
PARAMETER( listDim = 20 ) |
61 |
CHARACTER*(8) wrFldList(listDim) |
62 |
INTEGER j, nj |
63 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
64 |
#ifdef ALLOW_SITRACER |
65 |
CHARACTER*(8) fldName |
66 |
INTEGER iTrac |
67 |
#endif |
68 |
CEOP |
69 |
|
70 |
C-- Write model fields |
71 |
WRITE(fn,'(A,A)') 'pickup_seaice.',suff |
72 |
|
73 |
c IF ( seaice_pickup_write_mdsio ) THEN |
74 |
|
75 |
fp = precFloat64 |
76 |
j = 0 |
77 |
nj = 0 |
78 |
C record number < 0 : a hack not to write meta files now: |
79 |
|
80 |
C-- write Sea-Ice Thermodynamics State variables, starting with 3-D fields: |
81 |
IF ( .NOT.useThSIce ) THEN |
82 |
j = j + 1 |
83 |
nj = nj-1 |
84 |
IF (SEAICE_multDim.GT.1) THEN |
85 |
CALL WRITE_REC_3D_RL(fn,fp,MULTDIM,TICES, nj, myIter, myThid ) |
86 |
IF (j.LE.listDim) wrFldList(j) = 'siTICES ' |
87 |
C- switch to 2-D fields: |
88 |
c nj = nj*MULTDIM |
89 |
nj = nj-MULTDIM+1 |
90 |
ELSE |
91 |
CALL WRITE_REC_3D_RL( fn, fp, 1, TICE , nj, myIter, myThid ) |
92 |
IF (j.LE.listDim) wrFldList(j) = 'siTICE ' |
93 |
ENDIF |
94 |
|
95 |
C--- continue to write 2-D fields: |
96 |
j = j + 1 |
97 |
nj = nj-1 |
98 |
#ifdef SEAICE_ITD |
99 |
CALL WRITE_REC_3D_RL(fn, fp, nITD, AREAITD , nj, myIter, myThid) |
100 |
IF (j.LE.listDim) wrFldList(j) = 'siAREAn ' |
101 |
nj = nj-nITD+1 |
102 |
#else |
103 |
CALL WRITE_REC_3D_RL( fn, fp, 1, AREA , nj, myIter, myThid ) |
104 |
IF (j.LE.listDim) wrFldList(j) = 'siAREA ' |
105 |
#endif |
106 |
|
107 |
j = j + 1 |
108 |
nj = nj-1 |
109 |
#ifdef SEAICE_ITD |
110 |
CALL WRITE_REC_3D_RL(fn, fp, nITD, HEFFITD , nj, myIter, myThid) |
111 |
IF (j.LE.listDim) wrFldList(j) = 'siHEFFn ' |
112 |
nj = nj-nITD+1 |
113 |
#else |
114 |
CALL WRITE_REC_3D_RL( fn, fp, 1, HEFF , nj, myIter, myThid ) |
115 |
IF (j.LE.listDim) wrFldList(j) = 'siHEFF ' |
116 |
#endif |
117 |
|
118 |
j = j + 1 |
119 |
nj = nj-1 |
120 |
#ifdef SEAICE_ITD |
121 |
CALL WRITE_REC_3D_RL(fn, fp, nITD, HSNOWITD, nj, myIter, myThid) |
122 |
IF (j.LE.listDim) wrFldList(j) = 'siHSNOWn' |
123 |
nj = nj-nITD+1 |
124 |
#else |
125 |
CALL WRITE_REC_3D_RL( fn, fp, 1, HSNOW , nj, myIter, myThid ) |
126 |
IF (j.LE.listDim) wrFldList(j) = 'siHSNOW ' |
127 |
#endif |
128 |
#ifdef SEAICE_VARIABLE_SALINITY |
129 |
j = j + 1 |
130 |
nj = nj-1 |
131 |
CALL WRITE_REC_3D_RL( fn, fp, 1, HSALT , nj, myIter, myThid ) |
132 |
IF (j.LE.listDim) wrFldList(j) = 'siHSALT ' |
133 |
#endif |
134 |
#ifdef ALLOW_SITRACER |
135 |
DO iTrac = 1, SItrNumInUse |
136 |
WRITE(fldName,'(A6,I2.2)') 'siTrac', iTrac |
137 |
j = j + 1 |
138 |
nj = nj-1 |
139 |
CALL WRITE_REC_3D_RL( fn, fp, 1, |
140 |
& SItracer(1-OLx,1-OLy,1,1,iTrac), |
141 |
& nj, myIter, myThid ) |
142 |
IF (j.LE.listDim) wrFldList(j) = fldName |
143 |
ENDDO |
144 |
#endif |
145 |
ENDIF |
146 |
|
147 |
C-- write Sea-Ice Dynamics variables (all 2-D fields): |
148 |
j = j + 1 |
149 |
nj = nj-1 |
150 |
CALL WRITE_REC_3D_RL( fn, fp, 1, UICE , nj, myIter, myThid ) |
151 |
IF (j.LE.listDim) wrFldList(j) = 'siUICE ' |
152 |
|
153 |
j = j + 1 |
154 |
nj = nj-1 |
155 |
CALL WRITE_REC_3D_RL( fn, fp, 1, VICE , nj, myIter, myThid ) |
156 |
IF (j.LE.listDim) wrFldList(j) = 'siVICE ' |
157 |
|
158 |
#if (defined(SEAICE_CGRID) && defined(SEAICE_ALLOW_EVP)) |
159 |
IF ( SEAICEuseEVP ) THEN |
160 |
j = j + 1 |
161 |
nj = nj-1 |
162 |
CALL WRITE_REC_3D_RL( fn, fp, 1, seaice_sigma1, |
163 |
& nj, myIter, myThid ) |
164 |
IF (j.LE.listDim) wrFldList(j) = 'siSigm1 ' |
165 |
|
166 |
j = j + 1 |
167 |
nj = nj-1 |
168 |
CALL WRITE_REC_3D_RL( fn, fp, 1, seaice_sigma2, |
169 |
& nj, myIter, myThid ) |
170 |
IF (j.LE.listDim) wrFldList(j) = 'siSigm2 ' |
171 |
|
172 |
j = j + 1 |
173 |
nj = nj-1 |
174 |
CALL WRITE_REC_3D_RL( fn, fp, 1, seaice_sigma12, |
175 |
& nj, myIter, myThid ) |
176 |
IF (j.LE.listDim) wrFldList(j) = 'siSigm12' |
177 |
ENDIF |
178 |
#endif /* SEAICE_ALLOW_EVP */ |
179 |
|
180 |
nWrFlds = j |
181 |
IF ( nWrFlds.GT.listDim ) THEN |
182 |
WRITE(msgBuf,'(2A,I5,A)') 'WRITE_SEAICE_PICKUP: ', |
183 |
& 'trying to write ',nWrFlds,' fields' |
184 |
CALL PRINT_ERROR( msgBuf, myThid ) |
185 |
WRITE(msgBuf,'(2A,I5,A)') 'WRITE_SEAICE_PICKUP: ', |
186 |
& 'field-list dimension (listDim=',listDim,') too small' |
187 |
CALL PRINT_ERROR( msgBuf, myThid ) |
188 |
STOP 'ABNORMAL END: S/R WRITE_SEAICE_PICKUP (list-size Pb)' |
189 |
ENDIF |
190 |
|
191 |
#ifdef ALLOW_MDSIO |
192 |
C uses this specific S/R to write (with more informations) only meta files |
193 |
nj = ABS(nj) |
194 |
glf = globalFiles |
195 |
timList(1) = myTime |
196 |
CALL MDS_WR_METAFILES( fn, fp, glf, .FALSE., |
197 |
& 0, 0, 1, ' ', |
198 |
& nWrFlds, wrFldList, |
199 |
& 1, timList, oneRL, |
200 |
& nj, myIter, myThid ) |
201 |
C |
202 |
#endif /* ALLOW_MDSIO */ |
203 |
C-------------------------- |
204 |
c ENDIF |
205 |
|
206 |
RETURN |
207 |
END |