# Material tangent matricies

In the solution of nonlinear problems one typically uses a Newton or quasi-Newton method to iterate the global FEA equations to equilibrium. In this process one needs to properly compute element tangent matricies. These can be numerically checked using the MACRo command TANG,NUMErical,1, which solves problems by numerically differentiating (finite differencing) your element residual. This is an excellent tool for debugging element level errors in the tangent formulation especially when you are already confident of your gauss-point material tangent. To help check the gauss-point tangent (6 by 6 material moduli), it is useful to have a separate tool.
To check the gauss-point level material tangent one can also employ numerical differentiation. A typical material model returns the Cauchy stress tensor and the spatial material moduli. The input is the deformation gradient. In order to compute the needed tangent numerically, one needs to compute two times the derivative of the second Piola-Kirchhoff stress tensor with respect to the right Cauchy-Green deformation tensor. Since the input to the material module is usually the deformation gradient and the output the Cauchy stress, one needs to go through a few steps to do this properly.

The main steps are:
• Given the deformation gradient F, compute its polar decomposition F = RU, right Cauchy-Green deformation tensor C = F^T F = U^2, the Jacobian J = det(F), and the inverse F^{-1}.
• Also call the material model to get the Cauchy stress and what it thinks the spatial moduli are.
• Pull the Cauchy-stress back to compute the 2nd Piola-Kirchhoff stress S (unperturbed).
• For each unique entry of C, perturb it and call the material model to get the Cauchy stress. For the off diagonal entries the perturbations must be symmetric!
• Pull the Cauchy-stress back to compute the 2nd Piola-Kirchhoff stress S (perturbed).
• Difference the perturbed S with the unperturbed S, multiply by 2, and divided by the perturbation magnitude to get the corresponding column of the reference material moduli.
• Once all 6 column are completed, this can be pushed forward to obtain the numerically computed spatial material moduli, which can be compared to the ones originally computed by the material model. Obviously, one can also compare the pulled back moduli.

A MATLAB routine for doing so is attached along with an example material model file also in MATLAB. If you wish to run this program on your material model written in FORTRAN or C for FEAP, then you will need to write a MEX cover function or convert this to a user MACRo command which can be called from the command prompt in FEAP.