9.1. User-Programmable Features (UPFs)

User-programmable features (UPFs) are for which you can write your own FORTRAN routines. UPFs allow you to customize the program to your needs, which may be a user-defined material-behavior option, element, failure criterion (for composites), and so on. You can even write your own design-optimization algorithm that calls the entire program as a subroutine. UPFs are available in the Ansys Mechanical Enterprise family of products. For detailed information, see the Guide to User-Programmable Features in the Programmer's Reference.


Caution:  By linking in your own FORTRAN routines, you are creating a custom, site-specific version of the program. When you use UPFs, you are using the program in a nonstandard way, one that Ansys, Inc. verification testing does not cover. You are responsible for verifying that the results produced are accurate and that the routines you link do not adversely affect other, standard areas of the program.

Exercise care when using UPFs on parallel systems. Do not use the /CONFIG command or a config.ans file to activate parallelism on a system with UPFs.


The following topics concerning UPFs are available:

9.1.1. Understanding UPFs

UPFs can range from a simple element output routine for custom output to a much more complex user element or user-optimization algorithm; therefore, it is difficult to present the process without describing specific programming details. This section presents a general sequence of steps to follow. The Guide to User-Programmable Features in the Programmer's Reference contains more detail on UPFs.

A typical UPF involves the following steps:

  1. Design and program the desired user routine in FORTRAN. For more information on FORTRAN compilers please refer to either the Ansys, Inc. Windows Installation Guide or the Ansys, Inc. Linux Installation Guide for details specific to your platform or operating system. The source codes for all user routines are available on your Ansys, Inc. distribution medium. Most of them demonstrate at least simple functionality.

  2. Compile and link your user routine into the program. The Guide to User-Programmable Features describes how to do this on your system.

  3. Verify that the changes you have made do not affect other, standard features. (One way to do so is by running a set of Mechanical APDL Verification Manual problems.)

  4. Verify the user routine using whatever procedures you feel are adequate.

The program activates some UPFs (such as user elements) automatically when you use them. For example, to activate a user element, all you need to do is specify it as one of the element types in the model (via the ET command), set the element type attribute pointer (via the TYPE command) ), and define elements using the solid modeling (AMESH, VMESH, etc.) or direct generation (ET, etc.) method.

For other UPFs, you must issue the USRCAL command to activate them. If you do not issue the command, standard program logic applies by default.

For example, when you apply a convection load, the default is to use standard program logic even if you have linked a user convection routine. You must activate the appropriate user routine with the USRCAL command if you want the user convection routine to be used. Refer to the USRCAL command description for a list of user routines affected by the command. Use the NSVR command to define the number of extra variables that need to be saved for such user-programmable element options as user plasticity. (The NSVR command has no equivalent GUI path.)

Another useful command is /UCMD, which allows you to create your own command from a user routine. Suppose you link in a user routine for a parabolic distribution of pressure. If you name the routine USERnn (where nn = 01 to 10), you can create your own command to call the routine:

/UCMD,PARAB,1

PARAB now becomes a valid command that simply calls the user routine USER01. You can call up to ten such user routines as commands. By including /UCMD commands in your start-up file (start.ans), you can make the user routines available in all of your sessions.

9.1.2. Types of UPFs Available

Many UPFs are available in the program. Following is a brief description of each:

User-Programmable Features
User-defined elements Define your own element type. You can add it to the element library and use it as you would any other element. See User-Defined Elements in the Element Reference, and Creating a New Element in the Programmer's Reference.
User-defined materials Define your own material model. See Customizing Material Behavior and Subroutines for Customizing Material Behavior in the Programmer's Reference.
User-defined contact interfacial behaviors Contact elements (CONTA172, CONTA174, CONTA175, CONTA177, and CONTA178) enable you to define your own interfacial behaviors between surfaces. See Subroutines for Customizing Contact Interfacial Behavior in the Programmer's Reference.
User real constants Elements COMBIN37, CONTA172, CONTA174, CONTA175, CONTA177, and CONTA178 allow the input real constants to be modified based upon your own nonlinear function.
User thickness Available for SHELL181, SHELL208, SHELL209, and SHELL281.
User stresses Available for LINK180, SHELL181, PLANE182, PLANE183, SOLID185, SOLID186, SOLID187, SOLSH190, BEAM188, BEAM189, SHELL208, SHELL209, REINF264, SHELL281, and SOLID285.
User plasticity law Calculate plastic strains and form the tangent stress-strain matrix at an integration point based on your own plasticity law.
User creep equation Specify your own creep equation.
User swelling law To account for swelling in an analysis (due to neutron bombardment, for example), you can write the appropriate swelling law as a user routine.
User failure criteria Available for the layered elements (such as SOLID185 Layered Structural Solid, SOLID186 Layered Structural Solid, and SHELL281). Up to nine user-defined failure criteria can be supplied.
User loads Body loads such as temperatures, heat generations, and fluences (such as neutron flux), as well as surface loads such as pressures, convections, heat fluxes and charge density may be defined by way of user-written logic.
Mechanical APDL as a subroutine You can call the entire Mechanical APDL program as a subroutine in your own program, such as a user-written design optimization algorithm.
User access at the beginning and end of each run solution, load step, substep, and equilibrium iteration Evaluate results and perform any desired calculations during solution.
USRSURF116 Modify SURF151 and SURF152 film coefficients and bulk temperatures based on information from FLUID116.