CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Run python scrpit as functionObject (https://www.cfd-online.com/Forums/openfoam-post-processing/190029-run-python-scrpit-functionobject.html)

agustinvo July 3, 2017 08:07

Run python scrpit as functionObject
 
Good afternoon

I would like to know if it is possible to add a python script inside a functionObject, so I can postprocess some files that I have created in a previous functionObject. I am also wondering I could use pyFOAM for it. What I am doing is

1. I extract some slices with the OpenFOAM surfaces (done already)
2. With a python script, I perform an average on each point of the slice (done with python, and what I want to add to my controlDict)

Maybe with pyFOAM i could access to the field data, and then work on it directly.

What do you think? Is is possible?
Thank you in advance,
Agustín

alexeym July 3, 2017 12:21

Hi,

fieldValues function object seems to do what you want without Python (see $FOAM_SRC/functionObjects/field/fieldValues/controlDict for example of settings).

There is also systemCall function object, which can execute arbitrary shell code, so you can execute your Python script and post-process extracted slices.


All times are GMT -4. The time now is 15:25.