Running an Analysis

The first step in running a cross-section analysis is the creation of a CrossSection object. This class stores the structural geometry and finite element mesh and provides methods to perform various types of cross-section analyses.

class sectionproperties.analysis.cross_section.CrossSection(geometry, mesh, materials=None, time_info=False)[source]

Bases: object

Class for structural cross-sections.

Stores the finite element geometry, mesh and material information and provides methods to compute the cross-section properties. The element type used in this program is the six-noded quadratic triangular element.

The constructor extracts information from the provided mesh object and creates and stores the corresponding Tri6 finite element objects.

Parameters:
  • geometry (Geometry) – Cross-section geometry object used to generate the mesh
  • mesh (meshpy.triangle.MeshInfo) – Mesh object returned by meshpy
  • materials (list[Material]) – A list of material properties corresponding to various regions in the geometry and mesh. Note that if materials are specified, the number of material objects ust equal the number of regions in the geometry. If no materials are specified, only a purely geometric analysis can take place, and all regions will be assigned a default material with an elastic modulus and yield strength equal to 1, and a Poisson’s ratio equal to 0.
  • time_info (bool) – If set to True, a detailed description of the computation and the time cost is printed to the terminal.

The following example creates a CrossSection object of a 100D x 50W rectangle using a mesh size of 5:

import sectionproperties.pre.sections as sections
from sectionproperties.analysis.cross_section import CrossSection

geometry = sections.RectangularSection(d=100, b=50)
mesh = geometry.create_mesh(mesh_sizes=[5])
section = CrossSection(geometry, mesh)

The following example creates a 100D x 50W rectangle, with the top half of the section comprised of timber and the bottom half steel. The timber section is meshed with a maximum area of 10 and the steel section mesh with a maximum area of 5:

import sectionproperties.pre.sections as sections
from sectionproperties.pre.pre import Material
from sectionproperties.analysis.cross_section import CrossSection

geom_steel = sections.RectangularSection(d=50, b=50)
geom_timber = sections.RectangularSection(d=50, b=50, shift=[0, 50])
geometry = sections.MergedSection([geom_steel, geom_timber])
geometry.clean_geometry()

mesh = geometry.create_mesh(mesh_sizes=[5, 10])

steel = Material(
    name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=250,
    color='grey'
)
timber = Material(
    name='Timber', elastic_modulus=8e3, poissons_ratio=0.35, yield_strength=20,
    color='burlywood'
)

section = CrossSection(geometry, mesh, [steel, timber])
section.plot_mesh(materials=True, alpha=0.5)
Variables:
  • elements (list[Tri6]) – List of finite element objects describing the cross-section mesh
  • num_nodes (int) – Number of nodes in the finite element mesh
  • geometry (Geometry) – Cross-section geometry object used to generate the mesh
  • mesh (meshpy.triangle.MeshInfo) – Mesh object returned by meshpy
  • mesh_nodes (numpy.ndarray) – Array of node coordinates from the mesh
  • mesh_elements (numpy.ndarray) – Array of connectivities from the mesh
  • mesh_attributes (numpy.ndarray) – Array of attributes from the mesh
  • materials – List of materials
  • material_groups – List of objects containing the elements in each defined material
  • section_props (SectionProperties) – Class to store calculated section properties
Raises:

AssertionError – If the number of materials does not equal the number of regions

Checking the Mesh Quality

Before carrying out a cross-section analysis it is a good idea to check the quality of the finite element mesh. Some useful methods are provided to display mesh statistics and to plot the finite element mesh:

CrossSection.display_mesh_info()[source]

Prints mesh statistics (number of nodes, elements and regions) to the command window.

The following example displays the mesh statistics for a Tee section merged from two rectangles:

import sectionproperties.pre.sections as sections
from sectionproperties.analysis.cross_section import CrossSection

rec1 = sections.RectangularSection(d=100, b=25, shift=[-12.5, 0])
rec2 = sections.RectangularSection(d=25, b=100, shift=[-50, 100])
geometry = sections.MergedSection([rec1, rec2])
mesh = geometry.create_mesh(mesh_sizes=[5, 2.5])
section = CrossSection(geometry, mesh)
section.display_mesh_info()

>>>Mesh Statistics:
>>>--4920 nodes
>>>--2365 elements
>>>--2 regions
CrossSection.plot_mesh(ax=None, pause=True, alpha=1, materials=False, mask=None)[source]

Plots the finite element mesh. If no axes object is supplied a new figure and axis is created.

Parameters:
  • ax (matplotlib.axes.Axes) – Axes object on which the mesh is plotted
  • pause (bool) – If set to true, the figure pauses the script until the window is closed. If set to false, the script continues immediately after the window is rendered.
  • alpha (float) – Transparency of the mesh outlines: \(0 \leq \alpha \leq 1\)
  • materials (bool) – If set to true and material properties have been provided to the CrossSection object, shades the elements with the specified material colours
  • mask (list[bool]) – Mask array, of length num_nodes, to mask out triangles
Returns:

Matplotlib figure and axes objects (fig, ax)

Return type:

(matplotlib.figure.Figure, matplotlib.axes)

The following example plots the mesh generated for the second example listed under the CrossSection object definition:

import sectionproperties.pre.sections as sections
from sectionproperties.pre.pre import Material
from sectionproperties.analysis.cross_section import CrossSection

geom_steel = sections.RectangularSection(d=50, b=50)
geom_timber = sections.RectangularSection(d=50, b=50, shift=[50, 0])
geometry = sections.MergedSection([geom_steel, geom_timber])
geometry.clean_geometry()

mesh = geometry.create_mesh(mesh_sizes=[5, 10])

steel = Material(
    name='Steel', elastic_modulus=200e3, poissons_ratio=0.3, yield_strength=250,
    color='grey'
)
timber = Material(
    name='Timber', elastic_modulus=8e3, poissons_ratio=0.35, yield_strength=20,
    color='burlywood'
)

section = CrossSection(geometry, mesh, [steel, timber])
section.plot_mesh(materials=True, alpha=0.5)
../_images/composite_mesh.png

Finite element mesh generated by the above example.

Geometric Analysis

A geometric analysis calculates the area properties of the cross-section.

CrossSection.calculate_geometric_properties(time_info=False)[source]

Calculates the geometric properties of the cross-section and stores them in the SectionProperties object contained in the section_props class variable.

Parameters:time_info (bool) – If set to True, a detailed description of the computation and the time cost is printed to the terminal.

The following geometric section properties are calculated:

  • Cross-sectional area
  • Cross-sectional perimeter
  • Modulus weighted area (axial rigidity)
  • First moments of area
  • Second moments of area about the global axis
  • Second moments of area about the centroidal axis
  • Elastic centroid
  • Centroidal section moduli
  • Radii of gyration
  • Principal axis properties

If materials are specified for the cross-section, the moments of area and section moduli are elastic modulus weighted.

The following example demonstrates the use of this method:

section = CrossSection(geometry, mesh)
section.calculate_geometric_properties()

Plastic Analysis

A plastic analysis calculates the plastic properties of the cross-section.

Note

A geometric analysis must be performed on the CrossSection object before a plastic analysis is carried out.

CrossSection.calculate_plastic_properties(time_info=False, verbose=False, debug=False)[source]

Calculates the plastic properties of the cross-section and stores the, in the SectionProperties object contained in the section_props class variable.

Parameters:
  • time_info (bool) – If set to True, a detailed description of the computation and the time cost is printed to the terminal.
  • verbose (bool) – If set to True, the number of iterations required for each plastic axis is printed to the terminal.
  • debug (bool) – If set to True, the geometry is plotted each time a new mesh is generated by the plastic centroid algorithm.

The following warping section properties are calculated:

  • Plastic centroid for bending about the centroidal and principal axes
  • Plastic section moduli for bending about the centroidal and principal axes
  • Shape factors for bending about the centroidal and principal axes

If materials are specified for the cross-section, the plastic section moduli are displayed as plastic moments (i.e \(M_p = f_y S\)) and the shape factors are not calculated.

Note that the geometric properties must be calculated before the plastic properties are calculated:

section = CrossSection(geometry, mesh)
section.calculate_geometric_properties()
section.calculate_plastic_properties()
Raises:RuntimeError – If the geometric properties have not been calculated prior to calling this method

Warping Analysis

A warping analysis calculates the torsion and shear properties of the cross-section.

Note

A geometric analysis must be performed on the CrossSection object before a warping analysis is carried out.

CrossSection.calculate_warping_properties(time_info=False, solver_type='direct')[source]

Calculates all the warping properties of the cross-section and stores them in the SectionProperties object contained in the section_props class variable.

Parameters:
  • time_info (bool) – If set to True, a detailed description of the computation and the time cost is printed to the terminal.
  • solver_type (string) – Solver used for solving systems of linear equations, either using the ‘direct’ method or ‘cgs’ iterative method

The following warping section properties are calculated:

  • Torsion constant
  • Shear centre
  • Shear area
  • Warping constant
  • Monosymmetry constant

If materials are specified, the values calculated for the torsion constant, warping constant and shear area are elastic modulus weighted.

Note that the geometric properties must be calculated first for the calculation of the warping properties to be correct:

section = CrossSection(geometry, mesh)
section.calculate_geometric_properties()
section.calculate_warping_properties()
Raises:RuntimeError – If the geometric properties have not been calculated prior to calling this method

Stress Analysis

A stress analysis calculates the cross-section stresses arising from a set of forces and moments. Executing this method returns a StressResult object which stores the cross-section stresses and provides stress plotting functions.

Note

A geometric and warping analysis must be performed on the CrossSection object before a stress analysis is carried out.

CrossSection.calculate_stress(N=0, Vx=0, Vy=0, Mxx=0, Myy=0, M11=0, M22=0, Mzz=0, time_info=False)[source]

Calculates the cross-section stress resulting from design actions and returns a StressPost object allowing post-processing of the stress results.

Parameters:
  • N (float) – Axial force
  • Vx (float) – Shear force acting in the x-direction
  • Vy (float) – Shear force acting in the y-direction
  • Mxx (float) – Bending moment about the centroidal xx-axis
  • Myy (float) – Bending moment about the centroidal yy-axis
  • M11 (float) – Bending moment about the centroidal 11-axis
  • M22 (float) – Bending moment about the centroidal 22-axis
  • Mzz (float) – Torsion moment about the centroidal zz-axis
  • time_info (bool) – If set to True, a detailed description of the computation and the time cost is printed to the terminal.
Returns:

Object for post-processing cross-section stresses

Return type:

StressPost

Note that a geometric and warping analysis must be performed before a stress analysis is carried out:

section = CrossSection(geometry, mesh)
section.calculate_geometric_properties()
section.calculate_warping_properties()
stress_post = section.calculate_stress(N=1e3, Vy=3e3, Mxx=1e6)
Raises:RuntimeError – If a geometric and warping analysis have not been performed prior to calling this method

Calculating Frame Properties

Calculates the cross-section properties required for a 2D or 3D frame analysis.

Note

This method is significantly faster than performing a geometric and a warping analysis and has no prerequisites.

CrossSection.calculate_frame_properties(time_info=False, solver_type='direct')[source]

Calculates and returns the properties required for a frame analysis. The properties are also stored in the SectionProperties object contained in the section_props class variable.

Parameters:
  • time_info (bool) – If set to True, a detailed description of the computation and the time cost is printed to the terminal.
  • solver_type (string) – Solver used for solving systems of linear equations, either using the ‘direct’ method or ‘cgs’ iterative method
Returns:

Cross-section properties to be used for a frame analysis (area, ixx, iyy, ixy, j, phi)

Return type:

tuple(float, float, float, float, float, float)

The following section properties are calculated:

  • Cross-sectional area (area)
  • Second moments of area about the centroidal axis (ixx, iyy, ixy)
  • Torsion constant (j)
  • Principal axis angle (phi)

If materials are specified for the cross-section, the area, second moments of area and torsion constant are elastic moulus weighted.

The following example demonstrates the use of this method:

section = CrossSection(geometry, mesh)
(area, ixx, iyy, ixy, j, phi) = section.calculate_frame_properties()