CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   smth wrong with my udf for pin. (http://www.cfd-online.com/Forums/fluent-udf/75221-smth-wrong-my-udf-pin.html)

Filankes April 19, 2010 16:26

smth wrong with my udf for pin.
 

This code works, which shows motion of my pin.



#include "udf.h"
#include<stdio.h>
#include<math.h>





DEFINE_CG_MOTION(plate, dt, vel, omega, time, dtime)

{



vel[0] = 0.0;
vel[1] = -0.0149*728.31853*sin(628.31853*time);
vel[2] = 0.0;

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

}







Nevertheless this code with if, do not work, I don't understand why, please help me guys
================================================== ==

#include "udf.h"
#include<stdio.h>
#include<math.h>





DEFINE_CG_MOTION(plate, dt, vel, omega, time, dtime)

{

if (time==0.0)
{
vel[0] = 0.0;
vel[1] = -0.0149*728.31853*sin(628.31853*time);
vel[2] = 0.0;

omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = 0.0;
}
else if(time==0.002)
{
vel[0] = 0.0;
vel[1] = -0.0149*628.31853*sin(628.31853*time);
vel[2] = 0.0;

omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = 0.0;
}
else if(time==0.003)
{
vel[0] = 0.0;
vel[1] = -0.0149*528.31853*sin(628.31853*time);
vel[2] = 0.0;

omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = 0.0;
}
else if(time==0.005)
{
vel[0] = 0.0;
vel[1] = -0.0149*728.31853*sin(628.31853*time);
vel[2] = 0.0;

omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = 0.0;
}
else if(time==0.007)
{
vel[0] = 0.0;
vel[1] = -0.0149*628.31853*sin(628.31853*time);
vel[2] = 0.0;

omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = 0.0;
}
else if(time==0.008)
{
vel[0] = 0.0;
vel[1] = -0.0149*728.31853*sin(628.31853*time);
vel[2] = 0.0;

omega[0] = 0.0;
omega[1] = 0.0;
omega[2] = 0.0;
}
else if(time==0.01)
{
vel[0] = 0.0;
vel[1] = -0.0149*728.31853*sin(628.31853*time);
vel[2] = 0.0;

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


}

DoHander April 19, 2010 16:40

What do you mean by it does not work ? You can't compile the code or the results is wrong ?

Do

Filankes April 19, 2010 19:51

Quote:

Originally Posted by DoHander (Post 255339)
What do you mean by it does not work ? You can't compile the code or the results is wrong ?

Do


I can load both

but the first one works, and the pin moves, but the second one do not work ==>> pin do not move. Please help me guys.


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