Python API Reference¶
Submodules¶
abdbeam.core module¶
Module defining the classes Section
, Segment
, Point
and Load
.
Section Class¶
-
class
abdbeam.core.
Section
¶ Class that defines a cross section, calculates its properties and internal loads.
-
materials
¶ dict – Of the form {int : abdbeam.Material}
-
points
¶ dict – Of the form {int : abdbeam.Point}
-
segments
¶ dict – Of the form {int : abdbeam.Segment}
-
loads
¶ dict – Of the form {int : abdbeam.Load}
-
cells
¶ dict – An output of the form {int : abdbeam.Cell}
-
yc
¶ float – The centroid Y coordinate.
-
zc
¶ float – The centroid Z coordinate.
-
ys
¶ float – The shear center Y coordinate.
-
zs
¶ float – The shear center Z coordinate.
-
p_c
¶ numpy.ndarray – The 4x4 section stiffness matrix relative to the centroid.
-
w_c
¶ numpy.ndarray – The 4x4 section compliance matrix relative to the centroid.
-
p
¶ numpy.ndarray – The 4x4 section stiffness matrix relative to the section origin.
-
w
¶ numpy.ndarray – The 4x4 section compliance matrix relative to the section origin.
-
weight
¶ float – The section weight per unit length.
-
principal_axis_angle
¶ float – The angle of the coordinate system Y’-Z’ relative to Y-Z in which the moment of Inertia Iy’z’ is zero. Only applicable to isotropic beams.
-
sc_int_strains_df
¶ pandas.DataFrame – The pandas dataframe containing the axial strain, the Y curvature, the Z curvature and the rate of twist of the section relative to the centroid (to be implemented).
-
sgs_int_lds_df
¶ pandas.DataFrame – A pandas dataframe containing the segments internal loads for all load cases in the loads dictionary. Populated by the calculate_internal_loads method.
-
pts_int_lds_df
¶ pandas.DataFrame – A pandas dataframe containing the points internal loads for all load cases in the loads dictionary. Populated by the calculate_internal_loads method.
-
summary
()¶ Prints a summary of the section properties.
-
calculate_properties
()¶ Calculates the section properties.
-
calculate_internal_loads
()¶ Calculates internal loads for all load cases in the loads dictionary.
-
print_internal_loads
()¶ Prints to the console segment and point internal loads for all load cases in the loads dictionary.
Examples
Creating a 2-cells beam cross section comprised of asymmetric laminate segments (see appendix example in reference theory paper):
import abdbeam as ab sc = ab.Section() mts = dict() mts[1] = ab.Laminate() ply_mat = ab.PlyMaterial(0.166666, 148000, 9650, 4550, 0.3) mts[1].ply_materials[1] = ply_mat mts[1].plies = [[0,1], [0,1], [0,1], [0,1], [0,1], [0,1]] + [[45,1]]*6 mts[1].symmetry = 'T' mts[1].calculate_properties() pts = dict() pts[1] = ab.Point(0, -35) pts[2] = ab.Point(-50, -35) pts[3] = ab.Point(-50, 35) pts[4] = ab.Point(0, 35) pts[5] = ab.Point(50, 35) pts[6] = ab.Point(50, -35) sgs = dict() sgs[1] = ab.Segment(1,2,1) sgs[2] = ab.Segment(2,3,1) sgs[3] = ab.Segment(3,4,1) sgs[4] = ab.Segment(4,1,1) sgs[5] = ab.Segment(4,5,1) sgs[6] = ab.Segment(5,6,1) sgs[7] = ab.Segment(6,1,1) sc.materials = mts sc.points = pts sc.segments = sgs sc.calculate_properties() sc.summary()
Adding two load cases to the section above and printing their internal loads:
Lds = dict() Lds[101] = ab.Load(1000.0,25000,-36000) Lds[102] = ab.Load(Px=1500.0) Lds[103] = ab.Load(Vz_s=1000.0) sc.loads = Lds sc.calculate_internal_loads() sc.print_internal_loads()
-
calculate_internal_loads
() Calculates internal loads for all load cases in the loads dictionary.
Results are loaded into two pandas dataframes: self.sgs_int_lds_df and self.pts_int_lds_df. Segment loads are represented as quadratic equations by outputting the coefficients C2, C1 and C0, where Load = C2*n**2 + C1*n + C0. “n” is the location in the segment length varying from 0.0 (point A) to 1.0 (point B). Maximum and minimum segment values and their associated locations (0.0 - 1.0) inside the segment are also provided, along with the segment average and total (integrated) load.
-
calculate_properties
() Calculates the section properties.
-
print_internal_loads
(break_columns=True) Prints to the console segment and point internal loads for all load cases in the loads dictionary.
Warning
This method outputs a significant amount of data per load case and segment. Depending on your number of segments and load cases, manipulate the data stored in self.sgs_int_lds_df and self.pts_int_lds_df using pandas methods directly.
Parameters: break_columns (bool, default True) – Of the form {int : abdbeam.Material}
-
summary
() Prints a summary of the section properties.
-
Segment Class¶
-
class
abdbeam.core.
Segment
(point_a_id, point_b_id, material_id, description='')¶ Class that defines a section segment and calculates its properties.
-
point_a_id
¶ int – The first point id of the segment.
-
point_b_id
¶ int – The second point id of the segment.
-
material_id
¶ int – The material id of the segment.
-
description
¶ str – The segment description.
-
bk
¶ float – The segment length.
-
t
¶ float – The segment thickness (based on material data).
-
calculate_properties
(points, materials)¶ Prints a summary of the section properties.
Examples
Creating 3 segments and associating them to a section.
import abdbeam as ab sc = ab.Section() sgs = dict() sgs[1] = ab.Segment(1,2,1) sgs[2] = ab.Segment(2,3,1) sgs[3] = ab.Segment(3,4,1) sc.segments = sgs
-
calculate_properties
(points, materials) Calculates the segment properties.
This method is normally called by a Section object.
Parameters: - points (dict) – Of the form {int : abdbeam.Point}.
- materials (dict) – Of the form {int : abdbeam.Material}.
-
Point Class¶
-
class
abdbeam.core.
Point
(y=0.0, z=0.0, EA=0.0, GJ=0.0, description='')¶ A cross section point in the section (Y,Z) coordinate system, optionally having an EA and GJ associated to it.
-
y
¶ float – The Y location of the point.
-
z
¶ float – The Z location of the point.
-
EA
¶ float – The axial stiffness of the point.
-
GJ
¶ float – The torsional stiffness of the point.
-
description
¶ str – The point description.
Examples
Create two points and associate them to a section:
import abdbeam as ab sc = ab.Section() pts = dict() pts[1] = ab.Point(0.5, 1.0, 10000000.0, 4500000.0, 'Stringer 105') pts[2] = ab.Point(0.0, 0.0) sc.points = pts
-
Load Class¶
-
class
abdbeam.core.
Load
(Px_c=0.0, My=0.0, Mz=0.0, Tx=0.0, Vy_s=0.0, Vz_s=0.0, Px=0.0, yp=0.0, zp=0.0, Vy=0.0, Vz=0.0, yv=0.0, zv=0.0)¶ A single section load case.
-
Px_c
¶ float – The axial load at the centroid of the cross section. Positive sign induces tension in the cross section.
-
My
¶ float – The moment around the Y axis. Positive sign induces tension in the positive yz quadrant of the beam cross section.
-
Mz
¶ float – The moment around the Z axis. Positive sign induces tension in the positive yz quadrant of the beam cross section.
-
Tx
¶ float – The torque around the X axis. Positive sign is counterclockwise.
-
Vy_s
¶ float – The shear force oriented with the Y axis at the shear center.
-
Vz_s
¶ float – The shear force oriented with the section Z axis at the shear.
-
Px
¶ float – The axial force located at (yp, zp). Positive sign induces tension in the cross section.
-
yp
¶ float – The Y axis location of the Px axial force.
-
zp
¶ float – The Z axis location of the Px axial force.
-
Vy
¶ float – The shear force oriented with the Y axis at zv.
-
Vz
¶ float – The shear force oriented with the Z axis at yv.
-
yv
¶ float – The Y axis location of the Vz shear force.
-
zv
¶ float – The Z axis location of the Vy shear force.
Examples
Creating 3 load cases and associating them to a section:
import abdbeam as ab sc = ab.Section() Lds = dict() Lds[101] = ab.Load(My=5e6) Lds[102] = ab.Load(Tx=250000, Vz=5000.0) Lds[103] = ab.Load(0, 0, 0, 0, 0, 1000.0) sc.loads = Lds
-
abdbeam.materials module¶
Contains all material classes used by Section objects.
Material Class¶
-
class
abdbeam.materials.
Material
(t, abd_c=<sphinx.ext.autodoc.importer._MockObject object>, description='')¶ Bases:
object
Parent class for all materials.
May be instantiated directly but self.abd_c needs to be manually entered.
-
t
¶ float – The thickness of the material. Since for this parent class the compliance matrix is provided directly, the thickness is used for reference/plot purposes only.
-
abd_c
¶ numpy.ndarray – The material 6x6 compliance matrix based on CLT (Classical Laminate Theory).
-
abd
¶ numpy.ndarray – The material 6x6 stiffness matrix based on CLT (Classical Laminate Theory).
-
description
¶ str – The description of the material.
-
calculate_properties
()¶ Method used by classes that inherit this base class to calculate the stiffness abd and compliance abd_c matrices of the material based on the Classical Laminate Theory.
-
calculate_properties
() Method used by classes that inherit this base class to calculate the stiffness abd and compliance abd_c matrices of the material based on the Classical Laminate Theory.
For this parent class, abd_c needs to be manually provided.
-
Isotropic Class¶
-
class
abdbeam.materials.
Isotropic
(t, E, v, description='')¶ Bases:
abdbeam.materials.Material
An isotropic material that inherits the Material class.
-
t
¶ float – The thickness of the material.
-
E
¶ float – The Young Modulus of the material.
-
v
¶ float – The Poisson Ratio of the material.
-
description
¶ str – The description of the material.
-
abd_c
¶ numpy.ndarray – The material 6x6 compliance matrix based on CLT (Classical Laminate Theory).
-
abd
¶ numpy.ndarray – The material 6x6 stiffness matrix based on CLT (Classical Laminate Theory).
-
calculate_properties
()¶ Calculates the stiffness abd and compliance abd_c matrices of the isotropic material based on the Classical Laminate Theory.
Examples
mts = dict() mts[1] = ab.Isotropic(0.08, 10600000, 0.33) mts[1].calculate_properties()
-
calculate_properties
() Calculates the stiffness abd and compliance abd_c matrices of the isotropic material based on the Classical Laminate Theory.
-
Laminate Class¶
-
class
abdbeam.materials.
Laminate
¶ Bases:
abdbeam.materials.Material
A composite laminate material that inherits the Materials class.
-
t
¶ float – The laminate thickness. Calculated by the calculate_properties() method.
-
ply_materials
¶ dict – Of the form {int : abdbeam.PlyMaterial}
-
plies
¶ list – A list that defines the laminate stacking sequence. Plies are the elements of this list, which in turn are represented as 2-elements lists of angle and material ids the form [float, int]. The first element in the plies list is the bottom ply.
-
symmetry
¶ {‘T’, ‘S’, ‘SM’, ‘SMEAR’}, default = ‘T’ – ‘T’ means all plies are defined in the plies list; ‘S’ means symmetry will be applied to the plies list; ‘SM’ means symmetry will be applied around the last item in the plies list; ‘SMEAR’ means the effects of the plies stacking sequence will be ignored ([D]=t**2 / 12 * [A]).
-
abd_c
¶ numpy.ndarray – The material 6x6 compliance matrix based on CLT (Classical Laminate Theory).
-
abd
¶ numpy.ndarray – The material 6x6 stiffness matrix based on CLT (Classical Laminate Theory).
-
calculate_properties
()¶ Calculates the stiffness abd and compliance abd_c matrices of the laminate based on the Classical Laminate Theory.
Examples
Creating a symmetric and balanced 8 plies laminate:
mts = dict() mts[1] = ab.Laminate() ply_mat = ab.PlyMaterial(0.166666, 148000, 9650, 4550, 0.3) mts[1].ply_materials[1] = ply_mat mts[1].plies = [[45,1], [-45,1], [0,1], [90,1]] mts[1].symmetry = 'S' mts[1].calculate_properties()
-
calculate_properties
() Calculates the stiffness abd and compliance abd_c matrices of the laminate based on the Classical Laminate Theory.
-
PlyMaterial Class¶
-
class
abdbeam.materials.
PlyMaterial
(t, E1, E2, G12, v12, description='')¶ Bases:
object
A ply material used by the Laminate class.
-
t
¶ float – The ply thickness.
-
E1
¶ float – The axial stiffness of the ply.
-
E2
¶ float – The transverse stiffness of the ply.
-
G12
¶ float – The shear modulus of the ply.
-
description
¶ str – The description of the ply.
Examples
ply_mat = ab.PlyMaterial(0.166666, 148000, 9650, 4550, 0.3) mts[1].ply_materials[1] = ply_mat
-
Laminate Class¶
-
class
abdbeam.materials.
PlyMaterial
(t, E1, E2, G12, v12, description='') Bases:
object
A ply material used by the Laminate class.
-
t
float – The ply thickness.
-
E1
float – The axial stiffness of the ply.
-
E2
float – The transverse stiffness of the ply.
-
G12
float – The shear modulus of the ply.
-
description
str – The description of the ply.
Examples
ply_mat = ab.PlyMaterial(0.166666, 148000, 9650, 4550, 0.3) mts[1].ply_materials[1] = ply_mat
-
Shear Connector Class¶
-
class
abdbeam.materials.
ShearConnector
(t, G, description='')¶ Bases:
abdbeam.materials.Material
A shear connector that inherits the Material class.
Shear connectors have only the stiffness term A66 as nonzero and for this reason can only transfer shear loads. Small values are added to other terms of the stiffness matrix to prevent a singular matrix. For this material, only the compliance term a66 becomes an user input and is equal to 1/(G*t).
-
t
¶ float – The thickness of the shear connector material.
-
G
¶ float – The Shear Modulus of the shear connector material.
-
description
¶ str – The description of the material.
-
abd_c
¶ numpy.ndarray – The material 6x6 compliance matrix based on CLT (Classical Laminate Theory).
-
abd
¶ numpy.ndarray – The material 6x6 stiffness matrix based on CLT (Classical Laminate Theory).
-
calculate_properties
()¶ Calculates the stiffness abd and compliance abd_c matrices of the shear connector based on the Classical Laminate Theory.
Examples
mts = dict() mts[1] = ab.ShearConnector(0.075, 6380000, 'Shear-only Skin') mts[1].calculate_properties()
-
calculate_properties
() Calculates the stiffness abd and compliance abd_c matrices of the shear connector based on the Classical Laminate Theory.
-
abdbeam.plots module¶
Module containing methods to plot cross sections and their internal loads.
-
abdbeam.plots.
plot_section
(section, segment_coord=False, thickness=True, mid_plane=True, top_bottom=False, centroid=True, shear_center=True, origin=True, princ_dir=True, show_axis=True, prop_color='r', pt_size=4, filter_sgs=[], plot_sgs=[], legend=True, title='', figsize=(6.4, 4.8), dpi=80)¶ Uses matplolib to plot the section geometry and its properties (centroid, shear center and principal axis).
Note
Section properties need to be calculated using the method abdbeam.Section.calculate_properties() before using this function.
Parameters: - section (abdbeam.Section) – The section object to be plotted.
- segment_coord (bool, default False) – If True, will plot the segments local coordinate systems.
- thickness (bool, default True) – If True, will plot the segments thickness.
- mid_plane (bool, default True) – If True, will plot the segments mid-plane.
- top_bottom (bool, default False) – If True and thickness is also True, will identify the bottom side of the material with the red color and the top side with the green color.
- centroid (bool, default True) – If True, will plot the centroid location with an ‘o’ marker.
- shear_center (bool, default True) – If True, will plot the shear center location with a ‘x’ marker.
- origin (bool, default True) – If True, will plot the section origin location with a ‘+’ marker.
- princ_dir (bool, default True) – If True, will plot the moment of inertia principal axes.
- show_axis (bool, default True) – If True, will show plot dimensions.
- prop_color (string, default 'r') – The matplotlib color name to be used when plotting centroid, shear center and principal axes.
- pt_size (int, default 4) – The size in pixels of the marker. Booms (points with EAs and GJs) will have 2 times this size.
- filter_sgs (list, default []) – The list of segment ids that will not be plotted. Of the form [int]. Will also respect the filter imposed by the plot_sgs parameter.
- plot_sgs (list, default []) – The list containing the only segment ids that will be plotted. Of the form [int]. If left empty will plot all segments. Will also respect the filter imposed by the filter_sgs parameter.
- legend (bool, default True) – If True, will show a legend for the centroid, shear center and principal axis.
- title (str, default '') – The title to be added at the top of the figure.
- figsize (tuple, default (6.4, 4.8)) – Width and height of the figure in inches. Of the form (float, float).
- dpi (integer, default 80) – The resolution of the figure.
Examples
The example below creates a “C” section and plots it. The optional attribute prop_color is changed to purple usinh the HTML color code #800080:
import abdbeam as ab sc = ab.Section() mts = dict() mts[1] = ab.Isotropic(0.08, 10600000, 0.33) pts = dict() pts[1] = ab.Point(0, -1.5) pts[2] = ab.Point(-1, -1.5) pts[3] = ab.Point(-1, 1.5) pts[4] = ab.Point(0.5, 1.5) sgs = dict() sgs[1] = ab.Segment(1,2,1) sgs[2] = ab.Segment(2,3,1) sgs[3] = ab.Segment(3,4,1) sc.materials = mts sc.points = pts sc.segments = sgs sc.calculate_properties() ab.plot_section(sc, prop_color='#800080')
-
abdbeam.plots.
plot_section_loads
(section, load_id, int_load_list=['Nx', 'Nxy', 'Mx', 'My', 'Mxy'], title_list=[], thickness=True, pt_size=4, segment_contour=True, diagram=True, diagram_contour=False, diagram_alpha=0.15, diagram_scale=1.0, diagram_factor_list=[], contour_color='jet_r', contour_levels=10, filter_sgs=[], plot_sgs=[], no_result_sgs=[], result_sgs=[], figsize=(6.4, 4.8), dpi=80)¶ Uses matplotlib to plot the internal loads associated to a section and load case id.
Note
Internal loads need to be calculated using the method abdbeam.Section.calculate_internal_loads() before using this function; If two or more internal loads are plotted, the plots will be presented in two columns; figure sizes are for individual plots and not the entire figure.
Parameters: - section (abdbeam.Section) – The section object to be plotted.
- load_id (int) – The load case id key in the abdbeam.Section.loads dictionary.
- int_load_list (list, default ['Nx', 'Nxy', 'Mx', 'My','Mxy']) – The internal load type list to be plotted for the selected load case.
- title_list (list, default []) – A list containing all the plot titles to be added. An empty list (the default) will use the list int_load_list as titles. If the length of this list is smaller than int_load_list’s length, None values will be assumed for the last items.
- thickness (bool, default True) – If True, will plot the segments thickness.
- pt_size (int, default 4) – The size in pixels of the marker. Booms (points with EAs and GJs) will have 2 times this size.
- segment_contour (bool, default True) – If True, will plot the internal load contour inside a segment thickness.
- diagram (bool, default True) – If True, will plot internal load diagrams at each segment. Positive values are plotted towards the segment top side and negative towards the bottom side.
- diagram_contour (bool, default False) – If True, will replace the standard gray diagram color, with each segments’ result contour.
- diagram_alpha (float, default 0.15) – The diagram transparency alpha.
- diagram_scale (float, default 1.0) – A scale factor to be applied to the diagram plot. Negative values will reverse its plot direction. Does not affect the result values, only the diagram plot.
- diagram_factor_list (list, default []) – A list containing factors to multiply each segment’s diagram. An empty list (the default) is a list with factors=1. If the length of this list is smaller than the number of segments, 1.0 values will be assumed for the last items. The factors’ order is the same as the order in which the segments were entered in the section segments dictionary.
- contour_color (st, default 'jet_r') – The matplotlib’s colormap name to be used in all contours.
- contour_levels (int, default 10) – The number of contour level color areas to be used.
- filter_sgs (list, default []) – The list of segment ids that will not be plotted. Of the form [int]. Will also respect the filter imposed by the plot_sgs parameter.
- plot_sgs (list, default []) – The list containing the only segment ids that will be plotted. Of the form [int]. If left empty will plot all segments. Will also respect the filter imposed by the filter_sgs parameter.
- no_result_sgs (list, default []) – The list of segment ids that will not have results plotted. Of the form [int]. Will also respect the filter imposed by the result_sgs parameter.
- result_sgs (list, default []) – The list containing the only segment ids that will have results plotted. Of the form [int]. If left empty will plot contours for all segments. Will also respect the result_sgs.
- figsize (tuple, default (6.4, 4.8)) – Width and height of each internal load in inches. Of the form (float, float). Note that this is not the size of the entire matplotlib figure, but the size of each internal load plot.
- dpi (integer, default 100) – The resolution of the figure.
Examples
The example below creates a “C” section, creates load case id 100 with a vertical shear at the shear center of 150 and plots the ‘Nxy’ internal loads:
import abdbeam as ab sc = ab.Section() mts = dict() mts[1] = ab.Isotropic(0.08, 10600000, 0.33) pts = dict() pts[1] = ab.Point(0, -1.0) pts[2] = ab.Point(-1, -1.0) pts[3] = ab.Point(-1, 1.0) pts[4] = ab.Point(0, 1.0) sgs = dict() sgs[1] = ab.Segment(1,2,1) sgs[2] = ab.Segment(2,3,1) sgs[3] = ab.Segment(3,4,1) sc.materials = mts sc.points = pts sc.segments = sgs sc.calculate_properties() Lds = dict() Lds[100] = ab.Load(Vz_s=150) sc.loads = Lds sc.calculate_internal_loads() ab.plot_section_loads(sc, 100, int_load_list=['Nxy'])