Note
Click here to download the full example code
Creating a Composite Section¶
Create a section of mixed materials.
The following example demonstrates how to create a composite cross-section by assigning different material properties to various regions of the mesh. A steel 310UB40.4 is modelled with a 50Dx600W timber panel placed on its top flange.
The geometry and mesh are plotted, and the mesh information printed to the terminal before the analysis is carried out. All types of cross-section analyses are carried out, with an axial force, bending moment and shear force applied during the stress analysis. Once the analysis is complete, the cross-section properties are printed to the terminal and a plot of the centroids and cross-section stresses generated.
# sphinx_gallery_thumbnail_number = 2
import sectionproperties.pre.library.primitive_sections as sections
import sectionproperties.pre.library.steel_sections as steel_sections
from sectionproperties.pre.geometry import CompoundGeometry
from sectionproperties.pre.pre import Material
from sectionproperties.analysis.section import Section
Create material properties
steel = Material(
name="Steel",
elastic_modulus=200e3,
poissons_ratio=0.3,
yield_strength=500,
density=8.05e-6,
color="grey",
)
timber = Material(
name="Timber",
elastic_modulus=8e3,
poissons_ratio=0.35,
yield_strength=20,
density=0.78e-6,
color="burlywood",
)
Create 310UB40.4
ub = steel_sections.i_section(
d=304, b=165, t_f=10.2, t_w=6.1, r=11.4, n_r=8, material=steel
)
Create timber panel on top of the UB
panel = sections.rectangular_section(d=50, b=600, material=timber)
panel = panel.align_center(ub).align_to(ub, on="top")
# Create intermediate nodes in panel to match nodes in ub
panel = (panel - ub) | panel
Merge the two sections into one geometry object
section_geometry = CompoundGeometry([ub, panel])
Create a mesh and a Section object. For the mesh use a mesh size of 5 for the UB, 20 for the panel
section_geometry.create_mesh(mesh_sizes=[5, 20])
comp_section = Section(section_geometry, time_info=True)
comp_section.display_mesh_info() # display the mesh information
Mesh Statistics:
- 9083 nodes
- 4246 elements
- 2 regions
Plot the mesh with coloured materials and a line transparency of 0.6
comp_section.plot_mesh(materials=True, alpha=0.6)
<AxesSubplot: title={'center': 'Finite Element Mesh'}>
Perform a geometric, warping and plastic analysis
comp_section.calculate_geometric_properties()
comp_section.calculate_warping_properties()
comp_section.calculate_plastic_properties(verbose=True)
╭───────────────────────────── Geometric Analysis ─────────────────────────────╮
│ │
│ ✅ Geometric analysis ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 4.2805 s ] │
│ complete │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────── Warping Analysis ──────────────────────────────╮
│ │
│ ✅ Warping analysis ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 25.1499 s ] │
│ completed │
│ ✅ 9083x9083 stiffness ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 6.0900 s ] │
│ matrix assembled │
│ ✅ Warping function solved ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 0.0652 s ] │
│ (direct) │
│ ✅ Shear function vectors ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 5.6407 s ] │
│ assembled │
│ ✅ Shear functions solved ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 0.1199 s ] │
│ (direct) │
│ ✅ Shear and warping ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 3.8104 s ] │
│ integrals assembled │
│ ✅ Shear deformation ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 5.3781 s ] │
│ coefficients assembled │
│ ✅ Monosymmetry integrals ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 4.0271 s ] │
│ assembled │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
d = -185.130884950272; f_norm = 1.0
d = 168.869115049728; f_norm = -1.0
d = -8.13088495027199; f_norm = 0.13960518846748188
d = 13.5521668722403; f_norm = 0.0983423820518058
d = 60.60270845168366; f_norm = 0.008805290832494688
d = 64.90008929872147; f_norm = 0.000627383246551551
d = 65.22746216923495; f_norm = 4.393296043904811e-06
d = 65.22976962543778; f_norm = 2.21127426308038e-09
d = 65.2298027403226; f_norm = -6.080628894287011e-08
---x-axis plastic centroid calculation converged at 6.52298e+01 in 8 iterations.
d = -300.0; f_norm = 1.0
d = 300.0; f_norm = -1.0
d = 0.0; f_norm = 7.263545449900235e-17
d = 5e-07; f_norm = -4.773093592438759e-08
---y-axis plastic centroid calculation converged at 0.00000e+00 in 3 iterations.
d = -185.130884950272; f_norm = 1.0
d = 168.869115049728; f_norm = -1.0
d = -8.13088495027199; f_norm = 0.13960518846748188
d = 13.5521668722403; f_norm = 0.0983423820518058
d = 60.60270845168366; f_norm = 0.008805290832494688
d = 64.90008929872147; f_norm = 0.000627383246551551
d = 65.22746216923495; f_norm = 4.393296043904811e-06
d = 65.22976962543778; f_norm = 2.21127426308038e-09
d = 65.2298027403226; f_norm = -6.080628894287011e-08
---11-axis plastic centroid calculation converged at 6.52298e+01 in 8 iterations.
d = -300.0; f_norm = 1.0
d = 300.0; f_norm = -1.0
d = 0.0; f_norm = 7.263545449900235e-17
d = 5e-07; f_norm = -4.773093592438759e-08
---22-axis plastic centroid calculation converged at 0.00000e+00 in 3 iterations.
╭────────────────────────────── Plastic Analysis ──────────────────────────────╮
│ │
│ ✅ Plastic analysis complete ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 0.0874 s ] │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
Perform a stress analysis with N = 100 kN, Mxx = 120 kN.m and Vy = 75 kN
stress_post = comp_section.calculate_stress(N=-100e3, Mxx=-120e6, Vy=-75e3)
╭────────────────────────────── Stress Analysis ───────────────────────────────╮
│ │
│ ✅ Stress analysis complete ━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% [ 6.0855 s ] │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯
Print the results to the terminal
comp_section.display_results()
Section Properties
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Property ┃ Value ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ A │ 3.521094e+04 │
│ Perim. │ 2.206078e+03 │
│ Mass │ 6.534804e-02 │
│ E.A │ 1.282187e+09 │
│ E.Qx │ 2.373725e+11 │
│ E.Qy │ 1.057805e+11 │
│ cx │ 8.250000e+01 │
│ cy │ 1.851309e+02 │
│ E.Ixx_g │ 6.740447e+13 │
│ E.Iyy_g │ 1.745613e+13 │
│ E.Ixy_g │ 1.958323e+13 │
│ E.Ixx_c │ 2.345949e+13 │
│ E.Iyy_c │ 8.729240e+12 │
│ E.Ixy_c │ -3.906250e-03 │
│ E.Zxx+ │ 1.389212e+11 │
│ E.Zxx- │ 1.267184e+11 │
│ E.Zyy+ │ 2.909747e+10 │
│ E.Zyy- │ 2.909747e+10 │
│ rx │ 1.352644e+02 │
│ ry │ 8.251112e+01 │
│ phi │ 0.000000e+00 │
│ E.I11_c │ 2.345949e+13 │
│ E.I22_c │ 8.729240e+12 │
│ E.Z11+ │ 1.389212e+11 │
│ E.Z11- │ 1.267184e+11 │
│ E.Z22+ │ 2.909747e+10 │
│ E.Z22- │ 2.909747e+10 │
│ r11 │ 1.352644e+02 │
│ r22 │ 8.251112e+01 │
│ E_eff │ 3.641446e+04 │
│ G_eff │ 1.390847e+04 │
│ nu_eff │ 3.090753e-01 │
│ J │ 3.768367e+11 │
│ Iw │ 6.687734e+16 │
│ x_se │ 8.250105e+01 │
│ y_se │ 2.863411e+02 │
│ x_st │ 8.250104e+01 │
│ y_st │ 2.857085e+02 │
│ x1_se │ 1.049231e-03 │
│ y2_se │ 1.012102e+02 │
│ E.A_sx │ 4.022647e+08 │
│ E.A_sy │ 3.718571e+08 │
│ E.A_s11 │ 4.022647e+08 │
│ E.A_s22 │ 3.718571e+08 │
│ betax+ │ 2.039435e+02 │
│ betax- │ -2.039435e+02 │
│ betay+ │ 2.098462e-03 │
│ betay- │ -2.098462e-03 │
│ beta11+ │ 2.039435e+02 │
│ beta11- │ -2.039435e+02 │
│ beta22+ │ 2.098462e-03 │
│ beta22- │ -2.098462e-03 │
│ x_pc │ 8.250000e+01 │
│ y_pc │ 2.503607e+02 │
│ M_p,xx │ 4.238101e+08 │
│ M_p,yy │ 4.226021e+08 │
│ x11_pc │ 8.250000e+01 │
│ y22_pc │ 2.503607e+02 │
│ M_p,11 │ 4.238101e+08 │
│ M_p,22 │ 4.226021e+08 │
└──────────┴───────────────┘
Plot the centroids
comp_section.plot_centroids()
<AxesSubplot: title={'center': 'Centroids'}>
Plot the axial stress
stress_post.plot_stress_n_zz(pause=False)
<AxesSubplot: title={'center': 'Stress Contour Plot - $\\sigma_{zz,N}$'}>
Plot the bending stress
stress_post.plot_stress_m_zz(pause=False)
<AxesSubplot: title={'center': 'Stress Contour Plot - $\\sigma_{zz,\\Sigma M}$'}>
Plot the shear stress
stress_post.plot_stress_v_zxy()
<AxesSubplot: title={'center': 'Stress Contour Plot - $\\sigma_{zxy,\\Sigma V}$'}>
Total running time of the script: ( 0 minutes 38.558 seconds)