Note
Click here to download the full example code
Simple Example¶
Calculate section properties of a circle.
The following example calculates the geometric, warping and plastic properties of a 50 mm diameter circle. The circle is discretised with 64 points and a mesh size of 2.5 mm2.
The geometry and mesh are plotted, and the mesh information printed to the terminal before the analysis is carried out. Detailed time information is printed to the terminal during the cross-section analysis stage. Once the analysis is complete, the cross-section properties are printed to the terminal. The centroidal axis second moments of area and torsion constant are saved to variables and it is shown that, for a circle, the torsion constant is equal to the sum of the second moments of area.
# sphinx_gallery_thumbnail_number = 1
import sectionproperties.pre.library.primitive_sections as sections
from sectionproperties.analysis.section import Section
Create a 50 diameter circle discretised by 64 points
geometry = sections.circular_section(d=50, n=64)
geometry.plot_geometry()
<AxesSubplot: title={'center': 'Cross-Section Geometry'}>
Create a mesh with a mesh size of 2.5 and display information about it
geometry.create_mesh(mesh_sizes=[2.5])
section = Section(geometry, time_info=True)
section.display_mesh_info()
section.plot_mesh()
Mesh Statistics:
- 2557 nodes
- 1246 elements
- 1 region
<AxesSubplot: title={'center': 'Finite Element Mesh'}>
perform a geometric, warping and plastic analysis, displaying the time info
section.calculate_geometric_properties()
section.calculate_warping_properties()
section.calculate_plastic_properties()
╭───────────────────────────── Geometric Analysis ─────────────────────────────╮
│ │
│ ✅ Geometric analysis ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 1.3049 s ] │
│ complete │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────── Warping Analysis ──────────────────────────────╮
│ │
│ ✅ Warping analysis ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 7.3832 s ] │
│ completed │
│ ✅ 2557x2557 stiffness ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 1.5734 s ] │
│ matrix assembled │
│ ✅ Warping function solved ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 0.0976 s ] │
│ (direct) │
│ ✅ Shear function vectors ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 1.6762 s ] │
│ assembled │
│ ✅ Shear functions solved ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 0.1535 s ] │
│ (direct) │
│ ✅ Shear and warping ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 1.1067 s ] │
│ integrals assembled │
│ ✅ Shear deformation ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 1.5808 s ] │
│ coefficients assembled │
│ ✅ Monosymmetry integrals ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 1.1875 s ] │
│ assembled │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────── Plastic Analysis ──────────────────────────────╮
│ │
│ ✅ Plastic analysis complete ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 0.0332 s ] │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
Print the results to the terminal
section.display_results()
Section Properties
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Property ┃ Value ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ A │ 1.960343e+03 │
│ Perim. │ 1.570166e+02 │
│ Qx │ -8.764545e-12 │
│ Qy │ 3.601119e-12 │
│ cx │ 1.836985e-15 │
│ cy │ -4.470924e-15 │
│ Ixx_g │ 3.058119e+05 │
│ Iyy_g │ 3.058119e+05 │
│ Ixy_g │ 8.526513e-13 │
│ Ixx_c │ 3.058119e+05 │
│ Iyy_c │ 3.058119e+05 │
│ Ixy_c │ 8.526513e-13 │
│ Zxx+ │ 1.223248e+04 │
│ Zxx- │ 1.223248e+04 │
│ Zyy+ │ 1.223248e+04 │
│ Zyy- │ 1.223248e+04 │
│ rx │ 1.248996e+01 │
│ ry │ 1.248996e+01 │
│ phi │ 0.000000e+00 │
│ I11_c │ 3.058119e+05 │
│ I22_c │ 3.058119e+05 │
│ Z11+ │ 1.223248e+04 │
│ Z11- │ 1.223248e+04 │
│ Z22+ │ 1.223248e+04 │
│ Z22- │ 1.223248e+04 │
│ r11 │ 1.248996e+01 │
│ r22 │ 1.248996e+01 │
│ J │ 6.116238e+05 │
│ Iw │ 1.588407e-21 │
│ x_se │ -6.613922e-16 │
│ y_se │ 1.426706e-15 │
│ x_st │ -6.613922e-16 │
│ y_st │ 1.426706e-15 │
│ x1_se │ -2.498377e-15 │
│ y2_se │ 5.897630e-15 │
│ A_sx │ 1.680296e+03 │
│ A_sy │ 1.680296e+03 │
│ A_s11 │ 1.680296e+03 │
│ A_s22 │ 1.680296e+03 │
│ betax+ │ -8.344890e-15 │
│ betax- │ 8.344890e-15 │
│ betay+ │ 1.526682e-14 │
│ betay- │ -1.526682e-14 │
│ beta11+ │ -8.344890e-15 │
│ beta11- │ 8.344890e-15 │
│ beta22+ │ 1.526682e-14 │
│ beta22- │ -1.526682e-14 │
│ x_pc │ 1.836985e-15 │
│ y_pc │ -4.470924e-15 │
│ Sxx │ 2.078317e+04 │
│ Syy │ 2.078317e+04 │
│ SF_xx+ │ 1.699016e+00 │
│ SF_xx- │ 1.699016e+00 │
│ SF_yy+ │ 1.699016e+00 │
│ SF_yy- │ 1.699016e+00 │
│ x11_pc │ 1.836985e-15 │
│ y22_pc │ -4.470924e-15 │
│ S11 │ 2.078317e+04 │
│ S22 │ 2.078317e+04 │
│ SF_11+ │ 1.699016e+00 │
│ SF_11- │ 1.699016e+00 │
│ SF_22+ │ 1.699016e+00 │
│ SF_22- │ 1.699016e+00 │
└──────────┴───────────────┘
Get and print the second moments of area and the torsion constant
(ixx_c, iyy_c, ixy_c) = section.get_ic()
j = section.get_j()
print("Ixx + Iyy = {0:.3f}".format(ixx_c + iyy_c))
print("J = {0:.3f}".format(j))
Ixx + Iyy = 611623.837
J = 611623.837
Total running time of the script: ( 0 minutes 9.971 seconds)