Skip to content

Add 1D Euler-Bernoulli beam solver (cubic Hermite elements)#86

Draft
ferrari212 wants to merge 5 commits into
FEAScript:mainfrom
ferrari212:feature/eulerBernoulliBeamScript
Draft

Add 1D Euler-Bernoulli beam solver (cubic Hermite elements)#86
ferrari212 wants to merge 5 commits into
FEAScript:mainfrom
ferrari212:feature/eulerBernoulliBeamScript

Conversation

@ferrari212

@ferrari212 ferrari212 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a 1D Euler-Bernoulli beam bending solver (eulerBernoulliBeamScript) using cubic
    Hermite (C¹) finite elements, so both deflection w and slope theta = dw/dx are
    represented as nodal DOFs. The fourth-order analogue of the existing scalar 1D solvers
    (heatConductionScript, generalFormPDEScript).
  • Adds hermiteCubic support to basisFunctions.js (shape functions + 2nd ksi-derivative)
    and a matching 6-point Gauss rule to numericalIntegration.js. This is general C¹
    interpolation infrastructure, not beam-specific, eulerBernoulliBeam.js is just its
    first consumer, and it should be directly reusable for future 4th-order models (e.g.
    Kirchhoff plate bending).
  • Adds a worked example reproducing the "Bending of a Beam" problem from J.N. Reddy,
    An Introduction to the Finite Element Method, 3rd ed. (FEM1D reference program,
    Chapter 7): a beam clamped at one end, supported by a roller at midspan and a linear
    spring at the free end, carrying a distributed load, a point moment, and a point load.

What's included

  • src/mesh/basisFunctions.js — cubic Hermite basis functions and their 1st/2nd
    ksi-derivatives, on the same [0,1] natural-coordinate convention used by the existing
    linear/quadratic Lagrange elements in the library.
  • src/methods/numericalIntegration.js — 6-point Gauss quadrature rule for hermiteCubic
    (exact up to degree 11).
  • src/models/eulerBernoulliBeam.js (new) — element assembly
    (assembleEulerBernoulliBeamMat): builds the global stiffness/load system from
    EI(x), c0(x) (elastic foundation, optional), and q(x) (distributed load).
  • src/models/beamBoundaryConditions.js (new) — essential (fixed/pinned/rotation),
    natural (force/moment), and mixed/Robin (spring) boundary conditions. Unlike the
    side-based "0"/"1" boundary keys used elsewhere, these are keyed by 1-based node
    number
    , since beam problems commonly need supports/loads at interior nodes (e.g. a
    midspan roller), not just the two domain ends.
  • src/FEAScript.js — wires up solverConfig: "eulerBernoulliBeamScript".
  • examples/Beam1DFEM/Beam1DEuler_Bernoulli.js + README.md — the worked example above,
    plus documentation of the mesh/coefficient/boundary-condition API for this solver.
  • tests/unit/eulerBernoulliBeam.test.js — verifies the single-element stiffness matrix
    against the closed-form textbook Hermite beam matrix (2 EI/L combinations), and a
    cantilever tip-load case against the classical closed-form solution
    (w = PL³/3EI, theta = PL²/2EI).
  • tests/regression/EulerBernoulliBeam/ — regression baseline for the full worked example,
    plus an independent global force/moment equilibrium check (recomputed reactions from
    the raw, unconstrained assembly) that holds regardless of the specific baseline numbers.

Testing

  • npm test passes (5/5 test files, including the 2 new ones)
  • Single-element stiffness matrix matches the closed-form Hermite beam matrix to ~1e-10
  • Cantilever tip deflection/rotation matches the classical closed-form solution exactly
  • Full worked-example solution satisfies global force and moment equilibrium to ~1e-11
  • npm run build succeeds

Notes for reviewers

  • The beam geometry mesh only needs elementOrder: "linear" (2 end nodes per element);
    the cubic Hermite field interpolation is applied internally regardless of this setting,
    a standard "subparametric" formulation for beam elements.
  • See examples/Beam1DFEM/README.md for the boundary-condition syntax and a table of
    supported condition types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants