Repository navigation
Conversation
…ange ply stacking order
The laminate matrices A, B, D were wrong on any non-orthogonal parametrisation:
on a skewed patch they were up to ~35% unsymmetric, and a single isotropic ply
deviated from gsMaterialMatrixLinear by ~25%. The removed _cart2cov/_con2cart
maps had a typo in entry (0,1), put the engineering-shear factor 2 on the wrong
side of the strain map, and were not applied as a congruence.
* Basis change: C^con = Tc C_cart Tc^T with Tc = _transformation([e1 e2], gcon)
from gsMaterialMatrixBaseDim, e1 = a1/|a1|, e2 = a^2/|a^2|. Symmetric by
construction and free of matrix inversion. _cart2cov and _con2cart are deleted.
* eval3D_vector: N = A eps + B kappa and M = B^T eps + D kappa. The B coupling
was missing. Only the two matrices each output needs are evaluated, with no
per-point allocation. The unreachable Generic branch is removed.
* Stacking-order change: ply 0 is now the ply at the most negative z along the
normal n = a1 x a2 / |a1 x a2|, so B = +sum_i t_i z_i C_i. The old formula
corresponded to ply 0 at the top. This is a change of convention, not a sign
fix: unsymmetric layups given in the old order now give the mirrored laminate
and must be reversed to reproduce previous results.
* Doxygen for the class and constructors: ply order, angle unit and reference
direction, layout of G, and the A/B/D/N/M definitions.
Tests:
* New suite gsMaterialMatrixComposite_test (9 tests): isotropic ply against
gsMaterialMatrixLinear on orthogonal and skewed patches; orthotropic
laminates against an independent tensor-contraction oracle (A, B, D; 3D
and planar 2D); symmetry of A, B, D; N/M against fundamental-form strains;
and the stacking direction against a through-thickness integral of
gsMaterialMatrixLinear stresses at physical heights, which the reversed
ply order misses. Skewed tests assert that their patch is really skewed,
non-unit and curved.
* gsThinShellAssembler_test Modal_composite: ply angles used integer division
(all 0); now floating point. Result unchanged (isotropic plies).
Results change for every skewed parametrisation and for every unsymmetric
laminate. No existing example or test covers either case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prefix the data members of the test helpers Laminate and GeometryGuards with m_ (G+Smo member naming convention), and put the opening brace of the anonymous namespace on its own line. No change in behaviour; the 9 tests are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gsMaterialMatrixComposite has no TensionField option, so --composite aborted at start-up in gsOptionList::setInt. Skip the option and the per-iteration tension-field plot when --composite is given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- thickness_into returns the total laminate thickness (1 x u.cols(), sum over plies), the gsMaterialMatrixBaseDim contract. It used to leave result unsized, ignore the patch index, loop over the density vector and write one row per ply. - eval3D_matrix checks the requested output once, before the point and ply loops, and documents its real contract (z ignored, 9 x u.cols(), A/B/D). - Construction with zero plies is rejected. - density_into reports a missing density instead of dereferencing null. - Tests: per-patch thickness_into on a two-patch laminate, Generic output throws, zero plies throws. Laminate test helper checks its input sizes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ector eval3D_vector needs A (for N) or D (for M) plus B. It used to call eval3D_matrix twice, repeating the point computation, the evaluation of the ply data, the per-point metric and the ply loop. A private helper _eval3D_laminate now accumulates both matrices in the same loops and applies the basis change to each; eval3D_matrix calls it for a single matrix. Arithmetic and accumulation order per ply are unchanged. In isolation the removed evaluation was about 43 % of eval3D_vector at 1, 4 and 8 plies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- gsMaterialMatrixComposite_test: density_into throws without rho and returns sum_i t_i rho_i with rho; block comments in the two throw tests. - gsThinShellAssembler_test, Modal_composite: orthotropic plies at distinct angles instead of identical isotropic ones, so the eigenvalues depend on the ply rotation and the layup. The reference is a regression value from this code version (17 digits, 1e-8 relative). It fails for swapped plies or all-zero angles; reversing the whole stack is a symmetry of the pinned flat plate and is not detected (stacking direction is covered by Skewed_StackingDirection_MatchesKinematics). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ate helper - Class doxygen: for dim == 2 the normal is e3 and kappa = 0, so B and the ply order do not enter N. The A/B/D formulas are stated there once. - _eval3D_laminate asserts that the requested output is a laminate matrix. - example_shell2D: the TensionField guards test whether a composite was actually built, not only the --composite switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The exact == check on nu21*E1 = nu12*E2 was a debug-only assert, so inconsistent ply input gave a non-symmetric stiffness in Release, while rounded or computed ratios could fail it in Debug. It is now a GISMO_ENSURE with a 1% relative tolerance; within it, the off-diagonals are set to their mean so G is exactly symmetric. Adds doxygen and the gsCompositeMatrix_test suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015qurMPkppMMnMXasAHCVaE
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.
FIXED: gsMaterialMatrixComposite basis change from the ply frame to the contravariant basis. A, B and D were up to ~35 % non-symmetric, and wrong on any non-orthogonal parametrisation
FIXED: VectorN/VectorM of gsMaterialMatrixComposite omitted the coupling B; now N = A eps + B kappa and M = B^T eps + D kappa, consistent with the tangent
FIXED: gsMaterialMatrixComposite::thickness_into returned an unsized, per-ply result that ignored the patch index; it now returns the total laminate thickness of the requested patch (1 x npts)
FIXED: example_shell2D --composite aborted at start-up (TensionField option set on a material that does not have it)
FIXED: Modal_composite test ply angles were integer division (all 0)
FIXED: gsCompositeMatrix checked the ply reciprocity nu21E1 == nu12E2 with an exact == in a debug-only assert; it now throws std::runtime_error in every build type above a 1 % relative mismatch and symmetrises the off-diagonals below it (new unit test suite gsCompositeMatrix_test)
IMPROVED: gsMaterialMatrixComposite::eval3D_vector evaluates A (or D) and B in one pass over points and plies instead of two full evaluations
IMPROVED: gsMaterialMatrixComposite rejects zero plies, an unsupported eval3D_matrix output and density_into without densities with an exception, instead of 0/0, a late error or a null dereference
API: ply stacking order: ply 0 is now the ply at the most negative z along the normal; unsymmetric layups given in the old order give the mirrored laminate
API: protected helpers gsMaterialMatrixComposite::_cart2cov and _con2cart removed
NEW: unit test suite gsMaterialMatrixComposite_test (14 tests: independent tensor oracles for A/B/D on orthogonal and skewed patches, symmetry, N/M consistency, stacking direction, thickness, density, input validation)
What and why
The basis change in
gsMaterialMatrixCompositehad three defects: a typo in one entry, the factor 2 of theengineering shear on the wrong side, and no congruence. The result was laminate matrices that were not
symmetric and not correct on non-orthogonal parametrisations. It is now the congruence C^con = Qᵀ C_cart Q,
built with
gsMaterialMatrixBaseDim::_transformation. That form is symmetric by construction and needs noinverse.
The membrane and bending resultants now include the coupling matrix B, so the residual matches the tangent
the assembler already used. Several smaller defects found along the way are fixed as well:
thickness_intonow follows the base-class contract.eval3D_vectorno longer evaluates the laminate twice.example_shell2D --compositeruns.All changes are in
src/gsMaterialMatrixComposite.{h,hpp},examples/example_shell2D.cppand the unit tests.Interplay with the open
tft-membranesPR (#36). Both branches addunittests/gsMaterialMatrixComposite_test.cpp, so amerge gives one add/add conflict. Resolve it by keeping both halves in one suite. The helper functions are identical
on both sides.
eval3D_energybuilds on the same A, B and D, so it follows the new ply order and B sign.eval3D_energyneeds rewording. It says "dW/dε equals VectorN only forB = 0", but with this PR VectorN includes B, so the equality holds for any B.
API and semantic changes
B = Σ tᵢ zᵢ Cᵢ with zᵢ the signed height of ply i. The previous code was consistent with the opposite order
(ply 0 on top). This is a change of convention, not a sign fix. An unsymmetric layup that was given in the old
order now describes the mirrored laminate, and its B changes sign. Symmetric layups are unaffected.
orthogonal. On orthogonal patches A and D are unchanged.
laminates converge to a different, now consistent, solution.
thickness_into. It now returns1 × u.cols(), the sum of the ply thicknesses on the requested patch.Before, it returned one row per ply, evaluated on patch 0, and did not resize
result. Callers ingsMaterialMatrixIntegratealready read row 0 as the total thickness, but Composite isIntegratedand doesnot reach them.
std::runtime_error, in every build type):eval3D_matrixcalled with an output other than MatrixA/B/C/D, the defaultGenericincluded. Thiswas already an error, but it was raised later, inside the loops;
density_intoon a laminate constructed without densities. This was a null dereference.gsMaterialMatrixComposite::_cart2covand_con2cart. No class in gsKLShell derivesfrom
gsMaterialMatrixComposite._eval3D_laminate, which is not part of the API.Callers in this repository that see changed values are
example_shell3D,example_parametric_panelandgsThinShellAssembler_test(Modal_composite). The two examples use isotropic plies, so B = 0 there.Modal_compositenow uses orthotropic plies, with a new reference (see Verification).Verification
Full unit-test suite:
Success: 406 tests passed.(Release, gsKLShell enabled).gsMaterialMatrixComposite_test, 14 tests: the A/B/D tests compare with references that do not use the classunder test:
gsMaterialMatrixLinearfor a single isotropic ply;Before the fix, the value tests failed on the original code with relative errors of 0.13–0.35.
Modal_composite:this version, stored at 17 digits with a 1e-8 relative tolerance.
direction is covered by
Skewed_StackingDirection_MatchesKinematics.example_shell3D --composite --nl: Newton update norms 4.1e-2, 5.3e-2, 5.3e-4, 6.0e-6, 1.0e-11, anddisplacement 0.00826805 at the reference point. These are unchanged by the follow-up commits, including the
one-pass
eval3D_vector. A serial-r 3Newton trace is identical to all printed digits before and after it.example_shell2D:--composite(nonlinear and-t 2), the default, and--composite -m 1all exit 0.Cost of
eval3D_vector: measured before fusing. The removed second matrix evaluation was about 43 % ofeval3D_vectorat 1, 4 and 8 plies. No same-load before/after timing of the assembly was made.Review
Automated reviews, all by AI agents:
2026-11-13, medium level: 0 blockers, 10 majors, 3 minors, 3 notes. Each was fixed or decided before the
first two commits. One of those decisions is to describe the ply-order change as a convention change.
2026-11-16, light level: 2 findings, fixed (naming and layout in the test file).
2026-11-18, medium level, on the branch up to the one-pass
eval3D_vectorcommit: 0 blockers, 3 majors,2 minors, 3 notes. All 8 are fixed in the last two commits:
density_into;These two commits came after that review. Each was reviewed separately, per change, by an adversarial agent.
Not checked by the reviews: no mutation proof was run; no dedicated numerics or test-quality reviewer
(medium level); the examples were run by the implementation runs, not by the reviews.
Known, not fixed here (pre-existing):
example_shell2D --TFTcrashes: a nullmaterialMatrixTFTis passed to the assembler.GISMO_ASSERT, so they are not checked inRelease.
Checklist
AI assistance
The implementation, the tests, the example change and this description were generated with an AI coding
assistant (Claude Code with the gismo plugin). I have not yet reviewed the code myself. The checks so far
are the automated reviews and the tests listed above. Please review accordingly.