25.3. Using UDFs to Compute Output Parameters

Ansys Fluent allows you to create output parameters that let you compare reporting values for different cases. Output parameters are typically defined and computed through the graphical user interface and not accessible through user defined functions (UDFs).

If the beta-feature-access option is enabled in Ansys Fluent (as described in Introduction), you can compute and publish real output parameter values computed by UDFs to Workbench (or Ansys Fluent). When the beta feature is enabled, a new output parameter type called udf is available once you invoke the create command in the define/parameters/output-parameters menu. The create command has been extended to allow you to create a UDF-based output parameter. Using a registered UDF, you can compute your own output quantity. Currently, this command is called by Fluent in Workbench at the end of a calculation. When you select the udf type, you are prompted for information regarding the name of the output parameter, the user-defined function, the name of any input parameters, etc. When you are finished, you are left with a specific output parameter that uses a UDF that in turn may consume one or more input parameters. For example:

define/parameters/output-parameters> create

Output Parameter Type> 
drag-coefficient   lift-coefficient          udf
flux               moment-coefficient      volume-integral
force              surface-integral

Name of Output Parameter ["parameter-1"] 
Available udf of type output-parameter: ("mylibudf::libudf")
output-parameter UDF function name ["mylibudf::libudf"] 
Do you want to use Input Parameters in the UDF Output Parameter? [no] yes

Enter the no. of Input Parameters to be used in UDF [0] 2
Name of Input Parameter ["parameter-3"] 
parameter-3 value [0] 2
Name of Input Parameter ["parameter-4"] 
parameter-4 value [0] 3

To see the value of a particular output parameter, run the calculation for a few iterations (or initialize the solution), then type the define/parameters/output–parameters/print–to–console text command.