/  10
 
Compiling UPFs
Sheldon ImaokaMemo Number: STI0901ANSYS Release: 11.0February 7, 2009
1 Introduction
ANSYS User Programmable Features (UPFs) are quite powerful means of customizing ANSYS beyond the scripting capabilities of the ANSYS Para-metric Design Language (APDL). Writing one’s own constitutive modelsor complex loading functions or even creating a user-defined element arepossible with UPFs.Because some users may find it challenging to get started using UPFs,this memo hopes to discuss general issues related to compiling and linkinga customized version of ANSYS for Windows and Linux environments.
1
2 Getting Started
Before getting started, the user should refer to two important ANSYS docu-ments. The
ANSYS Installation and Licensing Documentation 
is accessiblefrom an ANSYS installation or from the ANSYS Customer Portal.
2
Withinthis document are the
ANSYS, Inc. Windows Installation Guide
and the
ANSYS, Inc. UNIX/Linux Installation Guide
, both of which list the re-quired compilers for each operating system. The user should keep in mindthat only the versions of the compilers noted in these documents are sup-ported and have been tested, although newer versions may be OK.The second important reference is the
Programmer’s Manual for AN-SYS 
, which only available from the ANSYS Customer Portal and must beobtained from that site.
3
This manual contains very useful information onUPFs and supporting routines.
1
UPFs are also available on IBM AIX, Sun Solaris, SGI IRIX, and HP-UX systems.
2
3
At ANSYS 12.0, the
Programmer’s Manual for ANSYS 
is tentatively planned to beincluded as part of the regular documentation of an ANSYS installation.
1
 
Sheldons ansys.net Tips Compiling UPFsUPFs are not installed by default, so the user must verify that the cus-tomization files are included on their computer. In the ANSYS installationdirectory, a folder called “custom” should be present on Windows, whereason Linux, a subdirectory called “customize” should exist. If the user doesnot find such a directory, the user should contact their IT administrator andreinstall ANSYS, being sure to specify that the customization files also beinstalled.Lastly, the user should already be familiar with programming in Fortran,but having a good Fortran programming book on hand can serve as a helpfulreference.
3 Overview of Process
User Programmable Features typically involve writing subroutines in For-tran. In ANSYS, Fortran 90 is the supported language, and there are manyexamples in the “custom” or “customize” directory for each of the supporteduser subroutines.The general steps are as follows:1. Assess whether the desired feature/capability is best implemented byAPDL or by UPFs.2. If UPFs are needed, check Reference[2]to determine which subroutine is best suited for the task.3. Find the example subroutine in the “custom” or “customize” directoryand modify it accordingly.4. With the supported compiler listed in Reference[1], compile subrou- tine to create the object file.5. With the supported linker, link the compiled object file and suppliedlibraries to create a custom ANSYS executable.
4
6. Run the customized ANSYS executable. In the ANSYS session, acti-vate the user-programmable feature using the relevant ANSYS com-mand.The following subsections will discuss the above process in more detail.
4
On Linux systems, it is possible to create a shared library instead of an executable.See Section 5.9 in Ref [2] for details.
2
 
Sheldons ansys.net Tips Compiling UPFs
3.1 APDL vs. UPFs
While this may sound trivial, there have been many situations where usershave mistakenly thought that UPFs were required for tasks that are easierto perform using APDL. While APDL can be thought of as a scripting lan-guage that may be slower to execute than compiled code, APDL has vectorfunctions that speed up tasks considerably. Moreover, changing/adjustingAPDL input files is much easier than modifying subroutines and recompil-ing/relinking. Hence, the user should consider whether or not the desiredfunctionality can be achieved with APDL, as that would generally be a mucheasier, quicker approach than implementing UPFs.
3.2 Determining the Right Subroutine to Use
In Reference[2], there are many subroutines to choose from, and some may seem to provide duplicate functionality with other subroutines. There aresome legacy subroutines available for users who may wish, for one reasonor another, to stick with older elements or older features. The “newer”subroutines are typically associated with the current-technology elements.
5
For example, to define one’s own nonlinear constitutive model, considerusing
USERMAT.F
instead of 
USERPL.F
.
3.3 Compiling and Linking UPFs
Example UPFs are provided in the “user” folder of the “custom” (Win-dows) or “customize” (Linux) subdirectories. Also with the example UPFsis a script called
ANSCUSTOM
(
ANSCUST.BAT
on Windows) that facilitates link-ing/compiling. Before running that script, it is important to note
ANSCUSTOM
on any operating system needs to know (a) where the compiling/linking ex-ecutables reside, (b) where system “include” files are located, and (c) where“libraries” are located. These are usually achieved through the definition of the PATH, INCLUDE, and LIB environment variables.All of the user subroutines are in the same folder, so if the user decidesto compile in the “user” folder, compiling may take a while since all usersubroutines will be compiled and linked together.
6
The author prefers either
5
Current technology elements include
LINK180
,
BEAM188-189
,
SHELL181/281
,
SHELL208-209
,
SOLSH190
,
SOLID185-187
, and
PLANE182/183
. At ANSYS 12.0, elements
SOLID272-273
,
SOLID285
,
PIPE288-289
, and
ELBOW290
will be added to this list.
6
At ANSYS 12.0, the design may be changed on the Windows platform such thatexample subroutines are in one folder and the
ANSCUST.BAT
script in a separate folder toprevent this behavior.
3

Share & Embed

More from this user

Add a Comment

Characters: ...