CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] How to output images using command automatically?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 19, 2009, 21:30
Default How to output images using command automatically?
  #1
Senior Member
 
lakeat's Avatar
 
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21
lakeat is on a distinguished road
Send a message via Skype™ to lakeat
Dear all,

Other than File->Save screenshot, I want to output images of U, epsilon, etc., automatically using shell script or other methods, do you know how to achieve this goal?

Thank you!

DW
__________________
~
Daniel WEI
-------------
Boeing Research & Technology - China
Beijing, China
Email
lakeat is offline   Reply With Quote

Old   April 20, 2009, 07:29
Default
  #2
Member
 
Michael Roth
Join Date: Mar 2009
Location: Guelph, Ontario, Canada
Posts: 50
Rep Power: 17
roth is on a distinguished road
Have you considered using Python to call ParaView? Perhaps something along the lines of http://www.cmake.org/pipermail/parav...ly/005427.html

Michael
roth is offline   Reply With Quote

Old   April 20, 2009, 09:42
Default
  #3
Senior Member
 
lakeat's Avatar
 
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21
lakeat is on a distinguished road
Send a message via Skype™ to lakeat
Thank you, Michael! But I really don't understand the python script and I think I have no energy to delve into it, and I am looking forward to pyFoam to have that function. It would be very nice if Mr. Gschaider will help us on this.

With Regards, Daniel
__________________
~
Daniel WEI
-------------
Boeing Research & Technology - China
Beijing, China
Email
lakeat is offline   Reply With Quote

Old   April 21, 2009, 07:19
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Daniel!

Quote:
Originally Posted by lakeat View Post
Thank you, Michael! But I really don't understand the python script and I think I have no energy to delve into it, and I am looking forward to pyFoam to have that function. It would be very nice if Mr. Gschaider will help us on this.
I (Bernhard) have spoken to Mr. Gschaider, and he says: PyFoam already has a similar functionality http://openfoamwiki.net/index.php/Co...mPVSnapshot.py. To quote from the online help:

Code:
pyFoamPVSnapshot.py -h
Usage
=====
  pyFoamPVSnapshot.py [options] <case>

 Generates snapshots of an OpenFOAM-case and a predefined paraview State-File
using the PV3FoamReader that comes with OpenFOAM.  The state-file can be
generated using a different case (the script adjusts it before using) but the
original case has to have a similar structure to the current one. Also exactly
one PV3Reader has to be used in the state-file (this requirement is fullfilled
if the StateFile was generated using paraFoam)  In TextSources the string
"%(casename)s" gets replaced by the casename. Additional replacements can be
specified
Is this the thing you are looking for? You have to prepare a state-file once ("Save State" in paraFoam) and then you can use it to make pictures of similar cases.

Bernhard

PS: There seems to be slight problem with the 3.3-version that is distributed with OpenFOAM. But it works with 3.4
gschaider is offline   Reply With Quote

Old   April 21, 2009, 08:55
Default
  #5
Senior Member
 
lakeat's Avatar
 
Daniel WEI (老魏)
Join Date: Mar 2009
Location: Beijing, China
Posts: 689
Blog Entries: 9
Rep Power: 21
lakeat is on a distinguished road
Send a message via Skype™ to lakeat
Hi Bernhard, say hi to Mr. Gschaider, when you meet him.
But what is state-file, can you give me an example?
__________________
~
Daniel WEI
-------------
Boeing Research & Technology - China
Beijing, China
Email
lakeat is offline   Reply With Quote

Old   April 21, 2009, 11:34
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by lakeat View Post
Hi Bernhard, say hi to Mr. Gschaider, when you meet him.
I usually avoid that. People look at me funny when I talk aloud to him.
Quote:
Originally Posted by lakeat View Post
But what is state-file, can you give me an example?
The state file is the file that you produce with "Save State" in the paraview-file menu. With "Load State" it allows you exactly return to the state you had (all the filters etc). Play around with these two menu-entries and you'll see what I mean

BTW: I added on the PyFoam-Wiki-page some information that explains how to set up a OF-installation so that PVSnapshot works

Bernhard
gschaider is offline   Reply With Quote

Old   May 14, 2009, 04:59
Default
  #7
New Member
 
Sumeet Kumar
Join Date: Mar 2009
Posts: 21
Rep Power: 17
crazysumi is on a distinguished road
Hi All,

I am using pyFoamPVSnapshot utility available in pyFoam. I have :-
pyFoam 0.5.2
python 2.5.4
paraview 3.4
on Opensuse 10.3 x86_64 machine

I installed paraview 3.4 with QT4.3.5.

The pyFoamPVLoadState script works fine but on running the snapshot script, with the provided inputs. I received following error messages :-

> pyFoamPVSnapshot.py --state-file=U.pvsm --latest-time --file-prefix=vel .
Snapshot 0 for t= 1000
vtkPainterPolyDataMapper : [ ...........]
Segmentation fault


Please advice

Regards
Sumeet

Last edited by crazysumi; May 14, 2009 at 08:35.
crazysumi is offline   Reply With Quote

Old   May 19, 2009, 17:59
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by crazysumi View Post
Hi All,

I am using pyFoamPVSnapshot utility available in pyFoam. I have :-
pyFoam 0.5.2
python 2.5.4
paraview 3.4
on Opensuse 10.3 x86_64 machine

I installed paraview 3.4 with QT4.3.5.

The pyFoamPVLoadState script works fine but on running the snapshot script, with the provided inputs. I received following error messages :-

> pyFoamPVSnapshot.py --state-file=U.pvsm --latest-time --file-prefix=vel .
Snapshot 0 for t= 1000
vtkPainterPolyDataMapper : [ ...........]
Segmentation fault


Please advice

Regards
Sumeet
That's a tough one. "Segmentation Fault" could be almost anything.

Some questions:
Does this happen with every StateFile or just with a specific one? Is the paraView compiled with MESA enabled? Do you feel comfortable with enabling core dumps with "ulimit -c <some value>" and getting a stack-trace with gdb (if not, don't bother it would take too long guiding you through this)?

Bernhard
gschaider is offline   Reply With Quote

Old   May 20, 2009, 01:29
Default
  #9
New Member
 
Sumeet Kumar
Join Date: Mar 2009
Posts: 21
Rep Power: 17
crazysumi is on a distinguished road
Hi Bernhard,

It happens with every state-file generated in paraFoam (for PV3FoamReader). I checked the script, MESA was not enabled in script. However, I enabled the INCLUDE_PYTHON and set the path for python libs in the script.

"Do you feel comfortable with enabling core dumps with "ulimit -c <some value>" and getting a stack-trace with gdb.."

I don't know how to do it.

Recently I started a bit different way of doing the same thing using pvpython shell. I created some state files by reading thru Parafoam, and paraview for VTK, ensight files. On loading state files using the shell, it is not able to recognize "PV3FoamReader" as a source. Howerver, state files for VTK, Ensight files are well read and loaded and images can be written. Is there any way to include PV3Foamreader as a source to pvpython shell.

Thanks,
Sumeet
crazysumi is offline   Reply With Quote

Old   May 20, 2009, 10:23
Default
  #10
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by crazysumi View Post
It happens with every state-file generated in paraFoam (for PV3FoamReader). I checked the script, MESA was not enabled in script. However, I enabled the INCLUDE_PYTHON and set the path for python libs in the script.
OK. Only checking. Because it should work with MESA, but I never tested it because my paraview is compiled without MESA to. But to cover that you could look for

view.UseOffscreenRenderingForScreenshots=True

in PyFoam.Applications.PVSnapshot.py and replace it with False (thus disabling MESA for sure)

Quote:
Originally Posted by crazysumi View Post
"Do you feel comfortable with enabling core dumps with "ulimit -c <some value>" and getting a stack-trace with gdb.."

I don't know how to do it.
And I don't know how to explain it. Let's leave this out

Quote:
Originally Posted by crazysumi View Post
Recently I started a bit different way of doing the same thing using pvpython shell. I created some state files by reading thru Parafoam, and paraview for VTK, ensight files. On loading state files using the shell, it is not able to recognize "PV3FoamReader" as a source. Howerver, state files for VTK, Ensight files are well read and loaded and images can be written. Is there any way to include PV3Foamreader as a source to pvpython shell.
PyFoam does this in PyFoam/Paraview/ServermanagerWrapper.py in the __init__-constructor. Have a look there. Maybe the reason for the segmentation fault lies in there

Bernhard
gschaider is offline   Reply With Quote

Old   August 18, 2010, 08:57
Default
  #11
Senior Member
 
Join Date: Dec 2009
Posts: 112
Rep Power: 16
heavy_user is on a distinguished road
Hi There (and special greetings to Bernhard, again ),

i am using OF1.6 now and pyFoamPVSnapshot.py ist not working...as mentioned above..

So I installed paraview3.4.0 with my ubuntu package-manager.


pyFoamPVSnapshot.py does not care about me having done this, it still refuses to work.
So how can I make pyFoamPVSnapshot.py use a certain paraview-version when i have installed more than one?

Thx!
heavy_user is offline   Reply With Quote

Old   August 18, 2010, 11:28
Default
  #12
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by heavy_user View Post
Hi There (and special greetings to Bernhard, again ),

i am using OF1.6 now and pyFoamPVSnapshot.py ist not working...as mentioned above..

So I installed paraview3.4.0 with my ubuntu package-manager.


pyFoamPVSnapshot.py does not care about me having done this, it still refuses to work.
So how can I make pyFoamPVSnapshot.py use a certain paraview-version when i have installed more than one?

Thx!
First problem you'll have is that the PV3Reader-plugin that comes with OF 1.6 expects a Paraview 3.6 and probably won't work with 3.4 (plus you'll need to compile OF from the sources to make that compile)

Loading the PV3-Plugin is a bit of a due to problems in the Python-code of Paraview and probably never will be supported for the OF1.6/PV3.6-combo and for the OF1.7/PV3.8-combo subject to research.

What is supported since the last version of PyFoam is the native OF reader (plugin for 3.6, built-in since 3.8). PVSnapshot looks at the state-file and tries to load the OF-reader that you used. There still may be a problem if the reader is a plugin

Bernhard
gschaider is offline   Reply With Quote

Old   August 19, 2010, 06:53
Default
  #13
Senior Member
 
Join Date: Dec 2009
Posts: 112
Rep Power: 16
heavy_user is on a distinguished road
Quote:
Originally Posted by gschaider View Post
First problem you'll have is that the PV3Reader-plugin that comes with OF 1.6 expects a Paraview 3.6 and probably won't work with 3.4 (plus you'll need to compile OF from the sources to make that compile)

Loading the PV3-Plugin is a bit of a due to problems in the Python-code of Paraview and probably never will be supported for the OF1.6/PV3.6-combo and for the OF1.7/PV3.8-combo subject to research.

What is supported since the last version of PyFoam is the native OF reader (plugin for 3.6, built-in since 3.8). PVSnapshot looks at the state-file and tries to load the OF-reader that you used. There still may be a problem if the reader is a plugin

Bernhard
Hi Bernhard,

so this means that there is no good solution to OF1.6 ?
Would it help to install OF1.6 and OF1.5( use the nice pyFoam stuff with of 1.5...) ?

Best
heavy_user is offline   Reply With Quote

Old   August 19, 2010, 13:11
Default
  #14
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by heavy_user View Post
Hi Bernhard,

so this means that there is no good solution to OF1.6 ?
Would it help to install OF1.6 and OF1.5( use the nice pyFoam stuff with of 1.5...) ?

Best
Just for snapshoting? I'm afraid that would be an option (But you don't have to switch versions permanently. Using the option --foam=1.5 would make PVSnapShot make believe that it is not living in a 1.6-world)

Alternative would be to install 1.7/3.8 and use a state-file where you used the native reader. That works for me (PV3Reader needs some modifications due to the new path were it is located)

Bernhard
gschaider is offline   Reply With Quote

Old   July 18, 2019, 13:39
Default
  #15
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 14
amin.z is on a distinguished road
Quote:
Originally Posted by gschaider View Post
PyFoam already has a similar functionality

hi Bernhard,

Is it possible to save the PNGs with transparent background?

the paraview's background, from which the state file is being saved, always comes with a color; to my knowledge transparent background is only available under File>save screenshot, is the same option available through pyFoamPVSnapshot.py ?


thanks
amin.z is offline   Reply With Quote

Old   July 19, 2019, 03:28
Default
  #16
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by amin.z View Post
hi Bernhard,

Is it possible to save the PNGs with transparent background?

the paraview's background, from which the state file is being saved, always comes with a color; to my knowledge transparent background is only available under File>save screenshot, is the same option available through pyFoamPVSnapshot.py ?


thanks

I must have a look whether the PYthon-API supports it. But I don't have it inmplemented ... yet
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   July 19, 2019, 10:06
Default
  #17
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 14
amin.z is on a distinguished road
Quote:
Originally Posted by gschaider View Post
I must have a look whether the PYthon-API supports it. But I don't have it inmplemented ... yet

great, thanks, looking forward for the "I implemented it" message
amin.z is offline   Reply With Quote

Old   July 19, 2019, 18:24
Default
  #18
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by amin.z View Post
great, thanks, looking forward for the "I implemented it" message
I guess it happens to you all the time as well: you think "Yeah that feature would be nice. Lets see how much time it taks to implement" You look at the sources and realize "it is already there"
Seems like I already implemented it in January and forgot about it


The reason why you don't see it is that there wasn't a release in the meantime. So the problem shifts to "when I find time for a release"
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   July 20, 2019, 05:13
Default
  #19
Senior Member
 
amin.z's Avatar
 
Amin
Join Date: Oct 2013
Location: Germany
Posts: 397
Rep Power: 14
amin.z is on a distinguished road
Quote:
Originally Posted by gschaider View Post
I guess it happens to you all the time as well: you think "Yeah that feature would be nice. Lets see how much time it taks to implement" You look at the sources and realize "it is already there"
Seems like I already implemented it in January and forgot about it


The reason why you don't see it is that there wasn't a release in the meantime. So the problem shifts to "when I find time for a release"

yes, I'm familiar with that feeling, kind of a deja vu
hope you'll get sometime and share the new features
thanks
amin.z 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] outputTime in Swak function immortality OpenFOAM Community Contributions 20 October 6, 2022 12:08
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 06:16
RNG diverged during the analysis the flow over a multi element airfoil, why? s.m OpenFOAM Running, Solving & CFD 0 August 5, 2013 08:39
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 09:34
lift and drag on ship superstructures vaina74 OpenFOAM Running, Solving & CFD 3 June 8, 2010 12:30


All times are GMT -4. The time now is 01:25.