CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Export a C code (http://www.cfd-online.com/Forums/openfoam-programming-development/69319-export-c-code.html)

vitor October 19, 2009 15:25

Export a C code
 
Is it possible to export a C written code to OpenFOAM?
For example, if Im looking forward to expressing a variable boundary condition (let's assume a senoid), can I write it in C and use it as an input to OpenFOAM?
Like in Fluent there are the UDF's (user defined functions).

Thank you, very much.

Regards.


Vitor Braga

olesen October 20, 2009 02:10

Quote:

Originally Posted by vitor (Post 233279)
Is it possible to export a C written code to OpenFOAM?
For example, if Im looking forward to expressing a variable boundary condition (let's assume a senoid), can I write it in C and use it as an input to OpenFOAM?

There's two ways to do it:
It'll depend on what type of bc you have (fixed, gradient, mixed), but you could take one of the timeVaryingXXX boundary conditions from OpenFOAM as a starting point and define your things as 'extern C' binding (presuming they are in an external library.

The other possibility is just to compile your existing C code as C++ as part of your new OpenFOAM bc.


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