|
[Sponsors] |
November 23, 2004, 06:43 |
UDF example
|
#1 |
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) } __________________________________________________ ____ |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 08:37 |
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 22:38 |
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 |