Feature/hyper modular - #109
Merged
Merged
Conversation
Introduce constitutive response API in ElasticityModule: stress(eps_el, ndi) and tangent(eps_el), plus L0() accessor. Implementations return the elastic predictor (el_pred) and the state-independent tangent (L_), and guard against unconfigured use. Add include <simcoon/parameter.hpp>. In ModularUMAT add L_cur_ state (6x6) and initialize it. Use elasticity_.L0() as the ground-state/reference stiffness when configuring viscoelastic mechanisms and setting initial L/Lt. Replace direct el_pred calls with elasticity_.stress(...) and refresh L_cur_ = elasticity_.tangent(...). Pass L_cur_ to mechanisms (compute_constraints, kappa, compute_jacobian_contribution) and use L_cur_ in compute_tangent so the multiplier Jacobian and consistent tangent see the tangent of the state where the stress was evaluated.
Document and enforce the contract around elastic tangents and state-dependent elasticity, and add tests that pin down ElasticityModule behavior. Key changes: add a warning in damage_mechanism about using the CURRENT tangent and the dangers of latching it; clarify that L0/M are ground-state stiffness/compliance and note tensor accessor semantics; document that mechanisms must not cache data derived from a possibly state-dependent tangent. In ModularUMAT: seed L_cur_ in set_elasticity, move/declare refresh_stress, compute_tangent now seeds Lt itself, use thermal_strain(...) instead of alpha()*DT, and remove a duplicate refresh_stress call in the return mapping path. Added unit tests to validate evaluate() consistency (stress vs predictor and tangent), behavior when unconfigured, and that plane-stress condenses stress only while keeping the full 6x6 tangent.
Introduce isochoric-invariant hyperelastic support and integrate it across the codebase. Added hyper_invariants_dW, hyper_potential_derivatives and hyper_invariants_response in the header and implemented them in Functions/hyperelastic.cpp (multiple potentials: Neo-Hookean, Mooney-Rivlin, Yeoh, Isihara, Gent-Thomas, Swanson). Refactored generic_hyper_invariants to delegate to the new potential/response APIs. Extended ElasticityModule with a new HYPER_INVARIANTS type, configure_hyper_invariants, props parsing and evaluation path (mapping eps_el -> V_el -> b_el and producing the correct box tangent/stress). Added Python dataclasses for the hyperelastic blocks and serialization in python-setup/simcoon/modular.py and added tests (Python and C++) to validate modular composition matches standalone UMAT kernels. Also added required includes and small helper utilities and updated existing tests to exercise the new functionality.
Introduce a typed HyperPotential enum and propagate it through the hyperelastic codepath and Python bindings. Rework hyper_potential_derivatives to accept HyperPotential (and centralize kappa handling), update the modular elasticity module to store HyperPotential and hyper_props, and change props_count to account for variable hyper parameter count. Adjust evaluation paths (V_el/J construction), thermal alpha initialization, and refresh_stress call sites to use the final Etot value. Add corresponding Python IntEnum and dataclass changes (HyperPotential and per-model potential fields), and update tests to use the enum and to add a ground-state stiffness check. Miscellaneous cleanup: remove unused includes and small API fixes to keep the standalone UMAT and modular composition consistent and type-safe.
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.
This pull request introduces support for hyperelastic potentials defined in terms of isochoric invariants to the modular UMAT framework. It adds a new elasticity type (
HYPER_INVARIANTS), updates theElasticityModuleandModularUMATclasses to handle state-dependent (nonlinear) elastic responses, and ensures that all relevant interfaces and documentation reflect these changes. The update also adds detailed comments and clarifies the behavior of tangents and stiffness references throughout the codebase.Support for hyperelasticity in isochoric invariants:
HYPER_INVARIANTS, to both C++ (ElasticityTypeenum) and Python bindings, allowing the use of hyperelastic potentials defined by isochoric invariants. [1] [2]configure_hyper_invariantsmethod and associated data members (hyper_potential_,hyper_props_) inElasticityModuleto configure and store hyperelastic potentials and their parameters. [1] [2]hyper_invariants_dWstruct and related functions to encapsulate and compute derivatives of isochoric-invariant hyperelastic potentials.State-dependent tangent and elasticity handling:
ElasticityModuleto provideL0()(ground-state stiffness) instead ofL(), clarifying the distinction between the undeformed stiffness and the potentially state-dependent current tangent; updated documentation accordingly. [1] [2]evaluatemethod toElasticityModuleto compute both stress and tangent for the current elastic strain in a single pass, supporting nonlinear elastic blocks efficiently.ModularUMATto track the current elastic tangent (L_cur_), recompute it as needed (refresh_stress), and clarify in documentation and interfaces that the tangent may be state-dependent and not constant over an increment. [1] [2] [3] [4]Documentation and interface improvements:
These changes significantly enhance the flexibility of the UMAT framework, enabling advanced hyperelastic modeling and ensuring that the infrastructure correctly handles nonlinear elasticity throughout the simulation stack.