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

UDF example

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 23, 2004, 06:43
Default UDF example
  #1
anni
Guest
 
Posts: n/a
Hello friends,

I believe that UDF manual is very badly written. I have succeded writting a UDF that is finally working and i want to share it with you, so people can have more examples , trying to write one...

A disk rotating and the angular velocity increments with time, till time reaches the 1.5 s. After 1.5 sec the rotation of the disk is 600rpm . In FLUENT I can only give UDF x,y velocity components and not rotational velocity. In my case the center of the axes is at the center of the disk.

__________________________________________________ ___

/*UDF for specifying a transient speed for disk */ #include "udf.h"

DEFINE_PROFILE(x_velocity, thread, position)

{

real x[ND_ND], y, u_vel, ron, rol, nn, nl, r;

real t = CURRENT_TIME;

face_t f;

r = 0.08; /* disk radious [m] */

nn = 400; /* [rpm] */

nl = 600; /* the final [rpm] */

ron = 2 * 3.14 * nn/60; /* rotational velocity [rad/s] */

rol = 2 * 3.24 * nl/60;

begin_f_loop(f, thread)

{

F_CENTROID(x,f,thread);

y = x[1];

if (t<=1.5)

{

u_vel = ron * r * t ; /* u=(w*r)*t */

F_PROFILE(f, thread, position) = u_vel * (-y)/r ; /* x-component of velocity */

}

else

{

u_vel = rol * r ; /* u=w*r */

F_PROFILE(f, thread, position) = u_vel * (-y)/r ; /* after 1.5 sec */

}

}

end_f_loop(f, thread)

}

__________________________________________________ ____

/*UDF for specifying a transient speed for disk */ #include "udf.h"

DEFINE_PROFILE(y_velocity, thread, position)

{

real x[ND_ND], xc, u_vel, ron, rol, nn, nl, r;

real t = CURRENT_TIME;

face_t f;

r = 0.08; /* disk radious [m] */

nn = 400; /* [rpm] */

nl = 600; /* rotation after the 1.5s [rpm] */

ron = 2 * 3.14 * nn/60; /* rotational velocity [rad/s] */

rol = 2 * 3.24 * nl/60;

begin_f_loop(f, thread)

{

F_CENTROID(x,f,thread);

xc = x[0];

if (t<=1.5)

{

u_vel = ron * r * t ; /* u=(w*r)*t */

F_PROFILE(f, thread, position) = u_vel * xc/r ; /* y component of velocity */

}

else

{

u_vel = rol * r ; /* u=w*r */

F_PROFILE(f, thread, position) = u_vel * xc/r ; /* time > 1.5 sec */

}

}

end_f_loop(f, thread)

}

__________________________________________________ ____

  Reply With Quote

Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF parallel error: chip-exec: function not found????? shankara.2 Fluent UDF and Scheme Programming 1 January 16, 2012 23:14
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
UDF...UDF...UDF...UDF Luc SEMINEL FLUENT 0 November 25, 2002 05:03
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 11:21.