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

problem in UDF's

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2005, 02:11
Default problem in UDF's
  #1
sangamnath
Guest
 
Posts: n/a
I got this code for parabolic velocity profile.

But when i give compile option it is giving error.

I have copied "udf.h" into current directory.

code is --> ----------------------------------------------------------

#include "udf.h"

void inlet_x_velocity(Thread *t, int nv){

Face *f;

float y, xv;

for (f = thread_face(t); f ! = NULL; f = face_next(f) {

y = face_centroid_y(f);

xv = 20. -y*y/(.0475*.0745)*20.;

set_face_var(f,nv,xv);

}

}

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

Error being displayed in Fluent -->

cpp -IC:\FLUENT.INC\fluent6.0/src -IC:\FLUENT.INC\fluent6.0/cortex/src -IC:\FLUENT.INC\fluent6.0/client/src -IC:\FLUENT.INC\fluent6.0/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" D:\sangam\ga-file ew\fluenr_UDF\user1.cError: D:\sangam\ga-file\new\fluenr_UDF\user1.c: line 5: Face: undeclared variable ----------------------------------------------------------

How to correct this.

  Reply With Quote

Old   December 6, 2005, 05:47
Default Re: problem in UDF's
  #2
RoM
Guest
 
Posts: n/a
You can look here. http://www.cfd-online.com/Forum/flue...cgi?read=31574 And for more questions feel free to ask.

RoM
  Reply With Quote

Old   December 6, 2005, 23:38
Default Re: problem in UDF's
  #3
sangamnath
Guest
 
Posts: n/a
Hi,

I saw the link which u had mentioned.

But still i am not clear.

If possible clarify it.

Or else give me steps to compile center peaked velocity profile UDF file.
  Reply With Quote

Old   December 7, 2005, 09:17
Default Re: problem in UDF's
  #4
RoM
Guest
 
Posts: n/a
I copied the expamle from chapter 3.1.1 udf manual and added some addition comments. Hope it helps.

RoM


#include "udf.h" /* must be at the beginning of every UDF you write */

/* x_velocity is the name of your function
A thread is collection of cells or faces that have something in common. In this
case "thread" will hold the faces that belong to your velocity inlet. The "index"
refers to the variable to be set by your function. "Thread" and "index" are fluent
intern. They are passed by the solver. Only use them and dont change them. */
DEFINE_PROFILE(x_velocity,thread,index)
{
/* vector that holds the coordinates of a face center, ND_ND is a constant
it is 2 for 2D and 3 for 3D */
real f_center[ND_ND]; /* f_center[0]=x,f_center[1]=y,f_center[2]=z */

/* all float/double values should be declared as "real" */
/* "real will change to "float" if you compile for single precision solver
and double for double precision solver */
real y; /* y coordinate of the face center */

face_t f; /* an integer variable that is needed to for the face loop */

/* loops over all faces in the thread passed in the DEFINE macro argument */
/* You should get used to using fluent macros and not try to rewrite looping
functions. */
begin_f_loop(f,thread)
{
/* copy the face center coordintates to f_center vector */
F_CENTROID(f_center,f,thread);
/* get the y coordinate */
y = f_center[1];
/* and set the value for x-velocity as a function of y */
F_PROFILE(f,thread,index) = 20. - y*y/(.0745*.0745)*20.;
}
end_f_loop(f,thread)
}
  Reply With Quote

Reply


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
Problem Importing Geometry ProE to CFX fatb0y CFX 3 January 14, 2012 19:42
Can I solve this problem by Fluent? Kai_kc FLUENT 1 October 27, 2010 05:29
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
Is this problem well posed? Thomas P. Abraham Main CFD Forum 5 September 8, 1999 14:52


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