![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
You are now ready to interpret or compile the profile UDF (named inlet_x_velocity) that you created in Step 2 and is contained within the source file named myexample.c. In general, you must compile your function as a compiled UDF if the source code contains structured reference calls or other elements of C that are not handled by the ANSYS FLUENT interpreter. To determine whether you should compile or interpret your UDF, see Section 1.5.1.
Interpret the Source File
Follow the procedure below to interpret your source file in ANSYS FLUENT. For more information on interpreting UDFs, see Chapter 4.
|
Note that this step does not apply to Windows parallel networks. See Section
4.2 for details.
|
Define
User-Defined
Functions
Interpreted...
In the Select File dialog box, select the desired file (e.g., myexample.c) and click OK. The Select File dialog box will close and the complete path to the file you selected will appear in the Source File Name text box in the Interpreted UDFs dialog box (Figure 8.1.4).
inlet_x_velocity: .local.pointer thread (r0) .local.int position (r1) 0 .local.end 0 save .local.int x (r3) 1 begin.data 8 bytes, 0 bytes initialized: .local.float y (r4) 5 push.float 0 .local.float h (r5) . . . . . . 142 pre.inc.int f (r6) 144 pop.int 145 b .L3 (28) .L2: 147 restore 148 restore 149 ret.v |
|
Note that if your compilation is unsuccessful, then
ANSYS FLUENT will report an error and you will need to debug your program. See Section
4.3 for details.
|
Compile the Source File
You can compile your UDF using the text user interface (TUI) or the graphical user interface (GUI) in ANSYS FLUENT. The GUI option for compiling a source file on a Windows system is discussed below. For details about compiling on other platforms, using the TUI to compile your function, or for general questions about compiling UDFs in ANSYS FLUENT see Chapter 5.
Define
User-Defined
Functions
Compiled...
In the Select File dialog box, select the desired file (e.g., udfexample.c) you want to compile. The complete path to the source file will then be displayed under Source File(s). Click OK. The Select File dialog box will close and the file you added will appear in the Source Files list in the Compiled UDFs dialog box.
In a similar manner, select the Header Files that need to be included in the compilation.
As the compile/build process begins, a Warning dialog box will appear, reminding you that the UDF source file must be in the folder that contains your case and data files (i.e., your working folder). If you have an existing library folder (e.g., libudf) then you will need to remove it prior to the build, to ensure that the latest files are used. Click OK to close the dialog box and resume the compile/build process. The results of the build will be displayed in the console. You can view the compilation history in the log file that is saved in your working folder.
|
If the compile/build is unsuccessful, then
ANSYS FLUENT will report an error and you will need to debug your program before continuing. See Section
5.6 for a list of common errors.
|
Opening library "libudf"... Library "libudf\ntx86\2d\libudf.dll" opened inlet_x_velocity Done. |
See Chapter 5 for more information on the compile/build process.