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

[PyFoam] First discussion thread about PyFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 21, 2012, 18:09
Default
  #261
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 Amir View Post
Dear Bernhard,

I have a trouble with both pyFoamPlotWatcher and Runner; Although I set the proper frequency of data plotting with "frequency option" but it gradually extends during iteration. What's the solution?

Bests,
I don't understand what you mean with "gradually extends during iteration".

Just to clarify: the purpose of the frequency-option is "only redo the plot every x seconds" the purpose of this is that otherwise for small runs with a lot of timesteps the plotting becomes more time-consuming than the actual calculation (because the plotting would occur several times a second)
gschaider is offline   Reply With Quote

Old   May 22, 2012, 15:31
Default
  #262
Senior Member
 
Amir's Avatar
 
Amir
Join Date: May 2009
Location: Montreal, QC
Posts: 735
Blog Entries: 1
Rep Power: 22
Amir is on a distinguished road
Quote:
Originally Posted by gschaider View Post
I don't understand what you mean with "gradually extends during iteration".

Just to clarify: the purpose of the frequency-option is "only redo the plot every x seconds" the purpose of this is that otherwise for small runs with a lot of timesteps the plotting becomes more time-consuming than the actual calculation (because the plotting would occur several times a second)
I meant that the time intervals between renewing plots gradually increases during iteration with a notification in terminal. Although the default frequency is 1 and I also use frequency option equal to 1 but it renews for example after 10 time steps (even it seems that plotting processes have stopped). I just want to plot them at each time step; i.e. disable automatic changing of frequency.
__________________
Amir
Amir is offline   Reply With Quote

Old   June 14, 2012, 05:01
Default
  #263
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 15
lindstroem is on a distinguished road
Hi all!

I want to extend the pyFoamPlotWatcher so it also plots the phase fraction. I have an inlet in my computation so it would be nice to see that.

As the structure is rather complex i wanted to ask for a hint, where it makes sense to add this function. I have my own (bash)script which gives me this plot, but as a post processing step, and not during runtime. So I think it cant be too difficult to integrate that.

Thanks for any hints!
lindstroem is offline   Reply With Quote

Old   June 14, 2012, 14:29
Default
  #264
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 lindstroem View Post
Hi all!

I want to extend the pyFoamPlotWatcher so it also plots the phase fraction. I have an inlet in my computation so it would be nice to see that.

As the structure is rather complex i wanted to ask for a hint, where it makes sense to add this function. I have my own (bash)script which gives me this plot, but as a post processing step, and not during runtime. So I think it cant be too difficult to integrate that.

Thanks for any hints!
As much as I welcome contributions to PyFoam I would discourage that (adding it to the code). The phase fraction is a solver-specific output and for such outputs there is the customRegexp-file (see http://openfoamwiki.net/index.php/Co...Regexp-files): basically you add this file to the case, PyFoam finds it there, looks for the patterns specified in this file and plots the data.

Adding application-specific patterns to PyFoam itself will decrease its overall performance as it will look for that pattern in every line even if the solver doesn't write such a line (and looking for these patterns is currently the bottleneck in the pyFoamWatcher anyway)

Bernhard
gschaider is offline   Reply With Quote

Old   June 15, 2012, 04:23
Default
  #265
Senior Member
 
Join Date: Nov 2010
Posts: 113
Rep Power: 15
lindstroem is on a distinguished road
Hi Bernhard,

reasonable.. nothing more to say thanks for your comment and the hint about the custom regexp

Best wishes
lindstroem is offline   Reply With Quote

Old   July 4, 2012, 05:38
Default AttributeError
  #266
Member
 
Aniko Rakai
Join Date: Oct 2009
Location: Geneva
Posts: 30
Rep Power: 16
ancsa is on a distinguished road
Hi,

after some time of foaming I found some time to investigate pyFoam and I wish it have happened earlier, thank you for it.

However I have a problem which seems to be some quotation mark issue or similar, using the templates from the advanced Gothenburg training:
Code:
rakai@lab1:~/OpenFOAM/rakai-2.0.0/run/pyFoamAdvanced/pyFoamAdvanced.git/testSeparator$ pyFoamFromTemplate.py constant/polyMesh/blockMeshDict "{'preLen':0.2, 'cavitiyWidth':0.15, 'channelHeight':0.1, 'interLen':0.05, 'cavityDepth':0.02, 'dx':0.005}"
Traceback (most recent call last):
  File "/home/rakai/my_python/bin/pyFoamFromTemplate.py", line 5, in <module>
    FromTemplate()
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Applications/FromTemplate.py", line 30, in __init__
    interspersed=True)
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Applications/PyFoamApplication.py", line 213, in __init__
    result=self.run()
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Applications/FromTemplate.py", line 60, in run
    t.writeToFile(fName,vals)
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Basics/TemplateFile.py", line 44, in writeToFile
    output=self.getString(vals)
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Basics/TemplateFile.py", line 54, in getString
    symbols=vals.copy()
AttributeError: 'str' object has no attribute 'copy'
I tried several quotation mark types I find on the keyboard but all the time the variables are treated as string, or maybe I am wrong somewhere else.

Any hints? Thank you
Aniko
ancsa is offline   Reply With Quote

Old   July 16, 2012, 15:18
Default
  #267
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 ancsa View Post
Hi,

after some time of foaming I found some time to investigate pyFoam and I wish it have happened earlier, thank you for it.

However I have a problem which seems to be some quotation mark issue or similar, using the templates from the advanced Gothenburg training:
Code:
rakai@lab1:~/OpenFOAM/rakai-2.0.0/run/pyFoamAdvanced/pyFoamAdvanced.git/testSeparator$ pyFoamFromTemplate.py constant/polyMesh/blockMeshDict "{'preLen':0.2, 'cavitiyWidth':0.15, 'channelHeight':0.1, 'interLen':0.05, 'cavityDepth':0.02, 'dx':0.005}"
Traceback (most recent call last):
  File "/home/rakai/my_python/bin/pyFoamFromTemplate.py", line 5, in <module>
    FromTemplate()
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Applications/FromTemplate.py", line 30, in __init__
    interspersed=True)
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Applications/PyFoamApplication.py", line 213, in __init__
    result=self.run()
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Applications/FromTemplate.py", line 60, in run
    t.writeToFile(fName,vals)
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Basics/TemplateFile.py", line 44, in writeToFile
    output=self.getString(vals)
  File "/home/rakai/my_python/lib/python2.6/site-packages/PyFoam/Basics/TemplateFile.py", line 54, in getString
    symbols=vals.copy()
AttributeError: 'str' object has no attribute 'copy'
I tried several quotation mark types I find on the keyboard but all the time the variables are treated as string, or maybe I am wrong somewhere else.

Any hints? Thank you
Aniko
Problem is that certain shells pass the "" with the argument and others don't.

Best fix I can offer is: go to FromTemplate.py and add the lines with the + (but without the +) after the other two lines:
Code:
             fName=self.parser.getArgs()[0]
             vals=eval(self.parser.getArgs()[1])
+            if type(vals)==str:
+                # fix a problem with certain shells
+                vals=eval(vals)
Otherwise: check whether your version already supports the --values-string-option and use that (along with options for the template files etc). That should work without modification
gschaider is offline   Reply With Quote

Old   August 3, 2012, 10:40
Default Problem solved, thank you
  #268
Member
 
Aniko Rakai
Join Date: Oct 2009
Location: Geneva
Posts: 30
Rep Power: 16
ancsa is on a distinguished road
Thank you, adding the + lines solved the problem.

The --values-string option I tried but does not work, I am using pyFoam-Version: 0.5.7.
Code:
pyFoamFromTemplate.py: error: no such option: --values-string
Aniko
ancsa is offline   Reply With Quote

Old   August 6, 2012, 18:54
Default
  #269
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 ancsa View Post
Thank you, adding the + lines solved the problem.

The --values-string option I tried but does not work, I am using pyFoam-Version: 0.5.7.
Code:
pyFoamFromTemplate.py: error: no such option: --values-string
Aniko
OK. Then this is something to come with the next version (along with a new template engine that allows branches and loops)
gschaider is offline   Reply With Quote

Old   April 8, 2013, 18:05
Default
  #270
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
Btw, can pyfoam be used via ssh if I am using a remote cluster? I installed it on the remote cluster and set the path and using ssh -Y option but there is still error.
__________________
~
Daniel WEI
-------------
Boeing Research & Technology - China
Beijing, China
Email

Last edited by lakeat; April 8, 2013 at 19:00.
lakeat is offline   Reply With Quote

Old   April 8, 2013, 18:58
Default
  #271
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
Btw, can pyfoambe used via ssh if I am using a remote cluster?
If it is installed on the cluster: yes ("installed on the cluster": an installation in the users home directory is sufficient if PATH and PYTHONPATH are set correctly). After all it is mainly command-line utilities
__________________
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   August 13, 2013, 05:43
Default
  #272
Senior Member
 
izna O'connor
Join Date: Jun 2013
Posts: 143
Rep Power: 12
izna is on a distinguished road
hello Berrnad.

i get this error
Quote:
running 500,000 cells mesh
Traceback (most recent call last):
File "./runAskervein.py", line 31, in <module>
from PyFoam.Applications.PlotRunner import PlotRunner
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Applications/PlotRunner.py", line 8, in <module>
from PyFoam.Execution.GnuplotRunner import GnuplotRunner
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/GnuplotRunner.py", line 4, in <module>
from .StepAnalyzedCommon import StepAnalyzedCommon
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/StepAnalyzedCommon.py", line 6, in <module>
from PyFoam.Execution.AnalyzedCommon import AnalyzedCommon
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/AnalyzedCommon.py", line 7, in <module>
from PyFoam.Basics.PlotTimelinesFactory import createPlotTimelines,createPlotTimelinesDirect
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Basics/PlotTimelinesFactory.py", line 4, in <module>
from PyFoam.Basics.GnuplotTimelines import GnuplotTimelines
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Basics/GnuplotTimelines.py", line 4, in <module>
from PyFoam.ThirdParty.Gnuplot import Gnuplot,Data
File "/usr/local/lib/python2.7/dist-packages/PyFoam/ThirdParty/Gnuplot/__init__.py", line 166, in <module>
from .PlotItems import PlotItem, Func, File, Data, GridData
File "/usr/local/lib/python2.7/dist-packages/PyFoam/ThirdParty/Gnuplot/PlotItems.py", line 31, in <module>
import numpypy
ImportError: No module named numpypy
running 5,000,000 cells
Traceback (most recent call last):
File "./runAskervein.py", line 31, in <module>
from PyFoam.Applications.PlotRunner import PlotRunner
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Applications/PlotRunner.py", line 8, in <module>
from PyFoam.Execution.GnuplotRunner import GnuplotRunner
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/GnuplotRunner.py", line 4, in <module>
from .StepAnalyzedCommon import StepAnalyzedCommon
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/StepAnalyzedCommon.py", line 6, in <module>
from PyFoam.Execution.AnalyzedCommon import AnalyzedCommon
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/AnalyzedCommon.py", line 7, in <module>
from PyFoam.Basics.PlotTimelinesFactory import createPlotTimelines,createPlotTimelinesDirect
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Basics/PlotTimelinesFactory.py", line 4, in <module>
from PyFoam.Basics.GnuplotTimelines import GnuplotTimelines
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Basics/GnuplotTimelines.py", line 4, in <module>
from PyFoam.ThirdParty.Gnuplot import Gnuplot,Data
File "/usr/local/lib/python2.7/dist-packages/PyFoam/ThirdParty/Gnuplot/__init__.py", line 166, in <module>
from .PlotItems import PlotItem, Func, File, Data, GridData
File "/usr/local/lib/python2.7/dist-packages/PyFoam/ThirdParty/Gnuplot/PlotItems.py", line 31, in <module>
import numpypy
ImportError: No module named numpypy
Can you please tell me what shoudl i do?

Kind regards
Izna
izna is offline   Reply With Quote

Old   August 13, 2013, 13:16
Default
  #273
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 izna View Post
hello Berrnad.

i get this error


Can you please tell me what shoudl i do?

Kind regards
Izna
pyFoamVersion.py will show that you have no numpy installed. Install it via the package manager of your distribution (usually it is called python-numpy or so)
izna likes this.
__________________
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   August 13, 2013, 13:26
Default
  #274
Senior Member
 
izna O'connor
Join Date: Jun 2013
Posts: 143
Rep Power: 12
izna is on a distinguished road
hi Bernard.. Even on installing all these i get the error that nympypy does nto exist..

I have found a case on the net and i wish to run ./Allrun and view it but try as i might it is not working..

i am sending you the case.

http://openfoamwiki.net/index.php/Fi...emplate.tar.gz


Apparently this use the pyfoam library..

Kind regard
izna
izna is offline   Reply With Quote

Old   August 13, 2013, 18:12
Default
  #275
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 izna View Post
hi Bernard.. Even on installing all these i get the error that nympypy does nto exist..

I have found a case on the net and i wish to run ./Allrun and view it but try as i might it is not working..

i am sending you the case.

http://openfoamwiki.net/index.php/Fi...emplate.tar.gz


Apparently this use the pyfoam library..

Kind regard
izna
PyFoam wouldn't try to import numpypy if numpy was installed.

To check that numpy is not installed try
Code:
python -c "import numpy;print numpy.__version__"
Or check with pyFoamVersion.py
__________________
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   August 16, 2013, 13:50
Default
  #276
Senior Member
 
izna O'connor
Join Date: Jun 2013
Posts: 143
Rep Power: 12
izna is on a distinguished road
hi Bernard

NUmpy has been installed
Quote:
izna@izna-MS-7592:~$ python -c "import numpy;print numpy.__version__"
1.6.1

But when i run my case i stil get those errors!!!

Quote:
izna@izna-MS-7592:~/Desktop/BL2Dtemplate$ ./Allrun
z0 = 0.001
ks = 0.01958
us = 0.517132402802
TKE = 1.54398428071
Running blockMesh
Decomposing

Decomposition
=============

Case is decomposed for 2 processors


============ ===== =====
CPU 0 1
------------ ----- -----
Points 37998 38310
Faces 75017 75635
Cells 18673 18827
============ ===== =====
frontAndBack 37346 37654
ground 249 251
inlet 0 75
outlet 75 0
top 249 251
============ ===== =====

sh: 1: gnuplot: not found
sh: 1: gnuplot: not found
Traceback (most recent call last):
File "./run_z0.py", line 100, in <module>
main(template0, template, orig, target0, withBlock, z0)
File "./run_z0.py", line 87, in main
PlotRunner(args=["--proc=%d"%procnr,"--hardcopy","--progress","simpleFoam","-case",work.name])
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Applications/PlotRunner.py", line 58, in __init__
description=description)
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Applications/PyFoamApplication.py", line 155, in __init__
result=self.run()
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Applications/PlotRunner.py", line 128, in run
jobId=self.opts.jobId)
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/GnuplotRunner.py", line 159, in __init__
plottingImplementation=plottingImplementation)
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/GnuplotRunner.py", line 70, in __init__
plottingImplementation=plottingImplementation)
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Execution/AnalyzedCommon.py", line 139, in createPlots
plots["cont"].setYLabel2("Global")
File "/usr/local/lib/python2.7/dist-packages/PyFoam/Basics/GnuplotTimelines.py", line 130, in setYLabel2
self.set_string('y2label "%s"' % title)
File "/usr/local/lib/python2.7/dist-packages/PyFoam/ThirdParty/Gnuplot/_Gnuplot.py", line 383, in set_string
self('set %s' % (option,))
File "/usr/local/lib/python2.7/dist-packages/PyFoam/ThirdParty/Gnuplot/_Gnuplot.py", line 210, in __call__
self.gnuplot(s)
File "/usr/local/lib/python2.7/dist-packages/PyFoam/ThirdParty/Gnuplot/gp_unix.py", line 210, in __call__
self.flush()
IOError: [Errno 32] Broken pipe
izna is offline   Reply With Quote

Old   August 16, 2013, 13:57
Default
  #277
Senior Member
 
izna O'connor
Join Date: Jun 2013
Posts: 143
Rep Power: 12
izna is on a distinguished road
hi again bernard

By the way i am running this case which i found from the internet...
izna is offline   Reply With Quote

Old   August 16, 2013, 14:01
Default
  #278
Senior Member
 
izna O'connor
Join Date: Jun 2013
Posts: 143
Rep Power: 12
izna is on a distinguished road
attached is the case..If you wish to check it out..
Attached Files
File Type: gz BL2Dtemplate.tar.gz (7.9 KB, 16 views)
izna is offline   Reply With Quote

Old   August 18, 2013, 07:40
Default
  #279
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@Izna: Clearly the problem is that gnuplot is not installed:
Quote:
Code:
sh: 1: gnuplot: not found
If you have Ubuntu/Debian, you can quickly install it by running:
Code:
sudo apt-get install gnuplot
Best regards,
Bruno
__________________
wyldckat is online now   Reply With Quote

Old   August 19, 2013, 12:26
Default
  #280
Senior Member
 
izna O'connor
Join Date: Jun 2013
Posts: 143
Rep Power: 12
izna is on a distinguished road
Hi Bruno...

After having installed the application i get errors still
Quote:

Create time

--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libgroovyBC.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable:pen(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libgroovyBC.so"
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libsimpleSwakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable:pen(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libsimpleSwakFunctionObjects.so"
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1179
dlopen error : libswakFunctionObjects.so: cannot open shared object file: No such file or directory
--> FOAM Warning :
From function dlLibraryTable:pen(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 99
could not load "libswakFunctionObjects.so"
Create mesh for time = 0

Reading set description:
line_h
line_inlet
line_y

Time = 0

End


Plotting the following cases:
['../Bump2D_run_1.06_10.0_1500.0_200.0_200.0_0.5_2000']
Traceback (most recent call last):
File "./runBump2D.py", line 211, in <module>
plot2DBump.main(target,hSample)
File "/home/izna/Desktop/benmartinez/2DBumpTemplate/plot2DBump.py", line 38, in main
m = max(lastRun)
ValueError: max() arg is an empty sequence
izna 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
Divergence detected in AMG solver: k when udf loaded google9002 Fluent UDF and Scheme Programming 3 November 7, 2019 23:34
udf problem jane Fluent UDF and Scheme Programming 37 February 20, 2018 04:17
Guide: Getting Started with the CFD Online Discussion Forums pete Site Help, Feedback & Discussions 8 July 29, 2016 05:00
Error messages atg enGrid 7 August 30, 2013 11:16
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 14:37


All times are GMT -4. The time now is 09:32.