User-Defined Material

The MATUSR Bulk Data Entry, in combination with the LOADLIB I/O Option Entry, allows for the definition of material through user-defined external functions.

The external functions may be written in Fortran or C. The resulting libraries and files should be accessible by OptiStruct regardless of the coding language, provided that consistent function prototyping is respected, and adequate compiling and linking options are used.

Writing External Functions

The OptiStruct installation provides an example file with subroutines for Fortran (umat.F) with proper subroutine definition, arguments, and compilation directives. This file can be used as a starting point to write your own subroutines.

Two Fortran subroutines are required to define user material in OptiStruct. First, a Nonlinear subroutine for the nonlinear solution, and another subroutine for the linear solution. Both subroutines are mandatory, and the same argument order should be followed as:

Nonlinear subroutine:
subroutine usermaterial(idu, stress, strain, dstrain, stater,
 state, nstate, drot, props, nprops, 
 temp, dtemp, ieuid, kinc, dt, t_step,
 t_total, cdev, cbulk)

integer idu, nstate, nprops, kinc, ieuid
double precision stress(6),stater(*),state(*),
     $     cdev(6,6),cbulk, drot(3,3), temp, dtemp, dt, 
     $     t_step, t_total,
     $     strain(6), dstrain(6), props(nprops)
Linear subroutine:
subroutine smatusr(idu, nprop, prop, smat)
integer idu, nprop
double precision prop(nprop), smat(*)
Note: It is important that both subroutines be named “usermaterial” and “smatusr”, respectively.

Subroutine Arguments

The following table briefly describes the arguments which are passed among OptiStruct and the external subroutines. OptiStruct calls these two subroutines for every integration point of every element in the model. Therefore, the values listed below are calculated at each integration point.
Argument Type Input / Output Description
idu integer Input This is defined via the USUBID parameter on the MATUSR Bulk Data Entry. This argument can be used to define and choose between different types of materials within the same user subroutine.

optional use

stress double (table) Input/Output This is the Stress tensor. The initial stress is considered to be input and the stress, tensor calculated during the nonlinear solution are output from the user subroutine to OptiStruct.
strain double (table) Input Strain tensor. The initial strain is considered to be input.
dstrain double (table) Input Incremental strain table. The incremental strain is input from OptiStruct to the user subroutine.
stater double (table) Input/Output Table of State variables at the previous increment. State variables are variables that can be requested as output in the H3D file. Any variable (for example, plastic strain, equivalent plastic strain, and so on) calculated within the solution process in the subroutine can be output by defining it as a state variable.
state double (table) Input/Output Table of State variables at the current increment. See stater for more information.
nstate integer Input/Output Number of State Variables that the user requires in the subroutine. See stater for more information.
props double (table) Input This table contains all the user-defined material property information from the PROPERTY continuation line of the MATUSR entry.
nprops Integer Input This is the total number of material properties defined on the PROPERTY continuation line of the MATUSR entry.
temp double Input This is the temperature at the previous converged increment.
dtemp double Input This is the temperature increment.
ieuid integer Input Element ID. This subroutine is called for every integration point for every element.
kinc integer Input Current increment.
dt double Input Current Time increment
t_step double Input Subcase time.
t_total double Input Total time (if CNTNLSUB is used)
cdev double (table) Output Deviatoric material modulus matrix. These are calculated during the solution and are output to OptiStruct to form the stiffness matrix.
cbulk double (table) Output Bulk material modulus Matrix. These are calculated during the solution and are output to OptiStruct to form the stiffness matrix.
smat Double (table) Output Material modulus matrix. These are calculated during the solution and are output to OptiStruct to form the stiffness matrix.

Build External Libraries for User-defined Materials

Allows building shared libraries on Windows or Linux.

Refer to Build External Libraries for more information.