4.23. Customizing Material Behavior

User subroutines enable you to modify the behavior of a material model or to create your own material model. You can also combine material subroutines and use them together. User-defined state variables are supported for many material subroutines and for subroutine combinations.

For information about each material subroutine, see Subroutines for Customizing Material Behavior in the Programmer's Reference.

4.23.1. Element Support for Material Subroutines

Generally, a given element supports a user subroutine if the native material is supported by that element.

For example, UserHyperAniso is supported by elements that support anisotropic hyperelasticity (TB,AHYPER), and userswstrain is supported by the swelling strain-function model (TB,SWELL).

For more information, see Material Model Support for Elements and Element Support for Material Models in the Element Reference.

4.23.2. Combining Material Subroutines

You can combine various user subroutines for material customization and use them together. Following are the valid combinations supported:


For porous media analysis, the subroutine userfreestrain (to define the free-strain increment) can be combined with other subroutines if the native material of those subroutines is supported by coupled pore-pressure-thermal mechanical elements (CPTnnn), as in this example:

You can use state variables with material subroutine combinations.

4.23.3. Using State Variables with Material Subroutines

User-defined state variables (TB,STATE) are supported by a number of subroutines that customize material behavior. The following topics are available:

4.23.3.1. Material Subroutines That Support State Variables

The following subroutines support the use of user-defined state variables:

SubroutinePurpose
UserMatCreating your own material model
UserMatThCreating your own thermal material model
UserHyperWriting your own isotropic hyperelasticity laws
UserHyperAnisoWriting your own anisotropic hyperelasticity laws
userMullinsWriting your own pseudo-elastic Mullins Effect law
UserCreepDefining your own implicit creep material behavior
UserCrDefining your own explicit creep material behavior
userCZMCreating your own cohesive zone material
user_tbelasticDefining your own material linear elastic properties
userswstrainDefining your own swelling laws
userthstrainDefining your own thermal strain
userfreestrainDefining your own free-strain increment
UsrShiftCalculating a pseudotime time increment according to a user-specified shift function

4.23.3.2. Accessing State Variables in Material Subroutines

Depending on the subroutine, a user-defined state variable is passed into the subroutine as an argument, or retrieved and updated via API calls:

  • State variables are passed directly into some subroutines, such as UserMat and UserCreep, as arguments.

    The program updates the state variable to its final state and updates the database automatically.

  • In other subroutines, such as userthstrain and user_tbelastic, state variables are retrieved via an API call (get_ElmData).

    When a state variable is retrieved via an API, it must be updated to its final state via an API call (put_ElmData). Doing so updates the database with the current value of the state variable.

Example 4.44: State Variable Passed in as an Argument

In this example, the user-defined state variable name is Ustatev. It is passed directly into UserCreep, a subroutine that enables you to define your own creep material behavior.

*deck,UserCreep    USERDISTRIB  parallel
      SUBROUTINE UserCreep (impflg, ldstep, isubst, matId , elemId,
     &                      kDInPt, kLayer, kSecPt, nstatv, nprop,
     &                      prop  , time  , dtime , temp  , dtemp , 
     &                      toffst, Ustatev, creqv , pres  , seqv  ,
     &                      delcr , dcrda)
c*******************************************************************

Example 4.45: State Variables Retrieved and Updated via API Calls

In this example, the subroutine in which state variables are being retrieved and updated is userthstrain, which enables you to define your own thermal strain.

*deck,userthstrain  USERDISTRIB   parallel  optimize
      subroutine userthstrain (nprop, propv,
     &                         ncomp, epth)

c     … code …

c     --- get element info
      call get_ElmInfo ('ELEMID  ',elemId)
      call get_ElmInfo ('MATIPT  ',matipt)
      call get_ElmInfo ('NSVAR   ', nstatev)
c *** Retrieve state variable
      call get_ElmData ('SVAR', elemId, matipt, nstatev, statev)

c     … code …

c *** Update state variable to database
      call put_ElmData ('SVAR', elemId, matipt, nstatev, statev)

4.23.3.3. Using State Variables with Subroutine Combinations

You can use state variables with subroutine combinations. For a given material, the state variable array length is defined via TB,STATE. The subroutines in a combination share the same state variable array.

Track State Variable Indices

Because each subroutine in a combination can have separate state variables, keep track of the state variable indices used for each subroutine. For example, the first subroutine may use indices 1 to 6, the second one may use indices 7 to 15, and so on.

Understand the Subroutine Calling Order

When it is necessary to share information via state variables between subroutines, in addition tracking the indices, be aware of the calling order of the subroutines. The various routines are called in a specific predefined order independent of user definitions and input. The calling order is hard-coded and adheres to the preexisting code framework.

One option to determine the calling order is to include write statements in the subroutines and examine the output file. For example, write(6,*) "Here in subroutine UserMat."

Another option is to use one of the state variable locations to indicate which routine was called previously. You can do so by assigning arbitrary numbers to the subroutines and inspecting the state variable value to learn the order. When combining userthstrain + UserMat, for example, the calling order is 1) userthstrain, then 2) UserMat. The order is intuitive because thermal strain is calculated and subtracted from the total strain before the material subroutine is called.

Subroutines May Be Called More Than Once

In a given global Newton-Raphson iteration, at a given material integration point, some subroutines may be called more than once depending on the element formulation. For example, due to the iterative nature of the hyperelasticity algorithm for plane stress, UserHyper can be called multiple times while the plane stress algorithm tries to converge. Subroutines called more than once can also lead to each material integration point having a different number of subroutine calls to satisfy convergence.