CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   udf initalizing problem (https://www.cfd-online.com/Forums/fluent-udf/98173-udf-initalizing-problem.html)

studen March 5, 2012 06:32

udf initalizing problem
 
#include "udf.h"
DEFINE_PROPERTY(cell_viscosity, c,t)
{
double u, uo, A, B, C, T; //uo, A, B, C are constant
uo = 4.485e-8;
A = -7.5907e-7;
B = 3.8968e-4;
C = 4.0130e-2;

for (T=1; T<101; T++)
{
u = uo*(exp(1/((A*T*T)+(B*T)+C)));
printf ("T = %3.0f, u= %3.8f \n", T, u);
}
return u;
}

this is my programme to simulate heat transfer considering variable viscosity, the programme can be interpreted but when i initalize it goes into an infinte loop, need suggestions and help.

thanks in advance

coglione March 6, 2012 06:14

First of all, the loop counter T should be defined as integer and not as real. Don't know how your compiler handles this exactly but fix it anyway.

Secondly DEFINE_PROPERTY macros are called for each cell every iteration. That means your udf will loop 100 times for each cell which may take a long time if your mesh is big.

cheers


All times are GMT -4. The time now is 13:23.