batch set up for OF 1.7
Dear all
I am trying to use pyFoam to automate my case set up for a series parameter variation. I would like to perform the following: 1: create a basecase OF director with the grid and all the settings, e.g.: run-base 2 Make a pyFoam python script which * read the original base case with SolutionDirectory, * loops over a serie of input parameter, * clones the base case, * modifies a value in on of the fields (e.g. the inlet velocity) * runs the case for a certain time to get a steady state * stops the case, switch on averaging in controlDict * continue case to collect the statistics * go to next case and do the same The problem is that I even don't get the simplest example of PyFoam running. I am using OF 1.7 and pyFoam 0.5.4 with python 2.6 I tried to run the example with the density variation of the dambreak I go to the dambreak directory and now have Code:
import sys,os,subprocess Code:
Density: 10 also I don't see exactly how this SolutionDirectory works. Does anybody have a working example for me for OF 1.7 use with PyFoam ? Any hints appreciated Regards Eelco |
Quote:
Bernhard PS: Have you had a look at the two presentations that are available for PyFoam ("Happy foaming with Python" and "Automatization with pyFoam") |
pyfoam batching example for qsub system
1 Attachment(s)
Hi Bernard,
Thanks for you explanation. I have done some trail and error yesterday (also based on the documents you are referring to). I found indeed that the working directory is considered to be an OpenFOAM case. It is not really what I want, because I want a script in the project directory which reads an OpenFOAM case below it which is the base-case (with the default setting and the grid), clones it into a new one, also below the current directory. I have resolved most problems and it is working now as I want it. For those interested in an extra pyfoam example I have added the python script as an attachment. The script clones a basecase, modifies funkySetFieldsDict based on a varying parameter, decomposes the case and runs it. In order to run the case in a batch queing system working with qsub I make a system call with the appropriate settings to a perlscript which generates the qsub asci file with is piped to qsub. In this way each case can be submitted. I have looked at the example in the Happy Foaming manual, but I could not get this way of submitting running the OF case from the python scripts working. My approach with job.pl works as well, but is a bit less elegant. Regards, Eelco |
Quote:
- the queuing manager has got to accept python as a valid interpreter for cluster-scipts - PyFoam has to be in the PYTHONPATH The second requirement can be worked around (if you can't/don't want to install PyFoam on the cluster). BEFORE importing any PyFoam-stuff do import sys sys.path.append("/path/to/the/pyfoam/installation/that/is/reachable/from/the/cluster") and it should find the PyFoam-stuff (the SolverJob-class still won't work on other queuing systems that SGE currently, but I accept patches) Bernhard |
All times are GMT -4. The time now is 00:23. |