UDF Folder

When creating an extension for Fluent, in the XML file, the element <simdata> can have a child <udf> element. This element specifies the location of the folder containing UDF libraries.

<simdata context="Fluent">
	<udf folder="udf_library"></udf>
  </simdata>

The path that you supply for the UDF folder uses the same logic as the path that you supply for the extension's IronPython script, where src is the path relative to the extension folder:

<script src="main.py"/>

Paths for both of these elements are relative to the extension folder. However, the element <script> requires a file relative path, while the element <udf> requires a folder relative path.

Sample XML code for a Fluent extension with the element <udf> follows. The extension FluentTest is a theoretical example.

<extension name="FluentTest" version="1" icon="icon.png">
  <guid>36DB3B25-C5E2-4E43-9A04-BA53AA7DC05A</guid>
  <author>Ansys, Inc.</author>
  <interface context="Fluent"></interface>
  <description>A sample extension for Fluent with UDF encapsulation</description>
  <script src="main.py" />
  <simdata context="Fluent">
	<udf folder="udf_library"></udf>
  </simdata>
</extension>

Because the UDF libraries in the specified folder are packaged with the extension, when this extension is installed, these libraries can be loaded.

When you specify the UDF folder name in the element <udf>, do not specify a Fluent version. The extension automatically appends the Fluent version in which the extension is running to the name of the folder. However, because UDF libraries are version-dependent, you must name each of the real UDF folders with the specified name followed by an underscore and the version.

In the previous example, the name specified for the UDF folder is udf_library. However, the real folders are named udf_library followed by an underscore and then the Fluent versions. The extension searches for the name given in the element <udf> followed by the Fluent version in which you are running the extension.

Thus, the naming convention of the UDF folder in the XML file is foldername, and the naming convention for the real folder is foldername_Fluent_version.