Results#
- class planestress.post.results.Results(plane_stress: PlaneStress, u: npt.NDArray[np.float64])[source]#
Bases:
objectClass for plane-stress results.
- Parameters:
plane_stress (PlaneStress) –
PlaneStressanalysis object used to generate these results.u (npt.NDArray[np.float64]) – Displacement vector.
- Variables:
ux (npt.NDArray[np.float64]) –
xcomponent of the displacement vector.uy (npt.NDArray[np.float64]) –
ycomponent of the displacement vector.uxy (npt.NDArray[np.float64]) – Resultant component of the displacement vector.
f (npt.NDArray[np.float64]) – Calculated nodal forces.
f_r (npt.NDArray[np.float64]) – Calculated nodal reactions.
element_results (list[ElementResults]) – List of
ElementResultsobjects.
Methods
Calculates and stores the resultant nodal forces.
Calculates and stores the nodal reactions.
Calculates and stores the element stresses in
self.element_results.Calculates the nodal stresses.
Calculates the prinicipal stresses at the nodes.
Calculates the Tresca stress at the nodes.
Calculates the von Mises stress at the nodes.
Partitions the
uvector intoxandydisplacement vectors.Plots the deformed shape.
Plots the displacement contours.
Generates a vector plot of the principal stresses.
Generates a stress contour plot.
Attributes
plane_stressuuxuyuxyff_relement_results- calculate_node_forces(k: csc_array) None[source]#
Calculates and stores the resultant nodal forces.
- Parameters:
k (csc_array) – Original stiffness matrix (before modification).
- calculate_reactions(f: ndarray[Any, dtype[float64]]) None[source]#
Calculates and stores the nodal reactions.
- calculate_stresses(elements: list[FiniteElement]) None[source]#
Calculates and stores the element stresses in
self.element_results.- Parameters:
elements (list[FiniteElement]) – List of
FiniteElementobjects used during the analysis.
- get_nodal_stresses(agg_func: ~typing.Callable[[list[float]], float] = <function average>) ndarray[Any, dtype[float64]][source]#
Calculates the nodal stresses.
- Parameters:
agg_func (Callable[[list[float]], float]) – A function that aggregates the stresses if the point is shared by several elements. The function must receive a list of stresses and return a single stress. Defaults to
np.average.- Returns:
A
numpy.ndarrayof the nodal stresses of size[n x 3], wherenis the number of nodes in the mesh. The columns consist of the three stress components, (sig_xx,sig_yy,sig_xy).- Return type:
- get_principal_stresses(agg_func: ~typing.Callable[[list[float]], float] = <function average>) ndarray[Any, dtype[float64]][source]#
Calculates the prinicipal stresses at the nodes.
- Parameters:
agg_func (Callable[[list[float]], float]) – A function that aggregates the stresses if the point is shared by several elements. The function must receive a list of stresses and return a single stress. Defaults to
np.average.- Returns:
A
numpy.ndarrayof the principal nodal stresses of size[n x 3], wherenis the number of nodes in the mesh. The columns consist of the two principal stress components and the principal stress angle: (\(\sigma_{11}\), \(\sigma_{22}\), \(\theta_p\)).- Return type:
- get_von_mises_stresses(agg_func: ~typing.Callable[[list[float]], float] = <function average>) ndarray[Any, dtype[float64]][source]#
Calculates the von Mises stress at the nodes.
- Parameters:
agg_func (Callable[[list[float]], float]) – A function that aggregates the stresses if the point is shared by several elements. The function must receive a list of stresses and return a single stress. Defaults to
np.average.- Returns:
A
numpy.ndarrayof the von Mises nodal stresses.- Return type:
- get_tresca_stresses(agg_func: ~typing.Callable[[list[float]], float] = <function average>) ndarray[Any, dtype[float64]][source]#
Calculates the Tresca stress at the nodes.
- Parameters:
agg_func (Callable[[list[float]], float]) – A function that aggregates the stresses if the point is shared by several elements. The function must receive a list of stresses and return a single stress. Defaults to
np.average.- Returns:
A
numpy.ndarrayof the Tresca nodal stresses.- Return type:
- plot_displacement_contour(direction: str, **kwargs: Any) Axes[source]#
Plots the displacement contours.
- Parameters:
- Keyword Arguments:
title (str) – Plot title. Defaults to
"Displacement Contours [{direction}]".contours (bool) – If set to
True, plots contour lines. Defaults toFalse.colormap (str) – Matplotlib color map, see https://matplotlib.org/stable/tutorials/colors/colormaps.html for more detail. Defaults to
"coolwarm".normalize (bool) – If set to
True,CenteredNormis used to scale the colormap, if set to False, the default linear scaling is used.CenteredNormeffectively places the center of the colormap at zero displacement. Defaults toTrue.num_levels (int) – Number of contour levels. Defaults to
11.colorbar_format (str) – Number formatting string for displacements, see https://docs.python.org/3/library/string.html. Defaults to
"{x:.4e}", i.e. exponential format with 4 decimal places.colorbar_label (str) – Colorbar label. Defaults to
"Displacement".alpha (float) – Transparency of the mesh outlines, \(0 \leq \alpha \leq 1\). Defaults to
0.2.kwargs (dict[str, Any]) – Other keyword arguments are passed to
plotting_context().
- Raises:
ValueError – If the value for
directionis not valid.- Returns:
Matplotlib axes object.
- Return type:
Example
TODO.
- plot_deformed_shape(displacement_scale: float, **kwargs: Any) Axes[source]#
Plots the deformed shape.
- Parameters:
- Keyword Arguments:
title (str) – Plot title. Defaults to
"Deformed Shape [ds = {displacement_scale}]".alpha (float) – Transparency of the mesh outlines, \(0 \leq \alpha \leq 1\). Defaults to
0.8.kwargs (dict[str, Any]) – Other keyword arguments are passed to
plotting_context().
- Returns:
Matplotlib axes object.
- Return type:
Example
TODO.
- plot_stress(stress: str, **kwargs: Any) Axes[source]#
Generates a stress contour plot.
- Parameters:
- Keyword Arguments:
title (str) – Plot title. Defaults to
"Stress Contour Plot - {stress}".contours (bool) – If set to
True, plots contour lines. Defaults toFalse.colormap (str) – Matplotlib color map, see https://matplotlib.org/stable/tutorials/colors/colormaps.html for more detail. Defaults to
"coolwarm".stress_limits (tuple[float, float] | None) – Custom colorbar stress limits (
sig_min,sig_max). Values outside these limits will appear as white. Defaults toNone.normalize (bool) – If set to
True,CenteredNormis used to scale the colormap, if set to False, the default linear scaling is used.CenteredNormeffectively places the center of the colormap at zero displacement. Defaults toTrue.num_levels (int) – Number of contour levels. Defaults to
11.colorbar_format (str) – Number formatting string for stresses, see https://docs.python.org/3/library/string.html. Defaults to
"{x:.4e}", i.e. exponential format with 4 decimal places.colorbar_label (str) – Colorbar label. Defaults to
"Stress".alpha (float) – Transparency of the mesh outlines, \(0 \leq \alpha \leq 1\). Defaults to
0.2.agg_func (Callable[[list[float]], float]) – A function that aggregates the stresses if the point is shared by several elements. The function must receive a list of stresses and return a single stress. Defaults to
np.average.kwargs (dict[str, Any]) – Other keyword arguments are passed to
plotting_context().
- Raises:
ValueError – If the value for
stressis not valid.- Returns:
Matplotlib axes object.
- Return type:
Example
TODO.
- plot_principal_stress_vectors(stress: str, **kwargs: Any) Axes[source]#
Generates a vector plot of the principal stresses.
- Parameters:
- Keyword Arguments:
title (str) – Plot title. Defaults to
"Stress Vector Plot - {stress}".colormap (str) – Matplotlib color map, see https://matplotlib.org/stable/tutorials/colors/colormaps.html for more detail. Defaults to
"coolwarm".stress_limits (tuple[float, float] | None) – Custom stress limits (
sig_min,sig_max). Values outside these limits will not be plotted. Defaults toNone.num_levels (int) – Number of contour levels. Defaults to
11.colorbar_format (str) – Number formatting string for stresses, see https://docs.python.org/3/library/string.html. Defaults to
"{x:.4e}", i.e. exponential format with 4 decimal places.colorbar_label (str) – Colorbar label. Defaults to
"Stress".alpha (float) – Transparency of the mesh outlines, \(0 \leq \alpha \leq 1\). Defaults to
0.2.agg_func (Callable[[list[float]], float]) – A function that aggregates the stresses if the point is shared by several elements. The function must receive a list of stresses and return a single stress. Defaults to
np.average.kwargs (dict[str, Any]) – Other keyword arguments are passed to
plotting_context().
- Raises:
ValueError – If the value for
stressis not valid.- Returns:
Matplotlib axes object.
- Return type:
Example
TODO.