You can use DEFINE_ANISOTROPIC_CONDUCTIVITY to specify the conductivity matrix in a solid, in order to simulate
anisotropic thermal conductivity. For details about user-defined anisotropic
conductivity, see User-Defined Anisotropic Thermal Conductivity in the
User’s Guide.
DEFINE_ANISOTROPIC_CONDUCTIVITY (name, c, t, dmatrix)
|
Argument Type |
Description |
|
|
UDF name. |
|
|
Cell index. |
|
|
Pointer to the cell thread on which the anisotropic conductivity is to be applied. |
|
|
Anisotropic conductivity matrix to be filled in by the user. |
Function returns
void
There are four arguments to DEFINE_ANISOTROPIC_CONDUCTIVITY: name, c, t, and dmatrix. You supply name, the name of the UDF. c, t, and dmatrix are variables that are passed by the ANSYS Fluent solver to your UDF.
Your function will compute the conductivity matrix for a single cell
and fill dmatrix with it. Note that anisotropic
conductivity UDFs are called by ANSYS Fluent from within a loop on cell
threads. Consequently, your UDF will not need to loop over cells in
a thread since ANSYS Fluent is doing it outside of the function call.
The following UDF, named cyl_ortho_cond computes the anisotropic conductivity matrix for a cylindrical shell
that has different conductivities in radial, tangential, and axial
directions. This function can be executed as a compiled UDF.
/******************************************************************************
UDF for defining the anisotropic conductivity matrix for a cylindrical shell
******************************************************************************/
#include "udf.h"
/* Computation of anisotropic conductivity matrix for
* cylindrical orthotropic conductivity */
/* axis definition for cylindrical conductivity */
static const real origin[3] = {0.0, 0.0, 0.0};
static const real axis[3] = {0.0, 0.0, 1.0};
/* conductivities in radial, tangential and axial directions */
static const real cond[3] = {1.0, 0.01, 0.01};
DEFINE_ANISOTROPIC_CONDUCTIVITY(cyl_ortho_cond,c,t,dmatrix)
{
real x[3][3]; /* principal direction matrix for cell in cartesian coords. */
real xcent[ND_ND];
real R;
C_CENTROID(xcent,c,t);
NV_VV(x[0],=,xcent,-,origin);
#if RP_3D
NV_V(x[2],=,axis);
#endif
#if RP_3D
R = NV_DOT(x[0],x[2]);
NV_VS(x[0],-=,x[2],*,R);
#endif
R = NV_MAG(x[0]);
if (R > 0.0)
NV_S(x[0],/=,R);
#if RP_3D
N3V_CROSS(x[1],x[2],x[0]);
#else
x[1][0] = -x[0][1];
x[1][1] = x[0][0];
#endif
/* dmatrix is computed as xT*cond*x */
dmatrix[0][0] = cond[0]*x[0][0]*x[0][0]
+ cond[1]*x[1][0]*x[1][0]
#if RP_3D
+ cond[2]*x[2][0]*x[2][0]
#endif
;
dmatrix[1][1] = cond[0]*x[0][1]*x[0][1]
+ cond[1]*x[1][1]*x[1][1]
#if RP_3D
+ cond[2]*x[2][1]*x[2][1]
#endif
;
dmatrix[1][0] = cond[0]*x[0][1]*x[0][0]
+ cond[1]*x[1][1]*x[1][0]
#if RP_3D
+ cond[2]*x[2][1]*x[2][0]
#endif
;
dmatrix[0][1] = dmatrix[1][0];
#if RP_3D
dmatrix[2][2] = cond[0]*x[0][2]*x[0][2]
+ cond[1]*x[1][2]*x[1][2]
+ cond[2]*x[2][2]*x[2][2]
;
dmatrix[0][2] = cond[0]*x[0][0]*x[0][2]
+ cond[1]*x[1][0]*x[1][2]
+ cond[2]*x[2][0]*x[2][2]
;
dmatrix[2][0] = dmatrix[0][2];
dmatrix[1][2] = cond[0]*x[0][1]*x[0][2]
+ cond[1]*x[1][1]*x[1][2]
+ cond[2]*x[2][1]*x[2][2]
;
dmatrix[2][1] = dmatrix[1][2];
#endif
}
After the UDF that you have defined using DEFINE_ANISOTROPIC_CONDUCTIVITY is interpreted (Interpreting UDFs)
or compiled (Compiling UDFs), the name
of the argument that you supplied as the first DEFINE macro argument (for example, cyl_ortho_cond) will become visible and selectable in the Create/Edit
Materials dialog box in ANSYS Fluent. See Hooking DEFINE_ANISOTROPIC_CONDUCTIVITY UDFs for details.