|
[Sponsors] |
[OpenFOAM] OpenFOAM reader in the ParaView CVS |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 22, 2006, 11:09 |
OpenFOAM reader in the ParaView CVS
|
#1 |
Member
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 17 |
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". |
|
November 27, 2006, 05:55 |
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: 20 |
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> |
|
November 30, 2006, 17:29 |
paraview also works under linu
|
#3 |
Member
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 17 |
paraview also works under linux
|
|
December 1, 2006, 16:13 |
That comment was in response t
|
#5 |
Member
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 17 |
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. |
|
December 2, 2006, 00:43 |
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: 20 |
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.
|
|
December 5, 2006, 13:11 |
Actually your patch does seem
|
#7 |
Member
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 17 |
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. |
|
December 6, 2006, 08:25 |
I was glad to see that the Ope
|
#8 |
Senior Member
Rasmus Hemph
Join Date: Mar 2009
Location: Sweden
Posts: 108
Rep Power: 17 |
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? |
|
December 6, 2006, 11:08 |
The only code I have for VTk i
|
#9 |
Member
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 17 |
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 . |
|
December 6, 2006, 12:56 |
Thanks for the file Terry. Thi
|
#10 |
Senior Member
Rasmus Hemph
Join Date: Mar 2009
Location: Sweden
Posts: 108
Rep Power: 17 |
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. |
|
December 6, 2006, 18:58 |
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: 20 |
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.
|
|
December 7, 2006, 11:30 |
Hi Takuya. Should have looked
|
#12 |
Senior Member
Rasmus Hemph
Join Date: Mar 2009
Location: Sweden
Posts: 108
Rep Power: 17 |
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? |
|
December 21, 2006, 10:16 |
You need to download the parav
|
#13 |
Member
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 17 |
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 |
|
January 4, 2007, 03:43 |
Great, With a new compilation,
|
#14 |
Senior Member
Rasmus Hemph
Join Date: Mar 2009
Location: Sweden
Posts: 108
Rep Power: 17 |
Great, With a new compilation, it is working. Something must have been messed up with my old installation.
|
|
January 23, 2007, 15:51 |
The reader was just updated on
|
#15 |
Member
Terry Jordan
Join Date: Mar 2009
Posts: 95
Rep Power: 17 |
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.
|
|
December 22, 2007, 09:18 |
I had some problems in using v
|
#16 |
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?
|
|
December 22, 2007, 10:05 |
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: 20 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Map of the OpenFOAM Forum - Understanding where to post your questions! | wyldckat | OpenFOAM | 10 | September 2, 2021 06:29 |
OpenFOAM Training Jan-Apr 2017, Virtual, London, Houston, Berlin | cfd.direct | OpenFOAM Announcements from Other Sources | 0 | September 21, 2016 12:50 |
OpenFOAM Training, London, Chicago, Munich, Houston 2016-2017 | cfd.direct | OpenFOAM Announcements from Other Sources | 0 | September 14, 2016 04:19 |
Parafoam - FATAL ERROR: ParaView reader module libraries do not exist | Amit_Pawarpawar | OpenFOAM Installation | 1 | August 25, 2014 11:31 |
New OpenFOAM Forum Structure | jola | OpenFOAM | 2 | October 19, 2011 07:55 |