CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Paraview & paraFoam

OpenFOAM reader in the ParaView CVS

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 22, 2006, 11:09
Default If you download and build the
  #1
Member
 
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 8
tj22 is on a distinguished road
If you download and build the CVS version of ParaView, you will now have access to the native OpenFOAM reader. It will also be available in the next release of ParaView.

NOTE: To use you need to copy or rename the "controlDict" to "controlDict.foam".
tj22 is offline   Reply With Quote

Old   November 27, 2006, 05:55
Default Hi, I tried building from the
  #2
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
Hi, I tried building from the CVS source tree of version 2.5 branch, and found a problem that multi time-step data can't be handled correctly (for example, only the first time step is read in the tutorials/icoFoam/cavity case). I looked into vtkOpenFOAMReader.cxx and found the following fixes the problem. Anyway thanks for a great work, as Windows users don't have to use foamToVTK anymore.
<pre>--- vtkOpenFOAMReader.cxx.orig 2006-11-27 16:02:45.218163200 +0900
+++ vtkOpenFOAMReader.cxx 2006-11-27 16:16:51.605208000 +0900
@@ -861,7 +861,7 @@

//calculate the time step increment based on type of run
//if(writeControl.compare(0,7,"timeStep",0,7) == 0)
- if(!strcmp(temp.substr(0,8).c_str(), "timeStep"))
+ if(!strcmp(writeControl.substr(0,8).c_str(), "timeStep"))
{
vtkDebugMacro(<<"Time step type data");
timeStepIncrement = writeInterval * deltaT;</pre>
7islands is offline   Reply With Quote

Old   November 30, 2006, 17:29
Default paraview also works under linu
  #3
Member
 
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 8
tj22 is on a distinguished road
paraview also works under linux
tj22 is offline   Reply With Quote

Old   December 1, 2006, 05:17
Default Yes, and I had the same proble
  #4
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
Yes, and I had the same problem on SUSE 10.1. Of course the same fix worked. It's platform-independent.
7islands is offline   Reply With Quote

Old   December 1, 2006, 16:13
Default That comment was in response t
  #5
Member
 
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 8
tj22 is on a distinguished road
That comment was in response to
"as Windows users don't have to use foamToVTK anymore." not your patch.

As for the patch, I do not have time right now to test it. To me, the patch, whether it operates properly or not it looks incorrect. I will try to address the issue as soon as I can.
tj22 is offline   Reply With Quote

Old   December 2, 2006, 00:43
Default I'm also doubtful if my patch
  #6
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
I'm also doubtful if my patch is correct because I still don't fully understand your code. The point is that the number of timesteps is counted incorrectly (at least) if the writeControl entry is set to timeStep. Sorry for taking your time but could you inspect it when you have time to spare.
7islands is offline   Reply With Quote

Old   December 5, 2006, 13:11
Default Actually your patch does seem
  #7
Member
 
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 8
tj22 is on a distinguished road
Actually your patch does seem to be correct. Sorry I just skimmed the code quickly. I am correcting it now and I will submit it to paraview.

That is what will be great about people using it, we can hammer out all the bugs and hopefully the reader will be very dependable in the end.
tj22 is offline   Reply With Quote

Old   December 6, 2006, 08:25
Default I was glad to see that the Ope
  #8
Senior Member
 
Rasmus Hemph
Join Date: Mar 2009
Location: Sweden
Posts: 108
Rep Power: 8
hemph is on a distinguished road
I was glad to see that the OpenFOAM-reader is also in the latest VTK-sources from CVS. I am trying to use the vtkOpenFOAM-reader using (the Python interface to) VTK, but I am not quite sure of the syntax.

I am able to create the reader using
ofreader = vtkOpenFoamReader(),

and to set the input file name by

ofreader.SetFileName('controlDict.foam'),

but when I call ofreader.Update() to cause reading, I get a crash saying

ofreader.Update()
terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_S_create

Is there a way to get VTK to accept my OpenFOAM case?
hemph is offline   Reply With Quote

Old   December 6, 2006, 11:08
Default The only code I have for VTk i
  #9
Member
 
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 8
tj22 is on a distinguished road
The only code I have for VTk is a tcl script

package require vtk
package require vtkinteraction


# Create a reader and write out the field
vtkOpenFOAMReader reader
reader SetFileName "$VTK_DATA_ROOT/Data/OpenFOAM/system/controlDict.foam"

vtkMultiGroupDataExtractDataSets extract
extract SetInputConnection [reader GetOutputPort]
extract AddDataSet 0 0

vtkMultiGroupDataGeometryFilter geom
geom SetInputConnection [extract GetOutputPort ]

vtkLookupTable lut
lut SetNumberOfTableValues 256
lut SetHueRange 0.6667 0
lut SetSaturationRange 1 1
lut SetValueRange 1 1
lut SetVectorComponent 0
lut SetVectorMode 1


vtkPolyDataMapper mapper
mapper SetInputConnection [geom GetOutputPort]
mapper SetScalarModeToUseCellFieldData
mapper ColorByArrayComponent "alpha" 0
mapper SetScalarRange -0.0428937 1
mapper SetLookupTable lut

vtkActor actor
actor SetMapper mapper

# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin

ren1 AddActor actor

renWin SetSize 300 300
iren Initialize
renWin Render

iren AddObserver UserEvent {wm deiconify .vtkInteract}

# prevent the tk window from showing up then start the event loop
wm withdraw .
tj22 is offline   Reply With Quote

Old   December 6, 2006, 12:56
Default Thanks for the file Terry. Thi
  #10
Senior Member
 
Rasmus Hemph
Join Date: Mar 2009
Location: Sweden
Posts: 108
Rep Power: 8
hemph is on a distinguished road
Thanks for the file Terry. This will be is a very useful addition to the VTK-readers. I located the cause of error. To create the reader, I need to be in a directory below the controlDict.

e.g.
chdir ./cavity/system/
ofreader.SetFileName('controlDict')

does not work, but
ofreader.SetFileName('./cavity/system/controlDict')
works.

(But for some reason
ofreader.SetFileName('/home/myUserName/OpenFOAM/OpenFOAM-1.3/tutorials/cavity/sy stem/controlDict')
does NOT work, but gives 100% CPU usage and no result!)

One more question. For some reason I only get the first time step when I use the reader above. Thus,

ofreader.GetNumberOfTimeSteps() gives 1, and
ofreader.GetTimeStepRange() gives (0,0),

but there are 5 time steps in the directory. Do you have any clues to how I can tell the reader about the other time steps?
Incidentally, I could not find the file
"$VTK_DATA_ROOT/Data/OpenFOAM/system/controlDict.foam"
in the VTKData directory I downloaded from kitware cvs page, so I dont know If the example include time step data.
hemph is offline   Reply With Quote

Old   December 6, 2006, 18:58
Default Hi Rasmus, as for the number o
  #11
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
Hi Rasmus, as for the number of timesteps, did you read this thread from the beginning? I reported exactly the same problem and a fix to the reader code. Sorry if I'm wrong as I know nothing about tcl but probably the same thing applies.
7islands is offline   Reply With Quote

Old   December 7, 2006, 11:30
Default Hi Takuya. Should have looked
  #12
Senior Member
 
Rasmus Hemph
Join Date: Mar 2009
Location: Sweden
Posts: 108
Rep Power: 8
hemph is on a distinguished road
Hi Takuya. Should have looked up! With your fix I get the time steps using VTK. Thanks!
However, I upgraded Paraview from CVS today and saw that the patch has been included in the official reader. I compiled a new Paraview, but it now crashes when I try to open a foam-case. This is the error message I get:

ErrorMessage
# Error or warning: There was a VTK Error in file: /usr/local/src/ParaView/GUI/Widgets/vtkKWTkUtilities.cxx (221)
vtkPVApplication (0x80d9388):
Script:
vtkTemp2 OpenCallback
Returned Error on line 1:
56Uncaught exception: basic_string::_S_create

Stack trace:
56Uncaught exception: basic_string::_S_create

while executing
"vtkTemp2 OpenCallback"
ErrorMessage end
ErrorMessage
# Error or warning: There was a VTK Error in file: /usr/local/src/ParaView/VTK/Filtering/vtkExecutive.cxx (784)
vtkCompositeDataPipeline (0x90cab30): UpdateInformation invoked during another request. Returning failure to algorithm vtkOpenFOAMRead er(0x90c85f8).
ErrorMessage end

Has anyone tried compiling with the new sources?
hemph is offline   Reply With Quote

Old   December 21, 2006, 10:16
Default You need to download the parav
  #13
Member
 
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 8
tj22 is on a distinguished road
You need to download the paraview 2.6 cvs version. Looks like it is working correctly to me. The commands to get 2.6 are:

cvs -d :pserver:anoncvs@www.paraview.org:/cvsroot/ParaView login

cvs -d :pserver:anoncvs@www.paraview.org:/cvsroot/ParaView co -r ParaView-2-6 ParaView
tj22 is offline   Reply With Quote

Old   January 4, 2007, 03:43
Default Great, With a new compilation,
  #14
Senior Member
 
Rasmus Hemph
Join Date: Mar 2009
Location: Sweden
Posts: 108
Rep Power: 8
hemph is on a distinguished road
Great, With a new compilation, it is working. Something must have been messed up with my old installation.
hemph is offline   Reply With Quote

Old   January 23, 2007, 15:51
Default The reader was just updated on
  #15
Member
 
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 8
tj22 is on a distinguished road
The reader was just updated on 1/18, there were some memory leaks and issues with windows. Seems to be working well now. Check it out. Of course you have to download the latest 2.6 CVS.
tj22 is offline   Reply With Quote

Old   December 22, 2007, 09:18
Default I had some problems in using v
  #16
iyer_arvind
Guest
 
Posts: n/a
I had some problems in using vtkOpenFOAMReader with OpenFOAM runs with timeFormat fixed; Does anyone have a solution for the same?
  Reply With Quote

Old   December 22, 2007, 10:05
Default Hi Iyer, If you are using 3.2
  #17
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 11
7islands is on a distinguished road
Hi Iyer,
If you are using 3.2 or 3.3 series of ParaView you can try the reader I posted to another thread on 23/Oct/2007.

Takuya
7islands is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Native ParaView Reader Bugs tj22 OpenFOAM Paraview & paraFoam 266 July 1, 2015 02:00
VisIt reader plugin for OpenFOAM hjasak OpenFOAM Post-Processing 19 May 4, 2009 00:58
ParaView Reader %7c Visit tj22 OpenFOAM Paraview & paraFoam 16 September 25, 2008 14:01
Trying to submit soon Paraview reader tj22 OpenFOAM Paraview & paraFoam 3 June 5, 2006 14:07
Building Paraview with reader builtin instead of parafoam script tj22 OpenFOAM Paraview & paraFoam 2 April 7, 2006 12:55


All times are GMT -4. The time now is 10:30.