CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Sinusoidal motion udf (

urmazda May 23, 2010 06:07

Sinusoidal motion udf
hey guys
i have a problem but i am not so sure if it is due to my fluent or udf or other things
i want to find the pressure distribution around an airfoil (which has a sinusoidal motion) in a water tank. i have written the following code in C:

#include "udf.h"
#define om 0.62831853
#define pi 3.1415926
#define scale 0.1612

x(t)= 2c*cos(wt)
alpha(t)= pi/2 + pi/2*sin(wt)

DEFINE_CG_MOTION(vel, omega, time)
real b,u;
u = -2*scale*om*sin(om*time);
b = pi/2*om*cos(om*time);
vel[0] = u;
vel[1] = 0.0;
vel[2] = 0.0;

omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = b;

but in fluent after building it in udf compiler, in loading time i am recived the following error;

Opening library "code"...
Error: open_udf_library: The system cannot find the file specified.

Error Object: ()

someone please help me
thank you in advance

DoHander May 23, 2010 09:47

If you use Windows as I suspect modify the files view menu in order to let you see the extensions of the known file types.


urmazda May 23, 2010 09:53

thank you, i am using windows and even i have had unmarked the "hide extension for known file type" previously.
and still the problem exists.

O.D.Y. May 31, 2010 04:06


did fluent comile this udf without an error?
If you take a look at the manual, the DEFINE_CG_MOTION is defined the following way:

#define DEFINE_CG_MOTION(name, dt, vel, omega, time, dtime)

So I guess you forgot some variables. And you also didn't give a name, so how did you hook the udf in fluent?

urmazda May 31, 2010 04:17

oops thank you but i think i pasted the wrong version of my c file here, in the main version i wrote as follow
DEFINE_CG_MOTION(pilo, dt, vel, omega, time, dtime)
indeed i have put name and other necessary variable!
but still i have the same problem!

O.D.Y. May 31, 2010 05:07


and do you have all your files in one directory and is there a directory named "code" after compiling?

It sounds as if some environment variables are not set properly.
Did you ever use another UDF before?


almostafa67 July 30, 2010 11:44

rotation around z axis
hi everybody...
i am trying to simulate peristaltic pump and for this i need to write an udf file to rotate on of edges about z axis,i will be thanfull if u could help me with this problem.
thank you in advance..

All times are GMT -4. The time now is 20:14.