Skip to content

feat(examples): add a J2 plasticity example solved by Newton's method - #71

Merged
Shizheng-Wen merged 1 commit into
mainfrom
feat/plasticity-cylinder-example
Oct 20, 2026
Merged

Shizheng-Wen merged 1 commit into
mainfrom
feat/plasticity-cylinder-example

Conversation

@Shizheng-Wen

Copy link
Copy Markdown
Collaborator

Summary

Adds examples/solid/plasticity_cylinder/: the elastic-plastic thick-walled cylinder under internal pressure (Hill 1950), in plane strain, with J2 plasticity and linear isotropic hardening (perfect plasticity by default).

What it adds over the existing plasticity_strip rung (L-BFGS on an incremental energy):

  • Newton's method with the consistent tangent of the radial return (closed form, de Souza Neto et al. box 7.4), so every load step converges quadratically: one update for elastic steps, three to five for plastic ones.
  • Quadrature-point state through the new quadrature_data argument (feat(assemble): pass per-quadrature-point data to the element and node assemblers #70): the stress feeds an internal-force NodeAssembler, the tangent moduli a stiffness ElementAssembler.
  • Pressure along the facet normal n of a FacetAssembler (fix(assemble): select boundary facets by incidence and add facet normals #69).
  • Displacement control with a linear predictor (Condenser.update_dirichlet), which follows the collapse plateau; --control pressure is the load-controlled variant.
  • A NumPy-built quarter ring of six-node triangles (no gmsh); the mid-edge nodes of the arcs lie on the circles.

The default run (825 nodes, 30 load steps) takes about 2 s on a CPU. It reaches 199.7 MPa, within 0.2 % of the limit pressure (2/√3) σ_y ln(b/a) = 200.1 MPa, approached from below.

Files

  • examples/solid/plasticity_cylinder/plasticity_cylinder.py, README.md
  • tests/assemble/test_plasticity_cylinder_example.py
  • docs/source/example_gallery/solid/plasticity_cylinder.rst plus the solid-mechanics index (new rung, solver pattern, card), with the figure and card image in _static/solid_mechanics/
  • zh_CN: a new catalog for the page; the index catalog is edited by hand, so the diff only touches the changed entries

Tests

tests/assemble/test_plasticity_cylinder_example.py:

  • Return map: stress on the yield surface; elastic points untouched; deviatoric flow; tangent equal to torch.func.jvp of the stress update (H = 0 and H > 0).
  • Stiffness: assembled tangent against central differences of the residual.
  • Mesh: area of the quarter ring, the two circles, the symmetry edges.
  • Elastic range: stiffness p / u_r(a) against Lamé, under pressure and displacement control.
  • First yield: no plasticity below the first-yield displacement; just above it, only in the innermost elements.
  • Limit pressure (perfect plasticity): within 1 %, from below; at most six Newton updates per step.
  • CUDA vs CPU: skipped without a GPU.

Results on Clariden, CPU partition, float64:

  • 8 passed (the node exposes GPUs, so the CUDA test ran).
  • The example ran in all three modes: default, --control pressure and --hardening 2000.
  • Docs (EN and zh) built against main: no new warnings once the title underline was fixed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Dst8zhPLnxVpZMBhR4Pvfs

A thick-walled cylinder under internal pressure (Hill 1950), in plane
strain, with J2 plasticity and linear isotropic hardening (perfect
plasticity by default). Every load step is solved by Newton's method
with the consistent tangent of the radial return, so the iterations
converge quadratically: three to five per plastic load step.

The plastic state lives at the quadrature points. The stress and the
tangent moduli reach an internal-force NodeAssembler and a tangent
ElementAssembler as quadrature_data (#70), and the pressure is a
FacetAssembler load along the outward normal n (#69). Displacement
control follows the collapse plateau; pressure control is an option.
The quarter ring of six-node triangles is built with NumPy, so the
example needs no gmsh.

Tests check the return map and its tangent against forward-mode
autodiff, the assembled stiffness against finite differences, the Lame
elastic response, first yield at the inner wall, the limit pressure
(2 / sqrt 3) sigma_y ln(b / a) of perfect plasticity (within 1 %), and
CUDA against CPU.

Docs: gallery page and solid-mechanics index entry, with zh_CN
translations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dst8zhPLnxVpZMBhR4Pvfs
Signed-off-by: Shizheng Wen <wenshizheng0710@gmail.com>
@Shizheng-Wen
Shizheng-Wen merged commit 2d544e8 into main Oct 20, 2026
4 checks passed
@Shizheng-Wen
Shizheng-Wen deleted the feat/plasticity-cylinder-example branch October 20, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant