|
|
Now that you have copied the fiber directory to your working directory, you can edit the UDF template file and customize it to fit your model needs.
|
|
Do not save the file with another name since it will not be recognized by the system.
|
|
|
The function names of the templates
user_friction_factor,
user_heat_transfer_coefficient, and
user_mass_transfer_coefficient
must not be altered since they are called by other routines in the continuous fiber model.
|
Example Heat Transfer Coefficient UDF
Below is an example of a heat transfer coefficient UDF that is defined in fiber_fluent_interface.c. The function is taken from Kase and Matsuo [ 3] and is implemented as the kase-matsuo-1 option in the fiber model. The function name user_heat_transfer_coefficient cannot, under any circumstances, be altered since it is called by other functions in the continuous fiber model.
There are two arguments to the
user_heat_transfer_coefficient UDF:
Fiber and
Local_Fiber_Data_Type.
Fiber *f is a pointer to the fiber structure that contains information about the fiber and
Local_Fiber_Data_Type *fd accesses temporary variables that are needed during the calculation of the fiber.
In the sample UDF below, a loop is performed over all fiber grid cells using the macro
FIB_N(f) which represents the number of grid cells for the fiber
f. The Reynolds number is computed based on the relative velocity,
(
ABS(FIB_C_U(f,i)-fd->up[i])), the fiber diameter
FIB_C_D(f,i), the density of the surrounding fluid
fd->rho[i], and the viscosity of the surrounding fluid
fd->vis[i]. The heat transfer coefficient
is computed from the Nusselt number using the thermal conductivity of the surrounding fluid,
, (
fd->k[i]) and is stored in
fd->alpha[i].
void
user_heat_transfer_coefficient(Fiber *f, Local_Fiber_Data_Type *fd)
{
int i;
real Red, Nud;
/* model from Kase/Matsuo (1967) */
for (i=0; i<FIB_N(f); i++)
{
/* compute Reynolds number based on relative velocity */
Red = ABS(FIB_C_U(f,i)-fd->up[i])*FIB_C_D(f,i)*fd->rho[i]/fd->vis[i];
Nud = 0.42*pow(Red, 0.334);
/* store heat transfer coefficient for latter use */
fd->alpha[i] = Nud*fd->k[i]/FIB_C_D(f,i);
}
}
|
All variables and macros that are used in
user_heat_transfer_coefficient are defined in header files provided with the continuous fiber model. For example, you will find the type definition
Fiber and the macros that are used to access variables of a single fiber in the header file
fiber.h. Temporary variables used in the type definition of
Local_Fiber_Data_Type can be found in the header file
fib-mem.h.
|
|
Note that you must not modify the header files provided with the continuous fiber model. Otherwise the compiled library will not be compatible with
ANSYS FLUENT and will show runtime errors.
|