Differentiable plasticity FEM in JAX

Learning notes · Raj Mahat · Georgia Tech

A mechanical test never measures the hardening law. It measures the law after it has passed through the local plastic response, equilibrium with contact, the loading history and the readout. These notes build a fully differentiable small punch test (SPT) model in JAX, follow how information about the law travels to the measured load, and compute its derivatives exactly.

Animation: a spherical punch pressing a clamped disc, coloured by accumulated plastic strain, with the load-depth curve traced alongside
The JAX solver on a load–unload path to 1 mm (SS316, literature combined-hardening parameters; 2952 F-bar elements, 180 increments). Left: the axisymmetric disc, mirrored about the axis, between the dies, coloured by accumulated plastic strain. Right: the punch load being traced. Every frame is one converged increment, and every one of them is differentiable with respect to the material parameters.
Read the notes (PDF)
Chain from hardening law through local response, equilibrium and contact, history to measured load
The test sees the law only after every stage in between.

0 · What is in the model

Everything below is plain JAX, with no external FE code inside the loop. The whole simulation, from the material parameters to the punch load and the bottom-face displacements, is one differentiable program.

Geometryaxisymmetric disc (about 0.5 mm thick, 4 mm die aperture), spherical punch of radius 1.2 mm, upper and lower dies with fillets
Kinematicsfinite strain, total Lagrangian; F-bar quadrilaterals against volumetric locking; mesh refined under the punch
Isotropic hardeningVoce, \(\sigma_y(p)=\sigma_0+Q\,(1-e^{-\beta p})\)
Kinematic hardeningChaboche: a sum of Armstrong–Frederick backstresses, carried with an objective (Jaumann or Green–Naghdi) rate
Local updatebackward-Euler radial return, solved inside jax.lax.custom_root; the consistent tangent comes from implicit differentiation
Contactpenalty contact with the punch and both dies; frictionless by default, Coulomb friction optional
Global solveNewton with the condensed tangent; a block-tridiagonal (block-Thomas) linear solve that exploits the banded mesh
Derivativesforward mode (one tangent per parameter) and reverse mode (adjoint) through every increment; a custom_jvp on the Newton solve, so derivatives never differentiate the iterations
Checksclosed-form uniaxial solutions; Abaqus/Standard on an identical mesh (Section 3); finite differences

1 · Isotropic and kinematic hardening

A metal can get stronger in two ways. Isotropic hardening (Voce) grows the elastic domain equally in every direction. Kinematic hardening (Armstrong–Frederick, Chaboche) moves it: a backstress \(\alpha\) shifts the centre of the yield surface towards the direction of loading. In tension alone the two can be made to give exactly the same curve. The difference appears only when the loading turns. After tension, the shifted surface reaches the compression side early (the Bauschinger effect); the grown one does not.

Animation: uniaxial tension then reversal; combined hardening versus its isotropic twin, with the yield surface in the deviatoric plane
Tension to 5 %, then reversal. Blue: combined hardening (Voce + one backstress). Grey dashed: its isotropic twin, which has the same tensile curve, all of it from isotropic growth. Right: the yield surface in the deviatoric plane. The blue surface grows a little and slides (the arrow is the backstress); the grey one only grows. On reversal the blue curve yields early in compression; the grey one must cross the full diameter first. Generic, illustrative parameters.

In the solver, the backward-Euler return map collapses to one scalar equation for the plastic multiplier. That equation is solved inside jax.lax.custom_root, so the consistent tangent is a single jax.jacfwd. It matches the textbook closed form to round-off.

Combined hardening and its isotropic twin: identical in monotonic tension, different under cycling
The same pair as in the animation. Left: in monotonic tension the two curves coincide; the twin is built so that its isotropic hardening equals the combined model's isotropic part plus the saturating backstress. Right: three cycles at ±2 %. The combined model yields early on every reversal and gives the rounded Bauschinger loop. The twin must cross its whole elastic range on each reversal, and its surface keeps growing from cycle to cycle. A tension test alone cannot tell these two materials apart.

2 · The forward solve: one load increment at a time

The punch is pushed into the plate in small steps of depth \(d_1, d_2, \dots, d_N\). Each step (an increment \(k\)) is a full nonlinear solve: find the nodal displacements for which the plate is in equilibrium, every Gauss point satisfies the plasticity law, and the plate does not pass through the punch. Once that is found, the plastic state is stored (committed) and becomes the starting point for the next step. The punch load \(L_k\) is read off at the end of each step, which gives the load–depth curve.

Notation used in the charts
\(k\)
increment (load step), \(k=1,\dots,N\)
\(U,\ \lambda\)
nodal displacements; contact pressure on the contact surface \(\Gamma_C\)
\(x_g\)
a Gauss (integration) point, where the material law is evaluated
\(v=(\sigma,\varepsilon^p,X,p)\)
unknowns at one Gauss point: stress, plastic strain, back-stress, accumulated plastic strain
\(q=(\varepsilon^p,X,p)\)
the history: the part of \(v\) that is stored and carried to the next increment
\(\theta=(\sigma_0,Q,\beta)\)
the hardening parameters we ask about
\(h,\ r\)
local residual (material law at a Gauss point) and global residual (force balance)
subscripts
partial derivatives: \(h_v=\partial h/\partial v\), \(r_U=\partial r/\partial U\), \(h_\theta=\partial h/\partial\theta\)
\(B,\ K_k\)
strain–displacement matrix; the tangent stiffness of increment \(k\)
\(L_k\)
punch load at increment \(k\) (the measurement)
Forward solve flowchart with residuals and condensed tangent

Reading the flowchart (left, top to bottom). Impose the new depth \(d_k\), starting from the stored history \(q_{k-1}\). Check which nodes touch the ball. Compute the strain at every Gauss point from the current displacements. Assume the step is elastic (the trial stress); if the trial stress lies inside the yield surface (\(f^{\rm tr}\le 0\)) it is accepted, otherwise the return map pulls it back onto the surface and updates the plastic variables. Differentiate that converged local update to get the consistent tangent, assemble the global residual \(r_k\) and stiffness \(K_k\), and take a Newton step. Repeat until the residual is small, then commit the history and read the load.

The right side says the same thing in equations. Three sets of conditions must hold together: the material law at every Gauss point (\(h_k=0\)), force balance (\(r_k=0\)), and contact (gap \(g_N\ge0\), pressure \(\lambda_N\ge0\), and pressure only where the gap is closed). Newton linearizes all of them at once. The key step is the boxed formula: the local unknowns can be eliminated, so the material's whole response is folded into one matrix, \(K_k = r_U - r_v h_v^{-1} h_U\) ("how the nodes push back when moved, after the material has re-equilibrated"). That factorized \(K_k\) is reused, unchanged, for every derivative in Section 4.

Six building blocks

Everything in Section 4 is assembled from six small maps. Each panel below shows one of them as a pipeline: the input on the left, the output on the right, and the formula underneath.

Return-map Jacobian rows and the local-stress-to-nodal-force chain

\(h_v\), the local block. The five equations a Gauss point must satisfy in one step: stress from elastic strain, the flow rule, back-stress evolution, accumulation of plastic strain, and staying on the yield surface. Its Jacobian \(h_v\) is what the return map inverts. Note where things enter: the parameters \(\theta\) appear only in the last (yield) row, through \(\sigma_y(p;\theta)\); the strain enters only the stress row; the stored history enters only the three evolution rows. \(r_v\), local to global. A change in stress at a Gauss point becomes a nodal force by the usual finite-element route: multiply by \(B^\top\) (virtual work), weight by the Gauss volume, and add up over elements.

Kinematics, constrained solve, state update and readout

\(\nabla^s\) (top left) is the opposite direction: nodal displacement to strain at each Gauss point, through \(B\). \(E_k\) (top right) answers "given extra forces, how do the nodes move?": solve with the tangent \(K_k\), then project with \(\Pi_k\) so the plate still respects contact (without it the punch could pass through the plate). \(C_k,\ S_q\) (bottom left) turn a strain change back into a change of the stored history, using the same local inverse \(h_v^{-1}\); \(S_q\) just picks the history entries out of \(v\). Readout (bottom right): of all the fields, only the contact pressure on the contact patch is measured; summing its normal part gives the single number \(\delta L_k\).

Load–depth curves
Load–depth curve for a generic material, and two parameter changes.
Which JAX tool does which job
How each step maps onto a JAX primitive.

3 · Checked against Abaqus

A differentiable solver is only useful if its forward answer is right. The JAX model was run against Abaqus/Standard with its built-in combined hardening (*Plastic, hardening=COMBINED with *Cyclic Hardening) on an identical mesh, for three parameter sets. Two things are compared: the punch force, and the backstress in every element.

Punch force and per-element backstress, JAX versus Abaqus, for three parameter sets
Left: punch force, JAX (lines) against Abaqus (circles); the relative difference is on the right axis. After the first few increments it stays within about 1 %, the same level as the pure Voce model on this mesh (−0.5 % to −0.6 % at 1 mm). Right: the deviatoric backstress in every element at 1 mm, JAX against Abaqus; the points fall on the 1:1 line for both objective rates. Abaqus integrates the Ziegler form, so only the deviatoric part of its ALPHA is compared.

Kinematic hardening shows itself mainly when the load reverses, so the stronger test is unloading. The same comparison on a cyclic path (two partial unload–reload loops and a final unload) is shown below, for the combined model and for its isotropic twin.

Cyclic punch test, JAX versus Abaqus, combined hardening and isotropic twin
Left: the full cyclic path. Middle: the unload–reload loop at 0.7 mm. Right: the final unload and springback. JAX follows Abaqus through the loops and the loss of contact. One practical lesson: unloading needs a stiffer contact penalty than loading (107 instead of 106 N/mm3). The softer value under-predicts the loop hysteresis by about a quarter.

4 · How a parameter change travels to the load

The question of this section: if \(\sigma_0\), \(Q\) or \(\beta\) is nudged by \(\delta\theta\), how much does the load at each depth change? The answer is the Jacobian \(J=\partial L/\partial\theta\) (one row per depth, one column per parameter). The charts show that computing it needs no new solver, only the building blocks above, reused in a fixed order.

Sensitivity equations and flow

Four moves per increment (follow the blue boxes on the right).

  1. Source. The parameters touch only the yield row (top-left box): a nudge to \(\theta\) shifts the yield stress at the plastic strain each Gauss point has reached. Elastic points feel nothing.
  2. Pseudoload. That shift, plus whatever the earlier increments already changed in the history (\(s_{k-1}=\partial q_{k-1}/\partial\theta\)), is pushed through \(h_v^{-1}\) (the material resists) and \(r_v\) to become an equivalent set of nodal forces \(f_{H,k}\). The extra term \(f_{\Gamma,k}\) is the corresponding contribution from the contact rows.
  3. Solve. Those forces are applied to the same factorized system as the forward Newton step: one extra right-hand side per parameter. This gives how the displacements and contact pressures move, \(U_{\theta,k}\) and \(\lambda_{\theta,k}\).
  4. Carry and read out. Two things are kept: the new history sensitivity \(s_k\), which feeds the next increment (dashed loop), and the load sensitivity \(\partial L_k/\partial\theta\), read off the contact pressure.
Recursion over one increment and its unrolling

The same thing as a signal-flow diagram. (a) Per increment, the bookkeeping is linear: the new history sensitivity is the old one carried forward, plus what this increment injects, \(s_i=\Phi_i s_{i-1}+\Upsilon_i\,\delta\theta\). The load change is read from the history (\(\mathcal H_i\)) plus a direct part that needs no history (\(\mathcal D_i\)). Here \(\Upsilon\) = "inject", \(\Phi\) = "carry", \(\mathcal H\) = "read through the history", \(\mathcal D\) = "read directly". (b) Unrolling over increments: every increment injects something, and an injection made at step \(j\) reaches the load at step \(k\) only after being carried through \(k-1-j\) \(\Phi\) boxes (one path highlighted in blue). So the load at depth \(k\) is the sum of contributions of every earlier step, each weighted by how far it has been carried.

Factorized Jacobian

Stacking all increments turns those per-step boxes into four operators, and the full Jacobian factors as: inject (\(\mathcal G\)), propagate through history (\((\mathrm{Id}-\mathcal T)^{-1}\)), observe (\(\mathcal H\)), plus the direct part (\(\mathcal D\)). Because a step can only affect later steps, \(\mathcal T\) shifts information strictly forward in time, so the inverse is an exact finite sum: this is the unrolled picture above, written as one formula.

State path and load path inside the operators

What is inside \(\Upsilon,\Phi,\mathcal H,\mathcal D\). All four are the same chain of building blocks, fed by one of two sources: the parameter source \(h_\theta\) (blue) or the history source \(h_{q_{k-1}}\) (orange). The commit path (top) ends in the stored state: the local block resists the change, and what the rest of the plate gives back after re-equilibrating (\(r_v\to E_k\to\nabla^s\to C_k\)) is subtracted. Fed by \(h_\theta\) it is \(\Upsilon_k\), fed by the history it is \(\Phi_k\). The exit path (bottom) ends in the load instead, through the contact pressure; fed by \(h_\theta\) it is \(\mathcal D_k\), fed by the history it is \(\mathcal H_k\). The grey dashed branch only matters with friction and is zero in this frictionless model.

Forward mode, adjoint, finite differences and hand recursion agree
Check: the recursion written out by hand, JAX forward mode, JAX reverse mode (adjoint) and finite differences give the same \(\theta_i\,\partial L/\partial\theta_i\) at every depth (the first three agree to about \(10^{-13}\), finite differences to about 2%). The small wiggles are real features of the discrete model, not noise: finite differences reproduce them, and smaller load steps make them sharper rather than smoother. They come from the coarse teaching mesh: each time another surface node touches the ball, or the plastic zone reaches another Gauss point, the response changes slope.

5 · A local Bayesian view with three parameters

Around one anchor, the data add precision Γ = JTΣ−1J. Its eigenvectors are the combinations of (σ0, Q, β) that a test pins down or leaves loose; along mode i the posterior variance shrinks by 1/(1+λi).

Tension sensitivities
Fisher eigenvalues and eigenvectors for tension and punch

6 · What the backstress does inside the punch

In a tensile bar the loading direction never changes, so a backstress and an equal amount of isotropic hardening cannot be told apart. In the punch test the disc bends, stretches and wraps around the ball, so the direction in which each point flows turns as the punch goes in. Wherever it turns, the backstress, built up along the old direction, is no longer aligned with the stress. The kinematic angle \(\varphi\) measures this: it is the angle between the deviatoric stress \(s\) and the flow direction \(\hat n\propto s-\alpha\). With isotropic hardening alone, \(\varphi=0\) everywhere.

Maps of the kinematic angle over the deformed disc at four punch depths
The kinematic angle at the points that are flowing, at four depths (SS316, literature parameters; hatched = not flowing at that instant). It concentrates under the punch early on, where the material first bends and is then stretched over the ball, and later in a band towards the die edge. Elsewhere it stays at a few degrees: during loading, the punch test is mostly a monotonic test.

This is why the backstress is hard to see in the force curve during loading. It shows mostly on unloading and reloading (Section 3), and in the full-field (DIC) displacement of the bottom face, which the solver also produces and differentiates.

Where this leads

The same machinery can ask a sharper question: at each punch depth, which part of the hardening curve does the load actually respond to? Instead of three Voce parameters, the hardening law is treated as a whole function of plastic strain, and the derivatives above are resolved along that strain axis. A first look:

Sensitivity of the punch load resolved over plastic strain and punch depth
How strongly the punch load at depth \(d\) depends on the hardening curve at strain \(\xi\) (darker = stronger). The black line is the largest strain reached anywhere in the disc at that depth. Work in progress.

Sections 2, 4 and 5 use the small-strain teaching model of the notes (generic material). The animations and Sections 3 and 6 use the full finite-strain solver. This page shares the write-up and figures only.

Click any figure to open it at full size.