|
[Sponsors] |
September 30, 2013, 14:27 |
Scripts to manage OpenFOAM cases
|
#1 |
Member
Ye Zhang
Join Date: Dec 2009
Location: Delft,Netherland
Posts: 92
Rep Power: 16 |
Dear foamers,
I am wondering how to write a script to manage OpenFOAM cases. Since I need to simulate 2D airfoil flow at different angle of attacks. Everytime I have to copy the case files and change the velocity and lift and drag direction. This method is time consuming and use a lot of disk. I know that using a script to mange the case and change the boundary condition is possible, anyone can give me some hints? Best regards, Ye |
|
September 30, 2013, 20:24 |
|
#2 |
New Member
Join Date: Sep 2013
Posts: 10
Rep Power: 12 |
you can use a custom dict, containing AoA in your case.
in your files 0/U etc include your dict und use variables depending on the entries in your dict. for example Ux #calc "$myVelocity*cos($myAoA)"; ... fixedValue ($Ux $Uy $Uz) referring to myVelocity and myAoA in your dict. this way, you only have to change the myAoA entry in a single dict to modify the case. Further, you can also use a shellscript to do the following steps for a whole list of prepared dict-files: copy dict_#i into the case, ./Allrun case, make directory anywhere/#i copy relevant output to anywhere/#i, ./Allclean case there might be more elegant ways, but it should work |
|
October 1, 2013, 09:08 |
|
#3 |
Member
Logan Page
Join Date: Sep 2010
Posts: 38
Rep Power: 15 |
I had a similar requirement, for which I created Python scripts (using some of pyFoam's functionality) to manage my case files and the automation of multiple CFD simulations.
|
|
October 3, 2013, 16:50 |
|
#4 |
Member
Ye Zhang
Join Date: Dec 2009
Location: Delft,Netherland
Posts: 92
Rep Power: 16 |
Thank you Logan!
Cause I am quite new to OpenFOAM. It will be better if you can describe it more detail. Best regards, Ye |
|
October 4, 2013, 05:50 |
|
#5 |
Member
Logan Page
Join Date: Sep 2010
Posts: 38
Rep Power: 15 |
Hi
I effectively set up code as described in the attached images. parameterisation.jpg optimisation.jpg The OpenFoam utilities and solvers where called (run) through the use of pyFoam. http://openfoamwiki.net/index.php/Contrib_PyFoam In my case the mesh file was also scripted / generated in Python and then used in blockMesh, but you can easily use another meshing program like gmsh coupled to Python. The general process I followed is:
SolveFoam.txt RunFoamS0Solution1.txt |
|
October 4, 2013, 05:54 |
|
#6 |
Senior Member
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 17 |
hello,
Like Logan say, take a look at pyFoam http://openfoamwiki.net/index.php/Contrib_PyFoam There is a full section about manipulating case. You can also change boundary with the changeDictionary commande, usin a "changeDictionnaryDict" file. regards, olivier |
|
July 17, 2020, 05:09 |
|
#7 | |
New Member
liwenpeng
Join Date: Jul 2020
Posts: 11
Rep Power: 5 |
Quote:
|
||
July 17, 2020, 05:14 |
|
#8 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
It's hard to find a Linux distribution that hasn't got Python installed But if you want to use PyFoam: yes. Python is necessary
__________________
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 |
|
July 17, 2020, 05:18 |
|
#9 | |
New Member
liwenpeng
Join Date: Jul 2020
Posts: 11
Rep Power: 5 |
Quote:
thanks |
||
July 17, 2020, 10:38 |
|
#10 |
Member
benoit paillard
Join Date: Mar 2010
Posts: 96
Rep Power: 16 |
If you want your life to be easy and enjoyable, I'd suggest sticking to a linux distribution and never use Windows for Openfoam simulations.
|
|
July 17, 2020, 22:41 |
|
#11 |
New Member
liwenpeng
Join Date: Jul 2020
Posts: 11
Rep Power: 5 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ESI-OpenCFD Releases OpenFOAM v2.2.0 | opencfd | OpenFOAM Announcements from ESI-OpenCFD | 13 | March 30, 2013 16:52 |
Is OpenFOAM tutorial cases valid? | j-avdeev | OpenFOAM Running, Solving & CFD | 3 | September 19, 2012 15:45 |
Comparison of axisymmetric case, Starccm+ and OpenFOAM | linnemann | OpenFOAM Running, Solving & CFD | 12 | June 16, 2011 05:43 |
Modified OpenFOAM Forum Structure and New Mailing-List | pete | Site News & Announcements | 0 | June 29, 2009 05:56 |
Manage openfoam solver project in KDevelop probably the last linker error any suggestion is welcome | lakeat | OpenFOAM Installation | 0 | July 7, 2007 10:01 |