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.
In your working directory, change directories to fiber/src. The /src directory contains the UDF template source file fiber_fluent_interface.c.
In the /src directory, use any text editor and edit fiber_fluent_interface.c.
Scroll down to the bottom of the fiber_fluent_interface.c file to the section that contains concatenated functions for friction factor (drag coefficient), heat transfer coefficient, mass transfer coefficient, fiber viscosity, fiber density, fiber thermal conductivity, fiber specific heat, and vapor liquid equilibrium, respectively. These are the UDFs that you can modify and customize.
Edit the function(s) you require for your particular application. Save fiber_fluent_interface.c and overwrite the existing file.
Important: Do not save the file with another name because it will not be recognized by the system.
Important: The function names of the templates user_friction_factor, user_heat_transfer_coefficient, and user_mass_transfer_coefficient must not be altered because they are called by other routines in the continuous
fiber model.
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 must not, under any circumstances, be altered
because 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; iFIB_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.
Important: 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 run time errors.
You can also calculate fiber material properties using UDFs. ANSYS Fluent provides a UDF template for every fiber property. You can modify the UDF templates for your specific case.
The template for the fiber density is as follows:
real User_Fiber_Specific_Heat(Fiber *f, real temp, real liq, int i)
{
real yi[MAX_SPE_EQNS];
real cp_p;
/* compute cp based on FLUENT's standard procedure selected in materials panel */
cp_p = Specific_Heat(FIB_MATERIAL_POLYMER(f), temp, 0., yi);
if (FIB_DRY_SPINNING(f))
{
real cp_s;
cp_s = Specific_Heat(FIB_MATERIAL_SOLVENT(f), temp, 0., yi);
return cp_p*(1.-liq)+cp_s*liq;
}
return cp_p;
}Important: The function names of the templates User_Friction_Factor, User_Heat_Transfer_Coefficient, User_Mass_Transfer_Coefficient, User_Fiber_Viscosity, User_Fiber_Density, User_Fiber_Thermal_Conductivity, User_Fiber_Specific_Heat, and User_Fiber_Vle must not be altered since they are called
by other routines of the continuous fiber model.
All variables and macros defined in the header files are provided
with the continuous fiber model. For example, you will find the type
definition Fiber and the macros to access
variables of a single fiber in the header file fiber.h. The temporary variables used in the type definition of Local_Fiber_Data_Type can be found in the header file fib-mem.h.
Important: You must not modify the header files provided with the continuous fiber model. Otherwise the compiled library will not be compatible with ANSYS Fluent resulting in runtime errors (messages will be printed in the console).