Add 1D Euler-Bernoulli beam solver (cubic Hermite elements)#86
Draft
ferrari212 wants to merge 5 commits into
Draft
Add 1D Euler-Bernoulli beam solver (cubic Hermite elements)#86ferrari212 wants to merge 5 commits into
ferrari212 wants to merge 5 commits into
Conversation
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.
Summary
eulerBernoulliBeamScript) using cubicHermite (C¹) finite elements, so both deflection
wand slopetheta = dw/dxarerepresented as nodal DOFs. The fourth-order analogue of the existing scalar 1D solvers
(
heatConductionScript,generalFormPDEScript).hermiteCubicsupport tobasisFunctions.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.jsis just itsfirst consumer, and it should be directly reusable for future 4th-order models (e.g.
Kirchhoff plate bending).
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/2ndksi-derivatives, on the same
[0,1]natural-coordinate convention used by the existinglinear/quadratic Lagrange elements in the library.
src/methods/numericalIntegration.js— 6-point Gauss quadrature rule forhermiteCubic(exact up to degree 11).
src/models/eulerBernoulliBeam.js(new) — element assembly(
assembleEulerBernoulliBeamMat): builds the global stiffness/load system fromEI(x),c0(x)(elastic foundation, optional), andq(x)(distributed load).src/models/beamBoundaryConditions.js(new) — essential (fixed/pinned/rotation),natural (
force/moment), and mixed/Robin (spring) boundary conditions. Unlike theside-based
"0"/"1"boundary keys used elsewhere, these are keyed by 1-based nodenumber, 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 upsolverConfig: "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 matrixagainst 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 testpasses (5/5 test files, including the 2 new ones)npm run buildsucceedsNotes for reviewers
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.
examples/Beam1DFEM/README.mdfor the boundary-condition syntax and a table ofsupported condition types.