Materials

Materials

Topics related to Granta Design and more.

Applying the User Programmable Features for User Defined Material Model

    • Emirhan
      Subscriber

      Hello,

      I want to apply an anisotropic hyperelastic constitutive model for an analysis that I will conduct using Transient Structural module in Workbench environment.

      Before writing the actual constitutive equation, I wrote a Fortran subroutine which contains the constitutive equation for a simple Neo-Hookean material just to practice the compiling and linking process into Ansys even though it is already defined in Engineering Data. However, I couldn't manage to use it in Ansys Workbench. I found out that there are a couple of ways to implement this fortran file with the extension ".f" into Ansys using “/upf” or dynamic link library. But as someone new to Fortran programming, I was not able to achieve it.

      My main objective is to define the strain-energy potential and its derivatives with respect to the strain invariants. My Fortran subroutine seems like this for a simple Neo-Hookean model:

      ----------------------------------------------------------

            SUBROUTINE USERHYPER(STRENGTH, J, I1B, I2B, W, DWDI1, DWDI2,

           &                     DWDJ, TEMP, DTEMP, NDI, NSHR, TIME, DTIME,

           &                     STRAN, D, STRESS, STIFF, DDSDDE, DDSDDT)

      C

      C     The strain-energy potential W and its derivatives

      C

            IMPLICIT NONE

            INTEGER NDI, NSHR

            REAL*8 STRENGTH(2), J, I1B, I2B, W, DWDI1, DWDI2, DWDJ

            REAL*8 TEMP, DTEMP, TIME, DTIME, STRAN(NDI,NDI), D(NDI,NDI)

            REAL*8 STRESS(NDI,NDI), STIFF(NDI,NDI,NDI,NDI)

            REAL*8 DDSDDE(NDI,NDI,NDI,NDI), DDSDDT(NDI,NDI)

            REAL*8 MU, KAPPA

       

      C     Material properties

            MU = STRENGTH(1)

            KAPPA = STRENGTH(2)

       

      C     Strain-energy potential

            W = 0.5D0 * MU * (I1B - 3.D0) + 0.5D0 * KAPPA * (J - 1.D0)**2

       

      C     Derivatives of the strain-energy potential

            DWDI1 = 0.5D0 * MU

            DWDI2 = 0.0D0

            DWDJ = KAPPA * (J - 1.D0)

       

            RETURN

            END

      ----------------------------------------------------------

      I am not sure if my subroutine is correct or not. It was succesfully compiled and it created the ".dll" file when I create a new Fortran project for creating a dynamic-link library in Visual Studio 2022. I was wondering how should I link this to the Ansys and use it in my analysis in Workbench environment by defining the mu and kappa constants. Any help is appreciated.

      Kind regards,

      Emirhan.

    • David Weed
      Ansys Employee

       

      Hello,

      For a usermat example of the Neo-Hookean model, see the Technology Showcase example in the MAPDL documentation: Chapter 38: Large-Deformation Neo-Hookean Analysis (via UserMat Subroutine). This will serve as a good check against your code.

      For implementing a user routine within WB-Mechanical, generally either ot these two methods will work:

      1) use the /UPF command in a command object, e.g., /UPF,usermat.F (in order to utilize this method set the environement variable, ANS_USE_UPF = TRUE, before starting WB-Mechanical)

      2) compile a shared library (using ANSUSERSHARED.bat) and then set the environment variable, ANS_USER_PATH, to point to the path of the dll. Note: set this variable before starting Workbench

      In terms of initializing the material model parameters, you can use either of two methods:

      1) use the TB,USER command and TBDATA within a command object under the Geometry object within Mechanical

      2) use the Engineering Data GUI to enter the usermat material parameters. To access this feature, open Engineering Data and locate Create Custom Model… under Custom Material Models:

      Also note that if you are going to use state variables to store quantities calculated within your subroutine, in order to post-process these state variables you will need to issue the OUTRES,SVAR,ALL command within the /SOLU module.

      Lastly, it is highly suggested to put a write statement within your Fortran subroutine so that when the model is solving, you can determine whether the routine is actually being accessed by printing something to the screen (this can also be useful in debugging your code).

       

    • David Weed
      Ansys Employee

      Also note that we have a user routine for anisotropic hyperelasticity which comes with the ANSYS install media. The Fortran file is in the following path: C:\Program Files\ANSYS Inc\v242\ansys\customize\user

      This routine is also documented in the MAPDL Programmer's Reference: 2.4.4. Subroutine UserHyperAniso (Writing Your Own Anisotropic Hyperelasticity Laws)

Viewing 2 reply threads
  • The topic ‘Applying the User Programmable Features for User Defined Material Model’ is closed to new replies.