Compiling Upfs: Sheldon Imaoka Memo Number: Sti0901 Ansys Release: 11.0 February 7, 2009
Compiling Upfs: Sheldon Imaoka Memo Number: Sti0901 Ansys Release: 11.0 February 7, 2009
Sheldon Imaoka
Memo Number: STI0901
ANSYS Release: 11.0
February 7, 2009
1 Introduction
2 Getting Started
Before getting started, the user should refer to two important ANSYS docu-
ments. The ANSYS Installation and Licensing Documentation is accessible
from an ANSYS installation or from the ANSYS Customer Portal.2 Within
this 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 mind
that 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 be
obtained from that site.3 This manual contains very useful information on
UPFs and supporting routines.
1
UPFs are also available on IBM AIX, Sun Solaris, SGI IRIX, and HP-UX systems.
2
http://www1.ansys.com/customer/
3
At ANSYS 12.0, the Programmer’s Manual for ANSYS is tentatively planned to be
included as part of the regular documentation of an ANSYS installation.
1
Sheldon’s ansys.net Tips Compiling UPFs
UPFs are not installed by default, so the user must verify that the cus-
tomization files are included on their computer. In the ANSYS installation
directory, a folder called “custom” should be present on Windows, whereas
on Linux, a subdirectory called “customize” should exist. If the user does
not find such a directory, the user should contact their IT administrator and
reinstall ANSYS, being sure to specify that the customization files also be
installed.
Lastly, the user should already be familiar with programming in Fortran,
but having a good Fortran programming book on hand can serve as a helpful
reference.
3 Overview of Process
5. With the supported linker, link the compiled object file and supplied
libraries to create a custom ANSYS executable.4
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
Sheldon’s ansys.net Tips Compiling UPFs
3
Sheldon’s ansys.net Tips Compiling UPFs
(a) to move all of the unused *.F files to a separate location to prevent un-
necessary compiling/linking or (b) to copy only necessary files and perform
the compiling/linking in a completely separate folder.
4
Sheldon’s ansys.net Tips Compiling UPFs
Once this is done, the IFORTVARS.BAT batch file can be called or run to
set up the correct PATH, LIB, and INCLUDE environment variables for the
Intel Fortran compiler and Microsoft linker. (While a user may define these
environment variables at the system level, the author does not recommend
doing this since that would prevent multiple compiler versions to be installed
and usable on the same PC.)
In the ANSYS installation directory, find ANSCUST.BAT in the “cus-
tom\user” folder. Open this in a text editor, and in the second line, add
the DOS command call <...>\ifortvars.bat, where <...> should be
replaced by the full path of the IFORTVARS.BAT batch file. If spaces are
present, enclose the full path in double-quotes. Also, the author prefers to
add a pause command at the very end of the ANSCUST.BAT file. That way,
one can double-click on the ANSCUST.BAT file, and the DOS window will not
disappear, allowing the user to determine whether compiling was successful
or not.
An alternative to modifying the batch files through the process described
above is to (1) open the appropriate Microsoft build environment command
prompt, (2) cd to the directory of the Intel Fortran compiler and execute
IFORTVARS.BAT, then (3) cd to the directory containing the subroutines and
run the ANSCUST.BAT script. This manually performs the steps described
earlier.
The files in the ANSYS “user\platform” subdirectory that are required
for compiling are as follows:
The author prefers copying the necessary files listed above to a separate
directory for compiling purposes.
Once this has been set up, one may double-click on the ANSCUST.BAT
batch file to create the new, customized ANSYS executable.
Once compiling is successful, the user should see several files created:
5
Sheldon’s ansys.net Tips Compiling UPFs
• There will be several ANSYS.* files, the most important of which are
the ANSYS.exe customized executable and ANSYS.exe.manifest man-
ifest files. The other files, such as ANSYS.lib and ANSYS.exp and
ANSYS.map are not required, although they can just be left in the di-
rectory.
6
Sheldon’s ansys.net Tips Compiling UPFs
which verifies that the customized rather than standard version is being
used.
4 Special Topics
4.1 Troubleshooting
Below are some troubleshooting tips.
7
Sheldon’s ansys.net Tips Compiling UPFs
4.2 Cross-Compiling
Although more of an “advanced” topic, it is worth noting that cross-compiling
is also possible. For example, on a 64-bit Windows PC, a user may create a
customized executable for 32-bit Windows, although it is not possible to cre-
ate a 64-bit Windows executable from a 32-bit Windows system. To cross-
compile, the user (a) must have a compiler that supports cross-compiling
and (b) needs to have that platform’s “custom” directory available.
To cross-compile 32-bit Windows on 64-bit Windows, do the following:
8
Sheldon’s ansys.net Tips Compiling UPFs
5 Conclusion
This memo attempted to cover some basic items related to creating one’s
own custom ANSYS executable on Windows and Linux.
References
9
Sheldon’s ansys.net Tips General Information
Sheldon’s ansys.net Tips and Tricks are available at the following URL:
http://ansys.net/sheldon tips/
Please remember that, with each release of ANSYS, new features and tech-
niques may be introduced, so please refer to the ANSYS documentation as
well as your local ANSYS support office to verify that these tips are the
most up-to-date method of performing tasks.
Disclaimer: the author has made attempts to ensure that the informa-
tion contained in this memo is accurate. However, the author assumes no
liability for any use (or misuse) of the information presented in this docu-
ment or accompanying files. Please refer to ansys.net for the latest version
of this document. Also, this memo and any accompanying input files are
not official ANSYS, Inc. documentation.
ANSYS Training
The XANSYS mailing list is a forum for exchanging ideas, providing and
receiving assistance from other users, and general discussions related to
ANSYS and Workbench. (Note that it is recommended to contact your
local ANSYS support office for technical support.) You can obtain more
information by visiting the following URL: http://www.xansys.org/
10