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.
element_results (list[ElementResults]) – List of
ElementResultsobjects.
Methods
Calculates and stores the element results in
self.element_results.Calculates and stores the resultant nodal forces.
Calculates the nodal stresses.
Partitions the
uvector intoxandydisplacement vectors.Plots the deformed shape.
Plots the displacement contours.
Plots the stress contours.
Attributes
plane_stressuuxuyuxyfelement_results- calculate_node_forces(k: ndarray[Any, dtype[float64]]) None[source]#
Calculates and stores the resultant nodal forces.
- calculate_element_results(elements: list[FiniteElement]) None[source]#
Calculates and stores the element results 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:
- 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 centre of the colormap at zero displacement. Defaults toTrue.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]#
Plots the stress contours.
- 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 centre of the colormap at zero displacement. Defaults toTrue.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.