CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [PyFoam] problems with pyFoamSamplePlot.py (https://www.cfd-online.com/Forums/openfoam-community-contributions/61326-problems-pyfoamsampleplot-py.html)

seb62 October 17, 2008 05:39

problems with pyFoamSamplePlot.py
 
Hi everyone,

Has someone been able to run the routine
"pyFoamSamplePlot.py" from the pyFoam library
(version 2.3).

It seems to be a problem when the routine is reading the file header of the sample files, obtained from the sample command in FoamX.

The bug slightly differs from one output format to another of the sample command (gnuplot, raw, xmgr or jplot).

It says for the gnuplot format :

Traceback (most recent call last):
File "/home/admintools/ext_python/bin/pyFoamSamplePlot.py", line 5, in ?
SamplePlot()
File "/home/admintools/ext_python/lib/python2.3/site-packages/PyFoam/Applicati
ons/SamplePlot.py", line 25, in __init__
interspersed=True)
File "/home/admintools/ext_python/lib/python2.3/site-packages/PyFoam/Applicati
ons/PyFoamApplication.py", line 26, in __init__
self.run()
File "/home/admintools/ext_python/lib/python2.3/site-packages/PyFoam/Applicati
ons/SamplePlot.py", line 88, in run
lines=samples.lines()
File "/home/admintools/ext_python/lib/python2.3/site-packages/PyFoam/RunDictio
nary/SampleDirectory.py", line 54, in lines
for t in self:
File "/home/admintools/ext_python/lib/python2.3/site-packages/PyFoam/RunDictio
nary/SampleDirectory.py", line 29, in __iter__
yield SampleTime(self.dir,t)
File "/home/admintools/ext_python/lib/python2.3/site-packages/PyFoam/RunDictio
nary/SampleDirectory.py", line 117, in __init__
vals=self.extractValues(f)
File "/home/admintools/ext_python/lib/python2.3/site-packages/PyFoam/RunDictio
nary/SampleDirectory.py", line 136, in extractValues
tmp[-1]=tmp[-1].split(".")[0]
IndexError: list index out of range

It always seems to come from the tmp array.

Thanks for your help

Séb

gschaider October 17, 2008 09:03

Hi Seb! quote: Has someone
 
Hi Seb!

quote: Has someone been able to run the routine "pyFoamSamplePlot.py" from the pyFoam library

Yes. I have ;)

Could you post the command line that you were using?

I'll have a look what the problem might be

Bernhard

hellorishi February 4, 2009 10:38

Hello, I am trying to use
 
Hello,

I am trying to use PyFoam for monitoring the solution (residuals etc). I installed the PyFoam as non-root user according to the instructions in http://openfoamwiki.net/index.php/Contrib_PyFoam

Then I did the installation checks (seems OK):
***************************************
Python 2.4.2 (#1, Jun 16 2006, 17:15:08)
[GCC 4.1.0 (SUSE Linux)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyFoam
>>> import PyFoam.FoamInformation
>>> print PyFoam.FoamInformation.foamTutorials()

/home/cfd2/OpenFOAM/OpenFOAM-1.5/tutorials

>>> import sys
>>> print sys.path
['', '/home/cfd2/OpenFOAM/PyFoam/lib64/python2.4/site-packages',

'/home/cfd2/OpenFOAM/ThirdParty/ParaView-3.4.0/bin',

'/home/cfd2/OpenFOAM/ThirdParty/ParaView-3.4.0/Utilities/VTKPythonWrapping',

'/usr/lib/python24.zip', '/usr/lib64/python2.4', '/usr/lib64/python2.4/plat-linux2',

'/usr/lib64/python2.4/lib-tk', '/usr/lib64/python2.4/lib-dynload',

'/usr/lib64/python2.4/site-packages', '/usr/lib64/python2.4/site-packages/dbus']
>>>

***************************************

Then tried to plot residual of job.
***************************************
% pyFoamPlotResiduals.py .
Usage
=====
pyFoamPlotResiduals.py [options] <datadir>
pyFoamPlotResiduals.py: error: Gnuplot module missing.
Can't plot
***************************************
Is the syntax correct? I ran a job using foamJob and wanted to have a graph of residuals


Since it seemed that gnuplot had some problem, did a check :
***************************************
% gnuplot --version
gnuplot 4.0 patchlevel 0
***************************************

Does PyFoam need a particular version of Gnuplot ?

Kindly help.

Rishi

gschaider February 4, 2009 12:52

Hi Rishi! My initial reacti
 
Hi Rishi!

My initial reaction was "Oh, my god didn't test this utility with the last release. Propably it is broken". Tested it here: it works.

To answer your question: no. It doesn't need a specific gnuplot and your version is fine. The module it is refering to is a Python-module (not written by me) that controls gnuplot (the program). And it can't find the module. Current distributions bring this module (older distributions of PyFoam required you to install it). So one way to fix it is to edit the script and replace the line

import Gnuplot

with

import PyFoam.ThirdParty.Gnuplot as Gnuplot

(make sure that the same number of spaces is there)

The other "fix" would be to use the pyFoamPlotWatcher.py

Bernhard

hellorishi February 5, 2009 05:37

Hello Bernhard, I edited th
 
Hello Bernhard,

I edited the following file as mentioned by you:
(in the source directory, where I untarred the files)

/home/cfd2/OpenFOAM/PyFoam-0.5.1/build/scripts-2.4/pyFoamPlotResiduals.py

Then I re-installed PyFoam again in another directory:
************************************************** *******
python setup.py install --prefix=/home/cfd2/OpenFOAM/PyFoam
************************************************** *******

Then I did an installation check and its OK
************************************************** *******
Python 2.4.2 (#1, Jun 16 2006, 17:15:08)
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyFoam
>>> import PyFoam.FoamInformation
>>> print PyFoam.FoamInformation.foamTutorials()
/home/cfd2/OpenFOAM/OpenFOAM-1.5/tutorials
************************************************** *******

and ran the utility again:
************************************************** *******
pyFoamPlotResiduals.py .
gnuplot> plot
^
line 0: function to plot expected
************************************************** *******
it seems that atleast the Gnuplot problem was solved.
However the gnuplot files were missing.
So I ran the case again as follows:

************************************************** *******
[icoFoam] pyFoamRunner.py myInkIcoFoam1 . t_stueck1
Traceback (most recent call last):
File "/home/cfd2/OpenFOAM/PyFoam/bin/pyFoamRunner.py", line 3, in ?
from PyFoam.Applications.Runner import Runner
File "/home/cfd2/OpenFOAM/PyFoam/lib64/python2.4/site-packages/PyFoam/Applications/Ru nner.py", line 8, in ?
from PyFoam.Execution.AnalyzedRunner import AnalyzedRunner
File "/home/cfd2/OpenFOAM/PyFoam/lib64/python2.4/site-packages/PyFoam/Execution/Analy zedRunner.py", line 4, in ?
from BasicRunner import BasicRunner
File "/home/cfd2/OpenFOAM/PyFoam/lib64/python2.4/site-packages/PyFoam/Execution/Basic Runner.py", line 17, in ?
from PyFoam.Infrastructure.FoamServer import FoamServer
File "/home/cfd2/OpenFOAM/PyFoam/lib64/python2.4/site-packages/PyFoam/Infrastructure/ FoamServer.py", line 11, in ?
from PyFoam.Infrastructure.NetworkHelpers import freeServerPort
File "/home/cfd2/OpenFOAM/PyFoam/lib64/python2.4/site-packages/PyFoam/Infrastructure/ NetworkHelpers.py", line 10, in ?
import xmlrpclib,xml
ImportError: No module named xml
************************************************** *******

IS something missing? xml module this time?

Thanks for your help.
Rishi

gschaider February 5, 2009 07:21

Hi Rishi! Seems like. But t
 
Hi Rishi!

Seems like. But that is strange since the relevant library is part of the python-standard-libraries:
http://www.python.org/doc/2.4.1/lib/....html#l2h-4292
at least for your version of Python. Which distro do you use? (maybe they've got a strange attitude about what a complete python-installation should be - I've seen such a thing with Suse)

Bernhard

PS: for the time being replacing in Applications/Runner.py the line

server=True,

with

server=False,

may or may not fix your problem

hellorishi February 5, 2009 09:37

Hello Bernhard, I tried wi
 
Hello Bernhard,

I tried with server=True, but I get the same error message.

I am SuSE Enterprise 10 on AMD64.

For some strange reason, there are two versions of python installations on the system, however the same version (apparently) !

/usr/bin/python
Python 2.4.2 (#1, Jun 16 2006, 17:15:08)
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

/usr/bin/python2.4
Python 2.4.2 (#1, Jun 16 2006, 17:15:08)
[GCC 4.1.0 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

any clues will be helpful. OR should I install the latest version of python as non-root using ./configure method in OpenFOAM/ThirdParty ?

Thanks,
Rishi

gschaider February 5, 2009 10:46

Hi Rishi! Usually python is
 
Hi Rishi!

Usually python is just a symbolic link to the most recent (in your case python2.4) python-version. Please check with

python -c 'import xml'

whether your installation is really missing the xml-module. The have a look at the package-manager of your distribution whether there is a way to install that standard-package.

Bernhard

PS: Anyone here with a Suse and a working PyFoam-installation who can comment on this?

kumar February 5, 2009 10:46

Hello Bernhard,
 
Hello Bernhard,
I am using OF-1.5 and lesInterFOAM solver to perform a simulation on a liquid sheeet being injected into a chamber with pressure difference. I have performed the simulations on the cluster and then I bring all the result files to my laptop and post process them.
I found out that I can use the PyfoamPlotwatcher.py script to plot my log fil.

I did that simply by using pyfoamplotwatcher.py logfile.

the script gave me three graphs, one plotting the residuals, the second with continuity and the third showing K_min,K_max,K_avg.

My first concern is what exactly is the residuals plot plotting.


1) does it plot the final residual vs timestep for U_x,U_y,U_z,pd,k. it is not reading pcorr.
is it using a log scale.
so can i assume that the plot represents the final residual printed in my logfile corresponding to each variable. (correct if wrong)
I will start looking into the script, but I have very little knowledge in Python, so any help from your side would be appreciated.

I also used the foamlog script on my log file and it gives me the directory logs. I am also looking into these files.
bye

kumar February 5, 2009 10:49

Hello Bernhard,
 
Hello Bernhard,
I am using OF-1.5 and lesInterFOAM solver to perform a simulation on a liquid sheeet being injected into a chamber with pressure difference. I have performed the simulations on the cluster and then I bring all the result files to my laptop and post process them.
I found out that I can use the PyfoamPlotwatcher.py script to plot my log fil.

I did that simply by using pyfoamplotwatcher.py logfile.

the script gave me three graphs, one plotting the residuals, the second with continuity and the third showing K_min,K_max,K_avg.

My first concern is what exactly is the residuals plot plotting.


1) does it plot the final residual vs timestep for U_x,U_y,U_z,pd,k. it is not reading pcorr.
is it using a log scale.
so can i assume that the plot represents the final residual printed in my logfile corresponding to each variable. (correct if wrong)
I will start looking into the script, but I have very little knowledge in Python, so any help from your side would be appreciated.

I also used the foamlog script on my log file and it gives me the directory logs. I am also looking into these files.
bye

gschaider February 5, 2009 12:19

Hi Suresh! No. PyFoam plots
 
Hi Suresh!

No. PyFoam plots the initial residual of the solver (if the solver is called for a number of times the value from the first call is used). The Final residual wouldn't make much sense, since it should always be below the solver tolerance and therefor isn't of much interest for judging the solver progress

Bernhard

kumar February 6, 2009 05:24

Hello Bernhard, Thankyou ve
 
Hello Bernhard,

Thankyou very much for your reply. I had a close look at the file and the plot , and now i understand the plots made by PyFOAM. Your point is correct the final residual is not much of interest for judging the solver progress as it should always be below the solver tolerance.

Just one more question regarding the foamlog script. I have generated the logs directory which contains all the files.

pd_0,pd_1
pdfinalRes_0,pdfinalRes_1

pdIters_0,pdIters_1

it would be very helpful to me if you give me some brief information regarding these files or some post where I can find the information regarding these files.

some lines from My correspnding log file

Courant Number mean: 0.0024387199 max: 0.48126912
deltaT = 1.0889988e-12
Time = 0.0001277695265

MULES: Solving for gamma
Liquid phase volume fraction = 0.0043558394 Min(gamma) = -1.3661196e-09 Max(gamma) = 1
MULES: Solving for gamma
Liquid phase volume fraction = 0.0043558312 Min(gamma) = -1.6701253e-09 Max(gamma) = 1
MULES: Solving for gamma
Liquid phase volume fraction = 0.0043558229 Min(gamma) = -1.0520911e-09 Max(gamma) = 1
MULES: Solving for gamma
Liquid phase volume fraction = 0.0043558147 Min(gamma) = -1.4644191e-09 Max(gamma) = 1
DILUPBiCG: Solving for k, Initial residual = 0.0071093718, Final residual = 2.1706608e-09, No Iterations 4
smoothSolver: Solving for Ux, Initial residual = 0.0041698317, Final residual = 1.0843951e-07, No Iterations 3
smoothSolver: Solving for Uy, Initial residual = 0.0036263636, Final residual = 1.706183e-07, No Iterations 3
smoothSolver: Solving for Uz, Initial residual = 0.018104342, Final residual = 8.344309e-07, No Iterations 3
GAMG: Solving for pd, Initial residual = 0.060448889, Final residual = 0.00058557745, No Iterations 59
GAMGPCG: Solving for pd, Initial residual = 0.001318819, Final residual = 8.0051628e-05, No Iterations 21
time step continuity errors : sum local = 1.2954087e-09, global = 5.1973811e-11, cumulative = 8.5302518e-09
ExecutionTime = 166245.64 s ClockTime = 166398 s

Courant Number mean: 0.0025407061 max: 0.47588108
deltaT = 1.1441867e-12
Time = 0.0001277695276

MULES: Solving for gamma
Liquid phase volume fraction = 0.004355806 Min(gamma) = -2.0864201e-10 Max(gamma) = 1
MULES: Solving for gamma
Liquid phase volume fraction = 0.0043557972 Min(gamma) = -1.1045348e-09 Max(gamma) = 1
MULES: Solving for gamma
Liquid phase volume fraction = 0.0043557885 Min(gamma) = -1.4970744e-09 Max(gamma) = 1
MULES: Solving for gamma
Liquid phase volume fraction = 0.0043557798 Min(gamma) = -2.086283e-10 Max(gamma) = 1
DILUPBiCG: Solving for k, Initial residual = 0.0075890745, Final residual = 3.9490434e-10, No Iterations 4
smoothSolver: Solving for Ux, Initial residual = 0.004368742, Final residual = 1.377492e-07, No Iterations 3
smoothSolver: Solving for Uy, Initial residual = 0.0038452247, Final residual = 2.1255783e-07, No Iterations 3
smoothSolver: Solving for Uz, Initial residual = 0.019045135, Final residual = 4.6511492e-08, No Iterations 4
GAMG: Solving for pd, Initial residual = 0.072337929, Final residual = 0.00069806604, No Iterations 53
GAMGPCG: Solving for pd, Initial residual = 0.0017684486, Final residual = 8.2084207e-05, No Iterations 21
time step continuity errors : sum local = 1.4372403e-09, global = 8.4469557e-11, cumulative = 8.6147214e-09
ExecutionTime = 166258.76 s ClockTime = 166412 s

thankyou very much
bye
with regards
K.Suresh kumar

gschaider February 6, 2009 07:53

Hi Suresh. a) this is not r
 
Hi Suresh.

a) this is not really a PyFoam-question, is it?
b) I don't know much more about foamLog than what the user-guide has to say. But if you have a look at the start of your logfile and the start of (for instance) pd_0, then figuring out which number goes into which file should be fairly easy

Bernhard

hellorishi February 17, 2009 09:38

Hello Bernhard, An update f
 
Hello Bernhard,

An update from my side. As you mentioned SUSE (SLED 10 in my case) has a lot of missing things with respect to XML-PYTHON etc...

I finally managed to run PyFoam (atleast partially) by installing approx. two dozen RPMs. I searched for all RPMs related to XML, Python, Tcl, libxml2, etc (with development RPMs if availalbe) and installed many of them. So I dont know which one was real problem solver, but installing these missing things does solve the problem with SUSE (partially).

Now I can run some PyFoam scripts like pyFoamClearCase, pyFoamPlotRunner, pyFoamPlotWatcher, etc. However some problem with Gnuplot and VTK is not solved. I get error message like
pyFoamPlotResiduals.py: error: Gnuplot module missing. Can't plot
pyFoamDisplayBlockMesh. Error while importing modules, no module named vtk

Any suggestions ?

This is a really cool tool and I wonder why its not included in the official OpenFOAM distribution till now. Thanks
Rishi

gschaider February 18, 2009 12:05

Hi Rishi! Sorry about heari
 
Hi Rishi!

Sorry about hearing those interdependencies. I hear that SuSE is quite a nice distro, but the PYthon-support seems to be a bit awkward

Anyway.

@pyFoamPlotResiduals.py: Havn't used that in quite some time because the PlotWatcher has the same functionality (and more). Nevertheless your problem is strange because it should use the Gnuplot-module that is in PyFoam.ThirdParty (the same that is used by the PlotWatcher)
@pyFoamDisplayBlockMesh.py: See http://openfoamwiki.net/index.php/Co...ayBlockMesh.py Look for a RPM vtk-python or similar (will need at least a vtk.rpm) The VTK that comes with Paraview is NOT an option

Thanks for your kind words.

pyFoam is not included because the guys at OpenCFD have the policy to only include stuff in the release that they can maintain. That means stuff written by them or necessary stuff (the things in ThirdParty). If you have a look at the message board about the problems people have with the ThirdParty-stuff that is already you will see that it is quite sensible to not include everything that looks nice (especially if you have a look at the can of dependency problems that PyFoam opened for you)

Bernhard

sradl March 22, 2009 07:00

pyFoamPlotWatcher gives no Output on 64-bit machine
 
Hi!

I installed Pyfoam-0.5.2 on my 64-bit Opensuse 11.0 installation and the pyFoamPlotWatcher gives no output. In contrast: on a similar installation on a 32-bit version of Opensuse 11.0 pyFoam works pretty!!

The dir "log.analyzed" is correctly generated. However, there are no files in this dir and gnuplot then complains about the xrange. This is clear to me, as there is nothing to plot :D

Any idea where to look for and what can be the problem?

cheers
Stefan

gschaider March 23, 2009 05:06

Hi!

Quote:

Originally Posted by sradl (Post 210271)
I installed Pyfoam-0.5.2 on my 64-bit Opensuse 11.0 installation and the pyFoamPlotWatcher gives no output. In contrast: on a similar installation on a 32-bit version of Opensuse 11.0 pyFoam works pretty!!

It can't be a 64-bit problem per se. I'm using it ONLY on 64-bit. And there should be no difference between a 64-bit and a 32-bit Python anyway

Quote:

Originally Posted by sradl (Post 210271)
The dir "log.analyzed" is correctly generated. However, there are no files in this dir and gnuplot then complains about the xrange. This is clear to me, as there is nothing to plot :D

Any idea where to look for and what can be the problem?

The problem looks like the watcher never matches a "Time = ..." and therefore never writes data.

First: have you tried both versions (64/32) on exactly the same file? Just to exclude different formats of the "Time = ..." being written due to different versions or solvers.

If the watcher works for one version but not for the other, then I'm a bit confused and I'd need some more information (character encoding etc).

Bernhard

Thomas Baumann April 3, 2009 10:03

Hi,

I have installed OpenFOAM 1.5 with Suse 11.1.
I installed pyFoam as a regular user. (using gnuplot 4.2.3 and Python2.6). Testing the Installations shows nothing irregular.

For example pyFoamClearPage.py works without problems,
but when running for example pyFoamPlotWatcher.py I get following message:

>>> exit()
hi204@islacrux:~/OpenFOAM/thomas-1.5/backward> pyFoamPlotWatcher.py log
Traceback (most recent call last):
File "/home/hi204/OpenFOAM/ThirdParty/my_python/bin/pyFoamPlotWatcher.py", line 3, in <module>
from PyFoam.Applications.PlotWatcher import PlotWatcher
File "/home/hi204/OpenFOAM/ThirdParty/my_python/lib64/python2.6/site-packages/PyFoam/Applications/PlotWatcher.py", line 6, in <module>
from PyFoam.Execution.GnuplotRunner import GnuplotWatcher
File "/home/hi204/OpenFOAM/ThirdParty/my_python/lib64/python2.6/site-packages/PyFoam/Execution/GnuplotRunner.py", line 86
with="steps",

I don"t know much about Linux and have problems with understanding the massage. Could anyone help me, please?

Thanks,
Thomas

gschaider April 3, 2009 15:22

Hi Thomas!

Quote:

Originally Posted by Thomas Baumann (Post 211861)
Hi,

I have installed OpenFOAM 1.5 with Suse 11.1.
I installed pyFoam as a regular user. (using gnuplot 4.2.3 and Python2.6). Testing the Installations shows nothing irregular.

For example pyFoamClearPage.py works without problems,
but when running for example pyFoamPlotWatcher.py I get following message:

File "/home/hi204/OpenFOAM/ThirdParty/my_python/lib64/python2.6/site-packages/PyFoam/Execution/GnuplotRunner.py", line 86
with="steps",

I don"t know much about Linux and have problems with understanding the massage. Could anyone help me, please?

Thanks,
Thomas

Starting with the newest version 2.6 of the python 2.x-line "with" is is a reserved version. The problem is that you're not using the newest version of PyFoam (0.5.2) where all usages of with as a variable have been removed.

You can check which version of PyFoam you are using with the pyFoamVersion.py command

Bernhard

Thomas Baumann April 6, 2009 05:39

Hi Bernhard,

thank you very much for your help.
By installing 0.5.2 pyFoam the problem has been fixed.

But now there is the following (using pyFoamPlotWatcher) message:

Warning: empty x range [1:1], adjusting to [0.99:1.01]
Warning: empty y range [5.60322e-06:5.60322e-06], adjusting to [5.54719e-06:5.65925e-06]
Warning: empty y2 range [5.60322e-06:5.60322e-06], adjusting to [5.54719e-06:5.65925e-06]
Warning: empty x range [1:1], adjusting to [0.99:1.01]

Two gnuplot pop-ups open, but no graphs are displayed.
I have searched in the forum and I found the same problem description in
http://www.cfd-online.com/Forums/ope...-pyfoam-5.html

Has the problem been solved yet? I installed the pyFoam Version from https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breede r/other/scripting/PyFoam, but nothing changed.

By the way, when starting pyFoamPlotRunner.py I get the same message.

Thanks & regards,

Thomas

gschaider April 6, 2009 12:34

Quote:

Originally Posted by Thomas Baumann (Post 212039)

But now there is the following (using pyFoamPlotWatcher) message:

Warning: empty x range [1:1], adjusting to [0.99:1.01]
Warning: empty y range [5.60322e-06:5.60322e-06], adjusting to [5.54719e-06:5.65925e-06]
Warning: empty y2 range [5.60322e-06:5.60322e-06], adjusting to [5.54719e-06:5.65925e-06]
Warning: empty x range [1:1], adjusting to [0.99:1.01]

Two gnuplot pop-ups open, but no graphs are displayed.

These messages come from Gnuplot. They mean "You have only given me one data point until now. I'm stretching that point a bit so that it becomes a range". Usually that has two reasons:

a) There was only one time-step yet (in your case that would be t=1)
b) there is more than one time-step but pyFoam doesn't recognize it. This happened in the past (certain solvers use a different annotation for the time-steps)

Could you tell me
a) which solver you're using (and which version of OF)
b) could you provide me with the complete output of two or three time-steps so that I can try to reproduce the problem

Quote:

Originally Posted by Thomas Baumann (Post 212039)
I have searched in the forum and I found the same problem description in
http://www.cfd-online.com/Forums/ope...-pyfoam-5.html

Has the problem been solved yet?

Honestly, I don't know (because I can't remember). Judging from the thread I'd say no, because I never could reproduce it

Quote:

Originally Posted by Thomas Baumann (Post 212039)
I installed the pyFoam Version from https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breede r/other/scripting/PyFoam, but nothing changed.

By the way, when starting pyFoamPlotRunner.py I get the same message.

The version on the SVN is virtually the same as the one distributed via the Wiki (no bug-fixes yet).

Bernhard

Thomas Baumann April 7, 2009 08:59

Hi Bernhard,

I got the error message for example with the solver icoFoam by solving the tatorial-file from the tutorial icoFoam/cavity.

The OpenFOAM version is the git version (OpenFOAM-1.5.x.git)

Here is the output from the log file:


Quote:

create time

Create mesh for time = 0

Reading transportProperties

Reading field p

Reading field U

Reading/calculating face flux field phi

Starting time loop

Time = 0.005

Courant Number mean: 0 max: 0
DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 2.96338e-06, No Iterations 8
DILUPBiCG: Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
DICPCG: Solving for p, Initial residual = 1, Final residual = 7.55402e-07, No Iterations 35
time step continuity errors : sum local = 5.03809e-09, global = 4.40722e-19, cumulative = 4.40722e-19
DICPCG: Solving for p, Initial residual = 0.523591, Final residual = 9.72352e-07, No Iterations 34
time step continuity errors : sum local = 1.07766e-08, global = 2.93897e-19, cumulative = 7.34619e-19
ExecutionTime = 0.03 s ClockTime = 0 s

Time = 0.01

Courant Number mean: 0.0514108 max: 0.585722
DILUPBiCG: Solving for Ux, Initial residual = 0.148584, Final residual = 7.15711e-06, No Iterations 6
DILUPBiCG: Solving for Uy, Initial residual = 0.256618, Final residual = 8.94127e-06, No Iterations 6
DICPCG: Solving for p, Initial residual = 0.379232, Final residual = 3.38648e-07, No Iterations 34
time step continuity errors : sum local = 3.15698e-09, global = 1.94222e-19, cumulative = 9.28841e-19
DICPCG: Solving for p, Initial residual = 0.286937, Final residual = 5.99637e-07, No Iterations 33
time step continuity errors : sum local = 6.08774e-09, global = 5.80474e-19, cumulative = 1.50932e-18
ExecutionTime = 0.03 s ClockTime = 0 s

Time = 0.015

Courant Number mean: 0.0761501 max: 0.758286
DILUPBiCG: Solving for Ux, Initial residual = 0.0448669, Final residual = 2.39894e-06, No Iterations 6
DILUPBiCG: Solving for Uy, Initial residual = 0.0782408, Final residual = 1.45948e-06, No Iterations 7
DICPCG: Solving for p, Initial residual = 0.109591, Final residual = 5.81093e-07, No Iterations 32
time step continuity errors : sum local = 4.70049e-09, global = -5.90607e-20, cumulative = 1.45025e-18
DICPCG: Solving for p, Initial residual = 0.0826507, Final residual = 7.26561e-07, No Iterations 31
time step continuity errors : sum local = 5.95385e-09, global = -5.75718e-20, cumulative = 1.39268e-18
ExecutionTime = 0.04 s ClockTime = 0 s
I checked the log file with an ubuntu system, but another version of OpenFOAM (1.5 64bit compiled download version) and everything worked.

Regards, Thomas

gschaider April 7, 2009 14:09

Hi Thomas!

Strange. Could you try the watcher on that file with the option --tail=0 ?

Bernhard

Thomas Baumann April 8, 2009 02:51

Hi Bernhard,

with pyFoamPlotWatcher.py --tail=0 logfile I get nearly the same massage:

Quote:

/usr/local/lib64/python2.6/site-packages/PyFoam/FoamInformation.py:5: DeprecationWarning: The popen2 module is deprecated. Use the subprocess module.
from popen2 import popen4
Warning: empty x range [0.005:0.005], adjusting to [0.00495:0.00505]
Warning: empty y range [4.40722e-19:4.40722e-19], adjusting to [4.36315e-19:4.45129e-19]
Warning: empty y2 range [4.40722e-19:4.40722e-19], adjusting to [4.36315e-19:4.45129e-19]
Warning: empty x range [0.005:0.005], adjusting to [0.00495:0.00505]
Warning: empty y range [1:1], adjusting to [0.99:1.01]
Python 2.6 is installed with GCC 4.3.2.
I installed pyFoam as root, too, but nothing changed.

Regards, Thomas

gschaider April 8, 2009 11:00

Quote:

Originally Posted by Thomas Baumann (Post 212281)
Hi Bernhard,

with pyFoamPlotWatcher.py --tail=0 logfile I get nearly the same massage:



Python 2.6 is installed with GCC 4.3.2.
I installed pyFoam as root, too, but nothing changed.

Regards, Thomas

OK. The --tail=0 was to check if there is a timing problem. No such luck.

Have I understood you correctly:

- OpenSuse with Python 2.6: Not working
- Ubuntu with Python2.6 on 64 Bit: working (other posting)

Weird. I think the problem is that the regular expression for "Time =" is not correctly matched on the Suse-system. I have a number of suspicions that involve stuff like Unicode and other encoding issues (nevertheless this would be a very weird problem). I'll try to come up with a test that helps to show what the problem might be, but it'll take some time.

Just another weird idea: You're using Suse and your surname sounds german: could you try this again with a user with English locales (Keyboard can stay ;) ) - if you're using non-english locales. This is one of the "other encoding"-ideas

Bernhard

BTW: Pointing out other peoples typos is the sign of a very simple mind, but the "I get nearly the same massage" was one of the highlights of this day. One of these days I really should try OpenSuse ....

Thomas Baumann April 9, 2009 11:08

Hi,

you're right, I'm from Germany (that's the reason for my bad English.. :confused:)

I have changed to English locales, but the problem still exists.

The Ubuntu System uses Python 2.5.1 with GCC 4.1.3. But the log-file, which has been created in the Suse system, works. So you can use the log file (created in Suse) and plot it in Ubuntu.

Happy Easter!
Thomas

gschaider April 14, 2009 15:35

Quote:

Originally Posted by Thomas Baumann (Post 212479)
Hi,

you're right, I'm from Germany (that's the reason for my bad English.. :confused:)

It was not the English (yours is quite good .... from an Austrians point of view ;) ) it was the name that led me to that conclusion

Quote:

Originally Posted by Thomas Baumann (Post 212479)
I have changed to English locales, but the problem still exists.

Thanks for checking

Quote:

Originally Posted by Thomas Baumann (Post 212479)
The Ubuntu System uses Python 2.5.1 with GCC 4.1.3. But the log-file, which has been created in the Suse system, works. So you can use the log file (created in Suse) and plot it in Ubuntu.

Very strange. Everything points to a problem with regular expressions. I will have a look

Bernhard

mahaputra April 27, 2009 16:35

Quote:

Originally Posted by gschaider (Post 212883)
It was not the English (yours is quite good .... from an Austrians point of view ;) ) it was the name that led me to that conclusion



Thanks for checking



Very strange. Everything points to a problem with regular expressions. I will have a look

Bernhard

Dear Bernhard Gschaider


did you prepare simple tutorial how to install and run pyFoam?

i read this thread, and seems interesting

but i dont know how to start with your script :(

please show me any link how to start from the simple work with pyFoam

and what is the latest ''feature'' of pyFoam has right now?

please so be kind to teach me

danke

gschaider April 28, 2009 12:36

Hi!

Quote:

Originally Posted by mahaputra (Post 214393)
Dear Bernhard Gschaider


did you prepare simple tutorial how to install and run pyFoam?

i read this thread, and seems interesting

The most up-to-date documentation is found on the Wiki-page. For installing this would be:
http://openfoamwiki.net/index.php/Co...m#Installation
Quote:

Originally Posted by mahaputra (Post 214393)
but i dont know how to start with your script :(

please show me any link how to start from the simple work with pyFoam

and what is the latest ''feature'' of pyFoam has right now?

There is also an almost complete list with all the utilities on the page. To get a complete list type "pyFoam" on the Command line and then use the TAB-key to give you a list of all the installed utilities (assuming that your shell supports command completion)

Every utility has documentation that is shown when calling it with the --help-option

Sorry. That's all the documentation there is.

Bernhard

hemph October 5, 2009 10:13

Hi.
Curious. Did this problem find its solution? I am experiencing the same error messages about empty ranges as Thomas did. The system I am using is 64 bit OpenSUSE 11.1 and OpenFOAM 1.6.x.

Kindly,
Rasmus

bigphil October 7, 2009 08:24

Was this problem sorted?
 
Hi,

Firstly pyFoam is a great utility.

But I sometimes, using pyFoamPlotWatcher, get a similar error to that posted above, and a blank gnuplot appears.

Code:

Warning: empty x range [1:1], adjusting to [0.99:1.01]
Warning: empty y range [1:1], adjusting to [0.99:1.01]

And then it starts printing out the latest log entries.

The strange thing is that 'pyFoamPlotWatcher' works for me on similar cases... strange.


I just recently downloaded pyFoam from using svn from the link on the wiki.

Was this problem figured out?


Philip

BTW: I am using OpenSUSE 11.0 32 bit and OF-1.4.1-dev

EDIT: When I try run the pyFoamPlotWatcher on the same case later, it works. I think the reason I got the error is because the first timestep hasn't been completed yet. I have many corrector steps within each timestep and didn't realise it was still on the first step. So problem solved from my perspective... i think/hope.

gschaider October 9, 2009 12:42

Quote:

Originally Posted by bigphil (Post 231749)
Hi,

Firstly pyFoam is a great utility.

But I sometimes, using pyFoamPlotWatcher, get a similar error to that posted above, and a blank gnuplot appears.

Code:

Warning: empty x range [1:1], adjusting to [0.99:1.01]
Warning: empty y range [1:1], adjusting to [0.99:1.01]

And then it starts printing out the latest log entries.

The strange thing is that 'pyFoamPlotWatcher' works for me on similar cases... strange.


I just recently downloaded pyFoam from using svn from the link on the wiki.

Was this problem figured out?


Philip

BTW: I am using OpenSUSE 11.0 32 bit and OF-1.4.1-dev

EDIT: When I try run the pyFoamPlotWatcher on the same case later, it works. I think the reason I got the error is because the first timestep hasn't been completed yet. I have many corrector steps within each timestep and didn't realise it was still on the first step. So problem solved from my perspective... i think/hope.

The message above is Gnuplots way of saying "I have only one data-point and can't draw a line". No easy way to get rid of this message and I don't want to because it helps finding other problems

Bernhard

bigphil October 9, 2009 12:50

Thanks for the reply Bernhard,

I understand now. :)

Philip

hemph October 21, 2009 07:21

pyFoamPlotWatcher with python 2.6?
 
Is it confirmed that pyFoamPlotWatcher works with python 2.6? I am asking because I just saw that there is no problem with plotting residuals on my server where python 2.3.5 is installed as default.

Running pyFoamPlotWatcher.py on the very same logfile on my own computer (with python 2.6) spits out the *wrong* error messages about empty x and y ranges. As Bernhard points out in a post above, it appears to be something related to pattern matching.

Best,
Rasmus

olivier October 21, 2009 07:39

Hello Bernhard!!

I have a small problem when installing the latest of PyFoam: when I try to compile it (as a regular user, not as root, on Gnome), I get this following error:

Neither numpy nor Numeric python-package installed. Plotting won't work.

And indeed, if I want to use PyFoamPlotWatcher.py utility, it doesn't work.

Any idea if I am missing some package, or how I can go around this error message?

Thank you very much!
Olivier

gschaider October 21, 2009 13:02

Quote:

Originally Posted by olivier (Post 233523)
Hello Bernhard!!

I have a small problem when installing the latest of PyFoam: when I try to compile it (as a regular user, not as root, on Gnome), I get this following error:

Neither numpy nor Numeric python-package installed. Plotting won't work.

And indeed, if I want to use PyFoamPlotWatcher.py utility, it doesn't work.

Any idea if I am missing some package, or how I can go around this error message?

Thank you very much!
Olivier

There is no way around it: the Gnuplot-Library needs one of those packages (which are API-equivalent) to be able to plot.
They are quite common and almost any python-software that does large numerical array uses them.
Talk to your friendly neighborhood admin about installing one of them

Bernhard

gschaider October 21, 2009 13:06

Quote:

Originally Posted by hemph (Post 233517)
Is it confirmed that pyFoamPlotWatcher works with python 2.6? I am asking because I just saw that there is no problem with plotting residuals on my server where python 2.3.5 is installed as default.

Running pyFoamPlotWatcher.py on the very same logfile on my own computer (with python 2.6) spits out the *wrong* error messages about empty x and y ranges. As Bernhard points out in a post above, it appears to be something related to pattern matching.

I think the publicly available version SHOULD work, but I'm not sure (I use another version internally that I will publish once I have gotten it to work with Paraview 3.6. That one definitly works with Python 2.6)

olivier October 21, 2009 14:32

Thank you for the answer Bernhard,

I actually found some NumPy installed somewhere in the system, but I think it is not at the right place so that PyFoam doesn't find it.

Would you happen to know where you specify the path of NumPy in PyFoam? I guess somewhere before the compilation there is a file that is read where NumPy's path is given.

If I could change this path to the one that I have, I guess there would be no problems.

Cheers,

Olivier

gschaider October 21, 2009 14:43

Quote:

Originally Posted by olivier (Post 233579)
Thank you for the answer Bernhard,

I actually found some NumPy installed somewhere in the system, but I think it is not at the right place so that PyFoam doesn't find it.

Would you happen to know where you specify the path of NumPy in PyFoam? I guess somewhere before the compilation there is a file that is read where NumPy's path is given.

If I could change this path to the one that I have, I guess there would be no problems.

Cheers,

Olivier

The path to non-standard Python-Libraries is specified by the PYTHONPATH-environment-variable (use like the usual PATH-variable)

Bernhard

olivier October 21, 2009 14:48

Then I am missing something, because I am poiting at the NumPy installation in the PYTHONPATH. I will try to have a look at it tomorrow. I hate when I am not admin...

Olivier


All times are GMT -4. The time now is 12:13.