Skip to content

Bug: Parenthesis error in DKT element dHxdeta function (line 180) #265

@pvinci

Description

@pvinci

Bug Description

There's a missing closing parenthesis in src/dkt.jl line 180 that causes incorrect computation of the DKT element stiffness matrix.

Location

src/dkt.jl, line 180, in the dHxdeta function within basis_factory:

# CURRENT (INCORRECT):
d9 = -2.0 + 6.0*eta + r5*(1.0-2.0*eta+xi*(r4-r5))
                                      missing closing paren

# SHOULD BE:
d9 = -2.0 + 6.0*eta + r5*(1.0-2.0*eta) + xi*(r4-r5)
                                      paren should close here

Impact

This bug causes:

  • Incorrect values for 13 out of 81 entries in the element stiffness matrix
  • All errors are in row 8 and column 8 (θy rotation at node 3)
  • The incorrect formula multiplies r5 by the entire expression instead of just (1.0-2.0*eta)

How to Reproduce

Run the existing test in test/test_dkt.jl:

@test isapprox(K, K_expected)

With the current code, this test passes because K_expected contains the incorrect values. After fixing the bug, K_expected needs to be
updated.

Expected Behavior

According to the Batoz & Bathe 1980 paper (the original DKT formulation), the shape function derivative should be:

dHxdeta[9] = -2 + 6η + r5(1-2η) + ξ(r4-r5)

Not:

dHxdeta[9] = -2 + 6η + r5(1-2η + ξ(r4-r5))

Proposed Fix

1. Fix src/dkt.jl line 180:

d9 = -2.0 + 6.0*eta + r5*(1.0-2.0*eta) + xi*(r4-r5)

2. Update test/test_dkt.jl lines 25-33:

The corrected K_expected should have these values for column 8 (changes marked):

K_expected = [
 4880     0     0  -2440   1220  -1220  -2440  1220  -1220   # was: 0
    0   915  -305    610    305    610   -610  -610   305    # no change
    0  -305   915    610    305   -610   -610   610   305    # no change
-2440   610   610   2440      0    610      0  -610   1220   # was: 610
 1220   305   305      0    610   -305  -1220   305     0    # was: 305
-1220   610  -610    610   -305    915    610  -915   305    # was: 0
-2440  -610  -610      0  -1220    610   2440  -610     0    # was: -610
 1220  -610   610   -610    305   -915   -610   915  -305    # was: 0
-1220   305   305   1220      0    305      0  -305   610]   # entire row was wrong

How This Was Discovered

While implementing an independent DKT element in Rust and cross-validating against FEMPlates.jl, we found systematic differences in row/column 8
of the stiffness matrix (84% match, 13/81 entries differing). After exhaustive debugging and line-by-line comparison with the Batoz & Bathe
paper, we traced the issue to this parenthesis error.

Validation

The corrected formula has been validated by:

  1. Comparing against Batoz & Bathe 1980 paper equations
  2. Independent implementation in Rust matching the corrected values
  3. Hand calculation for the unit right triangle test case
  4. Verifying stiffness matrix remains symmetric
  5. All 81 entries match expected analytical values

References

  • Batoz, Jean-Louis, Klaus-Jürgen Bathe, and Lee-Wing Ho. "A study of three-node triangular plate bending elements." International Journal for
    Numerical Methods in Engineering
    15.12 (1980): 1771-1812.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions