[ANSYS, Inc. Logo] return to home search
next up previous contents index



You can use DEFINE_CG_MOTION to specify the motion of a particular dynamic zone in ANSYS FLUENT by providing ANSYS FLUENT with the linear and angular velocities at every time step. ANSYS FLUENT uses these velocities to update the node positions on the dynamic zone based on solid-body motion. Note that UDFs that are defined using DEFINE_CG_MOTION can only be executed as compiled UDFs.


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

Argument Type Description
symbol name UDF name.
Dynamic_Thread *dt Pointer to structure that stores the dynamic mesh
  attributes that you have specified (or that are calculated
real vel[] Linear velocity.
real omega[] Angular velocity.
real time Current time.
real dtime Time step.
Function returns  

There are six arguments to DEFINE_CG_MOTION: name, dt, vel, omega, time, and dtime. You supply name, the name of the UDF. dt, vel, omega, time, and dtime are variables that are passed by the ANSYS FLUENT solver to your UDF. The linear and angular velocities are returned to ANSYS FLUENT by overwriting the arrays vel and omega, respectively.


Consider the following example where the linear velocity is computed from a simple force balance on the body in the x-direction such that

 \int_{t_o}^{t} dv = \int_{t_o}^{t} (F/m)~dt (2.6-1)

where $v$ is velocity, $F$ is the force and $m$ is the mass of the body. The velocity at time $t$ is calculated using an explicit Euler formula as

 v_t = v_{t - \Delta t} + (F/m)\Delta t (2.6-2)

 * 1-degree of freedom equation of motion (x-direction)
 * compiled UDF
#include "udf.h"
static real v_prev = 0.0;

  Thread *t;
  face_t f;
  real NV_VEC(A);
  real force, dv;

  /* reset velocities */
  NV_S(vel, =, 0.0);
  NV_S(omega, =, 0.0);

  if (!Data_Valid_P())

  /* get the thread pointer for which this motion is defined */
  t = DT_THREAD(dt);

  /* compute pressure force on body by looping through all faces */
  force = 0.0;
      force += F_P(f,t) * NV_MAG(A);

  /* compute change in velocity, i.e., dv = F * dt / mass
     velocity update using explicit Euler formula */
  dv = dtime * force / 50.0;
  v_prev += dv;
  Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev, 

  /* set x-component of velocity */
  vel[0] = v_prev;

Hooking a Center of Gravity Motion UDF to ANSYS FLUENT

After the UDF that you have defined using DEFINE_CG_MOTION is compiled (Chapter  5), the name of the argument that you supplied as the first DEFINE macro argument will become visible in the Dynamic Mesh Zones dialog box in ANSYS FLUENT. See Section  6.5.1 for details on how to hook your DEFINE_CG_MOTION UDF to ANSYS FLUENT.

next up previous contents index Previous: 2.6 Dynamic Mesh DEFINE
Up: 2.6 Dynamic Mesh DEFINE
Release 12.0 © ANSYS, Inc. 2009-01-14