Skip to content

Enhance support displacements, thermal loads, and hinge stiffness - #482

Open
mgrubisic wants to merge 4 commits into
anastruct:masterfrom
mgrubisic:upstream-pr
Open

mgrubisic wants to merge 4 commits into
anastruct:masterfrom
mgrubisic:upstream-pr

Conversation

@mgrubisic

Copy link
Copy Markdown

This PR adds support for imposed support displacements and rotations and thermal loads, including uniform temperature changes and temperature gradients. Both load types are available through SystemElements, LoadCase, and LoadCombination, with documentation, examples, and tests against analytical solutions.

It also improves key aspects of the structural analysis:

  • Hinges and rotational springs: End hinges are condensed exactly, and finite rotational springs are modeled in series with the element.
  • Discretization and internal hinges: Results no longer depend on element insertion order, and hinges on discretized elements are displayed by the plotter.
  • Buckling and second-order analysis: Buckling factors now agree with Euler solutions, and plastic hinges are included in second-order analysis.
  • Load and support handling: Fixes address thermal-gradient direction, inclined roller supports, load combinations, and imposed displacements in unrestrained directions.
  • Reliability fixes: Improves node and degree-of-freedom handling after element removal, dead loads in load cases and combinations, validation, and error reporting for unstable or invalid systems.

The changes include expanded documentation, three new examples, and broad test coverage for these features and related regressions.

mgrubisic and others added 4 commits October 29, 2026 11:18
Imposed displacements and rotations of supports (support settlement):
SystemElements.imposed_displacement(node_id, ux, uy, phi_z), also available
in LoadCase and LoadCombination. A positive uy acts in the +y direction like
a positive Fy, so a settlement is a negative uy. The displacement is applied
in process_supports() and enters the reactions and the element forces.

Thermal loads on elements: SystemElements.thermal_load(element_id, delta_t,
alpha, delta_t_gradient, h), also available in LoadCase and LoadCombination.
A uniform temperature change gives an equivalent axial force, a linear
gradient over the section depth h an equivalent end moment.

Includes the user documentation (docs/source/loads.rst, supports.rst), the
examples ex_27 to ex_29 and tests against analytical solutions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nges

Hinges and rotational springs at element ends: a hinge is condensed exactly
(an element with one hinge has 3EI/l instead of 4EI/l) and a finite spring k
acts in series with the element, instead of giving wrong values or NaN.

discretize() and the detection of internal hinges are reworked: the result no
longer depends on the order in which the elements are added, and the hinges
of the discretized elements are drawn by the plotter.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…tions

* solve(geometrical_non_linear=True) now agrees with the Euler buckling loads
  (the buckling factor follows from K0 x = -lambda Kg x).
* The sign of the thermal gradient is corrected: a positive gradient means the
  face to the left of node1 -> node2 is warmer.
* Loads on inclined (rotated) rollers are handled in the support directions.
* Plastic hinges are taken into account in the second order analysis.
* A LoadCombination is one calculation with all of its loads.
* A displacement imposed in a direction that no support restrains now gives a
  clear notice instead of being silently ignored.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Plastic hinges (mp=) are modelled as a rotational spring in series with
  the element and iterated with a secant method. Unloading returns to the
  elastic stiffness, a mechanism raises a FEMException, and every solve()
  starts from the elastic state.
* Node ids may have gaps after remove_element(): dof indices come from
  dof_index() and new ids are max(id) + 1; remove_node_id() cleans up the
  supports, springs and displacement loads of the node.
* LoadCase.dead_load works, and the dead load of the system counts once in a
  LoadCombination.
* validate() works before the first solve() and a displacement above 1e6
  raises a StabilityError.
* A zero-length element and a spring with k=inf raise a FEMException.
* Vertex coordinates are float64, rounded to 12 significant digits.
* Loads with invert_y_loads=False: x/parallel keep their direction, the
  others are reversed, and an explicit rotation is mirrored consistently.
* The spring and mp dictionaries given to add_element() are never modified.
* The examples ex_27 to ex_29 print each result next to its analytical value
  and assert that they agree.

The expected solutions of two tests in tests/test_e2e.py change, because the
stiffness of element end hinges is now exact.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mitchell-tesch

Copy link
Copy Markdown
Contributor

Hi @mgrubisic, just a heads-up that there's some overlap here. I ran into the geometrical non-linear bugs separately and opened two small PRs for them:

We ended up with pretty much the same approach for both, so whichever gets merged first, the other should rebase without much trouble. Happy to help with that either way.

@brookshsmith brookshsmith left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mgrubisic -

Thank you for your prompting on the several points in here. However, this is a very large and sprawling set of changes that is rather difficult to review adequately. Can you please split this pull request up into fixes for individual bugs, and additions of individual features?

I do want to be clear that I am not against AI (I use Claude to assist my coding too), but I've also seen first-hand how AI-generated code easily makes mistakes in engineering software, especially in edge cases, and I want to ensure that any updates that come into anaStruct are fully read and understood by a human - which means keeping changes small and focused.

Thank you!

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants