CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF in Cylindrical Coordinate (http://www.cfd-online.com/Forums/fluent-udf/91752-udf-cylindrical-coordinate.html)

 mas_viper August 22, 2011 02:51

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"
{
real x[ND_ND];
real y[ND_ND];
real xx;
real yy;
face_t f;

in the DEFINE macro argument */
{
yy = y[1];
xx = x[1];

}
}

: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*1000000-0.028*r*1000+11.565" where "r" is radial distance from 0,0,0
Thank you :)

 Erny August 22, 2011 05:46

If I am not mistaken the;-

Should give you the x,y,z coordinates for the cell such as;-
x[0] = x
x[1] = y
x[2] = z

 mas_viper August 22, 2011 06:43

Thank you so much! It is so easy :p

 donmezayd April 18, 2012 06:55

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)*(1-exp(-r*r/R*R));
}
end_f_loop(f,t)
}

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