/[MITgcm]/MITgcm/pkg/seaice/seaice_write_pickup.F
ViewVC logotype

Contents of /MITgcm/pkg/seaice/seaice_write_pickup.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.8 - (show annotations) (download)
Mon Sep 26 18:23:10 2011 UTC (12 years, 8 months ago) by heimbach
Branch: MAIN
Changes since 1.7: +51 -6 lines
Simple code for pickup of SItracer fields (#define ALLOW_SITRACER)
To be done:
* thorough testing of missing fields in S/R seaice_read_pickup
* thorough matching between generic tracers and specific fields used
  (e.g. volume-weighted age, area-weighted age, salinity, ...)

1 C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_write_pickup.F,v 1.7 2011/08/25 22:19:17 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 #if (defined (SEAICE_AGE) || defined (ALLOW_SITRACER))
65 CHARACTER*(8) fldName
66 CHARACTER*(8) wrFldListTrac(listDim)
67 CHARACTER*(MAX_LEN_FNAM) fnTrac
68 INTEGER iTrac
69 INTEGER jtrac, njtrac
70 INTEGER listDimTrac, nWrFldsTrac
71 PARAMETER( listDimTrac = 20 )
72 #endif
73 CEOP
74
75 C-- Write model fields
76 WRITE(fn,'(A,A)') 'pickup_seaice.',suff
77 #if (defined (SEAICE_AGE) || defined (ALLOW_SITRACER))
78 WRITE(fnTrac,'(A,A)') 'pickup_seaice_tracer.',suff
79 #endif
80
81 c IF ( seaice_pickup_write_mdsio ) THEN
82
83 fp = precFloat64
84 j = 0
85 nj = 0
86 jtrac = 0
87 njtrac = 0
88 C record number < 0 : a hack not to write meta files now:
89
90 C-- write Sea-Ice Thermodynamics State variables, starting with 3-D fields:
91 IF ( .NOT.useThSIce ) THEN
92 #ifdef SEAICE_MULTICATEGORY
93 j = j + 1
94 nj = nj-1
95 CALL WRITE_REC_3D_RL(fn,fp,MULTDIM,TICES, nj, myIter, myThid )
96 IF (j.LE.listDim) wrFldList(j) = 'siTICES '
97 C- switch to 2-D fields:
98 nj = nj*MULTDIM
99 #else
100 j = j + 1
101 nj = nj-1
102 CALL WRITE_REC_3D_RL( fn, fp, 1, TICE , nj, myIter, myThid )
103 IF (j.LE.listDim) wrFldList(j) = 'siTICE '
104 #endif /* SEAICE_MULTICATEGORY */
105
106 C--- continue to write 2-D fields:
107 j = j + 1
108 nj = nj-1
109 CALL WRITE_REC_3D_RL( fn, fp, 1, AREA , nj, myIter, myThid )
110 IF (j.LE.listDim) wrFldList(j) = 'siAREA '
111
112 j = j + 1
113 nj = nj-1
114 CALL WRITE_REC_3D_RL( fn, fp, 1, HEFF , nj, myIter, myThid )
115 IF (j.LE.listDim) wrFldList(j) = 'siHEFF '
116
117 j = j + 1
118 nj = nj-1
119 CALL WRITE_REC_3D_RL( fn, fp, 1, HSNOW , nj, myIter, myThid )
120 IF (j.LE.listDim) wrFldList(j) = 'siHSNOW '
121 #ifdef SEAICE_VARIABLE_SALINITY
122 j = j + 1
123 nj = nj-1
124 CALL WRITE_REC_3D_RL( fn, fp, 1, HSALT , nj, myIter, myThid )
125 IF (j.LE.listDim) wrFldList(j) = 'siHSALT '
126 #endif
127 #ifdef SEAICE_AGE
128 DO iTrac = 1, SEAICE_num
129 WRITE(fldName,'(A6,I2.2)') 'siAGEt', iTrac
130 j = j + 1
131 nj = nj-1
132 CALL WRITE_REC_3D_RL( fn, fp, 1,
133 & IceAgeTr(1-Olx,1-Oly,1,1,iTrac),
134 & nj, myIter, myThid )
135 IF (j.LE.listDim) wrFldList(j) = fldName
136 ENDDO
137 #endif
138 #ifdef ALLOW_SITRACER
139 DO iTrac = 1, SItrMaxNum
140 WRITE(fldName,'(A6,I2.2)') 'siTrac', iTrac
141 jtrac = jtrac + 1
142 njtrac = njtrac-1
143 CALL WRITE_REC_3D_RL( fnTrac, fp, 1,
144 & SItracer(1-Olx,1-Oly,1,1,iTrac),
145 & nj, myIter, myThid )
146 IF (jtrac.LE.listDimTrac) wrFldListTrac(jtrac) = fldName
147 ENDDO
148 #endif
149 ENDIF
150
151 C-- write Sea-Ice Dynamics variables (all 2-D fields):
152 j = j + 1
153 nj = nj-1
154 CALL WRITE_REC_3D_RL( fn, fp, 1, UICE , nj, myIter, myThid )
155 IF (j.LE.listDim) wrFldList(j) = 'siUICE '
156
157 j = j + 1
158 nj = nj-1
159 CALL WRITE_REC_3D_RL( fn, fp, 1, VICE , nj, myIter, myThid )
160 IF (j.LE.listDim) wrFldList(j) = 'siVICE '
161
162 #if (defined(SEAICE_CGRID) && defined(SEAICE_ALLOW_EVP))
163 IF ( SEAICEuseEVP ) THEN
164 j = j + 1
165 nj = nj-1
166 CALL WRITE_REC_3D_RL( fn, fp, 1, seaice_sigma1,
167 & nj, myIter, myThid )
168 IF (j.LE.listDim) wrFldList(j) = 'siSigm1 '
169
170 j = j + 1
171 nj = nj-1
172 CALL WRITE_REC_3D_RL( fn, fp, 1, seaice_sigma2,
173 & nj, myIter, myThid )
174 IF (j.LE.listDim) wrFldList(j) = 'siSigm2 '
175
176 j = j + 1
177 nj = nj-1
178 CALL WRITE_REC_3D_RL( fn, fp, 1, seaice_sigma12,
179 & nj, myIter, myThid )
180 IF (j.LE.listDim) wrFldList(j) = 'siSigm12'
181 ENDIF
182 #endif /* SEAICE_ALLOW_EVP */
183
184 nWrFlds = j
185 IF ( nWrFlds.GT.listDim ) THEN
186 WRITE(msgBuf,'(2A,I5,A)') 'WRITE_SEAICE_PICKUP: ',
187 & 'trying to write ',nWrFlds,' fields'
188 CALL PRINT_ERROR( msgBuf, myThid )
189 WRITE(msgBuf,'(2A,I5,A)') 'WRITE_SEAICE_PICKUP: ',
190 & 'field-list dimension (listDim=',listDim,') too small'
191 CALL PRINT_ERROR( msgBuf, myThid )
192 STOP 'ABNORMAL END: S/R WRITE_SEAICE_PICKUP (list-size Pb)'
193 ENDIF
194 #ifdef ALLOW_SITRACER
195 nWrFldsTrac = jTrac
196 IF ( nWrFldsTrac.GT.listDimTrac ) THEN
197 WRITE(msgBuf,'(2A,I5,A)') 'WRITE_SEAICE_PICKUP_TRACER: ',
198 & 'trying to write ',nWrFldsTrac,' fields'
199 CALL PRINT_ERROR( msgBuf, myThid )
200 WRITE(msgBuf,'(2A,I5,A)') 'WRITE_SEAICE_PICKUP_TRACER: ',
201 & 'field-list dim. (listDimTrac=',listDimTrac,') too small'
202 CALL PRINT_ERROR( msgBuf, myThid )
203 STOP
204 & 'ABNORMAL END: S/R WRITE_SEAICE_PICKUP_TRACER (list-size Pb)'
205 ENDIF
206 #endif
207
208 #ifdef ALLOW_MDSIO
209 C uses this specific S/R to write (with more informations) only meta files
210 nj = ABS(nj)
211 glf = globalFiles
212 timList(1) = myTime
213 CALL MDS_WR_METAFILES( fn, fp, glf, .FALSE.,
214 & 0, 0, 1, ' ',
215 & nWrFlds, wrFldList,
216 & 1, timList,
217 & nj, myIter, myThid )
218 C
219 # ifdef ALLOW_SITRACER
220 njtrac = ABS(njtrac)
221 CALL MDS_WR_METAFILES( fnTrac, fp, glf, .FALSE.,
222 & 0, 0, 1, ' ',
223 & nWrFldsTrac, wrFldListTrac,
224 & 1, timList,
225 & njTrac, myIter, myThid )
226 # endif /* ALLOW_SITRACER */
227 C
228 #endif /* ALLOW_MDSIO */
229 C--------------------------
230 c ENDIF
231
232 RETURN
233 END

  ViewVC Help
Powered by ViewVC 1.1.22