CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF error - parabolic velocity profile - 3D turbine (https://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*/
/* 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*/
{
/* 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 */
}
}

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

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"
{
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*/
{
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)));
}
}

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"

{
real x[ND_ND];
real x,y,z,r,angle;

face_t f;

{

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))
{
}

if ((angle>50.0) && (angle<=180.0))
{
}

}

else
{
}
}

}

 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
{
real x [ND,ND];
real y;
real z;
face_t,f;
{
y=x[1]
z=x[2]
if (y>=S)
F_PROFILE(f,thread,index)=0.55*double log (double (y/0.0016))
}
}
_________________________________
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.

 Shamoon Jamshed June 25, 2016 19:08

Quote:
 Originally Posted by Fouad Far (Post 491101) 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.
This code will help you otherwise see the tutorial at

https://confluence.cornell.edu/displ...rcating+Artery

UDF CODE

/************************************************** *********************/
/* vinlet_udf.c
*/
/* UDFs for specifying time dependant velocity profile boundary condition
*/
/************************************************** *********************/
//Written by Chiyu Jiang
//Cornell University

#include "udf.h"//file that contains definitions for define functions and fluent operations
#define PI 3.141592654

DEFINE_PROFILE(inlet_velocity,th,i)
{
face_t f;
begin_f_loop(f,th)
double t = (CURRENT_TIME*2-floor(CURRENT_TIME*2))/2; //t is the local time within each period

{
if(t <= 0.218)
F_PROFILE(f,th,i) = 0.5*sin(4*PI*(t+0.0160236));
else
F_PROFILE(f,th,i) = 0.1;
}
end_f_loop(f,th);
}

 All times are GMT -4. The time now is 17:24.