Phase D: emit consistent tangent dσ/dε as a rank-4 tensor property - #98
Merged
Conversation
added 2 commits
June 15, 2026 22:10
…σ/∂ε via cas::diff)
…cas::diff UB on drift)
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
NumSimMaterialTargetnow emits the consistent tangent dσ/dε as a rank-4tmech::tensorproperty, computed viacas::diff(stress, strain).Why this is the exact consistent tangent in scope (not just a partial): the rate-leaf guard forbids the rate from depending on strain, so the integrated state is independent of the current strain (dα/dε ≡ 0). Therefore dσ/dε = ∂σ/∂ε + ∂σ/∂α·(dα/dε) = ∂σ/∂ε — a single
cas::diff, no J⁻¹ solve, no rank-4 inverse. (This mirrors thestatic_assertinAlgorithmicTangentPassthat pins the same fact for the standalone path.)Reuses the proven tangent machinery:
cas::diff(σ,ε)→ rank-4, rendered by the sametensor()emit pipeline; folded into the tensor-output path so the ctor/callback/member emission handles it uniformly.Minor symmetry
roles::Straincarries a symmetric tensor space, socas::diffreturns the minor-symmetric rank-4 identityP_sym = ½(I⊗ᵘI + I⊗ˡI)— the emitted RHS contains bothotimesuandotimesl, as a stress-strain tangent must.Verified end-to-end (gcc)
Generated
Viscoelastic(σ=α·ε) emitsdstress_dstrain; driven through the real graph, dσ/dε = α·P_sym checks out component-wise:C(0,0,0,0)=α,C(0,1,0,1)=α/2(minor-symmetric),C(0,0,1,1)=0. (Tensor e2e is GCC-gated per numsim-core#16, same as the stress path; the emit shape is verified compiler-independently by the unit test.)Tests
EmitsConsistentTangent(rank-4 property + callback + minor-symmetricotimesu/otimesl),RejectsTangentOfMissingStress.Scope (honest)
This covers the strain-uncoupled consistent tangent (dα/dε=0). The strain-coupled case (rate depending on ε ⇒ the residual contract + solver-assembled blocks ∂R/∂ε, ∂σ/∂x and J⁻¹) remains future work, gated on the residual contract + strain-coupling support.
274 tests pass locally; warning-gated.
🤖 Generated with Claude Code