Materials > Working with External Materials > Built-in Material Function Interface Types

Built-in Material Function Interface Types
There are currently four different built-in external material function interface types, or sockets, which have many traits in common:
All of these allow the user to specify the number of states, nStates, to be defined at each integration point. These state values are passed to the external functions in an argument called states. Note that the states vector is both input and output: when the function is called, it contains the previous step converged values of the states; on return, it must contain the state values to be stored if the solver decides to proceed to the next step.
The user is also required to specify an array of material model parameters, called par. The number of parameters nPar is specified implicitly as the length of the material property array, which must be defined as a property in a property group under the calling External Material feature or set in the Material Contents table in the External Material node’s settings.
The functions may be written so as to accept a varying number of parameters and states, or to require fixed numbers. In any case, the number of parameters and states passed should be checked, and unexpected argument lengths should return with an error condition as given in the following table:
General Stress-Strain Relation
The General stress-strain relation socket implements a stress-strain relation computing a second Piola-Kirchhoff stress tensor given the current Green-Lagrange strain together with a material property vector and a vector of stored states. The expected external material function signature is:
int eval(double *e,            // Green-Lagrange strain, input
         double *s,            // Second Piola-Kirchhoff stress, output
         double *D,            // Jacobian of stress with respect to strain,output
         int *nPar,            // Number of material model parameters, input
         double *par,          // Material model parameters, input
         int *nStates,         // Number of states, input
         double *states) { }   // States, input/output
The e and s tensors are given in Voigt order; that is., the components in e are {exx, eyy, ezz, eyz, exz, exy} and similarly for s. The Jacobian D is a 6-by-6 matrix of partial derivatives of components of s (rows) with respect to components of e (columns); the matrix is stored in row-major order.
Inelastic Residual Strain
The Inelastic Residual Strain socket implements an update procedure for an additive inelastic contribution to the total Green-Lagrange strain. Total stress and strain at the previous converged step, current total strain, current temperature, a reference temperature, a material property vector, and a vector of stored states are passed as inputs.
int eval(double *sOld,         // Second Piola-Kirchhoff stress at previous step, input
         double *eOld,         // Green-Lagrange strain at previous step, input
         double *e,            // Green-Lagrange strain at current step, input
         double *T,            // Temperature, input
         double *Tref,         // Strain reference temperature, input
         double *eInel,        // Inelastic Green-Lagrange strain state, input/output
         double *Jac,          // Jacobian of inelastic strain, output
         int *nPar,            // Number of material model parameters, input
         double *par,          // Material model parameters, input
         int *nStates,         // Number of extra states, input
         double *states) { }   // Extra states, input/output
The sOld, eOld, e, and eInel tensors are given in Voigt order (that is, the components in e are {exx, eyy, ezz, eyz, exz, exy}) and similarly for the other tensors. The Jacobian Jac is a 6-by-6 matrix of partial derivatives of components of eInel (rows) with respect to components of e (columns); the matrix is stored in row-major order. Note that the primary output quantity eInel is declared as states, meaning that the argument on entry contains the previous converged step values. The temperature arguments T and Tref are standard model inputs, which are specified in the physics feature calling the external material where the Inelastic residual strain socket is selected.
General H(B) Relation
The General H(B) relation socket implements a generalization of an HB curve. It computes an updated magnetic field corresponding to an updated magnetic flux density, given the magnetic field and magnetic flux density at the previous converged step. A material property vector and a vector of stored states are passed as additional input. Typical implementations will use extra states to model hysteresis.
int eval(double *oldB,         // Magnetic flux density at previous step, input
         double *B,            // Magnetic flux density, input
         double *H,            // Magnetic field state, input/output
         double *Jac,          // Jacobian of H with respect to B, output
         int *nPar,            // Number of material model parameters, input
         double *par,          // Material model parameters, input
         int *nStates,         // Number of extra states, input
         double *states) { }   // Extra states, input/output
The magnetic flux densities oldB and B and the magnetic field H are passed as arrays of length 3. The Jacobian Jac is a 3-by-3 matrix of partial derivatives of components of H (rows) with respect to components of B (columns); the matrix is stored in row-major order. Note that the primary output quantity H is declared as states, meaning that the argument on entry contains the previous converged step values.
General B(H) relation
The General B(H) relation socket implements a generalization of a BH curve. It computes an updated magnetic flux density corresponding to an updated magnetic field, given the magnetic field and magnetic flux density at the previous converged step. A material property vector and a vector of stored states are passed as additional input. Typical implementations will use extra states to model hysteresis.
int eval(double *oldH,         // Magnetic field at previous step, input
         double *H,            // Magnetic field, input
         double *B,            // Magnetic flux density state, input/output
         double *Jac,          // Jacobian of Bwith respect to H, output
         int *nPar,            // Number of material model parameters, input
         double *par,          // Material model parameters, input
         int *nStates,         // Number of extra states, input
         double *states) { }   // Extra states, input/output
The magnetic fields oldH and H and the magnetic flux density B are passed as arrays of length 3. The Jacobian Jac is 3-by-3 matrix of partial derivatives of components of B (rows) with respect to components of H (columns); the matrix is stored in row-major order. Note that the primary output quantity B is declared as states, meaning that the argument on entry contains the previous converged step values..