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

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.



ND_ND


The constant ND_ND is defined as 2 for RP_2D ( ANSYS FLUENT 2D) and RP_3D ( ANSYS FLUENT 3D). It can be used when you want to build a $2 \times 2$ matrix in 2D and a $3 \times 3$ 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);



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;



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);


next up previous contents index Previous: 3.4.1 Macros for Dealing
Up: 3.4 Vector and Dimension
Next: 3.4.3 The NV Macros
Release 12.0 © ANSYS, Inc. 2009-01-14