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