CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

Run python scrpit as functionObject

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 3, 2017, 08:07
Default Run python scrpit as functionObject
  #1
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Brussels
Posts: 187
Rep Power: 7
agustinvo is on a distinguished road
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
agustinvo is offline   Reply With Quote

Old   July 3, 2017, 12:21
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,691
Rep Power: 28
alexeym will become famous soon enoughalexeym will become famous soon enough
Send a message via Skype™ to alexeym
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.
alexeym is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM can't be run in parallel in cluster sibo OpenFOAM Running, Solving & CFD 4 February 21, 2017 17:29
simpleFoam parallel AndrewMortimer OpenFOAM Running, Solving & CFD 12 August 7, 2015 18:45
functionObject to control run time marc.immer OpenFOAM Programming & Development 0 March 25, 2014 11:43
run pyFoam utilities from python script ilpaso OpenFOAM Running, Solving & CFD 7 March 11, 2014 17:44
First Parallel Run - need some help Gian Maria OpenFOAM 3 June 17, 2011 12:08


All times are GMT -4. The time now is 05:33.