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

Create dummy file (.OpenFoam) for paraView with touch

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By marzbali
  • 2 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 24, 2011, 19:43
Default Create dummy file (.OpenFoam) for paraView with touch
  #1
New Member
 
Concordia_CFD
Join Date: Jul 2010
Location: Canada
Posts: 24
Rep Power: 16
marzbali is on a distinguished road
Hello everyone,

I tried to create a dummy file for paraView by touch command and a file by .OpenFoam extension was created but it was empty!

Has anybody experienced the same problem or any idea to solve it?!

Thanks a lot in advance.
marzbali is offline   Reply With Quote

Old   September 24, 2011, 21:06
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Marzbali,

Don't worry, it's meant to be empty ParaView only needs a reference as to what the file extension is; having content in said file depends on the reader plugin. In this case, the OpenFOAM plug-in will step in and load the case directly from the simulation files.

Now, if you do want files to be open-able in any ParaView, without the need for the case itself, then you can use foamToVTK. Run:
Code:
foamToVTK -help
for more information.

edit: Wait, if you already knew that it was a dummy file, then why did you find it odd to be empty?

Best regards,
Bruno
__________________

Last edited by wyldckat; September 24, 2011 at 21:07. Reason: see "edit:"
wyldckat is offline   Reply With Quote

Old   September 27, 2011, 12:10
Default
  #3
New Member
 
Concordia_CFD
Join Date: Jul 2010
Location: Canada
Posts: 24
Rep Power: 16
marzbali is on a distinguished road
Hi Bruno,

Thanks a lot for your reply.
The dummy file that is created in empty as you mentioned but the thing is that when I run the python script in batch mode with pvbatch it is not able to load the case files.
The error message that it gives is: "NameError: name 'PV3FoamReader' is not defined"
What I did was the following: I postproccessed one case in GUI with paraView, saved the trace, edited the python script, modified it for another case in word editor, created the dummy file for the new case by touch, and executed the python script by pvbatch.
I checked my OF 1.7 utilities directory and saw that PV3FoamReader was compiled, so I think the problem is not the reader since it works in GUI.
Do you have any idea what might cause such a problem?!
Thanks.
marzbali is offline   Reply With Quote

Old   September 27, 2011, 12:12
Default
  #4
New Member
 
Concordia_CFD
Join Date: Jul 2010
Location: Canada
Posts: 24
Rep Power: 16
marzbali is on a distinguished road
I forgot to mention that I tried foamToVTK but it didn't work. So I guess the plug-in for VTK is not compiled with my paraView, right?
SHANRU likes this.
marzbali is offline   Reply With Quote

Old   October 1, 2011, 12:44
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Marzbali,

Sorry for taking so long to reply, but here goes:
  1. To use foamToVTK, do this in a terminal:
    • Go to the folder where you have your simulation case;
    • Run:
      Code:
      foamToVTK
    • Check the contents of the newly created folder "VTK":
      Code:
      ls -l VTK
    • Run:
      Code:
      paraview
    • Open in the newly open ParaView window the files that are inside the VTK folder, which you saw two steps above. If you open a file shorthand, something like "case..vtk" instead of "case_0.vtk", this means that ParaView should open those files as time snapshots, instead of just opening a single file.
  2. OpenFOAM's "PV3FoamReader" plugin will only work if you launch paraview from the command line in a terminal window where OpenFOAM's environment is active. In other words, you should be able to successfully run the following command when in the case folder:
    Code:
    paraFoam
    and then be able to visualize the case.
By what I can understand, you are trying to do something else beyond these standard procedures, but whichever steps you are taking, should be done in compliance with those steps above that should work.

Or in other words, run pvbatch only from the command line in a terminal window where the OpenFOAM environment is working.
But if this is what you are already doing, then you can try another file extension as well (you'll need at least ParaView 3.8.0 for this to work): instead of using the file extension ".OpenFOAM", use ".foam". This will force the usage of the internal reader that has been updated in ParaView 3.8.0 and above.

Best regards and good luck!
Bruno
Caio Martins and babak_n like this.
__________________
wyldckat is offline   Reply With Quote

Old   October 2, 2011, 14:11
Default
  #6
New Member
 
Concordia_CFD
Join Date: Jul 2010
Location: Canada
Posts: 24
Rep Power: 16
marzbali is on a distinguished road
Thanks a lot Bruno for your thorough reply.

I recompiled the paraView plug-ins and tried foamToVTK agian, it created the VTK folder including the results.

Regarding the PV3FoamReader, that was what I thought as well. This reader is meant to be used in GUI. However, in my case I want to postprocess my results in batch mode. So, which reader should I use instead in my python script?
And if I use the right reader in batch mode can I execute the python script by pvbatch or pvpython without loading paraView graphics?

Regards,
Marzbali
marzbali is offline   Reply With Quote

Old   October 2, 2011, 16:11
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Marzbali,

Quote:
Originally Posted by marzbali View Post
And if I use the right reader in batch mode can I execute the python script by pvbatch or pvpython without loading paraView graphics?
Mmm, I've never used pvbatch nor pvpython, so I can only guess:
  • If you use the extension ".foam", it should always work, except when it doesn't What I mean is: the internal ".foam" reader in ParaView 3.10.1 has some issues with some simulation cases in OpenFOAM 2.0.
  • If you use the extension ".OpenFOAM", then you must run pvbatch or pvpython from a command line that has the OpenFOAM environment activated! Either that or run them sort-of like this:
    Code:
    /full/path/to/OpenFOAM/bin/foamExec pvbatch ...
*OpenFOAM environment activated: this means that you are able to run (for example) icoFoam from there, right before you run pvbatch.

Best regards,
Bruno
__________________
wyldckat 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
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 17:02
Working directory via command line Luiz CFX 4 March 6, 2011 21:02
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23
OpenFOAM Install Script ljsh OpenFOAM Installation 82 October 12, 2009 12:47
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 21:51


All times are GMT -4. The time now is 18:11.