The TELEMAC-MASCARET system  trunk
converter.f
Go to the documentation of this file.
1 ! *****************
2  SUBROUTINE converter
3 ! *****************
4  &(loc_inpfile,loc_bndfile,
5  & loc_outfile,loc_outbndfile)
6 !
7 !***********************************************************************
8 ! STBTEL V6P1 11/07/2011
9 !***********************************************************************
10 !
11 !BRIEF WRITE A FILE OF MED FORMAT WITH THE MESH OBJECT
12 !+ INFORMATIONS
13 !
14 !HISTORY Y.AUDOUIN (EDF)
15 !+ 11/07/2011
16 !+ V6P1
17 !+ CREATION OF THE FILE
18 !
19 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 !| LOC_INPFILE |-->| NAME OF THE INPUT FILE
21 !| LOC_LOGFILE |-->| NAME OF THE LOG FILE
22 !| LOC_BNDFILE |-->| NAME OF THE BOUNDARY FILE
23 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 !
27  & outfile,outfmt,outbndfile,debug
28 !
30  IMPLICIT NONE
31  ! LANGAE AND OUTPUT VALUE
32 !
33 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34 !
35  ! NAME IN THE TEMPORARY FOLDER OF THE FILES :
36  ! EQUAL ' ' IF FILE NOT AVAILABLE
37  CHARACTER(LEN=MAXLENFILE), INTENT(IN) :: LOC_INPFILE
38  CHARACTER(LEN=MAXLENFILE), INTENT(IN) :: LOC_BNDFILE
39  CHARACTER(LEN=MAXLENFILE), INTENT(IN) :: LOC_OUTFILE
40  CHARACTER(LEN=MAXLENFILE), INTENT(IN) :: LOC_OUTBNDFILE
41 !
42 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 !
44  INTEGER :: I,J
45  INTEGER :: IERR
46  CHARACTER(LEN=80) :: TITLE
47  INTEGER :: INFID, OUTFID
48  INTEGER :: DATE(6)
49  INTEGER :: DATE2(3),TIME2(3)
50  INTEGER :: TYP_ELEM, TYP_BND_ELEM
51  INTEGER :: NPOIN,NELEM,NDP
52  INTEGER :: NPLAN, NPTIR
53  INTEGER :: NDIM
54  DOUBLE PRECISION, ALLOCATABLE :: X(:),Y(:),Z(:)
55  INTEGER :: NELEBD, NPTFR, NDP_BND
56  INTEGER, ALLOCATABLE :: IKLE(:)
57  INTEGER, ALLOCATABLE :: IKLES(:)
58  INTEGER, ALLOCATABLE :: IKLE_BND(:)
59  INTEGER, ALLOCATABLE :: KNOLG(:)
60  INTEGER, ALLOCATABLE :: IPOBO(:)
61  INTEGER, ALLOCATABLE :: LIHBOR(:)
62  INTEGER, ALLOCATABLE :: LIUBOR(:)
63  INTEGER, ALLOCATABLE :: LIVBOR(:)
64  INTEGER, ALLOCATABLE :: LITBOR(:)
65  INTEGER, ALLOCATABLE :: COLOR(:)
66  DOUBLE PRECISION, ALLOCATABLE :: UBOR(:),VBOR(:)
67  DOUBLE PRECISION, ALLOCATABLE :: HBOR(:),CHBORD(:)
68  DOUBLE PRECISION, ALLOCATABLE :: TBOR(:),ATBOR(:)
69  DOUBLE PRECISION, ALLOCATABLE :: BTBOR(:)
70  INTEGER, ALLOCATABLE :: NBOR(:)
71  INTEGER :: NTIMESTEP
72  INTEGER :: NVAR
73  DOUBLE PRECISION :: TIME
74  CHARACTER(LEN=16), ALLOCATABLE :: VAR_NAME(:)
75  CHARACTER(LEN=16), ALLOCATABLE :: VAR_UNIT(:)
76  CHARACTER(LEN=32), ALLOCATABLE :: VAR_NAMES(:)
77  CHARACTER(LEN=32) :: VARNAME
78  DOUBLE PRECISION, ALLOCATABLE :: VAR_VALUE(:)
79  INTEGER :: ITIME, IVAR
80  INTEGER :: X_ORIG, Y_ORIG
81 !=======================================================================
82 ! READING MESH FILE AND FILLING MESH_OBJ
83 !=======================================================================
84 !
85  IF(debug) WRITE(lu,*) '---FILES INFORMATION---'
86  IF(debug) WRITE(lu,*) 'INPUT FILE : ',infile
87  IF(debug) WRITE(lu,*) 'INPUT FORMAT : ',infmt
88  IF(debug) WRITE(lu,*) 'BOUNDARY FILE : ',boundfile
89  IF(debug) WRITE(lu,*) 'OUTPUT FILE : ',outfile
90  IF(debug) WRITE(lu,*) 'OUTPUT FORMAT : ',outfmt
91  IF(debug) WRITE(lu,*) 'OUT BOUNDARY FILE : ',outbndfile
92 !
93 !-----------------------------------------------------------------------
94 !
95 
96  CALL open_mesh(infmt,loc_inpfile,infid,'READ ',ierr)
97  CALL check_call(ierr,'CONVERTER:OPEN_MESH:IN')
98 
99  CALL get_mesh_title(infmt,infid,title,ierr)
100  CALL check_call(ierr,'CONVERTER:GET_MESH_TITLE')
101  CALL get_mesh_date(infmt,infid,date,ierr)
102  CALL check_call(ierr,'CONVERTER:GET_MESH_DATE')
103 
104  CALL get_mesh_dimension(infmt,infid,ndim,ierr)
105  CALL check_call(ierr,'CONVERTER:GET_MESH_DIMENSION')
106 
107  ! IDENTIFYING ELEMENTS TYPE
108  IF(ndim.EQ.2) THEN
109  typ_elem = triangle_elt_type
110  ELSE
111  typ_elem = prism_elt_type
112  ENDIF
113  IF(infmt(1:3).EQ.'MED') THEN
114  typ_bnd_elem = edge_bnd_elt_type
115  ndp_bnd = 2
116  ! CHECKING IF WE HAVE ANY EDGES
117  CALL get_mesh_nelem(infmt,infid,typ_bnd_elem,nelem,ierr)
118  IF(ierr.NE.0.OR.nelem.EQ.0) THEN
119  typ_bnd_elem = point_bnd_elt_type
120  ndp_bnd = 1
121  ENDIF
122  ELSE
123  typ_bnd_elem = point_bnd_elt_type
124  ndp_bnd = 1
125  ENDIF
126 
127  CALL get_mesh_npoin(infmt,infid,typ_elem,npoin,ierr)
128  CALL check_call(ierr,'CONVERTER:GET_MESH_NPOIN')
129  CALL get_mesh_nelem(infmt,infid,typ_elem,nelem,ierr)
130  CALL check_call(ierr,'CONVERTER:GET_MESH_NELEM')
131  CALL get_mesh_npoin_per_element(infmt,infid,typ_elem,ndp,ierr)
132  CALL check_call(ierr,'CONVERTER:GET_MESH_NDP')
133  CALL get_mesh_nplan(infmt,infid,nplan,ierr)
134  CALL check_call(ierr,'CONVERTER:GET_MESH_NPLAN')
135  CALL get_mesh_orig(infmt,infid,x_orig,y_orig,ierr)
136  CALL check_call(ierr,'CONVERTER:GET_MESH_ORIG')
137 
138  ALLOCATE(x(npoin),stat=ierr)
139  CALL check_allocate(ierr,'X')
140  ALLOCATE(y(npoin),stat=ierr)
141  CALL check_allocate(ierr,'Y')
142  CALL get_mesh_coord(infmt,infid,1,ndim,npoin,x,ierr)
143  CALL get_mesh_coord(infmt,infid,2,ndim,npoin,y,ierr)
144  IF(ndim.EQ.3) THEN
145  ALLOCATE(z(npoin),stat=ierr)
146  CALL check_allocate(ierr,'Z')
147  CALL get_mesh_coord(infmt,infid,2,ndim,npoin,z,ierr)
148  ENDIF
149 
150  ALLOCATE(ikle(nelem*ndp),stat=ierr)
151  CALL check_allocate(ierr,'IKLE')
152  CALL get_mesh_connectivity(infmt,infid,typ_elem,
153  & ikle,nelem,ndp,ierr)
154  CALL check_call(ierr,'CONVERTER:GET_MESH_CONNECTIVITY')
155 
156  CALL get_mesh_nptir(infmt,infid,nptir,ierr)
157  CALL check_call(ierr,'CONVERTER:GET_MESH_NPTIR')
158 
159 
160  ALLOCATE(knolg(npoin),stat=ierr)
161  CALL check_allocate(ierr,'KNOLG')
162  IF(nptir.GT.0) THEN
163  CALL get_mesh_l2g_numbering(infmt,infid,knolg,npoin,ierr)
164  CALL check_call(ierr,'CONVERTER:GET_MESH_L2G_NUMBERING')
165  ELSE
166  knolg = 0
167  ENDIF
168 
169  ALLOCATE(ipobo(npoin),stat=ierr)
170  CALL check_allocate(ierr,'IPOBO')
171  ipobo = 0
172 
173  IF(boundfile(1:1).NE.' ') THEN
174  CALL open_bnd(infmt,loc_bndfile,infid,'READ ',ierr)
175  CALL check_call(ierr,'CONVERT:OPEN_BND:IN')
176 
177  CALL get_bnd_npoin(infmt,infid,typ_bnd_elem,nptfr,ierr)
178  CALL check_call(ierr,'CONVERT:GET_BND_NPOIN')
179  CALL get_bnd_nelem(infmt,infid,typ_bnd_elem,nelebd,ierr)
180  CALL check_call(ierr,'CONVERT:GET_BND_NPOIN')
181 
182  CALL get_bnd_ipobo(infmt,infid,npoin,nelebd,typ_bnd_elem,
183  & ipobo,ierr)
184  CALL check_call(ierr,'CONVERT:GET_BND_IPOBO')
185 
186  ALLOCATE(nbor(nptfr),stat=ierr)
187  CALL check_allocate(ierr,'NBOR')
188  CALL get_bnd_numbering(infmt,infid,typ_bnd_elem,nptfr,nbor,ierr)
189  CALL check_call(ierr,'CONVERT:GET_BND_NUMBERING')
190 
191  ALLOCATE(ikle_bnd(nelebd*ndp_bnd),stat=ierr)
192  CALL check_allocate(ierr,'IKLE_BND')
193  CALL get_bnd_connectivity(infmt,infid,typ_bnd_elem,
194  & nelebd,ndp_bnd,ikle_bnd,ierr)
195  CALL check_call(ierr,'CONVERT:GET_BND_CONNECTIVITY')
196 
197  ALLOCATE(lihbor(nptfr),stat=ierr)
198  CALL check_allocate(ierr,'LIHBOR')
199  ALLOCATE(liubor(nptfr),stat=ierr)
200  CALL check_allocate(ierr,'LIUBOR')
201  ALLOCATE(livbor(nptfr),stat=ierr)
202  CALL check_allocate(ierr,'LIVBOR')
203  ALLOCATE(litbor(nptfr),stat=ierr)
204  CALL check_allocate(ierr,'LITBOR')
205  ALLOCATE(hbor(nptfr),stat=ierr)
206  CALL check_allocate(ierr,'HBOR')
207  ALLOCATE(ubor(nptfr),stat=ierr)
208  CALL check_allocate(ierr,'UBOR')
209  ALLOCATE(vbor(nptfr),stat=ierr)
210  CALL check_allocate(ierr,'VBOR')
211  ALLOCATE(tbor(nptfr),stat=ierr)
212  CALL check_allocate(ierr,'TBOR')
213  ALLOCATE(atbor(nptfr),stat=ierr)
214  CALL check_allocate(ierr,'ATBOR')
215  ALLOCATE(btbor(nptfr),stat=ierr)
216  CALL check_allocate(ierr,'BTBOR')
217  ALLOCATE(chbord(nptfr),stat=ierr)
218  CALL check_allocate(ierr,'CHBORD')
219  ALLOCATE(color(nptfr),stat=ierr)
220  CALL check_allocate(ierr,'COLOT')
221 
222  CALL get_bnd_value(infmt,infid,typ_bnd_elem,nelebd,
223  & lihbor,liubor, livbor,hbor,ubor,vbor,
224  & chbord,.true., litbor,tbor,atbor,btbor,
225  & nptfr,ierr)
226  CALL check_call(ierr,'CONVERT:GET_BND_VALUE')
227 
228  CALL get_bnd_color(infmt,infid,typ_bnd_elem,nelebd,color,ierr)
229  CALL check_call(ierr,'CONVERT:GET_BND_COLOR')
230 
231  CALL close_bnd(infmt,infid,ierr)
232  CALL check_call(ierr,'CONVERT:CLOSE_BND:IN')
233  ELSE
234  nptfr = 0
235  nelebd = 0
236  ipobo = 0
237  ENDIF
238 
239  CALL get_data_ntimestep(infmt,infid,ntimestep,ierr)
240  CALL check_call(ierr,'CONVERT:GET_DATA_NTIMESTEP')
241 
242  CALL get_data_nvar(infmt,infid,nvar,ierr)
243  CALL check_call(ierr,'CONVERT:GET_DATA_NVAR')
244 
245  ALLOCATE(var_name(nvar),stat=ierr)
246  CALL check_allocate(ierr,'VAR_NAME')
247  ALLOCATE(var_unit(nvar),stat=ierr)
248  CALL check_allocate(ierr,'VAR_UNIT')
249  ALLOCATE(var_names(nvar),stat=ierr)
250  CALL check_allocate(ierr,'VAR_NAME')
251 
252  CALL get_data_var_list(infmt,infid,nvar,var_name,var_unit,ierr)
253  CALL check_call(ierr,'CONVERT:GET_DATA_VAR_LIST')
254  DO i=1,nvar
255  var_names(i)(1:16) = var_name(i)
256  var_names(i)(17:32) = var_unit(i)
257  ENDDO
258 
259  CALL open_mesh(outfmt,loc_outfile,outfid,'WRITE ',ierr)
260  CALL check_call(ierr,'CONVERTER:OPEN_MESH:OUT')
261 
262  IF(boundfile(1:1).NE.' ') THEN
263  CALL open_bnd(outfmt,loc_outbndfile,outfid,'WRITE ',ierr)
264  CALL check_call(ierr,'CONVERTER:OPEN_BND:OUT')
265  ENDIF
266 
267  CALL set_header(outfmt,outfid,title,nvar,var_names,ierr)
268  CALL check_call(ierr,'CONVERTER:SET_HEADER')
269  DEALLOCATE(var_names)
270 
271  date2(1) = date(1)
272  date2(2) = date(2)
273  date2(3) = date(3)
274  time2(1) = date(4)
275  time2(2) = date(5)
276  time2(3) = date(6)
277  ALLOCATE(ikles(nelem*ndp),stat=ierr)
278  CALL check_allocate(ierr,'IKLES')
279  DO i=1,nelem
280  DO j=1,ndp
281  ikles(i+(j-1)*nelem) = ikle((i-1)*ndp+j)
282  ENDDO
283  ENDDO
284 
285 
286  IF(ndim.EQ.2) THEN
287  CALL set_mesh(outfmt,outfid,ndim,typ_elem,ndp,nptfr,nptir,
288  & nelem,npoin,ikles,ipobo,knolg,x,y,nplan,
289  & date2,time2,x_orig,y_orig,ierr)
290  ELSE
291  CALL set_mesh(outfmt,outfid,ndim,typ_elem,ndp,nptfr,nptir,
292  & nelem,npoin,ikles,ipobo,knolg,x,y,nplan,
293  & date2,time2,x_orig,y_orig,ierr,z)
294  ENDIF
295  CALL check_call(ierr,'CONVERTER:SET_MESH')
296 
297  DEALLOCATE(ikle)
298  DEALLOCATE(ikles)
299  DEALLOCATE(ipobo)
300  DEALLOCATE(knolg)
301  DEALLOCATE(x)
302  DEALLOCATE(y)
303 
304  IF(boundfile(1:1).NE.' ') THEN
305  ! CHANGING BOUNDRAY TYPE TO POINT IN SERAFIN
306  IF (outfmt(1:7).EQ.'SERAFIN') THEN
307  DEALLOCATE(ikle_bnd)
308  ALLOCATE(ikle_bnd(nptfr),stat=ierr)
309  CALL check_allocate(ierr,'IKLE_BND')
310 
311  ikle_bnd = nbor
312  typ_bnd_elem = point_bnd_elt_type
313  ndp_bnd = 1
314  ENDIF
315  CALL set_bnd(outfmt,outfid,typ_bnd_elem,nelebd,ndp_bnd,
316  & ikle_bnd,nptfr,lihbor,liubor,livbor,hbor,ubor,
317  & vbor,chbord,litbor,tbor,atbor,btbor,color,ierr)
318  CALL check_call(ierr,'CONVERTER:SET_BND')
319  DEALLOCATE(ikle_bnd)
320  DEALLOCATE(lihbor)
321  DEALLOCATE(liubor)
322  DEALLOCATE(livbor)
323  DEALLOCATE(hbor)
324  DEALLOCATE(ubor)
325  DEALLOCATE(vbor)
326  DEALLOCATE(chbord)
327  DEALLOCATE(tbor)
328  DEALLOCATE(atbor)
329  DEALLOCATE(btbor)
330  DEALLOCATE(color)
331  ENDIF
332 
333  ALLOCATE(var_value(npoin),stat=ierr)
334  CALL check_allocate(ierr,'VAR_VALUES')
335  DO itime=1,ntimestep
336  CALL get_data_time(infmt,infid,itime-1,time,ierr)
337  CALL check_call(ierr,'CONVERTER:GET_DATA_TIME')
338  DO ivar=1,nvar
339  CALL get_data_value(infmt,infid,itime-1,var_name(ivar),
340  & var_value,npoin,ierr)
341  CALL check_call(ierr,'CONVERTER:GET_DATA_VALUE')
342 
343  varname(1:16) = var_name(ivar)
344  varname(17:32) = var_unit(ivar)
345  CALL add_data(outfmt,outfid,varname,time,itime-1,
346  & ivar==1,var_value,npoin,ierr)
347  CALL check_call(ierr,'CONVERTER:ADD_DATA')
348  ENDDO
349  ENDDO
350  DEALLOCATE(var_value)
351 
352  IF(boundfile(1:1).NE.' ') THEN
353  CALL close_bnd(outfmt,outfid,ierr)
354  CALL check_call(ierr,'CONVERTER:CLOSE_BND:OUT')
355  ENDIF
356  CALL close_mesh(infmt,infid,ierr)
357  CALL check_call(ierr,'CONVERTER:CLOSE_MESH:IN')
358  CALL close_mesh(outfmt,outfid,ierr)
359  CALL check_call(ierr,'CONVERTER:CLOSE_MESH:OUT')
360 
361  END
subroutine get_mesh_nptir(FFORMAT, FID, NPTIR, IERR)
Definition: get_mesh_nptir.f:7
subroutine get_mesh_npoin(FFORMAT, FID, TYP_ELEM, NPOIN, IERR)
Definition: get_mesh_npoin.f:7
subroutine get_bnd_npoin(FFORMAT, FID, TYPE_BND_ELEM, NPTFR, IERR)
Definition: get_bnd_npoin.f:7
subroutine get_mesh_orig(FFORMAT, FID, X_ORIG, Y_ORIG, IERR)
Definition: get_mesh_orig.f:7
subroutine add_data(FFORMAT, FILE_ID, VAR_NAME, TIME, RECORD, FIRST_VAR, VAR_VALUE, N, IERR)
Definition: add_data.f:8
integer, parameter prism_elt_type
subroutine close_mesh(FFORMAT, FILE_ID, IERR, MESH_NUMBER)
Definition: close_mesh.f:7
subroutine get_bnd_connectivity(FFORMAT, FID, TYP_BND_ELEM, NELEBD, NDP, IKLE_BND, IERR)
subroutine set_mesh(FFORMAT, FILE_ID, MESH_DIM, TYPELM, NDP, NPTFR, NPTIR, NELEM, NPOIN, IKLE, IPOBO, KNOLG, X, Y, NPLAN, DATE, TIME, X_ORIG, Y_ORIG, IERR, Z, IN_PLACE)
Definition: set_mesh.f:9
subroutine get_data_nvar(FFORMAT, FID, NVAR, IERR)
Definition: get_data_nvar.f:7
subroutine get_bnd_color(FFORMAT, FID, TYP_BND_ELEM, NELEBD, COLOR, IERR)
Definition: get_bnd_color.f:7
subroutine get_data_var_list(FFORMAT, FID, NVAR, VARLIST, UNITLIST, IERR)
subroutine get_bnd_ipobo(FFORMAT, FID, NPOIN, NELEBD, TYP_BND_ELEM, IPOBO, IERR)
Definition: get_bnd_ipobo.f:7
integer, parameter triangle_elt_type
character(len=maxlenfile) boundfile
subroutine get_bnd_nelem(FFORMAT, FID, TYPE_BND_ELEM, NELEM, IERR)
Definition: get_bnd_nelem.f:7
subroutine close_bnd(FFORMAT, FILE_ID, IERR, MESH_NUMBER)
Definition: close_bnd.f:7
integer, parameter point_bnd_elt_type
subroutine get_data_value(FFORMAT, FID, RECORD, VAR_NAME, RES_VALUE, N, IERR)
Definition: get_data_value.f:7
character(len=maxlenfile) infile
subroutine get_mesh_nelem(FFORMAT, FID, TYP_ELEM, NELEM, IERR)
Definition: get_mesh_nelem.f:7
subroutine get_mesh_npoin_per_element(FFORMAT, FID, TYP_ELEM, NDP, IERR)
character(len=9) infmt
subroutine get_mesh_dimension(FFORMAT, FID, NDIM, IERR)
integer, parameter edge_bnd_elt_type
subroutine get_mesh_title(FFORMAT, FID, TITLE, IERR)
Definition: get_mesh_title.f:7
subroutine get_bnd_numbering(FFORMAT, FID, TYP_BND_ELEM, NPTFR, NBOR, IERR)
subroutine get_mesh_date(FFORMAT, FID, DATE, IERR)
Definition: get_mesh_date.f:7
subroutine converter(LOC_INPFILE, LOC_BNDFILE, LOC_OUTFILE, LOC_OUTBNDFILE)
Definition: converter.f:7
subroutine get_mesh_nplan(FFORMAT, FID, NPLAN, IERR)
Definition: get_mesh_nplan.f:7
subroutine set_header(FFORMAT, FILE_ID, TITLE, NVAR, VAR_NAME, IERR)
Definition: set_header.f:7
subroutine get_mesh_coord(FFORMAT, FID, JDIM, NDIM, NPOIN, COORD, IERR)
Definition: get_mesh_coord.f:7
subroutine set_bnd(FFORMAT, FID, TYPE_BND_ELT, NELEBD, NDP, IKLE, NPTFR, LIHBOR, LIUBOR, LIVBOR, HBOR, UBOR, VBOR, CHBORD, LITBOR, TBOR, ATBOR, BTBOR, COLOR, IERR)
Definition: set_bnd.f:9
subroutine get_bnd_value(FFORMAT, FID, TYP_BND_ELEM, NELEBD, LIHBOR, LIUBOR, LIVBOR, HBOR, UBOR, VBOR, CHBORD, TRAC, LITBOR, TBOR, ATBOR, BTBOR, NPTFR, IERR)
Definition: get_bnd_value.f:9
subroutine get_mesh_connectivity(FFORMAT, FID, TYP_ELEM, IKLE, NELEM, NDP, IERR)
subroutine open_mesh(FFORMAT, FILE_NAME, FILE_ID, OPENMODE, IERR, MESH_NUMBER)
Definition: open_mesh.f:7
subroutine open_bnd(FFORMAT, FILE_NAME, FILE_ID, OPENMODE, IERR, MESH_NUMBER)
Definition: open_bnd.f:7
subroutine get_data_time(FFORMAT, FID, RECORD, TIME, IERR)
Definition: get_data_time.f:7
subroutine get_mesh_l2g_numbering(FFORMAT, FID, KNOLG, NPOIN, IERR)
subroutine get_data_ntimestep(FFORMAT, FID, NTIMESTEP, IERR)