Skip to content

Add AnsysUSERMATTarget backend #3

Open

Description

@petlenz

Goal

Generate an ANSYS USERMAT user subroutine. ANSYS Mechanical's user-defined material framework — Fortran-callable, similar shape to Abaqus UMAT but with different component conventions and argument ordering.

USERMAT signature (simplified)

extern "C" void usermat_(
    int    *matId, int *elemId, int *kDomIntPt, int *kLayer, int *kSectPt,
    int    *ldstep, int *isubst, int *keycut,
    int    *nDirect, int *nShear, int *ncomp,
    int    *nStatev, int *nProp,
    double *Time, double *dTime,
    double *Temp, double *dTemp,
    double *stress,        // (ncomp)        in/out
    double *ustatev,       // (nStatev)      in/out
    double *dsdePl,        // (ncomp, ncomp) out: Jacobian
    double *sedEl, double *sedPl, double *epseq,
    double *Strain,        // (ncomp)        in
    double *dStrain,       // (ncomp)        in
    double *epsPl,         // (ncomp)        in/out
    double *prop,          // (nProp)
    double *coords,
    double *rotateM,
    double *defGrad_t, double *defGrad,
    double *tsstif, double *epsZZ,
    double *var0, double *var1, double *var2, double *var3, double *var4,
    double *var5, double *var6, double *var7, double *var8);

Convention differences from Abaqus

Abaqus ANSYS
3D component order {11, 22, 33, 12, 13, 23} {11, 22, 33, 12, 23, 13}
Shear strain engineering (γ = 2ε) engineering (γ = 2ε)
Stress sign tension positive tension positive
Tangent layout DDSDDE row-major dsdePl column-major (Fortran)

The component-order swap means we need a different tmech Voigt adapter than abq_std. Either:

  • Extend tmech with an ansys_std adapter, or
  • Use abq_std and add a 4×4 permutation matrix at the boundary.

Verify with tmech maintainer (you) which is preferable.

Tangent layout

ANSYS dsdePl is column-major (Fortran storage). The codegen needs to write the tangent in column-major order, or pre-transpose before writing.

What to emit

A .cpp file with:

  1. Embedded Layer-2 compute function.
  2. extern \"C\" USERMAT entry point.
  3. Boundary code with ANSYS-convention adapters and the column-major tangent write.

Acceptance criteria

  • targets/ansys_usermat.h with AnsysUSERMATTarget.
  • Tests: signature match, ANSYS-order Voigt adapters used, column-major tangent write.
  • Documentation in README.

Dependencies

  • Add AbaqusUMATTarget backend #1 (AbaqusUMATTarget) — most patterns are shared.
  • Possibly a tmech update for an ansys_std adapter (or use a runtime permutation).

Activity

  1. petlenz commented on May 31, 2026

    @petlenz
    MemberAuthor

    Tracked as Phase 6.3 of the NumSim compiler epic #28. Unblocks once Phase 3b (#35) lands; share the UMAT scaffolding from #2 once that exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions