CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   help for a simple UDF (https://www.cfd-online.com/Forums/fluent/47907-help-simple-udf.html)

Greg April 14, 2008 08:21

help for a simple UDF
 
Hi I am writting my first UDF but I did programming a long time ago..

So as to set a non constant pressure boundary, I wrote:

#include "udf.h"

DEFINE_PROFILE(pressure_profile, t, i)

{ face_t f; real to; to=1.3e-3; real po; po=10.5e6;

i= po*(1-time/to)*exp(time/to); }

After I will have to compile this .txt file in Fluent thanks to Compiled UDF buld. Am I right?

Thank you for your help.

Greg

bohis April 14, 2008 11:17

Re: help for a simple UDF
 
Hi,

firstly, You wonīt succeed if you compile *.txt. It must be *.c Then you can proceed compiling, but your UDF isnīt complete anyway! Check it out!

Bye

RE13 April 14, 2008 11:53

Re: help for a simple UDF
 
Try considering including the following lines in your code:

-------------------------------------------- real time = RP_Get_Real("flow-time");

begin_f_loop(f,t) {

F_PROFILE(f,t,i)=po*(1-time/to)*exp(time/to); } end_f_loop(f,t) -------------------------------------------- save your file with a .c extension and put it in your workind directory. now you can compile and build the UDF. Maybe you need a pressure inlet to hook this UDF properly. When selecting the gauge total pressure, use the drop down menu to select the profile you compiled previously.

See the UDF manual for details on hooking the UDF to the solver.

Regards



All times are GMT -4. The time now is 12:04.