Topics relate to Fluent, CFX, Turbogrid and more

How to use DEFINE_CG_MOTION to define both translation and rotation

    • jianan.zhao


      I am trying to write a UDF to define a rigid body motion. The motion includes translation in y direction (dash line), rotation around y axis and rotation around x axis (normal to the plane) relative to the center of gravity of the object as shown in the graph.

      My question is how to define the rotation in x direction with a moving CG? Any help would be appreciated.  - Jianan

      I have attached my UDF to define translation and rotation in y direction.

      #include "udf.h"


      #define pi 3.1415926

      #define A 6.0e-4 /* amplitude of oscillation in Y */

      #define T_oscY 0.1 /* time period of oscillation in Y */

      #define T_rotY 0.1 /* time period of rotation in Y */


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


      vel[0] = 0;

      //vel[1] = A*2*pi/T_oscY*cos(2*pi*time/T_oscY);

      vel[2] = 0;


      omega[0] = 0;

      omega[1] = 2 * pi / T_rotY;

      omega[2] = 0;


      N3V_S(origin, =, 0.0);        /* default values, line could be omitted */

      N3V_D(axis, =, 0.0, 0.0, 0.0);     /* default values, line could be omitted */


      /**End of UDF**/

    • Rob
      Ansys Employee

      Have a look at the 6DOF examples. You may find it's easier to set a rotating zone (have a look in the tutorials that come with the documentation) and then move that. 

    • jianan.zhao

      Dear Rwoolhou,

      Thank you for your suggestion. I will look into 6DOF. 

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