Fix/gil sma#92
Open
chemiskyy wants to merge 30 commits into
Open
Conversation
Add an optional `tangent_mode` (default 0) argument to many UMAT function signatures so callers can select tangent assembly behavior. Introduce tangent_assembly.hpp/.cpp and a unit test (Ttangent_assembly.cpp) to centralize tangent assembly logic. Update corresponding implementation files, Python wrappers and solver code to propagate the new parameter. Changes are backward-compatible due to the default parameter and prepare the codebase for alternate/optimized tangent computation paths.
Introduce a new unified_TR SMA implementation (header + source) providing a unified phenomenological SMA model with transformation and martensite reorientation (SMRDI/SMRDC/SMRAI/SMRAC variants). Add the new source to CMakeLists so it is built. Improve umat_sma_unified_T: refactor derivative assembly to avoid catastrophic cancellation by routing reverse-transformation K(1,·) through ETMean (stable chain-rule) and add clarifying comments. Fix python wrapper parallel props handling by aliasing the props column as a non-copying arma::vec to avoid NumPy/Carma allocations (and GIL deadlocks) in the parallel region.
Add an optional parameter to umat_prony_Nfast_T declaration (const int& = 0) to allow backward-compatible calls. Expose the new SMA_TR (unified reduced-tangent) UMAT to the Python wrappers: include unified_TR.hpp, register UMAT id 28 for SMRDI/SMRDC/SMRAI/SMRAC in the umat name map, and add a case to bind simcoon::umat_sma_unified_TR (arguments_type = 1).
…ype later removed)
Add `attestations: false` to pypa/gh-action-pypi-publish steps (test.pypi and release) in .github/workflows/wheels.yml. This disables PEP 740 attestations because, when invoked via the reusable workflow (release.yml -> wheels.yml), the attestation is signed by release.yml while the PyPI Trusted Publisher is wheels.yml, causing PyPI to reject the upload (HTTP 400).
Delete the previous ~1.2k-line solver implementation (including the GPL header and the large solver(...) function body) from src/Simulation/Solver/solver.cpp. This large removal appears to be part of a refactor or rewrite of the solver module, preparing the file for a new, slimmer implementation or for splitting functionality across new files. Review follow-up commits for the new implementation or relocated code.
Default the natural_basis to an undeformed Cartesian basis (g_i = e_i) and set metric tensors to identity to avoid a singular zero metric. Fix g0i computation to zero-and-accumulate (g^i = g^{ij} g_j) in constructors/update/from_F and use eye for g_ij/g0ij. Add utility methods: F(), F_inv(), U(), R(), contravariant(), and covariant() to expose transformation gradient, its inverse, right stretch, polar rotation (with error on U inversion), and conversions between covariant/contravariant tensor components. Also propagate the natural basis (nb = sv.nb) in state_variables::rotate_l2g and rotate_g2l so the local/global basis is carried through frame rotations (preserves anisotropy information).
Remove fibre_Fp UMAT from build and dispatcher, add Kirchhoff-based stress routing and correct output scaling. Changes: - src/CMakeLists.txt: removed Continuum_mechanics/Umat/Mechanical/Plasticity/fibre_Fp.cpp from sources. - src/Continuum_mechanics/Umat/umat_smart.cpp: - removed include for fibre_Fp and added <set> header. - removed EPTRF / fibre_Fp case handlers. - fixed several UMAT call signatures (removed redundant nb param where appropriate). - introduced a kirchhoff_box set and logic to treat certain UMAT boxes as already returning Kirchhoff stress (tau = sigma) while converting genuine Cauchy outputs into Kirchhoff when needed; PKII is computed from tau. - ensure small-strain dispatcher mirrors sigma -> tau so routes remain consistent. - fixed missing-key fallthrough risk by keeping proper mappings and explicit handlers. - src/Simulation/Phase/phase_characteristics.cpp: when Cauchy stress is requested (o_stress_type == 4) compute sigma = tau / J from the route-stored Kirchhoff stress so outputs are correctly scaled. Rationale: unify the internal solver route to use Kirchhoff stress (tau) so work accounting and mixed-control forms remain consistent across finite- and small-strain dispatchers; produce true Cauchy outputs on demand. Also remove deprecated/unsupported fibre_Fp UMAT from the project.
Expose new natural_basis API: F(), F_inv(), U(), R() accessors and contravariant()/covariant() tensor converters. These provide direct retrieval of the transformation gradient, its inverse, right stretch and polar rotation, and helpers to convert spatial tensors to/from the natural basis (with formulas documented in comments). Also include a minor whitespace/formatting cleanup in criteria.hpp.
Refactor and fix objective-rate handling and SMA transformation logic across the codebase. - Modified objective_rates.hpp/cpp to correct objective-rate calculations and adjust the API used by higher-level code. - Small fixes in criteria.hpp to align with updated objective-rate usage. - Updated SMA unified_TR implementation (unified_TR.cpp) to use the corrected objective-rate logic and improve transformation residual evaluation. - Adjusted state variable initialization/updates (state_variables.cpp) and solver integration (solver.cpp) to match the new APIs/behavior. - Added example result outputs (examples/mechanical/results/results_SMAUT_global-0.txt, results_SMAUT_local-0.txt) generated with the updated implementation. These changes ensure consistent objective-rate computations and correct SMA transformation responses when integrated with the solver and state management components.
Introduce logarithmic-strain correctors B_R and B_F (headers, implementations and Python bindings) and refactor objective-rate conversion logic for corate-aware tangent mapping. Add DSDE_2_DtauDe_corate and DtauDe_corate_2_DSDE helpers to convert between box Lt = d(tau_hat)/d(De) and material tangents per solver corate, and standardize finite UMATs to emit the canonical box tangent (Kirchhoff, XBM/log-rate). Fix Neo-Hookean incompressible tangent reconstruction bug by rebuilding the tangent from the potential and converting to the box convention. Propagate a new corate_type parameter through select_umat_M_finite/run_umat_M/solver so tangents can be re-baked to the active corate; register Saint-Venant and Neo-Hookean finite UMATs in the Python wrapper. Clean up Lt_convert Python wrapper implementation and ensure consistent handling of stress (Kirchhoff vs Cauchy) when converting tangents. These changes ensure corate-exact Jacobians and correct finite-strain tangents across solvers and Python bindings.
Introduce canonical box tangent helpers (box_DtauDe_from_dSdE, box_DtauDe_from_spatial) in objective_rates to assemble Lt = d(tau_hat)/d(De) from material or spatial elasticity tensors. Use these helpers across finite UMAT implementations (neo_hookean_incomp, generic_hyper_invariants, generic_hyper_pstretch, saint_venant) to standardize the box-tangent convention and remove duplicated pull/push mapping code. Update objective_rates switch formatting for corate cases and extend the UMAT selector API (select_umat_M_finite call/signature) to accept corate_type so the solver gets the correct rate convention.
Introduce Delta_log_strain_corate to compute an exact spatial log-strain increment for logarithmic-family corotational rates (XBM corate=2 and convected log_F corate=5), falling back to the midpoint trapezoid for other rates. Replace calls to Delta_log_strain with the corate-dispatched variant in solver to ensure etot integrates to lnV1 for the log rate. Make the velocity gradient computation in Jaumann and Green-Naghdi second-order accurate by using the centered (F0+F1)/2 configuration. Correct mechanical work bookkeeping in UMATs to use Kirchhoff stress (tau = J*sigma) with appropriate J0/J1 factors so Wm is the work per reference volume. Changes touch objective_rates, solver, and several finite UMAT implementations to improve accuracy and consistency.
Standardize naming of the stress variable across UMAT headers and docs: rename parameter/variable "sigma" to "stress" and update LaTeX/doc comments (\sigma -> \stress) and code examples. Affected modules include Damage, Elasticity, Plasticity, SMA, Viscoelasticity and External UMAT interfaces; corresponding source implementations were updated to match the new signatures. Note: this is an API-breaking change — callers must update to the new parameter name.
Switch the velocity gradient L in Jaumann and Green_Naghdi to a first-order end-configuration estimate (L = (F1-F0)/dt * inv(F1)) so that D = sym(L) is identical across all rate functions (matching Tobjective_rates.all_rates_same_D). Comments updated to explain consistency choice; Green-Naghdi spin still comes from the polar rotation rate. Adjust Tnatural_basis test: default natural_basis now represents an undeformed Cartesian basis (identity metric) instead of zero vectors to avoid a singular metric when from_F is never called. Update reference comparison data files (Umats/HYPER results) to reflect the new numerical outputs.
Replace the first-order velocity gradient L=(1/dt)*(F1-F0)*inv(F1) with a 2nd-order centered estimate L=(2/dt)*(F1-F0)*inv(F0+F1) across objective rate implementations (Jaumann, Green_Naghdi, logarithmic_R, logarithmic_F, Truesdell, logarithmic). Comments updated to explain the midpoint-based estimate and its purpose (consistent D=sym(L) across rates and better approximation of F1*F0^-1 via exp(L*dt) where used). Adjust unit test Tobjective_rates to compute the reference L using the same centered formula so D_test matches the production code.
Introduce natural_basis::V() (left/Eulerian stretch V = (F F^T)^{1/2}) by adding its declaration to the header and an implementation that returns sqrtmat_sympd(F * F^T). Also add a clarifying note in Hill_chaboche_ccp.hpp about stress measures: for finite strain the return mapping is done in a corotational frame and the stress input should be interpreted as the corotational/rotated stress (rate-dependent choice of frame).
Change the convergence check in stress_target_newton from 1e-12 to 1e-8 and add a comment explaining the rationale. This avoids spurious test failures on platforms using reference-netlib BLAS (which can floor above 1e-12) while still matching the test's asserted convergence target.
Replace inconsistent \boldsymbol{\stress} notation with \boldsymbol{\sigma} across multiple UMAT headers and unify the explanatory note on stress measures. Documentation now clearly states that the model 'stress' argument is the Cauchy stress for infinitesimal strains and the rotated Kirchhoff stress when updates run in a corotational frame (specifying the objective-rate frames). Also fix a related docstring for the consistent tangent (Lt) derivative and tidy a few SMA/viscoelasticity formulae. Changes touch damage, elasticity, plasticity, SMA and viscoelasticity headers (and associated source implementations).
Standardize documentation across Umat headers by converting plain text dimensional and symbolic annotations to consistent Doxygen/LaTeX style (\f$...\f$) math markup. Changes clarify Voigt sizes, matrix dimensions, units (e.g. 1/Stress^2 → \f$1/\mathrm{Stress}^2\f$), transformation arrows, and a few example notations (≈ → ~=). Minor corresponding updates applied to some implementation files, the Python wrapper and tests to keep docs/examples consistent.
Export Actions cache tokens and enable vcpkg binary cache for Windows CI to avoid repeated source downloads and intermittent netlib timeouts. Adds a step in .github/workflows/wheels.yml to export ACTIONS_CACHE_URL, ACTIONS_RUNTIME_TOKEN and ACTIONS_RESULTS_URL for vcpkg's x-gha provider, and sets VCPKG_BINARY_SOURCES in both the workflow env and pyproject.toml environment. Binary-cache errors are non-fatal, so builds remain resilient while allowing armadillo/openblas/clapack to be restored from the cache on later runs.
Replace the previous B_R/B_F 'logarithmic-strain corrector' APIs with A_R/A_F as engineering strain-concentration tensors and update all usages and wrappers accordingly. Changes: - API: rename B_R -> A_R and B_F -> A_F in public headers and Python bindings. - Implementation: rename functions and variables in objective_rates.cpp, convert returned matrices to the engineering strain-concentration Voigt convention (scale shear rows), and update eigen-decomposition error messages. - Behavior: clarify documentation/comments describing A^R and A^F (geometric-mean vs arithmetic-mean DK kernels), how to apply/invert them (De = v2t_strain(A * t2v_strain(D))) and their definiteness properties. - Python: update pybind wrappers and module exports to expose A_R/A_F instead of B_R/B_F. - Solver: use A_F when computing the log_F (corate_type==5) increment so the convected branch applies the A^F:D rate; update related comments. - Misc: remove an outdated comment in natural_basis constructor. Notes: - This is an API-breaking rename: callers (C++ and Python) must be updated to use A_R/A_F and to apply them with the engineering Voigt conventions.
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 updates the function signatures for a wide range of material model UMATs (user material subroutines) in the
simcooncontinuum mechanics library. The main change is the introduction of a new optional parameter,tangent_mode, with a default value of 0, to each UMAT function. This parameter will allow users to control the tangent computation mode directly when calling these functions, improving flexibility for advanced constitutive modeling.The most important changes are:
Addition of
tangent_modeparameter to UMATs (by material type):Finite deformation material models:
const int &tangent_mode = 0as an optional parameter to the following functions:umat_generic_hyper_invariants,umat_generic_hyper_pstretch,umat_hypoelasticity_ortho,umat_neo_hookean_comp,umat_neo_hookean_incomp, andumat_saint_venant. This change allows users to specify the tangent computation mode for these finite deformation constitutive laws. [1] [2] [3] [4] [5] [6]Mechanical damage models:
tangent_modeparameter toumat_damage_LLD_0andumat_damage_weibull, enabling control over tangent computation in damage models. [1] [2]Elasticity models:
umat_elasticity_iso,umat_elasticity_ortho, andumat_elasticity_trans_isoto include thetangent_modeparameter, allowing more flexible tangent computation in isotropic, orthotropic, and transversely isotropic elasticity models. [1] [2] [3]Plasticity models:
tangent_modeparameter to all Chaboche-based and Hill-based plasticity UMATs:umat_ani_chaboche_CCP,umat_dfa_chaboche_CCP,umat_generic_chaboche_CCP,umat_hill_chaboche_CCP, andumat_plasticity_hill_isoh_CCP. This provides consistent tangent mode control for advanced plasticity models. [1] [2] [3] [4] [5]