Fluids

Fluids

UDF for sinusoidal piston motion does not work properly

    • Muhamad Eldebawy
      Subscriber

      Hi every body, 


      I am trying to simulate the motion of piston inside cylinder. It is a sinusoidal motion


      I defined the piston as a rigid body and I wrote this UDF file to define the motion of the piston




      #include "udf.h"


      #define freq 1.5


      #define w 2.0*M_PI*freq


      #define a 0.15


      #define l 0.3


      static real velocity = 0.0;


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


      {


      real velocity;


      /* reset velocities */


      NV_S(vel, =, 0.0);


      NV_S(omega, =, 0.0);


      velocity = a * (w*M_PI/180) * cos(w*time);


      omega[0] = 0;


      omega[1] = 0;


      omega[2] = 0;


      vel[0] = velocity;


      vel[1] = 0;


      vel[2] = 0;


      }




      when I display the piston motion it reciprocates and translates at the same time. It moves from point to another point and reciprocates as I defined. I do not know why it translates, it is assumed to return to its initial position ??!!


      by the way I did not define the centre of gravity (Let all values  = 0) and the global coordinates at the centre of the piston face.


      Thank you

Viewing 0 reply threads
  • You must be logged in to reply to this topic.