# velocity profile for inlet with UDF

 Register Blogs Members List Search Today's Posts Mark Forums Read

 September 12, 2012, 03:51 velocity profile for inlet with UDF #1 New Member   selim Join Date: Sep 2009 Location: UK Posts: 19 Rep Power: 9 Sponsored Links Dear all, I want to impose a velocity at the inlet which is parabolic at the bottom and top and constant in the middle of the inlet. But flunet does not regonize the locations correctly, so what is wrong in my UDF, pls help!! Here is my udf, #include "udf.h" #define S 0.038 #define V1 10.86 DEFINE_PROFILE(inlet_x_velocity, thread, index) { real x[ND_ND]; /* this will hold the position vector */ real y; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); y = x[1]; if (y<=S) F_PROFILE(f, thread, index) = 249.384*y*y+249.384*y; else if (S<=y<=3*S) F_PROFILE(f, thread, index) = V1; else if (3*S<=y<=4*S) F_PROFILE(f, thread, index) = -83.514*y*y-83.514*y+14.6238; } end_f_loop(f, thread) } Thank you, -Selim

 September 12, 2012, 04:51 #2 New Member   Zhi-Gang Zhai Join Date: Sep 2012 Location: karlsruhe, Germany Posts: 7 Rep Power: 6 pls show the mesh and what is the wrong result ? thank you!

September 12, 2012, 05:45
#3
Senior Member

Daniele
Join Date: Oct 2010
Location: Italy
Posts: 998
Rep Power: 17
Hi,
the following udf will produce the following velocity-y coordinate chart; velocity will be a function of the only y coordinate.
Take care to operators <=, >= etc.: in your udf, if for example y=S both
are valid

Code:
```#include "udf.h"
#define S 0.038
#define V1 10.86

{
real x[ND_ND];        /* this will hold the position vector */
real y;
face_t f;

{
y = x[1];
if (y<=S)        /* y=S is included */
else if (S<y<3*S)        /* y=S and y=3S are not included */
else /* no need for another else if, 3S is included here */
}
}```
Attached Images
 notitle.jpg (31.0 KB, 17 views)

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Oli Fluent UDF and Scheme Programming 6 October 24, 2016 10:38 Rashad FLUENT 0 February 27, 2008 15:57 Anant FLUENT 1 February 27, 2008 15:54 William177 FLUENT 1 February 3, 2008 07:47 Jongdae Kim FLUENT 0 June 15, 2004 11:21