StressPost#
- class sectionproperties.post.stress_post.StressPost(section: Section)[source]#
Bases:
object
Class for post-processing finite element stress results.
A StressPost object is created when a stress analysis is carried out and is returned as an object to allow post-processing of the results. The StressPost object creates a
deepcopy
of theMaterialGroup
s within the cross-section to allow the calculation of stresses for each material. Methods for post-processing the calculated stresses are provided.- Variables:
section (Section) – Cross-section object for stress calculation
material_groups (MaterialGroup) – A deep copy of the
Section
material_groups
Methods
Returns the stresses within each material.
Plots Mohr's circles of the 3D stress state at position (
x
,y
).Plots filled stress contours over the finite element mesh.
Plots stress vectors over the finite element mesh.
- __init__(section: Section) None [source]#
Inits the StressPost class.
- Parameters:
section (Section) – Cross-section object for stress calculation
- plot_stress(stress: str, title: str | None = None, cmap: str = 'coolwarm', stress_limits: tuple[float, float] | None = None, normalize: bool = True, fmt: str = '{x:.4e}', colorbar_label: str = 'Stress', alpha: float = 0.5, material_list: list[Material] | None = None, **kwargs: Any) matplotlib.axes.Axes [source]#
Plots filled stress contours over the finite element mesh.
- Parameters:
stress (str) – Type of stress to plot, see below for allowable values
title (str | None) – Plot title, if None uses default plot title for selected stress
cmap (str) – Matplotlib color map, see https://matplotlib.org/stable/tutorials/colors/colormaps.html for more detail
stress_limits (tuple[float, float] | None) – Custom colorbar stress limits (sig_min, sig_max), values outside these limits will appear as white
normalize (bool) – If set to True,
CenteredNorm
is used to scale the colormap, if set to False, the default linear scaling is usedfmt (str) – Number formatting string, see https://docs.python.org/3/library/string.html
colorbar_label (str) – Colorbar label
alpha (float) – Transparency of the mesh outlines: \(0 \leq \alpha \leq 1\)
material_list (list[Material] | None) – If specified, only plots materials present in the list. If set to None, plots all materials.
kwargs (Any) – Passed to
plotting_context()
- Raises:
RuntimeError – If the plot failed to be generated
- Returns:
Matplotlib axes object
- Return type:
- plot_stress_vector(stress: str, title: str | None = None, cmap: str = 'YlOrBr', normalize: bool = False, fmt: str = '{x:.4e}', colorbar_label: str = 'Stress', alpha: float = 0.2, **kwargs: Any) Axes [source]#
Plots stress vectors over the finite element mesh.
- Parameters:
stress (str) – Type of stress to plot, see below for allowable values
title (str | None) – Plot title, if None uses default plot title for selected stress
cmap (str) – Matplotlib color map, see https://matplotlib.org/stable/tutorials/colors/colormaps.html for more detail
normalize (bool) – If set to True,
CenteredNorm
is used to scale the colormap, if set to False, the default linear scaling is usedfmt (str) – Number formatting string, see https://docs.python.org/3/library/string.html
colorbar_label (str) – Colorbar label
alpha (float) – Transparency of the mesh outlines: \(0 \leq \alpha \leq 1\)
kwargs (Any) – Passed to
plotting_context()
- Raises:
RuntimeError – If the plot failed to be generated
- Returns:
Matplotlib axes object
- Return type:
- get_stress() list[dict[str, object]] [source]#
Returns the stresses within each material.
- Returns:
A list of dictionaries containing the cross-section stresses at each node for each material
- Return type:
Note
Each list of stresses in the dictionary contains the stresses at every node (order from
node 0
tonode n
) in the entire mesh. As a result, when the current material does not exist at a node, a value of zero will be reported.Dictionary keys and values
In general the stresses are described by an action followed by a stress direction
(action)_(stress-direction)
, e.g.mzz_zx
represents the shear stress in thezx
direction caused by the torsionmzz
.Below is a list of the returned dictionary keys and values:
"material"
- material name"sig_zz_n"
- normal stress \(\sigma_{zz,N}\) resulting from the axial load \(N\)"sig_zz_mxx"
- normal stress \(\sigma_{zz,Mxx}\) resulting from the bending moment \(M_{xx}\)"sig_zz_myy"
- normal stress \(\sigma_{zz,Myy}\) resulting from the bending moment \(M_{yy}\)"sig_zz_m11"
- normal stress \(\sigma_{zz,M11}\) resulting from the bending moment \(M_{11}\)"sig_zz_m22"
- normal stress \(\sigma_{zz,M22}\) resulting from the bending moment \(M_{22}\)"sig_zz_m"
- normal stress \(\sigma_{zz,\Sigma M}\) resulting from all bending moments \(M_{xx} + M_{yy} + M_{11} + M_{22}\)"sig_zx_mzz"
-x
component of the shear stress \(\sigma_{zx,Mzz}\) resulting from the torsion moment \(M_{zz}\)"sig_zy_mzz"
-y
component of the shear stress \(\sigma_{zy,Mzz}\) resulting from the torsion moment \(M_{zz}\)"sig_zxy_mzz"
- resultant shear stress \(\sigma_{zxy,Mzz}\) resulting from the torsion moment \(M_{zz}\)"sig_zx_vx"
-x
component of the shear stress \(\sigma_{zx,Vx}\) resulting from the shear force \(V_{x}\)"sig_zy_vx"
-y
component of the shear stress \(\sigma_{zy,Vx}\) resulting from the shear force \(V_{x}\)"sig_zxy_vx"
- resultant shear stress \(\sigma_{zxy,Vx}\) resulting from the shear force \(V_{x}\)"sig_zx_vy"
-x
component of the shear stress \(\sigma_{zx,Vy}\) resulting from the shear force \(V_{y}\)"sig_zy_vy"
-y
component of the shear stress \(\sigma_{zy,Vy}\) resulting from the shear force \(V_{y}\)"sig_zxy_vy"
- resultant shear stress \(\sigma_{zxy,Vy}\) resulting from the shear force \(V_{y}\)"sig_zx_v"
-x
component of the shear stress \(\sigma_{zx,\Sigma V}\) resulting from the sum of the applied shear forces \(V_{x} + V_{y}\)."sig_zy_v"
-y
component of the shear stress \(\sigma_{zy,\Sigma V}\) resulting from the sum of the applied shear forces \(V_{x} + V_{y}\)."sig_zxy_v"
- resultant shear stress \(\sigma_{zxy,\Sigma V}\) resulting from the sum of the applied shear forces \(V_{x} + V_{y}\)"sig_zz"
- combined normal stress \(\sigma_{zz}\) resulting from all actions"sig_zx"
-x
component of the shear stress \(\sigma_{zx}\) resulting from all actions"sig_zy"
-y
component of the shear stress \(\sigma_{zy}\) resulting from all actions"sig_zxy"
- resultant shear stress \(\sigma_{zxy}\) resulting from all actions"sig_11"
- major principal stress \(\sigma_{11}\) resulting from all actions"sig_33"
- minor principal stress \(\sigma_{33}\) resulting from all actions"sig_vm"
- von Mises stress \(\sigma_{vM}\) resulting from all actions
- plot_mohrs_circles(x: float, y: float, title: str | None = None, **kwargs: Any) Axes [source]#
Plots Mohr’s circles of the 3D stress state at position (
x
,y
).- Parameters:
x (float) – x-coordinate of the point to draw Mohr’s Circle
y (float) – y-coordinate of the point to draw Mohr’s Circle
title (str | None) – Plot title, if None uses default plot title “Mohr’s Circles for 3D Stress State at {pt}”
kwargs (Any) – Passed to
plotting_context()
- Raises:
ValueError – If the point (
x
,y
) is not within the meshRuntimeError – If the plot failed to be generated
- Returns:
Matplotlib axes object
- Return type:
Example
The following example plots the Mohr’s circles for the 3D stress state within a 150x90x12 UA section at the point
x=10
,y=88.9
resulting from the following actions:\(N = 50\) kN
\(M_{xx} = -5\) kN.m
\(M_{22} = 2.5\) kN.m
\(M_{zz} = 1.5\) kN.m
\(V_{x} = 10\) kN
\(V_{y} = 5\) kN
from sectionproperties.pre.library import angle_section from sectionproperties.analysis import Section # create geometry and section geom = angle_section(d=150, b=90, t=12, r_r=10, r_t=5, n_r=8) geom.create_mesh(mesh_sizes=[0]) sec = Section(geometry=geom) # perform analysis sec.calculate_geometric_properties() sec.calculate_warping_properties() post = sec.calculate_stress( n=50e3, mxx=-5e6, m22=2.5e6, mzz=0.5e6, vx=10e3, vy=5e3 ) # plot mohr's circle post.plot_mohrs_circles(x=10, y=88.9)
(
Source code
,png
,hires.png
,pdf
)