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/)
-   -   3D velocity inlet UDF (https://www.cfd-online.com/Forums/fluent-udf/76730-3d-velocity-inlet-udf.html)

zumaqiong June 2, 2010 14:20

3D velocity inlet UDF
 
Hi!
I have a problem with 3D velocity inlet UDF.
My velocity is parabolic time dependent.
and I write UDF like this:

#include"udf.h"
DEFINE_PROFILE(inlet_y_velocity, thread, position)
{
real x[ND_ND]; real r; face_t f;
real t;
int n;
real T=1;
real y,z;

begin_f_loop(f, thread)

{

F_CENTROID(x,f,thread);
t=RP_Get_Real("flow-time");
n=(int)(t/T);
y=x[0];
z=x[2];
r=sqrt(pow(y,2)+pow(z,2)); /*radius of cylinder*/

F_PROFILE(f,thread,position)=1360.41*(0.0001-r*r)*exp(-0.5*pow(15.15*t-3.46-15.15*n,2));

}
end_f_loop(f, thread)
}

but if I add #include "surf.h"
at the beginning of this UDF, the velocity is not parabolic. it will be constant changing only with time.

Is there anybody who knows why this will happen?
and what is the meaning of #include "surf.h"?

Thank you!

om1234 June 4, 2010 19:31

hi
as i know, udf.h is used in the beginig of your udf and surf.h is the library that the macros you use in your udf are defined in there. now depending in your importing your udf to fluent, if u use interpret, u dont need to do additional works(and the udf beginig must be udf.h).but when u use compile u must define the library(surf.h) in "add header" next to "add udf"

mmunige October 24, 2016 04:44

UDF for inlet temperature
 
Dear all

I have following UDF for inlet temperature, untill 1300s it takes correct values according to equation, but after 1300s values are higher and not accorrding to equation, like at 1301s it should have value of 405C but in simulation inlet temperature is 621C. I could not find the error in my UDF after lot of try. please check this and guide me. Thanks in advance.
#include"udf.h"

DEFINE_PROFILE(inlet_temperature,thread,position )

{

face_t f;

begin_f_loop(f,thread)

{

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

if (t <=1300.0 )

{

F_PROFILE(f,thread,position) = 379.13 + 0.0005*t;

}

else if (1300.0 < t && t <= 1500.0 )

{

F_PROFILE(f,thread,position)= -1.04289036878969*pow(10,-10)*pow(t,6.0)+ 8.86126436853789*pow(10,-7)*pow(t,5.0)-3.13621260398811*pow(10,-3)*pow(t,4.0)+5.91804640375908*pow(t,3.0)-6.27969461279651*pow(10,3)*pow(t,2.0)+ 3.55273415252714*pow(10,6)*t - 8.37223405676245*pow(10,8);
}
else
{

F_PROFILE(f,thread,position) = -9.51538261322402*pow(10,-23)*pow(t,6) + 8.26192751387975*pow(10,-18)*pow(t,5)-2.85237398505875*pow(10,-13)*pow(t,4)+4.97518353700886*pow(10,-9)*pow(t,3)-4.58733775886876*pow(10,-5)*pow(t,2)+ 2.10251137071757*pow(10,-1)*t +3.57252192344954*pow(10,2);

}

}

end_f_loop(f,thread)

}


All times are GMT -4. The time now is 20:37.