fix: use consistent Voigt order for the shell reference curvature - #97
Merged
Conversation
IgaShell3PAD builds the membrane metric (ref_a/act_a) and the strain
transformation matrix in Voigt order [11, 22, 12], and the actual
curvature act_b uses the same order:
act_b = (a1_1 . a3, a2_2 . a3, a1_2 . a3)
The reference curvature computed in add(), however, used [11, 12, 22]:
ref_b = (a1_1 . a3, a1_2 . a3, a2_2 . a3)
Since kap = T * (act_b - ref_b) applies the same [11, 22, 12] transform
to both, the mismatched ordering mixes the b22 and b12 curvature
components, giving a wrong bending strain whenever the reference surface
is curved (ref_b != 0). Flat references (ref_b == 0) and the membrane
element are unaffected, which is why the baked reference test (a flat
patch) does not change.
Reorder ref_b to [11, 22, 12] to match act_b and the transformation.
Add a value-level regression test: on a curved reference the isotropic
shell energy must be invariant under relabelling the parametric
directions (u1 <-> u2, i.e. permuting the shape-function rows). This
fails before the fix and passes after; it is verified independently
against a numpy reference implementation using the consistent ordering.
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.
Problem
IgaShell3PADbuilds the membrane metric (ref_a/act_a) and the strain transformation matrixTin Voigt order [11, 22, 12], and the actual curvature uses the same order:But the reference curvature built in
add()used [11, 12, 22]:kap = T * (act_b - ref_b)applies the same[11, 22, 12]transform to both operands, so the mismatched ordering subtracts theb12andb22components across different slots — a wrong bending strain whenever the reference surface is curved (ref_b != 0).Flat references (
ref_b == 0) and the membrane element (IgaMembrane3PAD, whoseref_a/act_aare consistently[11, 22, 12]) are unaffected. This is why the existing baked reference test — a flat patch — does not change.Fix
Reorder
ref_bto[11, 22, 12]to matchact_band the transformation:ref_b(ref_a1_1.dot(ref_a3), ref_a2_2.dot(ref_a3), ref_a1_2.dot(ref_a3));Why the usual tests can't catch this
test_iga_shell_3p_adasserts values produced by the element itself, and its reference is flat — the bug is invisible there.gvsfcannot catch it either: the AD differentiates whatever energy expression is written, sogstays consistent withfeven when that expression is wrong.Test
tests/test_iga_shell_3p_symmetry.pyuses a value-level physical invariant on a curved reference: for an isotropic material the shell energy must be invariant under relabelling the parametric directionsu1 <-> u2(which only permutes the shape-function rows).f_orig = 0.4182vsf_swapped = 0.3031→ fails.Cross-checked independently against a numpy reference implementation using the consistent
[11, 22, 12]ordering (elementfmoves from0.4182(matches the buggy ordering) to0.2237(matches the reference)). Full suite: 44 passed, existing shell baseline unchanged.Impact
Kirchhoff-Love shells with a curved reference geometry previously produced an incorrect energy, gradient and Hessian. Flat references and membranes were not affected.