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

3.7.2 Customize fiber_fluent_interface.c for Your Fiber Model Application

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.

1.   In your working directory, change directories to fiber/src. The /src directory contains the UDF template source file fluent_interface_fiber.c.

2.   In the /src directory, use any text editor and edit fiber_fluent_interface.c.

3.   Scroll down to the bottom of the fiber_fluent_interface.c file to the section that contains three concatenated functions for friction factor (drag coefficient), heat transfer coefficient, and mass transfer coefficient, respectively. These are the UDFs that you can modify and customize.

4.   Edit the function(s) you desire for your particular application. Save fiber_fluent_interface.c and overwrite the existing file.

figure   

Do not save the file with another name since it will not be recognized by the system.

figure   

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, $u_f - u_{par}$ ( 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 $\alpha$ is computed from the Nusselt number using the thermal conductivity of the surrounding fluid, $\lambda$, ( 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.

figure   

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.


next up previous contents Previous: 3.7.1 UDF Setup
Up: 3.7 User-Defined Functions (UDFs)
Next: 3.7.3 Compile Fiber Model
Release 12.0 © ANSYS, Inc. 2009-01-05