Skip to content

Feature/hyper modular - #109

Merged
chemiskyy merged 7 commits into
masterfrom
feature/hyper-modular
Sep 11, 2026
Merged

chemiskyy merged 7 commits into
masterfrom
feature/hyper-modular

Conversation

@chemiskyy

Copy link
Copy Markdown
Member

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 the ElasticityModule and ModularUMAT classes 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:

  • Added a new elasticity type, HYPER_INVARIANTS, to both C++ (ElasticityType enum) and Python bindings, allowing the use of hyperelastic potentials defined by isochoric invariants. [1] [2]
  • Introduced the configure_hyper_invariants method and associated data members (hyper_potential_, hyper_props_) in ElasticityModule to configure and store hyperelastic potentials and their parameters. [1] [2]
  • Added the hyper_invariants_dW struct and related functions to encapsulate and compute derivatives of isochoric-invariant hyperelastic potentials.

State-dependent tangent and elasticity handling:

  • Modified ElasticityModule to provide L0() (ground-state stiffness) instead of L(), clarifying the distinction between the undeformed stiffness and the potentially state-dependent current tangent; updated documentation accordingly. [1] [2]
  • Added an evaluate method to ElasticityModule to compute both stress and tangent for the current elastic strain in a single pass, supporting nonlinear elastic blocks efficiently.
  • Updated ModularUMAT to 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:

  • Extended and clarified comments throughout the codebase to warn about the implications of state-dependent elasticity for damage and other mechanisms, and to ensure correct usage of tangents and stiffness references. [1] [2]

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.

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.

@chemiskyy chemiskyy left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chemiskyy
chemiskyy merged commit fd75d55 into master Sep 11, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in simcoon 2.0 Sep 11, 2026
@chemiskyy
chemiskyy deleted the feature/hyper-modular branch September 11, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant