You are on page 1of 3

User Defined Functions

Problem Specification

Consider the case of a fluid flowing past a cylinder, as in the steady cylinder case, with a  Reynolds number of 20. 
By altering the cylinder wall boundaries to include sucking and blowing jets, separation can be eliminated and the lift force on the
cylinder can be increased. 
The lift L is specified as (neglecting viscous shear):

Fluent can only integrate for the lift coefficient over sections specified as walls; in this problem some sections of the cylinder wall will be
specified as velocity inflows or outflows and not as walls. User-defined functions (UDFs) will be used to integrate over the entire
cylinder for the lift coefficient. User-defined functions are C functions used to enhance features of the FLUENT solver.

Pre-Analysis & Start-Up

This tutorial demonstrates the use of user-defined functions through boundary control of a cylinder. 
First, complete the "Steady Flow past a Cylinder tutorial before completing this tutorial.
To start-up, open your completed "Steady Flow Past a Cylinder" project file. (If using the completed version in the zip file above, extract
the files and open "Cylinder.wbpj".)
Right-click on Fluid Flow (FLUENT) and then click Duplicate. Enter "Boundary Controlled" in the highlighted field to rename it.
Geometry

UDF_geometry
Mesh
The following video shows how to regenerate the mesh and create named selections for each of the cylinder boundary sections. (If the
video doesn't appear in your browser, try reloading the webpage) 
UDF_mesh

Physics Setup

The physics set up is shown in the video below. Velocity could alternately be adjusted to attain Re=20. Cylinder wall sections 0 and 20
are adjusted to 0.4m/s velocity inlet, and 18 and 3 are adjusted to -0.4m/s, as velocity outlets.
UDF_Physics
Numerical Solution

The strategy for computing the lift force using the UDF is as follows:
1. Turn on a 'user defined scaler' φ which Fluent will solve for
2. On the cylinder surface, set the below equation by implementing the UDF as a boundary condition
for φ 
3. Run at least one iteration to integrate φ over the cylinder surface 

Note that the liftFunc UDF calculates a side force that is NOT normalized. So you'll have to divide the reported value by
0.5*rho*v^2*D*1 to get the normalized side force. This is because when you integrate liftFunc, you get the integral of -p*sin(theta) on
the chosen surfaces.

User-defined function implementation to obtain the lift coefficient around the cylinder is as follows. 
UDF_UDF
Numerical Results

A plot of the velocity contours in the Post-Processor will demonstrate the effect of the jets on the flow.

Verification and Validation

Verify that the user defined function is correct. Calculate the user-defined scalar only for a single wall boundary, by going to Results-
>Reports->Surface Integrals, and selecting the type as an Integral, and the field variable as the User Defined Scalar on the desired wall
section, and clicking 'Compute'. This can be compared to the lift calculated in Fluent under Results->Reports->Forces and printing the
lift coefficient on the same wall section.  
Exercises

The user defined function downloaded in the first section is only applicable to cylindrical boundaries due to the definition of the lift
function as a function of theta. Alter the UDF to be applicable to any surface geometry, such as an airfoil, and verify that it calculates the
same value for the cylinder as the UDF for this section.

You might also like