UDF in Cylindrical Coordinate
Hi guys,
I am a newbie in UDF world and I need some help for a simple UDF problem. I have a 3d turbo setup and i need to have tangential velocity profile in inlet as a function of "r" in cylindrical coordinate. I had no idea about C programing and UDF so I used Fluent sample for inlet boundary and changed it to this: #include "udf.h" DEFINE_PROFILE(T_velocity,thread,index) { real x[ND_ND]; real y[ND_ND]; real xx; real yy; face_t f; begin_f_loop(f,thread) /* loops over all faces in the thread passed in the DEFINE macro argument */ { F_CENTROID(y,f,thread); yy = y[1]; F_CENTROID(x,f,thread); xx = x[1]; F_PROFILE(f,thread,index) = 0.00002*(xx*xx+yy*yy)*10000000.028*sqrt(xx*xx+yy*yy)*1000+11.565; } end_f_loop(f,thread) } :confused::mad:Clearly it did not work because I did not know what I was doing!!! please helpme to change this UDF to give me velocity in cylindrical coordinate as "0.00002*r^2*10000000.028*r*1000+11.565" where "r" is radial distance from 0,0,0 Thank you :) 
If I am not mistaken the;
F_CENTROID(x,f,thread) Should give you the x,y,z coordinates for the cell such as; x[0] = x x[1] = y x[2] = z 
Thank you so much! It is so easy :p

i also have to define a parabolic tangential profile but the velocity values computed by the udf does not match with the real values. help please!
#include "udf.h" DEFINE_PROFILE(velocity_profile,t,i) { real x[ND_ND]; /* this will hold the position vector */ real r,R,omega; face_t f; R=0.1; omega=20; begin_f_loop(f,t) { F_CENTROID(x,f,t); r=sqrt((x[0]*x[0])+(x[1]*x[1])); F_PROFILE(f,t,i) = (omega*R*R/r)*(1exp(r*r/R*R)); } end_f_loop(f,t) } 
All times are GMT 4. The time now is 05:52. 