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

PyFoam

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

Like Tree4Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   April 25, 2009, 15:42
Default
  #121
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by fightingfalcon23 View Post
Hi all together,

I am using pyFoam and never had problems untill now. But after updating ubuntu to Version 9.04, everytime I want to start a calculation, I get the following message:

"
/usr/local/lib/python2.6/dist-packages/PyFoam/FoamInformation.py:5: DeprecationWarning: The popen2 module is deprecated. Use the subprocess module.
from popen2 import popen4
Traceback (most recent call last):
File "/usr/local/bin/pyFoamPlotRunner.py", line 3, in <module>
from PyFoam.Applications.PlotRunner import PlotRunner
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Applications/PlotRunner.py", line 8, in <module>
from PyFoam.Execution.GnuplotRunner import GnuplotRunner
File "/usr/local/lib/python2.6/dist-packages/PyFoam/Execution/GnuplotRunner.py", line 86
with="steps",
^
SyntaxError: invalid syntax
"
Two things have happened here:
a) the new Ubuntu has python 2.6 which has a new keyword "with"
b) you are using an old version of PyFoam where variables named with exist
so the best way to fix this is to install the most recent version of PyFoam

Quote:
Originally Posted by fightingfalcon23 View Post
At the beginning of the thread, I wrote about about a mistake with the pythonpath, but I don't know, how to deal with it. I tried to install pyFoam completely new (as root using "sudo") but after installation, I see the same message again!

Thanks for reading
fightingfalcon23
If you're getting those messages then the PYTHONPATH is pointing to a PyFoam-installation
gschaider is offline   Reply With Quote

Old   July 7, 2009, 05:58
Default Separated Residual Plots
  #122
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 176
Rep Power: 8
markusrehm is on a distinguished road
Hello Bernhard and others,

I would like to make my plot separate solver convergence graphs for different field variables. For me would be appropriate:
Graph1: All but chemical species (Ux, Uy, Uz, p ,...)
Graph2; All chemical species mass fractions

I tried to do with a customRegexp like

Code:
{"expr":"DILUPBiCG:  Solving for Ux, Initial residual = (%f%)","name":"test","titles":["Ux"]}
{"expr":"DILUPBiCG:  Solving for Uy, Initial residual = (%f%)","name":"test","titles":["Uy"]}
{"expr":"DILUPBiCG:  Solving for Uz, Initial residual = (%f%)","name":"test","titles":["Uz"]}
but it starts a window for every entry and is not log-scaled.

Any Idea how to do that the most elegant way?

Regards, Markus.
markusrehm is offline   Reply With Quote

Old   July 7, 2009, 07:00
Default
  #123
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by markusrehm View Post
Hello Bernhard and others,

I would like to make my plot separate solver convergence graphs for different field variables. For me would be appropriate:
Graph1: All but chemical species (Ux, Uy, Uz, p ,...)
Graph2; All chemical species mass fractions

I tried to do with a customRegexp like

Code:
{"expr":"DILUPBiCG:  Solving for Ux, Initial residual = (%f%)","name":"test","titles":["Ux"]}
{"expr":"DILUPBiCG:  Solving for Uy, Initial residual = (%f%)","name":"test","titles":["Uy"]}
{"expr":"DILUPBiCG:  Solving for Uz, Initial residual = (%f%)","name":"test","titles":["Uz"]}
but it starts a window for every entry and is not log-scaled.
Collecting results from multiple lines into one custom-graph is currently not possible. It came to my mind, but I never implemented it because when I would have needed it I didn't have the time (what is the English word for "Leidensdruck"? "Pressure of suffering" doesn't sound right )

Log-scale on the other hand is possible:
Code:
{"expr":"DILUPBiCG:  Solving for Ux, Initial residual = (%f%)","name":"test","titles":["Ux"],"logscale":True}
For the multiple-lines thing. One of the things I never figured out was: "What would be a logical syntax (not just for my sick mind, but for everyone else)"

Using a "Master":
Code:
{"expr":"DILUPBiCG:  Solving for Ux, Initial residual = (%f%)","titles":["Ux"],"name":"VelResiduals"}
{"expr":"DILUPBiCG:  Solving for Uy, Initial residual = (%f%)","titles":["Uy"],"master":"VelResiduals"}
{"expr":"DILUPBiCG:  Solving for Uz, Initial residual = (%f%)","titles":["Uz"],"master":"VelResiduals"}
or specifying a "name-expression":
Code:
{"expr":"DILUPBiCG:  Solving for (U.), Initial residual = (%f%)","name":"test","titlesExpressions":[0],"name":"VelResiduals"}
Question to all PyFoam-users: which form would you be using?

Bernhard
gschaider is offline   Reply With Quote

Old   July 7, 2009, 08:18
Default
  #124
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 176
Rep Power: 8
markusrehm is on a distinguished road
Hi Bernhard,

thanks so far but I don't really understand your question

Markus
markusrehm is offline   Reply With Quote

Old   July 7, 2009, 12:06
Default
  #125
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by markusrehm View Post
thanks so far but I don't really understand your question
The question is: there are these two possible ways to specify multi-line-plots that I was thinking about. I will only implement one of them (once I have time for that). Which one do you (and other PyFoam-users) prefer. Because each of them has its advantages but to implement both of them would be a great mess

Bernhard
gschaider is offline   Reply With Quote

Old   July 7, 2009, 15:49
Default
  #126
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 176
Rep Power: 8
markusrehm is on a distinguished road
So the first one seems more intuitive to me but looks like more "work".

And if Variables don't fit the scheme in the second approach (U.)?

What about a dictionary with two coloumns for multiplot selection?

Code:
//value  master
Ux         win1;
Uy         win1;
CH4      win2;
C2H2    none;
Regards Markus.
markusrehm is offline   Reply With Quote

Old   July 8, 2009, 04:43
Default
  #127
Member
 
lord_kossity's Avatar
 
Andreas Dietz
Join Date: Mar 2009
Location: Munich
Posts: 79
Rep Power: 8
lord_kossity is on a distinguished road
Hi Bernhard,

again another one having gnuplot problems...

I recently (yesterday) installed the current version of PyFoam (0.5.2). Way here everything went very well and the installation was successful according to your site on the wiki.

My main interest was monitoring the residuals on the fly, so I used pyFoamPlotRunner.py. I tried to run it with several tutorial cases from 1.5.x (turbFoam/airFoil2D, icoFoam/elbow, dieselFoam/aachenBomb) but could not manage to get any output in gnuplot.
In fact two gnuplot windows pop up and the legends for the graphs are correctly depicted but the graphs themselves do not show up at all.

Error message is e.g. for icoFoam/elbow

Warning: empty x range [0.05:0.05], adjusting to [0.0495:0.0505]
Warning: empty y range [-1.42102e-10:-1.42102e-10], adjusting to [-1.40681e-10:-1.43523e-10]
Warning: empty y2 range [-1.42102e-10:-1.42102e-10], adjusting to [-1.40681e-10:-1.43523e-10]
Warning: empty x range [0.05:0.05], adjusting to [0.0495:0.0505]
Warning: empty y range [1:1], adjusting to [0.99:1.01]


Im working on a machine with the following setup:

openSUSE 11.1 (x86_64)
Python 2.6
PyFoam 0.5.2
gnuplot 4.2

Furthermore the import of the Numeric package shows no errors in the python shell.


Do you have any hint what may be wrong / unloaded in my installation?

Regards,
Andreas
lord_kossity is offline   Reply With Quote

Old   July 8, 2009, 06:41
Default
  #128
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 9
jaswi is on a distinguished road
Hi Andreas

Had the same problem myself but updating some packages solved the problem. Here is what i did on OpenSUSE :

- started yast2 (i know it needs root passwd :-) )
- searched for python
- updated all the packages which in a way could be related to gnuplot
(always include all necessary for development as well) or in my sense
could be useful when I am using python as a development environment

I regret that I did not make the list of packges I installed otherwise I could have pointed exactly the packages you need to get over this error.

Try this way. by the way pyFOAM does not need my endorsement but believe me it makes working with OpenFOAM a lot easier and efficient.

Best Regards
jaswi
jaswi is offline   Reply With Quote

Old   July 8, 2009, 11:22
Default
  #129
Member
 
lord_kossity's Avatar
 
Andreas Dietz
Join Date: Mar 2009
Location: Munich
Posts: 79
Rep Power: 8
lord_kossity is on a distinguished road
Thanks Jaswi

Finally the reason was that it properly works with the numpy package (now installed) but does not with the Numeric (installed before).

Thanks for your effort.
lord_kossity is offline   Reply With Quote

Old   July 8, 2009, 13:09
Default
  #130
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
[QUOTE=markusrehm;221829]So the first one seems more intuitive to me but looks like more "work".
[/CODE]
Second one would have the advantage that it automatically would recognize new names (for instance chemical species - don't know if you need those )

Quote:
Originally Posted by markusrehm View Post
And if Variables don't fit the scheme in the second approach (U.)?

What about a dictionary with two coloumns for multiplot selection?

Code:
//value  master
Ux         win1;
Uy         win1;
CH4      win2;
C2H2    none;
Regards Markus.
That leads to another idea: Loose the "OneLinePerExpression-PseudoPython-Dictionary"-Format for customRegex. I'll think about it (and how to preserve backwards-compatibility)

Bernhard
gschaider is offline   Reply With Quote

Old   July 8, 2009, 13:12
Default
  #131
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by lord_kossity View Post
Finally the reason was that it properly works with the numpy package (now installed) but does not with the Numeric (installed before).
Strange. It should work with both. But the problem you described was reported previously several times (most of the time on SuSE-machines).
gschaider is offline   Reply With Quote

Old   August 16, 2009, 04:41
Default
  #132
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 10
braennstroem is on a distinguished road
Hi Bernhard,

I am bit curious and wonder, how your planings are for the urwid-based pyFoam work :-)

Regards!
Fabian
braennstroem is offline   Reply With Quote

Old   August 17, 2009, 14:07
Default
  #133
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by braennstroem View Post
I am bit curious and wonder, how your planings are for the urwid-based pyFoam work :-)
Currently not much is planned (when I have time to work on PyFoam I'm adapting it to cope with the new things that come with 1.6).

As I said somewhere else: the majority of work to be done would be writing the description files (although there are still some extensions to the backend planned). I currently plan to use the CaseBuilder-functionality to write small tailor-made GUIs for specific applications, but not for writing (for instance) a "general GUI for simpleFoam" (and it would need some adaptions to really work for that). But I would support any effort in that direction

@urwid: the backend of the CaseBuilder-stuff is GUI-agnostic, using urwid was just a case of "first thing I stumbled upon that is relatively small footprint". I'm planning to replace it by a GUIier GUI (PyQT probably) when I find time (which is another word for "sometime this century" )

Bernhard
gschaider is offline   Reply With Quote

Old   August 26, 2009, 16:46
Default PyFoam installs but does not work
  #134
New Member
 
Evgeniy Redekop
Join Date: Mar 2009
Posts: 5
Rep Power: 8
unit is on a distinguished road
Hi,

I have just installed PyFoam as a root following the Wiki:
http://openfoamwiki.net/index.php/Contrib_PyFoam

It passes the installation test recommended in the Wiki, but when I try to use PlotWatcher on one of my logs it does nothing and returns prompt. Here is the command I use:

unit@laplace:/usr/lib/python2.5/site-packages/PyFoam/Applications$ python PlotWatcher.py /home/unit/OpenFOAM/unit-1.5.x/run/cstr/3dcstrMRF01/log.3dcstrMRF01

I have tested Gnuplot installation and it works fine. What do you think the problem with PyFoam is?

Thank you for your help.
unit is offline   Reply With Quote

Old   August 26, 2009, 17:09
Default
  #135
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by unit View Post
but when I try to use PlotWatcher on one of my logs it does nothing and returns prompt. Here is the command I use:

unit@laplace:/usr/lib/python2.5/site-packages/PyFoam/Applications$ python PlotWatcher.py /home/unit/OpenFOAM/unit-1.5.x/run/cstr/3dcstrMRF01/log.3dcstrMRF01

I have tested Gnuplot installation and it works fine. What do you think the problem with PyFoam is?
There is no problem. It is just that you are calling a class definition file that is not meant to be called (and therefor does nothing). If the installation ran OK you should be able to plot your data with

pyFoamPlotWatcher.py /home/unit/OpenFOAM/unit1.5.x/run/cstr/3dcstrMRF01/log.3dcstrMRF01

(doesn't matter where you do it, the script should be found in the PATH). The pyFoamPlotWatcher.py uses the PlotWatcher.py-file, so you were halfway there with your try

Bernhard
gschaider is offline   Reply With Quote

Old   August 27, 2009, 03:25
Default
  #136
Senior Member
 
lakeat's Avatar
 
Daniel WEI (老魏)
Join Date: Mar 2009
Location: South Bend, IN, USA
Posts: 688
Blog Entries: 9
Rep Power: 12
lakeat is on a distinguished road
Send a message via Skype™ to lakeat
Dear Bernhard,

Perhaps you have noticed that I am busy with some parallel computing issues.
I have a few questions here,
1. Why there's no update of Benchmark.py since version 1.4?
2. Is it now standardBench_v2.cfg the right one that I should use?
3. How to modify the Benchmark.py from using Lam to Openmpi or other choices, it seems Lam implementation is not popular in my circle now. And I want to have a try of openmpi and mpich.

Thank you again.
__________________
~
Daniel WEI
-------------
NatHaz Modeling Laboratory
Department of Civil & Environmental Engineering & Earth Sciences
University of Notre Dame, USA
Email || My Personal CFD Blog
lakeat is offline   Reply With Quote

Old   August 27, 2009, 05:24
Default
  #137
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by lakeat View Post
Perhaps you have noticed that I am busy with some parallel computing issues.
I have a few questions here,
1. Why there's no update of Benchmark.py since version 1.4?
2. Is it now standardBench_v2.cfg the right one that I should use?
You're right. the v2-file runs with 1.5 (currently won't work with 1.6). V1 is for 1.4 and older.
The Wiki-Page for the Benchmark-Tool is outdated. Maybe some kind soul will update it (or I will, if I eventually feel like it)
Quote:
Originally Posted by lakeat View Post
3. How to modify the Benchmark.py from using Lam to Openmpi or other choices, it seems Lam implementation is not popular in my circle now. And I want to have a try of openmpi and mpich.
The MPI-implementation is transparently chosen according to the WM_MPLIB-variable (you shouldn't have to do anything). Usually I use OpenMPI (the stuff for LAM is still there, but I havn't tested it in a long time since it is a dying technology) so it is known to work. For details on modifying the call to the mpirun-command see

http://openfoamwiki.net/index.php/Co...yFoam#Settings
gschaider is offline   Reply With Quote

Old   August 27, 2009, 06:30
Default
  #138
Senior Member
 
lakeat's Avatar
 
Daniel WEI (老魏)
Join Date: Mar 2009
Location: South Bend, IN, USA
Posts: 688
Blog Entries: 9
Rep Power: 12
lakeat is on a distinguished road
Send a message via Skype™ to lakeat
Thank you, Bernhard!

I asked because standardBench_v2.cfg file got a line to appoint machines file, which is not needed for openmpi I think.
I don't care anyway, for now I am just interested in one case, case 9.
I have got the results.

Is it proper to name it Speed-up based on baseline? Isn't Speed-up factor defined as ratio of the execution time on a single processor (the sequential version) to that on a multicomputer?

And there seems no results of multiprocessors (more than 4) on that list.
__________________
~
Daniel WEI
-------------
NatHaz Modeling Laboratory
Department of Civil & Environmental Engineering & Earth Sciences
University of Notre Dame, USA
Email || My Personal CFD Blog
lakeat is offline   Reply With Quote

Old   August 27, 2009, 14:50
Default
  #139
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by lakeat View Post
I asked because standardBench_v2.cfg file got a line to appoint machines file, which is not needed for openmpi I think.
It is not needed, but it is possible to specify it in OpenMPI. Which you should do when benchmarking (it can make a difference whether all 4 processes run on one machine or on 4 different machines)
Quote:
Originally Posted by lakeat View Post
I don't care anyway, for now I am just interested in one case, case 9.
I have got the results.

Is it proper to name it Speed-up based on baseline? Isn't Speed-up factor defined as ratio of the execution time on a single processor (the sequential version) to that on a multicomputer?
That'd be parallel speedup.
But you can have speedup due to (for instance) using another machine, having a different algorithm, using another OF-version, changing compiler switches, using another MPI-library .....

The baseline-values are from the slowest machine I had available at the time.
Quote:
Originally Posted by lakeat View Post
And there seems no results of multiprocessors (more than 4) on that list.
And they're rather old, too.

The best way to use the benchmark-script for your purposes is to write your own cfg-file that represents a mix of the cases you are doing. Run it on one machine. Use the times from that machine as "baseline". Then test the other configurations. Of course you should always have a look at the raw data. The speedup compared to baseline just gives you one quick number
gschaider is offline   Reply With Quote

Old   September 3, 2009, 01:09
Default nubie pyfoam question
  #140
New Member
 
Peter Johnston
Join Date: Mar 2009
Location: Brisbane, Queensland, Australia
Posts: 23
Rep Power: 8
prjohnston is on a distinguished road
Dear All,

Yesterday I installed PyFoam from the svn site. I did the installation under sudo and all seemed to go well. I carried out the testing as described under section 3.5 in the wiki.

I am interested in the example doInletVariation.py. Unfortunately, I cannot make it work. The file itself uses the tutorial example pitzDaily. I copied the pitzDaily directiory from /home/peter/OpenFOAM/peter-1.6/run/tutorials/incompressibl
e/simpleFoam/pitzDaily into the PyFoam/examples directory. Is this the correct
thing to do? Then, from the PyFoam/examples directory I type "python doInletVarpation.py" and get the error message:

PyFoam FATAL ERROR on line 89 of file /usr/local/lib/python2.6/dist-packages/PyFoam/Execution/BasicRunner.py : Solution directory . does not exist. No use running. Problem: [Errno 2] No such file or directory

The error seems to occur at the ConvergenceRunner line of the script. The script has already created the pitzDaily/InletVariation directory and modified the inlet velocity in the pitzDaily/0/U file.

If someone could help me, that would be much appreciated.

I am running OpenFOAM 1.6 under ubuntu 9.04. Unitl now everything has been going really well.

Thank you,

Peter.
prjohnston 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
PyFoam library seb62 OpenFOAM Post-Processing 52 September 30, 2011 08:28


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