CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   mathematical function in UDF (https://www.cfd-online.com/Forums/fluent/46318-mathematical-function-udf.html)

Abhijit October 14, 2007 11:36

mathematical function in UDF
 
Dear All,

I have trying to run UDF interpreted or compiled to define velocity profile on a face thread. But unable to hook the udf. Please find below udf

#include "udf.h" #include "math.h"

DEFINE_PROFILE(velocity_profile, thread, position)

{

face_t f;

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

begin_f_loop(f, thread)

{

if(t>=5 & t<=10)

F_PROFILE(f, thread, position) = double pow (double t, double 2);

else

F_PROFILE(f, thread, position) = 25;

}

end_f_loop(f, thread)

}

The error message obtained for both the interpreted & compiled user defined functions are below

Error: C:\udf_inlet\trial.c: line 14: parse error.

(chdir "libudf")() (chdir "ntx86\2ddp")() 'nmake' is not recognized as an internal or external command, operable program or batch file. 'nmake' is not recognized as an internal or external command, operable program or batch file.

The probable reasons for malfunctioning of udf is the computation of t raised to power 2 using mathematical functions. Can anyone through more light on this & help

Thanking you, Abhijit


Kiran October 15, 2007 02:18

Re: mathematical function in UDF
 
There is a problem in the logical statement which you have written. if(t>=5 & t<=10) should be if(t>=5 && t<=10) Rgds

Abhijit October 15, 2007 03:19

Re: mathematical function in UDF
 
Thanks for your reply. I could solve the same udf with both the options in the logical statement considering different calculations to calculate the velocity.

But now I have changed on the below statement in the udf

F_PROFILE(f, thread, position) = double pow (double t, double 2);

I have also tried by placing global.h in working folder.

thanks & bye...abhijit



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