Skip to content

ccaprani/pycba

Repository files navigation

PyCBA logo

PyCBA — Python Continuous Beam Analysis

Fast, accurate continuous-beam analysis for the design, assessment and teaching of buildings and bridges —
from linear statics to plastic collapse, modal dynamics and moving-load bridge assessment.

PyPI version Python versions Tests codecov Documentation License: AGPL v3 Code style: black

PyCBA result diagrams

PyCBA is a focused, dependable 1-D continuous-beam engine built on the matrix (direct) stiffness method. It is deliberately not a general 2-D/3-D FE package — instead it does one thing extremely well, with a clean API, light dependencies (numpy / scipy / matplotlib), and an analysis core that powers a surprisingly broad toolkit.

import pycba as cba

# A two-span continuous beam: 10 m + 12 m, EI = 30 000 kN·m², pinned supports
beam = cba.BeamAnalysis(L=[10, 12], EI=30_000, supports=["pin", "pin", "pin"])
beam.add_udl(i_member=1, w=20)         # 20 kN/m on span 1
beam.add_pl(i_member=2, p=50, a=6)     # 50 kN point load at mid-span 2
beam.analyze()

beam.plot_results()                    # bending moment, shear, deflection + reactions
print(beam.at(5.0))                    # -> {'M': 162.5, 'V': -17.5, 'R': 0.0, 'D': -0.05}

✨ What it does

Analysis

  • Continuous beams of any number of spans, with pin / roller / fixed / vertical-spring / rotational-spring supports, prescribed settlements, and internal hinges — plus pre-solve mechanism detection.
  • An element library: Euler–Bernoulli, Timoshenko (shear-deformable), non-prismatic (variable EI), and beam-on-Winkler-foundation.
  • Nonlinear elasto-plastic analysis to collapse (plastic hinges, mechanism detection, collapse-mechanism plots).
  • Free-vibration (modal) analysis — natural frequencies, periods and mode shapes.

Loads & bridges

  • UDL, point, partial, trapezoidal, moment and imposed-curvature (creep / shrinkage / thermal) loads; load cases, combinations and patterned UDLs.
  • Moving-load bridge assessment — influence lines, envelopes, coincident effects, lane UDLs and shear points / critical shear.
  • Code load models — road & rail, from six nations — AASHTO HL-93, Eurocode LM1 / LM71, BS 5400 / CS 454 HB, CSA CL-625, China JTG, AREA Cooper E, AS 5100 M1600 / S1600 / 300LA, NAASRA T44 / MS18 — organised by region.
  • A post-tensioning preprocessor for prestress.

Visualisation

  • Beam & load schematics in matplotlib and publication-quality TikZ / stanli.
  • Shaded bending-moment / shear / deflection diagrams, reaction plots, coincident-effects, mode-shape, collapse-mechanism and vehicle plots.
  • An interactive Plotly backend, and selectable display unit systems (SI / US / N·mm).

Ergonomics

  • Point queries at(x), exports to_dataframe() / to_csv(), a friendly supports= API, and clear errors — all validated against closed-form solutions, with 370+ tests.

📦 Installation

pip install pycba                 # core
pip install "pycba[plotly]"       # + interactive plots

Requires Python 3.9+.

📚 Documentation & tutorials

Full documentation, a Theoretical Basis, and a dozen worked-example notebooks (bridges, foundations, modal, non-prismatic, nonlinear collapse, creep/shrinkage/thermal, the vehicle library, and more) are at ccaprani.github.io/pycba.

🌱 Origins

PyCBA began life as a Python port of Colin Caprani's MATLAB Continuous Beam Analysis program (later ported to C++ by Pierrot). It has since grown well beyond that starting point into the toolkit above — but the spirit is unchanged: fast, exact, and a pleasure to use.

📄 License

PyCBA is released under the GNU Affero General Public License v3.0 (AGPL-3.0). In short: you are free to use PyCBA for any purpose — including professional and commercial work — but if you incorporate it into your own software, or offer it over a network (e.g. a hosted or SaaS tool), that software must in turn be released under the AGPL. Contributions and issues are welcome on GitHub.

About

Python Continuous Beam Analysis

Topics

Resources

License

Stars

121 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors

Languages