CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Strange foamToVTK problem

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By cfdrogu

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 28, 2007, 14:49
Default Hi, OpenFOAMers: After comp
  #1
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 18
hsieh is on a distinguished road
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
hsieh is offline   Reply With Quote

Old   December 28, 2007, 16:25
Default Pei, The reason for this is
  #2
New Member
 
Shivasubramanian Gopalakrishnan
Join Date: Mar 2009
Location: Amherst, Massachusetts, USA
Posts: 15
Rep Power: 17
shivasub is on a distinguished road
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
shivasub is offline   Reply With Quote

Old   December 28, 2007, 21:53
Default Thanks a lot Shiva! Your sc
  #3
Senior Member
 
Pei-Ying Hsieh
Join Date: Mar 2009
Posts: 317
Rep Power: 18
hsieh is on a distinguished road
Thanks a lot Shiva!

Your script works great!

Pei
hsieh is offline   Reply With Quote

Old   December 29, 2007, 09:41
Default The 1.4.1 foamToVTK still crea
  #4
Senior Member
 
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26
mattijs is on a distinguished road
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.
mattijs is offline   Reply With Quote

Old   January 4, 2009, 01:03
Default Anybody knows why there is
  #5
Member
 
Heng Xiao
Join Date: Mar 2009
Location: Zurich, Switzerland
Posts: 58
Rep Power: 17
xiao is on a distinguished road
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
xiao is offline   Reply With Quote

Old   April 24, 2023, 22:12
Default simple fix for later versions of openfoam
  #6
New Member
 
Join Date: May 2018
Posts: 1
Rep Power: 0
cfdrogu is on a distinguished road
For later versions of openfoam (I've only checked for 7+, 2000+), just use the flag "-useTimeName" and it will name the VTK files properly.
wilsonrcf likes this.
cfdrogu is offline   Reply With Quote

Old   May 31, 2024, 06:06
Default foamToVTK time index problem
  #7
Member
 
Rajat soni
Join Date: Oct 2016
Posts: 32
Rep Power: 10
rsoni451 is on a distinguished road
Dear Colleagues,

I am simulation dieselSpray with multiComponentFluid solver in OpenFOAM 11 version. I using "foamToVTK -useTimeName" to visualize the spray parcels under "VTK/lagrangian/cloud" folder. The files are named as cloud_0, cloud_0.0005, cloud_0.0006, .... and so on. However, when I visualize it in Paraview, the time steps are shown as 0, 1, 2, .... so on. Can anyone tell me if I am missing some flag here while converting to VTK or something else that I should consider?

Best regards
rsoni451 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with channeloodles and foamToVTK farbfilm OpenFOAM Running, Solving & CFD 0 October 31, 2008 06:28
[OpenFOAM] FoamToVTK problem oevermann ParaView 6 July 11, 2006 16:10
Please help see this strange problem liugx212 OpenFOAM Running, Solving & CFD 3 February 23, 2006 19:03
CHT strange problem MatejK CFX 3 September 1, 2005 06:32
A strange problem Lee Siemens 0 April 3, 2005 13:33


All times are GMT -4. The time now is 06:46.