j2_plasticity, j2_rk_plasticity and drucker_prager_plasticity share about half their code by copy: trial state, elastic-branch handling, history writes, tangent assembly. J2 is effectively written twice.
The cost already showed up once: the explicit RK stage passed G where the other two pass effective_modulus(G), a 3x error in the multiplier that the copy in j2_plasticity did not have.
Approach
Additive, in the style plasticity_utils.h already uses (evaluate_at_state, make_isotropic_tangent): extract free functions and have the materials call them one at a time, each behind the existing tests. No common base class and no change to the materials' public parameters or outputs. A draft YieldFunctionPolicy concept would document what the yield-function policies must provide.
All references are to main at 91bd26f.
j2_plasticity,j2_rk_plasticityanddrucker_prager_plasticityshare about half their code by copy: trial state, elastic-branch handling, history writes, tangent assembly. J2 is effectively written twice.The cost already showed up once: the explicit RK stage passed
Gwhere the other two passeffective_modulus(G), a 3x error in the multiplier that the copy inj2_plasticitydid not have.Approach
Additive, in the style
plasticity_utils.halready uses (evaluate_at_state,make_isotropic_tangent): extract free functions and have the materials call them one at a time, each behind the existing tests. No common base class and no change to the materials' public parameters or outputs. A draftYieldFunctionPolicyconcept would document what the yield-function policies must provide.All references are to
mainat 91bd26f.