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 |
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 |
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 |
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 |
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 |
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 |
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 |
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? |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Hi!
Quote:
Quote:
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 |
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 |
Hi Thomas!
Quote:
You can check which version of PyFoam you are using with the pyFoamVersion.py command Bernhard |
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 |
All times are GMT -4. The time now is 08:28. |