CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF error - parabolic velocity profile - 3D turbine

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By skris2009

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 11, 2010, 02:45
Default UDF error - parabolic velocity profile - 3D turbine
  #1
New Member
 
Zaqie
Join Date: Jul 2009
Posts: 22
Rep Power: 17
Zaqie is on a distinguished road
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 followsreference 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
Attached Files
File Type: pdf velocity profile.pdf (3.9 KB, 452 views)
Zaqie is offline   Reply With Quote

Old   May 11, 2010, 12:30
Default problem solved
  #2
New Member
 
Zaqie
Join Date: Jul 2009
Posts: 22
Rep Power: 17
Zaqie is on a distinguished road
The source file was named parabolic profile.c . I removed the gap between the words in source files - parabolicprofile.c and it works!
Zaqie is offline   Reply With Quote

Old   May 25, 2010, 00:08
Default 3d Parabolic Profile Error
  #3
New Member
 
Sowmya K
Join Date: Nov 2009
Posts: 22
Rep Power: 17
skris2009 is on a distinguished road
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
soheil_r7 likes this.
skris2009 is offline   Reply With Quote

Old   May 25, 2010, 00:30
Default
  #4
New Member
 
Sowmya K
Join Date: Nov 2009
Posts: 22
Rep Power: 17
skris2009 is on a distinguished road
Nevermind, I got it...
stupid mistake....it should be z=x[2]
Thanks anyways
skris2009 is offline   Reply With Quote

Old   September 6, 2012, 07:14
Default
  #5
New Member
 
n7310889
Join Date: Aug 2012
Posts: 26
Rep Power: 14
n7310889 is on a distinguished road
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)
}
n7310889 is offline   Reply With Quote

Old   September 20, 2012, 08:05
Default
  #6
New Member
 
rayolau
Join Date: Aug 2012
Posts: 23
Rep Power: 14
rayolau is on a distinguished road
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!
rayolau is offline   Reply With Quote

Old   September 23, 2012, 02:48
Default
  #7
New Member
 
hzsme
Join Date: Sep 2012
Posts: 7
Rep Power: 14
hzsme is on a distinguished road
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.
hzsme is offline   Reply With Quote

Old   September 23, 2012, 04:23
Default
  #8
New Member
 
n7310889
Join Date: Aug 2012
Posts: 26
Rep Power: 14
n7310889 is on a distinguished road
Quote:
Originally Posted by hzsme View Post
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
n7310889 is offline   Reply With Quote

Old   May 11, 2014, 09:34
Default
  #9
New Member
 
fouad
Join Date: May 2014
Posts: 1
Rep Power: 0
Fouad Far is on a distinguished road
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:

t.jpg

thank you.
Fouad Far is offline   Reply With Quote

Old   June 25, 2016, 20:08
Default
  #10
Senior Member
 
Shamoon Jamshed
Join Date: Apr 2009
Location: Karachi
Posts: 381
Rep Power: 18
Shamoon Jamshed is on a distinguished road
Send a message via Skype™ to Shamoon Jamshed
Quote:
Originally Posted by Fouad Far View Post
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);
}
Shamoon Jamshed is offline   Reply With Quote

Reply

Tags
3d turbine, compile, macro, parabolic velocity, udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF inlet velocity profile mismatch with Fluent ChristineL Fluent UDF and Scheme Programming 15 November 25, 2016 07:45
UDF problems - velocity profile Oli Fluent UDF and Scheme Programming 6 October 24, 2016 11:38
How to make a UDF to have a velocity profile in a square channel Gigis Fluent UDF and Scheme Programming 8 January 13, 2013 23:20
Logarithmic velocity profile cfdworker Fluent UDF and Scheme Programming 0 April 23, 2009 20:09
particle velocity and velocity profile HGG FLUENT 2 June 10, 2001 17:32


All times are GMT -4. The time now is 13:50.