CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF error - parabolic velocity profile - 3D turbine (http://www.cfd-online.com/Forums/fluent-udf/75974-udf-error-parabolic-velocity-profile-3d-turbine.html)

Zaqie May 11, 2010 01:45

UDF error - parabolic velocity profile - 3D turbine
 
1 Attachment(s)
Hi

I was trying to write a UDF for a parabolic velocity profile for a turbine problem. The parabolic shape is only in the vertical direction(y direction), i.e velocity steadily increases upwards the domain(see the attached figure). Maximum velocity -1.73 m/sec. Domain diameter - 30m

The UDF is as follows:(reference fluent manual)
-----------------------------------------------------------------------

/************************************************** *********************
UDF for parabolic velocity profile at inlet boundary
************************************************** **********************/
#include"udf.h"
DEFINE_PROFILE(inlet_x_velocity, thread, position) /* inlet x velocity = name of the x velocity */
{
real x[ND_ND];
/* this will hold the position vector */
real y,z;
face_t f;
/* f = all the cell faces on the boundary*/
begin_f_loop(f,thread)
/* thread = given boundary zone, defined automatically when the UDF is hooked to inlet boundary, the macro begin_f_loop is applied to all the cell faces*/
{
F_CENTROID(x, f, thread);
/* the coordinates of the face centroid accessed by F_CENTROID */
y= x[1];
F_PROFILE(f, thread, position) = 1.73-((15-y)*(15-y)*1.73/(30*30));
/* return velocity is assigned through F_PROFILE */
}
end_f_loop(f, thread)
}

-----------------------------------------------------------------------

But on compiling my UDF I get the error

Opening library "libudf"...
Error: open_udf_library: The system cannot find the file specified.


Any clue what the error is?

Regards
Zaqie

Zaqie May 11, 2010 11:30

problem solved
 
The source file was named parabolic profile.c . I removed the gap between the words in source files - parabolicprofile.c and it works!:)

skris2009 May 24, 2010 23:08

3d Parabolic Profile Error
 
Hi

I have the following UDF written for fully developed flow as a boundary condition for a pipe inlet. The inlet face is on the Y-Z plane and the velocity is normal to the face in the X direction. But if I check the initialization, the profile doesnt look parabolic at all. I have just modified the profile given the Fluent guide.

#include "udf.h"
#include "math.h"
DEFINE_PROFILE(inlet_x_velocity, thread, index)
{
real x[ND_ND]; /* this will hold the position vector */
real y;
real z;
real a;
face_t f;
begin_f_loop(f, thread) /*loops over all faces in the thread passed in the DEFINE macro argument*/
{
F_CENTROID(x,f,thread);
y =x[1];
z =x[1];
a = pow((pow(y,2)+pow(z,2)),0.5);
F_PROFILE(f, thread, index) = 2*0.00000491976*(1- (a*a/(0.10214*0.10214)));
}
end_f_loop(f, thread)
}

Any ideas will be appreciated. Thanks

skris2009 May 24, 2010 23:30

Nevermind, I got it...
stupid mistake....it should be z=x[2]
Thanks anyways:)

n7310889 September 6, 2012 06:14

Hi, could any of you can tell me whats wrong with this macro? Its for 3d to provide input heat-flux profile around a semi circular cylinder of 33mm radius and 1.5m long.The heat profile varies along the verticle y direction and translates the same along the horizontal z axis.

#include "udf.h"

DEFINE_PROFILE(heat_profile,thread,index)
{
real x[ND_ND];
real x,y,z,r,angle;

face_t f;

begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);

x =x[0];
y =x[1];
z =x[2];
r =sqrt(pow(x,2)+pow(y,2));
angle =acos(-y/r);

if ((z>=0.0) && (z<=1.4))
{

if ((angle>=0.0) && (angle<=60.0))
{
F_PROFILE(f,thread,index) =6500.0;
}

if ((angle>50.0) && (angle<=180.0))
{
F_PROFILE(f,thread,index) =0.0;
}

}

else
{
F_PROFILE(f,thread,index) =0.0;
}
}

end_f_loop(f,thread)
}

rayolau September 20, 2012 07:05

Hi, I am working in similar 3D case. At the moment, my macro is this:

____________________________________
#include "udf.h"
#define S 0.0016
DEFINE_PROFILE(inlet_x_velocity, thread, index)
{
real x [ND,ND];
real y;
real z;
face_t,f;
begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread)
y=x[1]
z=x[2]
if (y>=S)
F_PROFILE(f,thread,index)=0.55*double log (double (y/0.0016))
}
end_f_loop(f,thread)
}
_________________________________
But on compiling my UDF I get the error. Why? What's wrong?
Thanks!

hzsme September 23, 2012 01:48

Try to declare the (face_t f;) at first and then other variables....like this:

face_t f;
real x [ND,ND];
real y;
real z;
.
.
.
.
.
Also there is an extra character between (face_t) and (f)....i mean the comma.....omit it and then compile your UDF.
Bests.

n7310889 September 23, 2012 03:23

Quote:

Originally Posted by hzsme (Post 383152)
Try to declare the (face_t f;) at first and then other variables....like this:

face_t f;
real x [ND,ND];
real y;
real z;
.
.
.
.
.
Also there is an extra character between (face_t) and (f)....i mean the comma.....omit it and then compile your UDF.
Bests.

Hi,
Thanks a lot.
However, I've written a udf for heat flux, and it is running well. Now I'm trying to add radiation in that macro at a fashion like that: F_PROFILE(x,t,i) = heat_flux_function - some_constant*(pow(F_T(f,t),4)-pow(Temp_glass,4));

Whenever I try to interprate this macro, fluent shows me parse error, just at this line. One thing I'm wondering is, I'm assigning input heat to a certain face and again use the temperature of the same face to negate radiation exchange from the resultant heat flux! Input heat will be utilized first to raise the face temperature, then radiation exchange will be function of this temperature, is my understanding. I don't understand actually how should I assign radiation exchange in my model. Could you please help me to get rid of this riddle? I'll be thankful really.
Regards

Fouad Far May 11, 2014 08:34

1 Attachment(s)
Hello every body.
I would like to ask a question about UDF. I want to write a velocity profile with use of UDF an I don't know How I can write this periodic profile:

Attachment 30761

thank you.


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