CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Matlab m file to create openfoam case "like Helyx" (https://www.cfd-online.com/Forums/openfoam-programming-development/155401-matlab-m-file-create-openfoam-case-like-helyx.html)

kebsiali June 30, 2015 08:27

Matlab m file to create openfoam case "like Helyx"
 
Hello dear Foamers,

I am creating a crazy solver in openfoam which needs hundreds of parameters to be defined in the case folder.
some of the boundary conditions, setField values depend on these parameters.
so i thought about creating a matlab, octave, or scilab function that will generate the case files based on provided parameters or read from text file.

Is there anything like this done before? it will make my task easier.
Thank you very much

blais.bruno July 8, 2015 10:49

Quote:

Originally Posted by kebsiali (Post 552692)
Hello dear Foamers,

I am creating a crazy solver in openfoam which needs hundreds of parameters to be defined in the case folder.
some of the boundary conditions, setField values depend on these parameters.
so i thought about creating a matlab, octave, or scilab function that will generate the case files based on provided parameters or read from text file.

Is there anything like this done before? it will make my task easier.
Thank you very much

You might want to look into what has been done with pyFOAM. Some of the tools used there might be of use or at least how Bernard has shaped the framework might help you to get a better idea.

I think python is the ideal language for this type of task. With the numpy modules you can do any kind of calculations you need and with the OS module you can easily open, naviguate, etc. between files.

The work on pyFOAM is but an example of what you can do with python and openFOAM.

pbachant July 12, 2015 13:52

I have not used pyFoam, but Python in general is very good at working with text--quite a bit better than Matlab/Octave. Here's an example of a script I use to generate a dict with a large table of values, which is admittedly not optimized to take advantage of Python's advanced string formatting abilities: https://github.com/petebachant/UNH-R...dynmeshdict.py


All times are GMT -4. The time now is 07:16.