Feature/modular default#95
Merged
Merged
Conversation
Introduce a legacy->MODUL adapter layer and test/bench infra. Adds legacy_adapters.hpp/.cpp implementing property translators and a registry for legacy UMAT names, and forwards adapted calls to umat_modular. Updates src/CMakeLists.txt to compile the new source. Harden criteria functions to throw std::invalid_argument instead of exiting, and add DFA branches. Add a benchmarking script (bench/bench_legacy_vs_modular.py) and a small probe symlink in examples to support runs. Extend Python tests (test_modular.py) with multiple legacy-vs-MODUL equivalence tests and make the pytest symlink handling robust. These changes gate a migration that lets selected legacy UMAT names be served by the modular engine while keeping ABI-compatible props/state handling and providing automated equivalence checks.
Introduce a new UMAT catalog (docs/simulation/umat_catalog.rst) and update Abaqus/Ansys/FEA docs to reference the modular UMAT engine and unified property layouts. Remove a set of legacy UMAT headers/sources for elasticity, plasticity and viscoelastic models and adapt the codebase to the composable MODUL framework (updates to include/.../modular_umat.hpp, src UMat implementations, Python wrapper and CMake). Documentation clarifies which legacy names are served via modular adapters, statev layout changes, and notes on validation/bit-identical adapter tests. This consolidates many legacy kernels into the modular engine while preserving the calling convention and testing coverage.
Expose and propagate solver tangent_mode through UMAT API and docs: add documentation for tangent_mode (none/continuum/algorithmic/closest-point) and note the 2.0 renumbering. Update many UMAT/modular/viscoelastic/SMA headers to include simcoon/parameter.hpp and change function signatures' default tangent_mode from 0 to tangent_default. Replace hardcoded numeric references in comments and APIs with named tangent constants (e.g. tangent_algorithmic, tangent_closest_point). In tangent_assembly.hpp add a HessianProvider typedef, compute_tangent_operator declarations and include <functional> to support lazy per-mechanism Hessian evaluation and mode dispatching.
Introduce sma_flow.hpp with a shared sma_transformation_flow() to remove duplicated flow-direction code in mechanical and thermomechanical unified SMA kernels. Validate tangent_mode early (Python wrapper and solver) to avoid unsafe throws in parallel regions and reject unknown modes in ModularUMAT::compute_tangent. Change tangent-mode semantics: introduce tangent_none vs tangent_continuum mapping for thermomechanical kernels so physical heat-source sensitivities (P_epsilon/invBhat) remain active for explicit integration. Assemble algorithmic-tangent docs/notes and enforce allowed modes; add small housekeeping (reset cumulative work on start, remove unused variables, adjust includes). Minor fixes to thermomechanical P_theta consistency (use invBhat) and include/exception cleanup.
Introduce an in-memory Python solver API and comprehensive UMAT tutorial: add docs (docs/simulation/python_solver.rst, docs/simulation/umat_tutorial.rst and index updates), a Python demo (examples/solver/python_solver.py), and a tutorial UMAT implementation (examples/umat_tutorial/umat_tutorial_J2.*). Add new python-setup solver package modules and C++ solver-sink/wrappers (include/src simcoon-python-builder and src/Simulation/Solver), plus tests and reference kernels. Update numerous example scripts to call the low-level binding sim._core.solver instead of sim.solver to reflect the new in-memory vs legacy file-driven interfaces.
tangent_assembly: Avoid unconditional arma::inv() on possibly ill-conditioned blocks by using arma::inv(Minv, ...) and returning the continuum tangent as a safe fallback when inversion fails. This prevents backend-dependent failures caused by FD-derived blocks. step_meca: Add legacy mode-3 FILE handling that shifts the time-axis anchor (BC_file_n) when in-memory tab_data is empty and the file rows restart per step. Introduce real_logmat_3x3 — a real-arithmetic 3x3 matrix logarithm using Denman–Beavers square roots and the Gregory series — and prefer it over arma::logmat to avoid complex Schur/LAPACK crashes on some platforms; fall back to arma::logmat when needed. Use real matrices for log/expm paths to keep operations in real arithmetic. Apply the BC_file_n legacy fix in both generate and generate_kin. step_thermomeca: Apply the same legacy mode-3 FILE time-axis fix (BC_file_n adjustment) in generate and generate_kin. These changes improve numerical robustness and portability (esp. on LAPACK/backends that may mis-handle complex Schur or ill-conditioned inverses) and restore correct behavior for legacy mode-3 files.
Project per-iteration Fischer-Burmeister (FB) correction onto Dp >= 0 by clamping dp so the accumulated plastic strain p never falls below its start-of-increment value (p_start). Adds p_start retrieval and conditional adjustment of dp, and updates comments explaining the rationale (prevents spurious FB roots from tiny negative Dp and avoids freezing/slowdown). Updated test baselines to reflect the changed behavior.
Use arma::inv with failure/finite checks when inverting Bbar and fall back to the elastic operator if inversion fails (e.g. degenerate hardening / SMA transformation plateau). Return a ContinuumTangent with Lt = L, zeroed invBhat and P_epsilon to avoid producing inf/NaN that would abort the global solver. Also add a guard against tiny or non-finite Bhat_scalar to prevent 1/Bhat from poisoning Lt, and keep invBhat masked to inactive rows/cols. Updated test result file to reflect the changed behavior.
Register MODUL for finite-strain (NLGEOM) with an explicit corate_type=3 (log_R) requirement and map log-strain/Kirchhoff output correctly; reject other corates with a RuntimeError. Add example and path file (MODUL_finite.py / MODUL_finite_path.txt) and document the finite-strain behavior in the catalog and Python API docs. Implement onset regularization for PowerLawHardening (m < 1) with precomputed quadratic blend coefficients to avoid divergent tangent at p->0. Add solver-level divergence guards and a unified step-cut policy: cap Newton strain correction magnitude, handle singular Jacobian by bisecting increments (or rethrow when at minimal fraction), and centralize step-cut logic. Propagate the same recoverable-failure handling for sqrt/exp/inv/det exceptions in both mechanical and thermomechanical loops. In ModularUMAT reject unusable committed states early (non-finite stress or runaway per-increment plastic multiplier) and request a step cut instead of committing pathological states. Fix selection of Kirchoff-route boxes to key by UMAT names (avoid id remap bug) and include MODUL in that set. Add test harness and pytest tests exercising finite-strain MODUL behavior and solver robustness (new tests and harness under simcoon-python-builder/test/test_core). Misc: small includes and header Doxygen clarifications.
Remove the hard-coded Newton correction norm cap (Delta_cap_solver) and its early bailout checks from solver.cpp (mechanical and thermomechanical loops). Revise test comments in test_solver_robustness.py to document the actual guards under test (ModularUMAT behavior, tangent-assembly fallback, singular global Jacobian step-cut and exception handling) and clarify the failure scenario. Update the comparison results file accordingly.
When a Jacobian inversion fails at the minimal increment fraction, stop throwing an exception and instead fall back to the existing step-cut / inforce path. The mechanical and thermomechanical Newton loops now call try_step_cut and set the loop to exit (compteur = maxiter_solver) rather than raising a simcoon::exception_solver, which avoids platform-fragile hard crashes due to backend LAPACK singularity detection. The corresponding test was updated to reflect that EPICP (legacy CCP kernel) convergence is platform-dependent: the docstring clarifies the invariant being tested (no hard crash; the cycle completes, yields, and dissipates), and assertions were changed to check those invariants (ran to completion, yielded on loading, and dissipated) instead of exact final-state values.
Delete legacy command-line tools in software/: Elastic_props.cpp, L_eff.cpp, ODF.cpp, PDF.cpp and solver.cpp. Also remove the add_executable loop from CMakeLists.txt that built solver, L_eff, Elastic_props, ODF and PDF so these public executables are no longer built. Cleans up old/unused utilities from the project build.
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.
No description provided.