CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Strange foamToVTK problem (http://www.cfd-online.com/Forums/openfoam-solving/58161-strange-foamtovtk-problem.html)

hsieh December 28, 2007 14:49

Hi, OpenFOAMers: After comp
 
Hi, OpenFOAMers:

After completing a OF run. I ran foamToVTK to convert the transient data (time 0, 0.01, 0.02, 0.03,...) to VTK. In VTK folder, I saw something like:

casename_0.vtk
casename_1.vtk
casename_108.vtk
casename_209.vtk
casename_310.vtk
casename_411.vtk
casename_512.vtk

Why the numbers jumpped by 101 starting from 108?
How can I output the file with continuous number?

Thanks!

Pei

shivasub December 28, 2007 16:25

Pei, The reason for this is
 
Pei,

The reason for this is that while outputting the vtk files, the function runTime.timeIndex() is used for obtaining the filename. here is the snippet of code from foamToVTK

// Create file and write header
//
fileName vtkFileName
(
fvPath/vtkName
+ "_"
+ name(runTime.timeIndex())
+ ".vtk"
);


you can write a small bash/tcsh script to rename the files to get continuous numbers. here is a sample script.



#!/bin/bash
#enumerates and renumbers files

num=0

for file in $1_?.vtk;do let num++;name=$1_`echo $num`.vtk; mv $file $name;done
for file in $1_??.vtk;do let num++;name=$1_`echo $num`.vtk; mv $file $name;done
for file in $1_???.vtk;do let num++;name=$1_`echo $num`.vtk; mv $file $name;done
for file in $1_????.vtk;do let num++;name=$1_`echo $num`.vtk; mv $file $name;done
for file in $1_?????.vtk;do let num++;name=$1_`echo $num`.vtk; mv $file $name;done


Cheers
Shiva

hsieh December 28, 2007 21:53

Thanks a lot Shiva! Your sc
 
Thanks a lot Shiva!

Your script works great!

Pei

mattijs December 29, 2007 09:41

The 1.4.1 foamToVTK still crea
 
The 1.4.1 foamToVTK still creates files from time index. The advantage is that there is a one-to-one correspondence to the absolute time. Disadvantage is that the non-consecutive filenames aren't recognized by Paraview as a time series.

The 1.4.2 instead outputs consecutively numbered files.

xiao January 4, 2009 01:03

Anybody knows why there is
 
Anybody knows why there is

casename_0.vtk
casename_1.vtk

in the folder? I am using OF 1.4.1, In my case, casename_0.vtk is very short with no field information at all. This causes paraview 3.4 to ignore all the fields in vtk files which are not present in casename_0.vtk.

----------------
time cases: 0, 0.2, 0.4, 0.6, 0.8

VTK names:

meshPar2_0.vtk ***
meshPar2_1.vtk ***
meshPar2_20.vtk
meshPar2_40.vtk
meshPar2_60.vtk
meshPar2_80.vtk


All times are GMT -4. The time now is 02:08.