You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rewrite docs/writing_a_material.md for the engine-2 API, with a compiled example #236
docs/writing_a_material.md (205 lines) predates partials, residual systems, history kinds and the error contract. A material author reading it today learns the declaration style but not:
how to make the material differentiable;
how to set up a local system;
which exception to throw.
The review of #222–#231 found pitfalls an author cannot guess from the API:
converges() keeps references to its tolerance and max-passes arguments, so they must be members or parameters;
independent_of() applies to every output of the callback;
residuals must be normalised scalars, because the tolerance is absolute;
checkpoints restore only history properties, never state a material keeps elsewhere;
step-size failures throw cutback_error, configuration errors throw logic_error/invalid_argument, and only fatal_error stops a host.
Design
Sections:
Inputs, outputs and history (with kinds).
Callbacks and reads.
Partials and independent_of, and how check_partials verifies them.
Local problems: converges() versus a system (Newton, newton_fd or picard), and what the implicit-function-theorem tangent gives you for free.
Errors and cutbacks.
Testing a material: the conformance list, the finite-difference check, report decks.
Checklist before opening a PR.
The worked example is a small 1D-in-3D viscoelastic (Maxwell) material. It uses a history, a system for the internal variable, declared partials and the tangent from derivative(). It lives in examples/writing_a_material/ and is built and run as a test, and the guide includes it by line ranges, so the guide cannot drift from the code.
Tests
The example builds and runs in CI.
check_partials and the conformance test cover it.
Its tangent matches central finite differences.
Depends on
Can start after #229. It is final after #235, which removes the old paths the guide must no longer mention.
Out of scope
API reference generation (Doxygen); the guide is a tutorial.
Activity