run pyFoam utilities from python script
Hi,
sorry for this stupid question. The pyFoam utilities are very useful! How can I run these utilities from a python script. Example: How to run a solver on a case as with pyFoamPlotRunner.py? Regards |
Quote:
|
Hi gschaider,
thank you for your kind reply. I've read all your presentations. I'm climbing the learning curve ;) . I'll try what is written in the slides 43/44. Thanks for the help! bye |
In the wiki I can find:
pyFoamPlotRunner.py: Runs an OpenFoam solver. Needs the usual 3 arguments (<solver> <directory> <case>) If I run (from another directory "/anotherDir", not /mydir/) pyFoamPlotRunner.py icoFoam /mydir mycase it returns an error: "Case /anotherDir does not have a 'system' directory' in Application-class: PlotRunner Case anotherDir does not have a 'system' directory' in Application-class: PlotRunner" This is the first step to solve in order to use the utilities as classes. thank you |
Quote:
|
If I write the case variable directly in the script it returs the error:
"... does not have a 'system' directory' in Application-class: PlotRunner Case anotherDir does not have a 'system' directory'..." How have I to modify the code in order to run the script in a different path and not in the case path? Code:
import sys |
Hi again,
there was a space between the "-" and the "case" so it didn't work. Now it works! Thank you. |
Quote:
BTW: which version of PyFoam do you use? I can't reproduce your problem (but I've got others. For instance does the decomposer complain that 1 CPU is very little) |
airfoil optimization with openfoam and python
Hey guys,
I want to do a shape optimization for an airfoil in python and want to have open foam as my fluid solver. My question is how to link these two to get the fluid flow data in open foam as a result of shape optimization? |
A naive approach consists of the following three steps:
1/ define an Allrun bash shell script that define geometry, generate mesh, run simulation and writes quantities (pressure distribution) of interest to file; 2/ define python function that runs the Allrun script (via shell commands), reads quantities on interest to file (possibly using dataframes) and compute the quality (cost functional) of the current design (shape of airfoil);c 3/ pass above python function as argument to function that does optimization (genetic algorithm or Cobyla algorithm); A less naive (and possibly smarter approach) is to use some form of a mesh morphing technique to avoid remeshing at each iteration. |
All times are GMT -4. The time now is 09:50. |