2.3.14.  DEFINE_ZONE_MOTION

2.3.14.1. Description

You can use DEFINE_ZONE_MOTION to specify the cell zone motion components in a moving reference frame or moving mesh simulation. All motion components are passed as arguments to the UDF, so that access to them is provided in a single UDF. The arguments contain the default values already, so that if a specific component (for example, the origin) is not modified by the UDF, it will retain its default value.

2.3.14.2. Usage

DEFINE_ZONE_MOTION (name, omega, axis, origin, velocity, time, dtime)

Argument Type

Description

symbol name

UDF name.

real *omega

Pointer to the rotational velocity magnitude, default 0.

real axis[3]

Rotation axis direction vector, default (0 0 1) and (1 0 0) for 2D axisymmetric cases.

real origin[3]

Rotation axis origin vector, default (0 0 0).

real velocity[3]

Translational velocity vector, default (0 0 0).

real current_time

Current time.

real dtime

Current time step.

Function returns

void

There are seven arguments to DEFINE_ZONE_MOTION: name, omega, axis, origin, velocity, time, and dtime. You supply name, the name of the UDF. The variables omega, axis, origin, velocity, time, and dtime are passed by the ANSYS Fluent solver to your UDF. Your UDF will need to compute the motion components that you want to modify. If a certain component is not modified by the UDF, it will retain its default value. The vector specified as axis does not need to be a unit vector; note that it will be normalized before it is used further inside the solver, that is, definitions such as (1 1 1) and (10 10 10) are equivalent.

All vectors are specified as 3 dimensional, even for 2D simulations. The third component of the origin and the translational velocity vectors will be ignored in 2D cases. For regular 2D cases, rotation is assumed to be around the Z axis. In a 2D axisymmetric case, the rotation is around the X axis. Hence, for 2D cases any modification to the axis vector inside the UDF will be ignored.

2.3.14.3. Example

The following UDF, named fmotion, computes the rotation rate of a cell zone, simulating start-up behavior. The angular velocity is increased linearly in time up to a flow time of 0.1 s, after which it remains constant. A constant translational velocity of 1 m/s in the X direction is assigned. The lines assigning the origin and axis vectors only repeat the default behavior, and could be omitted. The source can be interpreted or compiled.

#include "udf.h"
 DEFINE_ZONE_MOTION(fmotion,omega,axis,origin,velocity,time,dtime)
{
  if (time < 0.1) 
   {
    *omega = 2500.0 * time;
   }
	 else
   {
    *omega = 250.0;
   }
  N3V_D (velocity,=,1.0,0.0,0.0);
  N3V_S(origin,=,0.0);        /* default values, line could be omitted */
  N3V_D(axis,=,0.0,0.0,1.0);     /* default values, line could be omitted */

  return;
}

2.3.14.4. Hooking a Frame Motion UDF to ANSYS Fluent

After the UDF that you have defined using DEFINE_ZONE_MOTION is interpreted (Interpreting UDFs) or compiled (Compiling UDFs), the name of the argument that you supplied as the first DEFINE macro argument will become visible and selectable in the cell zone condition dialog boxes.

See Hooking DEFINE_ZONE_MOTION UDFs for details.


Release 18.2 - © ANSYS, Inc. All rights reserved.