Skip to content
nathan-carmichael edited this page Mar 11, 2026 · 2 revisions

ShepherdLab LW FEA-OPT (Python)

Lightweight 2-D frame and truss finite element analysis with stress-ratio thickness optimisation. Pure Python, built on NumPy and SciPy.


Getting Started

  • Installation & Quick Start — requirements, setup, and running the demos
  • README — project overview with usage examples

Documentation

Chapter Description
1 — Introduction Overview, installation, project layout, conventions, and differences from the MATLAB version.
2 — Theory Element formulation, global assembly, Newton–Raphson solver, stress recovery, and the optimisation algorithm.
3 — API Reference Full documentation of every public class, method, and function.
4 — Worked Examples Curved beam optimisation, truss topology optimisation, and a minimal custom problem.
5 — Profile Export Pipeline Rasterisation, morphological cleanup, contour tracing, spline fitting, and SolidWorks import workflow.
A — File Listing & Error IDs Complete file manifest and error ID reference.

Links

# ShepherdLab LW FEA-OPT (Python)

Lightweight 2-D frame and truss finite element analysis with stress-ratio thickness optimisation. Pure Python, built on NumPy and SciPy.


Getting Started

Documentation

Chapter Description
1 — Introduction Overview, installation, project layout, conventions, and differences from the MATLAB version.
2 — Theory Element formulation, global assembly, Newton–Raphson solver, stress recovery, and the optimisation algorithm.
3 — API Reference Full documentation of every public class, method, and function.
4 — Worked Examples Curved beam optimisation, truss topology optimisation, and a minimal custom problem.
5 — Profile Export Pipeline Rasterisation, morphological cleanup, contour tracing, spline fitting, and SolidWorks import workflow.
A — File Listing & Error IDs Complete file manifest and error ID reference.

Demos

Script What it does
demo_beam.py Imports an S-shaped beam from an IGES file, runs linear and nonlinear analysis, optimises thickness, and exports a CAD-ready profile.
demo_truss.py Builds a Warren truss programmatically, subdivides into fine elements, optimises, and exports with side-by-side before/after plots.

Key Concepts at a Glance

Workflow — every analysis follows four stages: define geometry → analyse → optimise → export.

Indexing — all node, element, and DOF indices are 0-based, following Python convention.

Core classes:

Class / Function Module Role
StructureGeometry structure_geometry.py Topology, materials, constraints, DOF maps
FEAAnalysis fea_analysis.py Linear and nonlinear solvers
LoadCase load_case.py Nodal loads and load-factor stepping
optimize_thickness optimize_thickness.py Stress-ratio thickness optimiser
subdivide_truss subdivide_truss.py Refine truss members into sub-elements
import_csv_curve importers.py Import 2-D curves from CSV
import_igs_curve importers.py Import 2-D curves from IGES/IGS
export_profile export_profile.py Rasterise and export CAD-ready profiles
StructurePlotter structure_plotter.py Visualisation utilities

Dependencies:

Package Required Used for
NumPy Yes Array operations, linear algebra
SciPy Yes Sparse matrices, spsolve
matplotlib No (recommended) Plotting and visualisation
scikit-image For export only Rasterisation, morphology, contour tracing

Links

Clone this wiki locally