CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF piston movement problem (https://www.cfd-online.com/Forums/fluent-udf/181843-udf-piston-movement-problem.html)

Dozer_94 December 22, 2016 08:42

UDF piston movement problem
 
Hi everyone,

I'm trying to simulate a moving piston in a cylinder. The simple UDF i've written contains a sine wave to describe the velocity.

It compiles correctly, and when I ask Fluent to 'Display Zone Motion', the piston starts accelerating and slowing down as expected. BUT, when it has come to a halt, instead of decelerating to a negative velocity, it accelerates in the positive direction!

It appears like the absolute value is computed instead of the real one. The UDF looks as follows:

--------------------------------------------------------------------------------
#include "udf.h"

DEFINE_CG_MOTION(object_mov, dt, vel, omega, time, dtime)
{
real w, r, l;

w = 146.6;
r = 0.030;
l = 0.1;

/* define object movement law */
vel[0] = 0.1*(r*w*sin(w*time)+(r*r*w*sin(2*w*time))/(2*l));
vel[1] = 0;
vel[2] = 0;
}
----------------------------------------------------------------------------------

Any help/suggestion is more than welcome!

KevinZ09 December 22, 2016 09:49

So are you saying the piston keeps on advancing in between halts? Did you hook your UDF? And have you tried with a simple sine wave?

Dozer_94 December 26, 2016 09:56

Hi Kevin, thanks for your reply.

I've managed to resolve this issue by decreasing the time step. Also, the problem only emerged when I was using the 'Display Zone Motion' function.


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