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 code not working (https://www.cfd-online.com/Forums/fluent-udf/201450-udf-code-not-working.html)

new_cfd May 3, 2018 03:11

UDF code not working
 
Hi,
I used the following code to increase the heat flux along a vertical wall from 0-500 linearly. However it doesn't work. I checked the wall heat flux at different locations in the CFD post, but it didn't give the right fluxes.Please let me know the correct solution.

DEFINE_PROFILE(lin_incr,t,i)
{
face_t f;
float x[ND_ND];
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
F_PROFILE(f,t,i)=0+1250*x[0];
}
end_f_loop(f,t)
}

pakk May 3, 2018 06:08

Which fluxes did it give, and which fluxes are the "right fluxes"?

new_cfd May 3, 2018 08:41

It gave a uniform flux of 125 W/m2. It should increase from 0 to 500.

pakk May 3, 2018 09:55

Does your boundary happen to be located at x=0.1 m?

What is probably happening: you wrote a UDF that varies linearly in x-coordinate, but your boundary varies in y-coordinate. (Or z-coordinate?)

Use x[1] in stead of x[0] if you want to vary in y-coordinate. (Or x[2] for z-coordinate.)

new_cfd May 3, 2018 20:22

Yes! It works! Thanks a lot!


All times are GMT -4. The time now is 09:44.