Phase 2a: emit strain-coupled implicit-residual materials (Mode B) - #100
Merged
Conversation
added 3 commits
June 17, 2026 21:54
…Mode-B emit lands
…a NumSimMaterialTarget
…ed-name guards, jacobian-validating e2e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Teaches
NumSimMaterialTargetto emit strain-coupled implicit-residual materials — a recipe whose scalar state is defined by an implicitR(x, ε)=0(viaadd_scalar_residual_equation, landed in #99) is lowered to a numsim-materials material that holds amaterial_ref<backward_euler>and drives the Newton loop itself in onecompute()(Mode B, the robust patternsmall_strain_plasticityuses — no Local-edge ordering fragility). The consistent tangentdσ/dεis deferred to PR 2b and rejected loudly here.Commits
90f98d9— Finding A guard. Before this PR, a residual recipe was mishandled onmain:NumSimMaterialTargetthrew a misleading rate/rk_integrator error, and the self-contained path (emit_compute_function, standalone/MOOSE) silently emitted a function dropping the state. Now both reject loudly with an accurate message (the self-contained guard is permanent; the target one is replaced by emission in commit 2).f6edc2a— Mode-B emitter.emit_residual_material():material_ref<backward_euler>+solve(eval)returning{residual, jacobian}(∂R/∂x viacas::diff), state-apply, stress.emit()routes residual recipes here. Unit tests + a gcc-gated cross-repo e2e against the realbackward_euler(z=c·tr(ε), σ=z·ε).df9fb8e— review fixes (3-lens critical review folded in). See below.Verification
jacobian=1.0makes it fail).Review fixes (commit
df9fb8e)Four HIGH emitted-code-correctness bugs the single-output test recipe never exercised: multi-output CSE temp collision (
t0redeclared),<state>_old→ unbound identifier,solver/eval/residual/jacobianname collisions, and an e2e that couldn't catch a wrong jacobian (linear ∂R/∂z≡1). All fixed + pinned by tests.Deferred (tracked):
backward_euler::solve()clampsstd::max(x,0)(plasticity convention — documented in the emitted header; upstream issue for an unclamped mode to follow); ~445-line duplication vs the rate path (extractdetail::helpers after PR 2b).🤖 Generated with Claude Code