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   October 7, 2007, 15:50
Default Hi Pierre! Yeah. A Bug. But
  #21
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Pierre!

Yeah. A Bug. But not in my stuff. There were 2 things wrong with the blockMeshDict written by the cylindermesh.m4. That it was parsed by blockMesh is owed to the fact that the OF-fileparser seems to be very tolerant:

1. The data-header did not conform to the description in section 4.2.3 of the UserGuide (quote: "All data files ..... begin with a dictionary named FoamFile containing ...." In the generated files the content was present, but the "FoamFile {" and "}" that should enclose the content to make it a dictionary was missing
2. The patch definitions contained lists of the form "(2 4(0 3 2 1))" which should in fact be "(0 3 2 1)". The first version is a list that consists of a number and a list of 4 vertices. Don't know what this is supposed to mean. (It's not explicitly stated in the UG, but I believe that a list in an OF-File is a collection of things of the same type, like the List-template class)

I will not fix the parser to tolerate these two inconsistencies. Instead I post a version of cyclindermesh.m4 that writes a dictionary that is read by PyFoam:

cylinderMesh.m4

Bernhard

PS: OK. The ParserError could be a bit more descriptive. I'll work on that
__________________
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   October 10, 2007, 00:46
Default Hi Bernhard, Thanks again
  #22
pvc
Guest
 
Posts: n/a
Hi Bernhard,

Thanks again for considering my request.
The patch definition you mentionned is namely a bit unclear but working in the native file. Can't explain why also ...

Actually, I am sorry but the file you've just posted does not work with PyFoam. I have checked and double-checked without any success, but I may be wrong ...

Rgds

Pierre
  Reply With Quote

Old   October 10, 2007, 09:59
Default Hi Pierre! You have first s
  #23
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Pierre!

You have first sent it through m4, have you? (it's not a blockMeshDict, but a m4-script to produce the dict, like in the thread you referenced). The generated blockMesh works on my PyFoam-installation. What is the problem you're having now? (Of cousre I can't exclude the possibility that it is a version-problem, as my version is a bit more up-to-date than yours)

Bernhard
__________________
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   October 12, 2007, 04:42
Default Hi Bernhard, sorry for the
  #24
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19
braennstroem is on a distinguished road
Hi Bernhard,

sorry for the delay, forgot to answer... the extraction of the average pressure works good. Thanks!

So, I have one more question :-)
Can I use pyfoam to distribute runs on certain machines and start their calculations/importing/post all from one script. In plain python I would just use os.system("rsh machine RUN_OPF"), but then the script does not wait for the calculation to finish. It would be nice, if I can do that with pyfoam!?

A similar problem is to start a run in parallel with pyfoamRunner. I could not figure the exact syntax to start a parallel job. Do you have a small example?

Greetings!
Fabian
braennstroem is offline   Reply With Quote

Old   October 12, 2007, 06:48
Default Hi Fabian! @rsh-feature: No
  #25
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Fabian!

@rsh-feature: Not yet. Sounds like a cool feature (you can become the most unpopular person in the whole lab: "Where does this run come from?"). I'll have a look at how difficult it would be to implement it. (BTW: have a look at the subprocess-library in python 2.4+. It has facilities that wait for the end of an execution)

Parallel runs should be easy. Decompose the case with (no need to write the dict yourself)
pyFoamDecomposer --method=metis testCase 4
Then (provided you run on an SMP-machine)
pyFoamRunner --proc=4 simpleFoam . testCase
If you are running on more than one machine you must create a hostfile and do
pyFoamRunner --machinefile=hostfile simpleFoam . testCase
pyFoam should run your favourite MPI-implementation (in the case of LAM it first does a lamboot), no need to say mpirun (or -parallel).
Please note, that I currently only have OpenMPI (the LAM-support used to work a year ago, I don't see why it should be broken). MPIch I never had access to, don't know if it works.

Bernhard
fumiya 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   October 14, 2007, 13:27
Default Hi Bernhard, thanks for the
  #26
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19
braennstroem is on a distinguished road
Hi Bernhard,

thanks for the parallel help! According to you rsh-concerns; I would just run the jobs over night ;-) Thanks for the hint with the subprocess-library.

Fabian
braennstroem is offline   Reply With Quote

Old   October 16, 2007, 03:21
Default Hello Bernhard, I recently
  #27
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 184
Rep Power: 17
markusrehm is on a distinguished road
Hello Bernhard,

I recently installed pyFoam and I think it is great. There was just one thing I wasn't able to achieve: plotting ;)

It tells me for example
Warning: empty x range [1641:1641], adjusting to [1624.59:1657.41]
Warning: empty y range [6.07427e-07:6.07427e-07], adjusting to [6.01353e-07:6.13501e-07]
Warning: empty y2 range [6.07427e-07:6.07427e-07], adjusting to [6.01353e-07:6.13501e-07]

and the plots stay empty. I installed the Gnuplot site-package for Python. Is that correct? If yes you could add that to the Wiki as well - because I needed to struggle some time to find out that this is needed and not the "normal" gnuplot-package.

Thank you Markus.
markusrehm is offline   Reply With Quote

Old   October 17, 2007, 12:38
Default Hi Bernhard, I have a small
  #28
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19
braennstroem is on a distinguished road
Hi Bernhard,

I have a small add-on request... it would be great, if the plotting stuff would work with matplotlib too, which has some nice features as paning, zooming and saving. It is probably to late and to much work to implement!?

Fabian
braennstroem is offline   Reply With Quote

Old   October 18, 2007, 08:28
Default @markus: It seems that gnuplot
  #29
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
@markus: It seems that gnuplot currently has only the data for one timestep (what are you using the pyFoamPlotRunner.py or the pyFoamPlotWatcher.py? Or the Library without an application). That is the usual output gnuplot gives, when you're trying to plot. What is the other output you're seeing on the terminal (from the solver) or does the script end with some error message?

For the requirements: gnuplot itself should be sufficient. PyFoam brings the Gnuplot-Library with it (in the ThirdParty-branch). And the Python-Numeric package is needed for plotting (I hope I stated that on the Wiki. Will check.)

@fabian: I will have a look at it. But don't hold your breath.
The two main goals for the plotting library were:
- portability: The user should not be required to install too much external software. gnuplot can be assumed to be installed on any decently managed workstation (OK Python-Numeric is required. But that was too big to be distributed with the PyFoam-sources)
- speed: The main reason I was using gnuplot and not some library was that when I was trying out these things they were not as fast as I wanted them to be. When I use the plotter to watch the residuals for some 5000-cells MickyMouse-case I don't want to spend more CPU-time for plotting than for calculating (some libraries were making beautiful graphs, but they were taking in the order of seconds to plot 1000+-points - not splitseconds like gnuplot)

But if you want beautiful graphs you can always use the --write-option of the plot-commands. They will write the residuals etc to a directory and you can use any other program (XMgrace, Origin ..... Excel) to make them

Bernhard
__________________
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   October 20, 2007, 13:27
Default Hi Bernhard, the main advan
  #30
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19
braennstroem is on a distinguished road
Hi Bernhard,

the main advantage of matplotlib over gnuplot is just the possible interactivity. And until today, I thought, that gnuplot python does not work with the numeric-successor numpy, but just replacing the imports of numeric seem to work...so don't do to much work with matplotlib, unless you already like it so much ;-)

Fabian
braennstroem is offline   Reply With Quote

Old   October 23, 2007, 02:49
Default Hi Bernhard, thanks for you
  #31
Senior Member
 
Markus Rehm
Join Date: Mar 2009
Location: Erlangen (Germany)
Posts: 184
Rep Power: 17
markusrehm is on a distinguished road
Hi Bernhard,

thanks for your help but I couldn't fix it yet. I have to spend some more time. The solver gives no errors. I use pyFoamPlotRunner.py.

Thanks so far. Regards Markus.
markusrehm is offline   Reply With Quote

Old   October 23, 2007, 08:46
Default Hi Markus! And the solver h
  #32
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Markus!

And the solver has completed more than one timestep? (Because before the second time-step Gnuplot will produce that kind of output)

Could you please send me a file (preferably by mail, we don't want to bother the people on the MessageBoard) with the output of your solver, so that I can try to reproduce the problem (10 time-steps or so would be sufficient)

Bernhard
__________________
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   November 8, 2007, 15:13
Default Hi Bernhard, I have just in
  #33
Member
 
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17
jason is on a distinguished road
Hi Bernhard,

I have just installed PyFoam and thank you, it is wonderful. But I have a small problem when running in parallel. I followed your instructions above on 12/10/07 and I am trying to run a case on a dual dual-core machine ie 4 processors but I get some errors. For a single processor case everything works great but after I have decomposed and issue the command

pyFoamRunner.py --proc=4 simpleFoam . <mytestcase>

I get the following error

[linux-qz5q:12360] [0,0,0] ORTE_ERROR_LOG: Error in file runtime/orte_init_stage1.c at line 312
--------------------------------------------------------------------------
It looks like orte_init failed for some reason; your parallel process is
likely to abort. There are many reasons that a parallel process can
fail during orte_init; some of which are due to configuration or
environment problems. This failure appears to be an internal failure;
here's some additional information (which may only be relevant to an
Open MPI developer):

orte_pls_base_select failed
--> Returned value -1 instead of ORTE_SUCCESS

--------------------------------------------------------------------------
[linux-qz5q:12360] [0,0,0] ORTE_ERROR_LOG: Error in file runtime/orte_system_init.c at line 42
[linux-qz5q:12360] [0,0,0] ORTE_ERROR_LOG: Error in file runtime/orte_init.c at line 52
--------------------------------------------------------------------------
Open RTE was unable to initialize properly. The error occured while
attempting to orte_init(). Returned value -1 instead of ORTE_SUCCESS.
--------------------------------------------------------------------------
Getting LinuxMem: [Errno 2] No such file or directory: '/proc/12360/status'

Would you be able to help?

Regards

Jason
jason is offline   Reply With Quote

Old   November 8, 2007, 15:16
Default ps - I forgot to say that ever
  #34
Member
 
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17
jason is on a distinguished road
ps - I forgot to say that everything works ok when I start a parallel case using

mpirun -np 4 simpleFoam . <mytestcase> -parallel

But I would love to see some plots of the simulation too.

Regards

Jason
jason is offline   Reply With Quote

Old   November 8, 2007, 15:27
Default pps - I also forgot to say tha
  #35
Member
 
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17
jason is on a distinguished road
pps - I also forgot to say that I am running openSUSE v10.2, 32 bit version and OF release v1.4.1 and upto now everything works great.

I also get this error when I run the pitzDaily tutorial in parallel so I don't think it is my model.

Regards

Jason
jason is offline   Reply With Quote

Old   November 8, 2007, 16:23
Default Hi Jason! OK. Its seems tha
  #36
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Jason!

OK. Its seems that you are the victim of a fix I had to do at my site (passwordless-login on other machines, you don't want to know).

Open the file PyFoam/Execution/ParallelExecution.py and look for the line
mpirun+=["--mca","pls_rsh_agent","rsh"]+nr+machine+["-x","LD_LIBRARY_PATH","-x", "WM_PROJECT_DIR","-x","FOAM_MPI_LIBBIN","-x","MPI_BUFFER_SIZE"]

replace it with the line

mpirun+=nr+machine

That should work. If not, add the line

print mpirun

before

return mpirun

It should look similar to your commandline. If not: tell me what it looks like

Bernhard

PS: Don't forget: Indentation is important in Python!!
PPS: I'll make the fix more configurable in the next release
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   November 8, 2007, 17:23
Default Hi Bernhard, Many thanks fo
  #37
Member
 
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17
jason is on a distinguished road
Hi Bernhard,

Many thanks for the quick response, I followed your instructions but I got the same error. I've attached the ParallelExecution.py file to make sure I did it right (sorry, but I'm not a good programmer). The print mpirun part didnt seem to do anything

ParallelExecution.py

Here is the error output

[linux-qz5q:06128] [0,0,0] ORTE_ERROR_LOG: Error in file runtime/orte_init_stage1.c at line 312
--------------------------------------------------------------------------
It looks like orte_init failed for some reason; your parallel process is
likely to abort. There are many reasons that a parallel process can
fail during orte_init; some of which are due to configuration or
environment problems. This failure appears to be an internal failure;
here's some additional information (which may only be relevant to an
Open MPI developer):

orte_pls_base_select failed
--> Returned value -1 instead of ORTE_SUCCESS

--------------------------------------------------------------------------
[linux-qz5q:06128] [0,0,0] ORTE_ERROR_LOG: Error in file runtime/orte_system_init.c at line 42
[linux-qz5q:06128] [0,0,0] ORTE_ERROR_LOG: Error in file runtime/orte_init.c at line 52
--------------------------------------------------------------------------
Open RTE was unable to initialize properly. The error occured while
attempting to orte_init(). Returned value -1 instead of ORTE_SUCCESS.
--------------------------------------------------------------------------
Getting LinuxMem: [Errno 2] No such file or directory: '/proc/6128/status'

Thanks

Jason
jason is offline   Reply With Quote

Old   November 8, 2007, 18:37
Default Hi Jason! The changes are c
  #38
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Jason!

The changes are correct. My suspicion is that the file is not used. Did you install PyFoam as described on the Wikipage (python setup.py install) ? And if yes which version of ParallelyExecution.py did you edit:

a) the one that comes from the untarring of the archive
b) the one that was written to some system directory by setup.py

If you edited a) then you won't see any changes because b) is still used by the utilities. One possibility to correct this is to run the setup again (thus copying your changes from a) to b) ).

Bernhard
__________________
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   November 9, 2007, 07:02
Default Hi Bernhard, there seems to
  #39
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19
braennstroem is on a distinguished road
Hi Bernhard,

there seems to be a small bug with a lot of impact...
Using pyFoamClone case the source and destination should be vice versa!? At least I just erased existing simulations:

ceplx049~/SCR1/Solververgleich/E1_Messaufbau/OpenFOAM/ceplx015> pyFoamCloneCase.py E1_SIMPLE_GROB_EPSILON E1_SIMPLE_GROB_EPSILON_OPF_Poly E1_SIMPLE_FEIN_POLY_RNG
Traceback (most recent call last):
File "/scr/ceplx049/scr1/gcae504/Software/OpenFOAM/PyFoaM/bin//pyFoamCloneCase.py", line 5, in ?
CloneCase()
File "/scr/ceplx049/scr1/gcae504/Software/OpenFOAM/PyFoaM//lib/python2.3/site-package s/PyFoam/Applications/CloneCase.py", line 14, in __init__
PyFoamApplication.__init__(self,description=descri ption,usage="%prog <source> <destination>",interspersed=True,nr=2)
File "/scr/ceplx049/scr1/gcae504/Software/OpenFOAM/PyFoaM//lib/python2.3/site-package s/PyFoam/Applications/PyFoamApplication.py", line 21, in __init__
self.run()
File "/scr/ceplx049/scr1/gcae504/Software/OpenFOAM/PyFoaM//lib/python2.3/site-package s/PyFoam/Applications/CloneCase.py", line 40, in run
sol.cloneCase(dName)
File "/scr/ceplx049/scr1/gcae504/Software/OpenFOAM/PyFoaM//lib/python2.3/site-package s/PyFoam/RunDictionary/SolutionDirectory.py", line 70, in cloneCase
self.execute("cp -r "+d+" "+name)
TypeError: cannot concatenate 'str' and 'NoneType' objects
ceplx049~/SCR1/Solververgleich/E1_Messaufbau/OpenFOAM/ceplx015> pyFoamCloneCase.py
usage: pyFoamCloneCase.py <source> <destination>


Maybe I just did something wrong, but ...

Regards!
Fabian
braennstroem is offline   Reply With Quote

Old   November 9, 2007, 08:49
Default Hi Bernhard, I modified th
  #40
Member
 
Jason Dale
Join Date: Mar 2009
Location: UK
Posts: 80
Rep Power: 17
jason is on a distinguished road
Hi Bernhard,

I modified the one in the tar archive!, I ran the setup again and sucess, it all works fine, thank you.

I have a couple of other less technical questions.

1/ Are the graphs saved anywhere automatically or do I have to do alt-printscreen?
2/ Is the data that the graphs are drawn from saved anywhere for possible manipulation elsewhere?
3/ Do have have to run reconstructPar manually after or is there an automatic option?

Thanks

Jason
jason 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 8, 2019 00:34
udf problem jane Fluent UDF and Scheme Programming 37 February 20, 2018 05:17
Guide: Getting Started with the CFD Online Discussion Forums pete Site Help, Feedback & Discussions 8 July 29, 2016 06:00
Error messages atg enGrid 7 August 30, 2013 12:16
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 15:37


All times are GMT -4. The time now is 08:38.