Repository navigation
Conversation
core/tensor_kind.h grows stress_like into kinded<T, voigt, leg...> with the aliases for reference strains, two-point and material tensors, vectors and moduli, and rotated() acting on spatial legs only. statev_map builds every kinded entry with one builder: 3/9 full slots for voigt::none, 6 otherwise, a rotate step only when a leg is spatial, and describe() marks per kind. Plain tensor2 history keeps its engineering, spatial meaning.
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.
Implements #216 (part of epic #221). No other PR has to merge first.
What and why
statev_mapknew three history shapes: a scalar, a symmetric rank-2 tensor stored like a strain (plusstress_likefrom #91), and a minor-symmetric rank-4 tensor. Every tensor entry was rotated under DROT. Reference-configuration history (Cp, Fp, a fibre structure tensor), non-symmetric tensors, vectors and symmetric non-strains (conductivity, diffusivity) had no correct storage.This PR generalises
stress_likeinto a kind carried by the type:core/tensor_kind.h(new):enum class leg {spatial, material},enum class voigt {none, engineering, plain}andkinded<T, V, Legs...>, atmech::tensor<T, 3, sizeof...(Legs)>with the tensor's constructors, assignment and expression support. Aliases:stress_like,reference_strain,two_point,material_tensor,spatial_vector,material_vector,spatial_moduli,material_moduli.rotated(a, R)/rotate_legs<Legs...>(t, R): R acts on each spatial leg only, so R·v, R·t·Rᵀ, R·t, t·Rᵀ, or nothing.core/stress_like.hstays as a header that includestensor_kind.h, so existing includes keep compiling.umat/statev_map.h: one entry builder (add_kinded<V, Legs...>) for every kinded type and for plaintensor<T,3,2>:voigt::none(all components, row-major), 6 otherwise (Abaqus order, shear doubled forengineeringand as is forplain);require_symmetricon pack forengineering/plain, no check fornone;has_rotatable_history()is false when only material-leg and scalar history exist, and the UMAT evaluator then skips the DROT step;describe()marks each entry with its storage and legs:[engineering shear],[stress],[vector],[full], then[reference](all legs material) or[two-point](mixed legs).stress_likebranch from STATEV: stress-like tensor history without the engineering-shear factor (#63) #91 is gone;stress_likegoes through the same builder.umat/tensor_conversion.h:full_from_buffer/full_to_buffer(tmechfull<3>adaptor) next to the strain/stress conversions.A plain
tensor<T,3,2>history keeps its meaning (engineering shear, spatial legs), and scalars andtensor<T,3,4>are unchanged. No existing material changes its STATEV layout.Decisions
stress_likewasstress_like<T, Dim = 3>; it is now the aliasstress_like<T>from the issue, becausekindedis 3D only. Every user in the repository writesstress_like<value_type>.spatial_moduliandstress_likeare the same type, as in the issue's sketch, so a spatial modulus is described as[stress](stored without the shear factor).kindedrejects at compile time the combinations that cannot be stored: rank other than 1 or 2, a vector with six-slot storage, and six-slot storage of a two-point tensor (symmetry needs both legs alike).{11 12 13 21 22 23 31 32 33}, the tmechfull<3>adaptor.material_point/material_point_evaluatorneeded no change: they already askhas_rotatable_history()before the DROT step.Tests
New
tests/test_history_kinds.cpp(9 tests), with two test-only probe materials whose history outputs are kinded:stress_like<T>iskinded<T, plain, spatial, spatial>;rotated()acts on each spatial leg only (vector, symmetric, two-point either way round, material).reference_strain,material_vectorandmaterial_tensorcome back unchanged on both sides, whiletensor2,spatial_vector,spatial_modulirotate andtwo_pointbecomes R·F.two_pointandmaterial_tensorkeep all 9 non-symmetric components through pack and unpack (raw slots checked); vectors round-trip through 3 slots.spatial_modulistores D₁₂ while thetensor2andreference_strainnext to it store 2ε₁₂.reference_strainwith a skew part is rejected on pack.describe()marks for every kind.has_rotatable_history()is false with only material-leg and scalar history.StatevMap.StressLikeHistoryKeepsItsShearComponentsForTheHostand all existingstatev_maptests pass unchanged.Gate
GCC 14 gate (with the ASan/UBSan test targets, -Werror): BUILD=0, 1458/1458 tests passed, 0 warnings.