|
[Sponsors] |
December 6, 2005, 03:11 |
problem in UDF's
|
#1 |
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. |
|
December 6, 2005, 06:47 |
Re: problem in UDF's
|
#2 |
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 |
|
December 7, 2005, 00:38 |
Re: problem in UDF's
|
#3 |
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. |
|
December 7, 2005, 10:17 |
Re: problem in UDF's
|
#4 |
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) } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem Importing Geometry ProE to CFX | fatb0y | CFX | 3 | January 14, 2012 20:42 |
Can I solve this problem by Fluent? | Kai_kc | FLUENT | 1 | October 27, 2010 06:29 |
natural convection problem for a CHT problem | Se-Hee | CFX | 2 | June 10, 2007 07:29 |
Adiabatic and Rotating wall (Convection problem) | ParodDav | CFX | 5 | April 29, 2007 20:13 |
Is this problem well posed? | Thomas P. Abraham | Main CFD Forum | 5 | September 8, 1999 15:52 |