3.4.2. The ND Macros

The use of ND macros in a UDF allows you to include general 3D expressions in your code, and the ND macros take care of removing the z components of a vector when you are compiling with RP_2D.

3.4.2.1. ND_ND

The constant ND_ND is defined as 2 for RP_2D (ANSYS Fluent 2D) and 3 for RP_3D (ANSYS Fluent 3D). It can be used when you want to build a matrix in 2D and a matrix in 3D. When you use ND_ND, your UDF will work for both 2D and 3D cases, without requiring any modifications.

 real A[ND_ND][ND_ND]
 
 for (i=0; i<ND_ND; ++i)
  for (j=0; j<ND_ND; ++j)
  A[i][j] = f(i, j); 

3.4.2.2. ND_SUM

The utility ND_SUM computes the sum of ND_ND arguments.

 ND_SUM(x, y, z)
  2D: x + y;
  3D: x + y + z;
 

3.4.2.3. ND_SET

The utility ND_SET generates ND_ND assignment statements.

 ND_SET(u, v, w, C_U(c, t), C_V(c, t), C_W(c, t))
  u = C_U(c, t);
  v = C_V(c, t);
 
 if 3D:
 21
  w = C_W(c, t);
 

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