1.8. Creating a Customized UPF

After you make your changes to the user routines supplied on your product distribution medium, you can either:

For both Windows and Linux platforms, three methods of compiling and linking are available as detailed in the following table.

MethodTypical Use / AdvantagesOutput
/UPF command

For occasional use.

Simplest method useful for testing.

Source code can be displayed in the output file.

Creates a shared library (.so on Linux, .dll on Windows) for every /UPF command issued in the working directory and runs it at run time.
Create a shared library on Linux or a dynamic-link library on Windows

For frequent use with user or third-party libraries.

Advantageous if custom code is frequently used or shared with others.

To create a shared library on Linux or a dynamic-link library on Windows, use the ANSUSERSHARED script. One person installs the compilers and creates the library that can be shared with others and used without the need to compile.

On Windows, each user routine is built into a separate dynamic link library (.dll), and functions and data must be explicitly exported and imported. See Sharing Data Between User Routines.

On Linux, all user routines are contained in a single shared library, and data sharing is straightforward.

Creates a shared library (.so on Linux, .dll on Windows) in the working directory.
Create a custom executable

To create a permanently changed Mechanical APDL executable that is used by many users, or most of the time, use the ANS_ADMIN251 or the ANSCUST script.

Useful if you want to validate custom code.

Can be combined with the other two methods[a].

Creates a customized executable version of Mechanical APDL.

Creating a custom .exe in Windows circumvents the need for using the data sharing routines.

[a] In some cases, you may want to combine two methods. For example, you might:

  • first create a custom executable that contains user creep laws.

  • then use the ANS_USER_PATH environment variable to include a user material (or third-party library) created with the ANSUSERSHARED script.

For detailed compiling and linking procedures on different operating systems, see the following two sections: