1.2. What You Should Know Before Using UPFs

Before you do anything with linked UPFs, contact your on-site system support person to get the permissions needed to access the appropriate Ansys, Inc. files.

The UPF subroutines are written in Fortran; some extensions are used. They contain comments intended to give you enough detail to develop your own versions of the subroutines.

User routines that can be modified have the term "USERDISTRIB" in the first line of the routine. These routines are provided with the Ansys, Inc. distribution media. You can modify these routines to tailor the program to your specific needs. Certain other routines described in this document are not provided on the distribution media, but can be called using the provided header information.

To use UPFs successfully, you need strong working knowledge of the following:

  • The Mechanical APDL program.

  • The UPF subroutines themselves. Study the UPF subroutines before customizing them, and make sure that you fully understand the subroutines, as well as any applicable functions. Unless you review them carefully, a few UPF subroutines may seem like a maze with many logic paths to consider. You may have to set special variables correctly in order to run your custom Mechanical APDL solution without errors. Even if you have in-depth knowledge of the Mechanical APDL input and your desired outputs, you still need to ensure that everything that must be done in the UPF subroutines is done properly in your custom version.

  • Fortran. Besides knowing how to write Fortran subroutines, you must be sure that the level of the Fortran compiler is as least as high as the level mentioned in your Ansys, Inc. installation manual. For more information on Fortran compilers, refer to the installation guide specific to your operating system (Ansys, Inc. Linux Installation Guide or Ansys, Inc. Windows Installation Guide). You also need to know what to do should the computer abort the program due to an arithmetic error, a file read error, a memory access error, and so on.

  • The mathematics of the phenomenon you are planning to include.

Important

  • UPFs are not available or will behave unpredictably in certain data center environments or on some hardware configurations. You should take special care when using UPFs on parallel systems. It is a good practice to verify your coding with single processing by using the -np,1 option before you run your analysis. For additional information, consult your installation guide or your on-site Ansys system-support person

  • Carefully consider whether you wish to use UPFs, especially if you are linking them into Mechanical APDL (rather than into a shared library for use as external commands). When you add your own routines to Mechanical APDL by either method, you are creating a custom, site-dependent version of the program. Ansys, Inc. considers the use of UPFs a nonstandard use of the program, one that the Ansys, Inc. Quality Assurance verification testing program does not cover. Therefore, you are responsible for verifying that the results produced are accurate and that your customizations do not adversely affect unchanged areas of the Mechanical APDL program.

  • Although the flexibility that UPFs offer can be highly attractive, UPF usage is a complicated process that can introduce errors. Consider what you want your customizations to accomplish. You may be able to customize Mechanical APDL more easily and safely with macros than with UPFs.

  • When using shared memory, all user-programmable features are supported except for common block variables in Fortran and external variables in C or C++. You should avoid overwriting the values of these variables by multiple cores at the same time.

  • For distributed-memory parallel (DMP) solutions, all user-programmable features are supported except for global (often in common block) variables in Fortran and global (often external) variables in C or C++. You should avoid overwriting the values of these variables; they should have the same values across all cores used in the distributed solution.

For other guidelines for nonstandard uses of the Mechanical APDL program, see User-Programmable Features and Nonstandard Uses in the Advanced Analysis Guide.