pycba.analysis.BeamAnalysis#
- class BeamAnalysis(L, EI, R, LM=None, eletype=None, D=None)[source]#
Bases:
objectDirect-stiffness continuous beam analyser.
Assembles the global stiffness matrix from individual span stiffness matrices, applies support boundary conditions (including elastic springs and prescribed displacements), solves the linear system for nodal displacements, and recovers support reactions and distributed load effects along each member.
After calling
analyze(), results are available throughbeam_results:beam_results.R— reactions at fully-fixed DOFs.beam_results.Rs— spring forcesk_s × u_iat spring DOFs.beam_results.D— global nodal displacement vector.beam_results.results— concatenated member load-effect arrays (x,M,V,D,R).
Construct a beam analysis object.
- Parameters:
L (
ndarray) – Span lengths. LengthNfor anN-span beam.EI (
Union[float,ndarray]) – Flexural rigidity of each span. A scalar value is applied to all spans; otherwise one value per span is required.R (
ndarray) –Nodal restraint vector, length
2(N+1). Two entries per node (vertical DOF then rotational DOF), ordered left to right:-1— fully restrained (zero displacement unless overridden byD).0— free.+k— elastic spring stiffness in consistent units.
LM (
Optional[List[List[Union[int,float]]]]) –Load matrix: a list of load descriptors, each of the form
[span, load_type, value, a, c]. Load types:UDL —
valueis load intensity; seta = c = 0.Point load —
valueat distanceafrom the span start.Partial UDL —
valueintensity fromafor lengthc.Moment load —
valueat distanceafrom the span start.
eletype (
Optional[ndarray]) –Element type for each span, controlling which end(s) carry moment:
Fixed–fixed (default).
Fixed–pinned (moment release at right end).
Pinned–fixed (moment release at left end).
Pinned–pinned (moment releases at both ends).
At an internal hinge, only one of the two members meeting at that node should have a pinned end.
D (
Optional[list]) – Prescribed-displacement vector, length2(N+1)(same asR). UseNonefor DOFs whose displacement is unknown (the default). Provide a float for DOFs with a known displacement (e.g. a support settlement — negative = downward). Fixed supports (R = -1) default to zero displacement unlessDprovides an explicit override.
- Raises:
ValueError – If
RandDhave different lengths, orEIis not scalar and its length differs fromlen(L).
Methods
Append a concentrated moment load.
Append a point load.
Append a partial uniformly-distributed load.
Append a full-span uniformly-distributed load.
Execute the direct-stiffness analysis.
Plot bending moment, shear force, and deflection diagrams.
Replace the current load matrix with a new one.
Attributes
The underlying
Beamobject.Post-analysis results object.
- property beam_results: BeamResults#
Post-analysis results object.
Noneuntilanalyze()has been called successfully. Provides nodal displacements (D), reactions at fixed supports (R), spring forces (Rs), and per-member load-effect arrays (vRes,results).- Type:
- property beam: Beam#
The underlying
Beamobject.Provides direct access to span geometry, stiffness matrices, restraints, and prescribed displacements.
- Type:
- set_loads(LM)[source]#
Replace the current load matrix with a new one.
Any loads previously added via
add_udl(),add_pl(),add_pudl(), oradd_ml()are discarded.- Parameters:
LM (
List[List[Union[int,float]]]) – New load matrix in the same format as theLMargument of__init__().
- add_udl(i_span, w)[source]#
Append a full-span uniformly-distributed load.
- Parameters:
i_span (
int) – 1-based span index.w (
float) – Load intensity. Positive values act downward.
- add_pl(i_span, p, a)[source]#
Append a point load.
- Parameters:
i_span (
int) – 1-based span index.p (
float) – Load magnitude. Positive values act downward.a (
float) – Distance from the left end of the span to the load.
- add_pudl(i_span, w, a, c)[source]#
Append a partial uniformly-distributed load.
Any portion of the load that extends beyond the end of the span is silently ignored.
- Parameters:
i_span (
int) – 1-based span index.w (
float) – Load intensity. Positive values act downward.a (
float) – Distance from the left end of the span to the start of the load.c (
float) – Length (cover) of the partial UDL.
- add_ml(i_span, m, a)[source]#
Append a concentrated moment load.
- Parameters:
i_span (
int) – 1-based span index.m (
float) – Moment magnitude. Positive values are counter-clockwise.a (
float) – Distance from the left end of the span to the load.
- analyze(npts=None)[source]#
Execute the direct-stiffness analysis.
Assembles the unrestricted global stiffness matrix, validates the model, applies boundary conditions (including spring supports and prescribed displacements), solves for nodal displacements, and recovers support reactions. Results are stored in
beam_results.- Parameters:
npts (
Optional[int]) – Number of evaluation points along each member for computing distributed load effects (bending moment, shear, deflection). Must be greater than 3; defaults to 100 if omitted or≤ 3.- Returns:
0on successful completion.- Return type:
int- Raises:
ValueError – If the model is invalid (see
_validate()) or if the structure is geometrically unstable (see_solver()).
- plot_results()[source]#
Plot bending moment, shear force, and deflection diagrams.
Produces a three-panel figure of bending moment, shear force, and deflection along the beam. Bending moment is plotted with the sagging-positive convention (y-axis inverted so sagging appears below the beam line).
Note
The axis labels (“kNm”, “kN”, “mm”) and the deflection scaling (×1000) assume a kN / m unit system. If a different consistent unit system is used the plots will still be correct in shape but the labels and deflection axis values will need interpretation.
Has no effect and prints a warning if
analyze()has not been called yet.