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

2.6.4 DEFINE_GRID_MOTION



Description


By default, ANSYS FLUENT updates the node positions on a dynamic zone by applying the solid-body motion equation. This implies that there is no relative motion between the nodes on the dynamic zone. However, if you need to control the motion of each node independently, then you can use DEFINE_GRID_MOTION UDF. A mesh motion UDF can, for example, update the position of each node based on the deflection due to fluid-structure interaction. Note that UDFs that are defined using DEFINE_GRID_MOTION can be executed only as compiled UDFs.



Usage



DEFINE_GRID_MOTION( name, d, dt, time, dtime)


Argument Type Description
symbol name UDF name.
Domain *d Pointer to domain.
Dynamic_Thread *dt Pointer to structure that stores the dynamic mesh
  attributes that you have specified (or that are calculated
  by ANSYS FLUENT).
real time Current time.
real dtime Time step.
   
Function returns  
void  
   

There are five arguments to DEFINE_GRID_MOTION: name, d, dt, time, and dtime. You supply name, the name of the UDF. d, dt, time, and dtime are variables that are passed by the ANSYS FLUENT solver to your UDF.



Example


Consider the following example where you want to specify the deflection on a cantilever beam based on the $x$ position such that


$\displaystyle \omega_y(x)$ $\textstyle =$ $\displaystyle -10.4\sqrt{x}\sin{26.178~t} \quad\quad x > 0.02$ (2.6-3)
$\displaystyle \omega_y(x)$ $\textstyle =$ $\displaystyle 0 \quad\quad x <= 0.02$ (2.6-4)

where $\omega_y(x)$ is the $y$-component of the angular velocity at a position $x$. The node position is updated based on


 (\vec{r})^{t+\Delta t} = (\vec{r})^t + \vec{\Omega} \times (\vec{r})^t \Delta t (2.6-5)

where $\vec{\Omega}$ is the angular velocity and $\vec{r}$ is the position vector of a node on the dynamic zone.

/**********************************************************
 node motion based on simple beam deflection equation
 compiled UDF
 **********************************************************/
#include "udf.h"

DEFINE_GRID_MOTION(beam,domain,dt,time,dtime)
{
  Thread *tf = DT_THREAD(dt);
  face_t f;
  Node *v;
  real NV_VEC(omega), NV_VEC(axis), NV_VEC(dx);
  real NV_VEC(origin), NV_VEC(rvec);
  real sign;
  int n;
  
  /* set deforming flag on adjacent cell zone */
  SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));

  sign = -5.0 * sin (26.178 * time);
  
  Message ("time = %f, omega = %f\n", time, sign);
  
  NV_S(omega, =, 0.0);
  NV_D(axis, =, 0.0, 1.0, 0.0);
  NV_D(origin, =, 0.0, 0.0, 0.152);
  
  begin_f_loop(f,tf)
    {
      f_node_loop(f,tf,n)
        {
          v = F_NODE(f,tf,n);

          /* update node if x position is greater than 0.02
             and that the current node has not been previously
             visited when looping through previous faces */
          if (NODE_X(v) > 0.020 && NODE_POS_NEED_UPDATE (v))
            {
              /* indicate that node position has been update
                 so that it's not updated more than once */
              NODE_POS_UPDATED(v);

              omega[1] = sign * pow (NODE_X(v)/0.230, 0.5);
              NV_VV(rvec, =, NODE_COORD(v), -, origin);
              NV_CROSS(dx, omega, rvec);
              NV_S(dx, *=, dtime);
              NV_V(NODE_COORD(v), +=, dx);
            }
        }
    }

  end_f_loop(f,tf);
}



Hooking a DEFINE_GRID_MOTION to ANSYS FLUENT


After the UDF that you have defined using DEFINE_GRID_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.4 for details on how to hook your DEFINE_GRID_MOTION UDF to ANSYS FLUENT.


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