CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   udfs on linux (https://www.cfd-online.com/Forums/fluent/35241-udfs-linux.html)

Mark December 7, 2004 15:46

udfs on linux
 
Hi,

I am trying to understand udfs. I have these questions:

What is a header file? How do you make a .so file? What is a .so file? With respect to the file tree described in the fluent documentation, where do you save your .cas file?

I would really appreciate an answer to any of these questions, as the fluent documentation assumes knowledge of some issues.

Mark

ap December 7, 2004 17:36

Re: udfs on linux
 
A header file is a file containing function prototypes and variables declarations. Such a kind of files are widely used in C, and their extension is .h.

If you write UDFs, you just need the udf.h header file, which have to be included with the command:

#include "udf.h"

at the beginning of your UDF C source file.

What version of FLUENT are you using?

In FLUENT 6.1, you just have to save the cas and the .C file source in the same directory. Then, you can manage the compilation process through FLUENT graphical interface.

Regards,

ap :-D

Rob Hart December 7, 2004 18:03

Re: udfs on linux
 
A .so file is equivalent to a .dll on windows - essentially it is a library of functions, that can be loaded by a program.

It contains your UDFs in a form that is ready to run by Fluent.

Mark December 7, 2004 18:36

Re: udfs on linux
 
Hi again,

Thanks for the response. In

Define|User-Defined|Functions|Compiled

it asks me for two sets of files, sources files (.c files) and header files (.h files). Where do I go to get the .h file I need, udf.h, and where in my simulation directory should I put this?

Here is my directory tree (found this on another website):

libudf|(Makefile, src, lnx86)

src|(makefile, my_udf.c)

lnx86|2ddp|(makefile, my_udf.c, libudf.so)

i.e. Makefile, src, and lnx86 are files and directories in the 'libudf' directory...

Mark


Mark December 7, 2004 18:38

Re: udfs on linux
 
So this .so file is made by Fluent or do I make this? Just so this is clear, I am trying to use compiled udfs.

Thanks again, Mark

Rob Hart December 8, 2004 05:45

Re: udfs on linux
 
It depends which version of fluent you are using.

In older versions you had to create it outside fluent, but it looks like the latest version has included some GUI stuff to do it for you. It is all explained in the UDF manual...

Rob

Andrew Garrard December 8, 2004 06:11

Re: udfs on linux
 
If you put

#include "udf.c"

as the first line of your source code: my_udf.c in your case, you do not need to supply a header file in the fluent gui. Just go to

Define|User-Defined|Functions|Compiled

Add the source file, which must be in the same dir as your .cas file click "build" and this will create all the directory tree and files in the libudf directory. Then click "Load" to load your UDF so that you can access the macros.

Mark December 8, 2004 08:58

Re: udfs on linux
 
I have got udfs to work. Thanks to all that responded!!!!!!! Your help is much appreciated.

Mark


All times are GMT -4. The time now is 00:57.