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

4.2 Interpreting a UDF Source File Using the Interpreted UDFs Dialog Box

This section presents the steps for interpreting a source file in ANSYS FLUENT. After it has been interpreted, the names of UDFs contained within the source file will appear in drop-down lists in graphics dialog boxes in ANSYS FLUENT.

The general procedure for interpreting a source file is as follows:

1.   Make sure that the UDF source file is in the same folder that contains your case and data files.

figure   

If you are running the parallel version of ANSYS FLUENT on a network of Windows machines, you must `share' the working folder that contains your UDF source, case, and data files so that all of the compute nodes in the cluster can see it. To share the working folder, open Windows Explorer and browse to the folder; right-click on the working folder, select Sharing and Security from the menu, click Share this folder, and click OK.

2.   For UNIX/Linux, start ANSYS FLUENT from the directory that contains your case, data, and UDF source files. For Windows, start ANSYS FLUENT using FLUENT Launcher, being sure to specify the folder that contains your case, data, and UDF source files in the Working Directory text box in the General Options tab.

3.   Read (or set up) your case file.

4.   Interpret the UDF using the Interpreted UDFs dialog box (Figure  4.2.1).

Define $\rightarrow$ User-Defined $\rightarrow$ Functions $\rightarrow$ Interpreted...

Figure 4.2.1: The Interpreted UDFs Dialog Box
figure

(a)   Indicate the UDF source file you want to interpret by clicking the Browse... button. This will open the Select File dialog box (Figure  4.2.2).

Figure 4.2.2: The Select File Dialog Box
figure

In the Select File dialog box, select the desired file (e.g., udfexample.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  4.2.1).

(b)   In the Interpreted UDFs dialog box, specify the C preprocessor to be used in the CPP Command Name text box. You can keep the default cpp or you can enable the Use Contributed CPP option to use the preprocessor supplied by ANSYS FLUENT.

(c)   Keep the default Stack Size setting of 10000, unless the number of local variables in your function will cause the stack to overflow. In this case, set the Stack Size to a number that is greater than the number of local variables used.

(d)   Enable the Display Assembly Listing option on if you want a listing of assembly language code to appear in the console when the function interprets. This option will be saved in your case file, so that when you read the case in a subsequent ANSYS FLUENT session, the assembly code will be automatically displayed.

(e)   Click Interpret to interpret your UDF.

If the compilation is successful and you have enabled Display Assembly Listing, then the assembler code will be displayed in the console. If you chose not to display the listing and the compilation is successful, then the CPP Command Name that was executed will be displayed the console. If the compilation is unsuccessful, then ANSYS FLUENT will report an error and you will need to debug your program. See Section  4.3. You can also view the compilation history in the log file that is saved in your working folder.

(f)    Close the Interpreted UDFs Dialog Box when the interpreter has finished.

5.   Write the case file . The interpreted function(s) will be saved with the case file, and automatically interpreted when the case file is subsequently read.


next up previous contents index Previous: 4.1.2 Limitations
Up: 4. Interpreting UDFs
Next: 4.3 Common Errors Made
Release 12.0 © ANSYS, Inc. 2009-01-14