# UDF Help

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

 March 23, 2014, 12:40 UDF Help #1 New Member   anonymous Join Date: Mar 2014 Posts: 2 Rep Power: 0 I am trying write a UDF to be used as an inlet BC. I have read through the tutorial in Fluent and it doesn't provide much help for a 3-d application. My inlet velocity is composed of velocity magnitudes (x,y,z velocities). The velocity only varies in Y-direction and I have derived an equation for each velocity(u=f(y),v=f(y),w=f(y)). I am just curious how to write the UDF that will be able to define velocity the entire span of the inlet. Thanks

 March 24, 2014, 22:55 #2 Super Moderator     Ghazlani M. Ali Join Date: May 2011 Location: Tokyo, Japan Posts: 1,366 Blog Entries: 23 Rep Power: 21 I am no expert in UDF, I just wrote my UDF last week; the UDF manual and the tutorials will help you understand the functions, but if you wanna learn , look for existing pieces of codes, understand them and modify them so it can suit your need... 2-D should not be that different from 3-D you just add the z component... I guess __________________ Regards, New to ICEM CFD, try this document --> https://goo.gl/NEbygB Ali

March 28, 2014, 09:40
#3
Senior Member

François Grégoire
Join Date: Jan 2010
Posts: 380
Rep Power: 9
Hi cfduser,

Here's your udf, I just copied 3 times an example from the udf manual version 15.0: 2.3.19.3. Example 1 - Pressure Profile

It doesn't matter 2D or 3D in this case, the DEFINE_PROFILE loops over all faces of the boundary where you apply it.

Code:
``` #include "udf.h"
DEFINE_PROFILE(vx,t,i)
{
real x[ND_ND];    /* this will hold the position vector */
real y;
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
F_PROFILE(f,t,i) = 1.1e5 - y*y/(.0745*.0745)*0.1e5;
}
end_f_loop(f,t)
}

DEFINE_PROFILE(vy,t,i)
{
real x[ND_ND];    /* this will hold the position vector */
real y;
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
F_PROFILE(f,t,i) = 1.1e5 - y*y/(.0745*.0745)*0.1e5;
}
end_f_loop(f,t)
}

DEFINE_PROFILE(vz,t,i)
{
real x[ND_ND];    /* this will hold the position vector */
real y;
face_t f;
begin_f_loop(f,t)
{
F_CENTROID(x,f,t);
y = x[1];
F_PROFILE(f,t,i) = 1.1e5 - y*y/(.0745*.0745)*0.1e5;
}
end_f_loop(f,t)
}```
Attached Images
 001.png (14.3 KB, 8 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 pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12 shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14 kim FLUENT 3 October 26, 2011 21:38 Luc SEMINEL FLUENT 0 November 25, 2002 05:03 Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01

All times are GMT -4. The time now is 10:54.