elasticipy.yield_criteria
- class elasticipy.yield_criteria.DruckerPrager(alpha, k)[source]
Bases:
YieldCriterionDrucker-Prager pressure-dependent plasticity criterion, with associated normality rule
Create a Drucker-Prager (DP) plasticity criterion.
The DG criterion can be defined by the pai values alpha and c, or c and phi (see notes).
- Parameters:
alpha (float) – Pressure dependence parameters (see notes for details)
k (float) – Constant component of the yield surface (see below)
Notes
The pressure-dependent DP plasticity criterion assumes that the yield surface is defined as:
\[\alpha I_1 + \sqrt{J_2} - k\]where \(I_1\) is the first invariant of the stress tensor, and \(J_2\) is the second invariant of the deviatoric stress tensor.
- draw_surface_normal(fig, stress, length=1.0, color='red', cone_scale=0.2, auto_scale=False, label=None)[source]
Plot the normal to the yield surface in the principal stress space
- Parameters:
fig (plotly.graph_objs._figure.Figure) – Figure where the plot is drawn
stress (StressTensor) – Location of the surface normal to plot. If the stress tensor is not diagonal, the corresponding eigenstresses are used instead.
length (float, optional) – Length of the normal arrow
color (str, optional) – Color of the glyph used to show the normal
cone_scale (float, optional) – Size of the cone used to show the normal
auto_scale (bool, optional) – If true, the stress will be scaled automatically so that the normal will appear on the yield surface
label (str, optional) – Name to display in legend
- Returns:
Handle to the figure
- Return type:
plotly.graph_objs._figure.Figure
See also
plot3Dplot the yield surface in the 3D principal stress space
plot2Dplot the yield surface in the biaxial tensile stress space
scale_stress_to_yield_surfacescale the stress to reach the yield surface
- classmethod from_cohesion_friction_angle(c, phi, fit='middle', degrees=True)[source]
Define a Drucker-Prager yield criterion from the cohesion factor and friction angle
- Parameters:
c (float) – cohesion factor
phi (float) – cone angle, in degrees
fit (str ['inside', 'middle', 'outside'], optional) –
How to treat c and phi, as they usually refer to the Mohr-Coulomb (MC) yield criterion. It relates the shape of the DP cone in the principal stress space with respect to that of the MC criterion:
inside : the DP cone is inside that of MC (tangent to the faces of the MC cone)
outside : the DP cone is outside that of MC
middle : the DP cone is of intermediate shape between inside and outside.
degrees (bool, optional) – Whether the friction angle is in given degrees. Default is True.
Notes
if fit==’outside’:
\[ \begin{align}\begin{aligned}k = \frac{ 6c\cos\phi }{ \sqrt{3}\left(3+\sin\phi\right) }\\\alpha = \frac{-2\sin\phi}{ \sqrt{3}\left(3+\sin\phi\right) }\end{aligned}\end{align} \]if fit==’inside’:
\[ \begin{align}\begin{aligned}k = \frac{ 3c\cos\phi }{ \sqrt{\left(9+3\sin^2\phi\right)} }\\\alpha = \frac{-\sin\phi}{ \sqrt{\left(9+3\sin^2\phi\right)} }\end{aligned}\end{align} \]if fit==’middle’:
\[ \begin{align}\begin{aligned}k = \frac{ 6c\cos\phi }{ \sqrt{3}\left(3-\sin\phi\right) }\\\alpha = \frac{-2\sin\phi}{ \sqrt{3}\left(3-\sin\phi\right) }\end{aligned}\end{align} \]- Returns:
DP yield criterion
- Return type:
- classmethod from_tensile_compression_stress(tensile_stress, compressive_stress)[source]
Create a Drucker-Prager yield criterion from tensile and compression yield stresses.
- Parameters:
tensile_stress (float) – Yield stress in tension. This value must be positive.
compressive_stress (float) – Yield stress in compression. This value must be negative.
- Return type:
Notes
The compression and tensile stress values passed to the constructor can be switched, as they are automatically sorted in descending order.
Examples
Consider a material whose yield stresses in tension and compression are 100 and -150, respectively:
>>> from elasticipy.yield_criteria import DruckerPrager >>> s_c, s_t = -100, 150 >>> dp = DruckerPrager.from_tensile_compression_stress(s_t, s_c)
One can check that the yield function vanishes for these stress values:
>>> from elasticipy.tensors.stress_strain import StressTensor >>> stress = StressTensor.tensile([1,0,0], [s_c, s_t]) >>> dp.yield_function(stress) array([0., 0.])
- normal(stress, **kwargs)[source]
Apply the normality rule
- Parameters:
stress (StressTensor) – Stress tensor to apply the normality rule
kwargs (dict) – Keyword arguments passed to the function
- Returns:
Normalized direction of plastic flow
- Return type:
- plot2D(color='red', fig=None, ax=None, alpha=0.3, xrange=None, yrange=None, npt=400, label=None, linewidth=1.0, linestyle='solid')[source]
Plot the elastic domain in the biaxial tensile space.
- Parameters:
color (str, optional) – Color to use for the plot.
fig (matplotlib.figure.Figure, optional) – Figure to plot on. If not provided, a new figure will be created.
ax (matplotlib.axes.Axes, optional) – Axes to plot on.
alpha (float, optional) – Transparency of the inside of the yield surface.
xrange (tuple, optional) – Set the x-range of the plot. If not provided, it will be set automatically.
yrange (tuple, optional) – Set the y-range of the plot. If not provided, it will be set automatically.
npt (int, optional) – Number of points along each direction to use for the plot.
label (str, optional) – Label for the plot. If not provided, the name of the yield criterion constructor will be used.
linewidth (float, optional) – Width of the lines in the plot. Default is 1.
linestyle (str, optional) – Style of the lines in the plot. Default is ‘solid’.
- Returns:
fig (matplotlib.figure.Figure) – Figure where the plot is drawn.
ax (matplotlib.axes.Axes) – Axes where the plot is drawn.
See also
plot3Dplot the yield surface in the principal stress space
Examples
Plot the von Mises yield surface:
from elasticipy.plasticity import VonMisesPlasticity VonMisesPlasticity().plot2D()
- plot3D(xrange=None, yrange=None, zrange=None, color='red', opacity=1.0, npt=100, fig=None)[source]
Plot the yield surface in the principal stress space
- Parameters:
xrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
yrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
zrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
color (str, optional) – color to use for plotting the surface
opacity (float, optional) – opacity of the surface
npt (int, optional) – number of points along each direction to use for the plot.
fig (plotly.graph_objs._figure.Figure) – handle to existing plotly figure. This is used when one want to plot multiple surfaces on the same graph.
- Returns:
fig – Figure where the plot is drawn
- Return type:
plotly.graph_objs._figure.Figure
See also
plot2Dplot the yield surface in the biaxial stress space
draw_surface_normalshow the surface normal at a given location in the principal stress space
- scale_stress_to_yield_surface(stress)[source]
Automatically scale the stress to reach the yield surface.
For a given stress tensor \(\sigma\), find k such that \(f(k\sigma)=0\).
- Parameters:
stress (StressTensor) – stress to scale
- Returns:
scaled stress tensor
- Return type:
Examples
Find the tensile yield stress for von Mises criterion:
>>> from elasticipy.tensors.stress_strain import StressTensor >>> from elasticipy.yield_criteria import VonMisesCriterion >>> vm = VonMisesCriterion(yield_stress=100)
Define a reference stress:
>>> stress = StressTensor.tensile([1,0,0], 1)
Find where the yield surface is reached along the path given by the reference stress:
>>> vm.scale_stress_to_yield_surface(stress) Stress tensor [[99.99999999 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
- yield_function(stress)[source]
Return the yield function, with respect to the plasticity criterion.
- Parameters:
stress (StressTensor) – Stress tensor to compute the yield function from.
- Returns:
Negative if, and only if, the elasticity criterion is met
- Return type:
float or numpy.ndarray
- class elasticipy.yield_criteria.MohrCoulomb(c, phi, degrees=True)[source]
Bases:
YieldCriterionMohr-Coulomb pressure-dependent plasticity criterion, with associated normality rule
Create a Mohr-Coulomb (MC) yield criterion.
- Parameters:
c (float) – Cohesion factor
phi (float) – Friction angle
degrees (bool, optional) – If true (default), the friction angle must be in degrees. Otherwise, it must be in radians.
Notes
Given the principal stresses \(\sigma_{I}\geq \sigma_{II}\geq \sigma_{III}\), the MC yield function is defined as:
\[\sigma_{I} - \sigma_{III} - \left(\sigma_{I} + \sigma_{III}\right)\sin\phi - 2c\cos\phi\]See also
from_tensile_compression_stressconstruct a MC yield criterion from tensile compression stresses
- draw_surface_normal(fig, stress, length=1.0, color='red', cone_scale=0.2, auto_scale=False, label=None)[source]
Plot the normal to the yield surface in the principal stress space
- Parameters:
fig (plotly.graph_objs._figure.Figure) – Figure where the plot is drawn
stress (StressTensor) – Location of the surface normal to plot. If the stress tensor is not diagonal, the corresponding eigenstresses are used instead.
length (float, optional) – Length of the normal arrow
color (str, optional) – Color of the glyph used to show the normal
cone_scale (float, optional) – Size of the cone used to show the normal
auto_scale (bool, optional) – If true, the stress will be scaled automatically so that the normal will appear on the yield surface
label (str, optional) – Name to display in legend
- Returns:
Handle to the figure
- Return type:
plotly.graph_objs._figure.Figure
See also
plot3Dplot the yield surface in the 3D principal stress space
plot2Dplot the yield surface in the biaxial tensile stress space
scale_stress_to_yield_surfacescale the stress to reach the yield surface
- classmethod from_tensile_compression_stress(tensile_stress, compressive_stress)[source]
Create a Mohr-Coulomb yield criterion from tensile and compression yield stresses.
- Parameters:
tensile_stress (float) – Yield stress in tension. This value must be positive.
compressive_stress (float) – Yield stress in compression. This value must be negative.
- Return type:
Notes
The compression and tensile stress values passed to the constructor can be switched, as they are automatically sorted in descending order.
Examples
Consider a material whose yield stresses in tension and compression are 100 and -150, respectively:
>>> from elasticipy.yield_criteria import MohrCoulomb >>> s_c, s_t = -150, 100 >>> mc = MohrCoulomb.from_tensile_compression_stress(s_t, s_c)
One can check that the yield function vanishes for these stress values:
>>> from elasticipy.tensors.stress_strain import StressTensor >>> stress = StressTensor.tensile([1,0,0], [s_c, s_t]) >>> mc.yield_function(stress) array([0., 0.])
- normal(stress, **kwargs)[source]
Apply the normality rule
- Parameters:
stress (StressTensor) – Stress tensor to apply the normality rule
kwargs (dict) – Keyword arguments passed to the function
- Returns:
Normalized direction of plastic flow
- Return type:
- plot2D(color='red', fig=None, ax=None, alpha=0.3, xrange=None, yrange=None, npt=400, label=None, linewidth=1.0, linestyle='solid')[source]
Plot the elastic domain in the biaxial tensile space.
- Parameters:
color (str, optional) – Color to use for the plot.
fig (matplotlib.figure.Figure, optional) – Figure to plot on. If not provided, a new figure will be created.
ax (matplotlib.axes.Axes, optional) – Axes to plot on.
alpha (float, optional) – Transparency of the inside of the yield surface.
xrange (tuple, optional) – Set the x-range of the plot. If not provided, it will be set automatically.
yrange (tuple, optional) – Set the y-range of the plot. If not provided, it will be set automatically.
npt (int, optional) – Number of points along each direction to use for the plot.
label (str, optional) – Label for the plot. If not provided, the name of the yield criterion constructor will be used.
linewidth (float, optional) – Width of the lines in the plot. Default is 1.
linestyle (str, optional) – Style of the lines in the plot. Default is ‘solid’.
- Returns:
fig (matplotlib.figure.Figure) – Figure where the plot is drawn.
ax (matplotlib.axes.Axes) – Axes where the plot is drawn.
See also
plot3Dplot the yield surface in the principal stress space
Examples
Plot the von Mises yield surface:
from elasticipy.plasticity import VonMisesPlasticity VonMisesPlasticity().plot2D()
- plot3D(xrange=None, yrange=None, zrange=None, color='red', opacity=1.0, npt=100, fig=None)[source]
Plot the yield surface in the principal stress space
- Parameters:
xrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
yrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
zrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
color (str, optional) – color to use for plotting the surface
opacity (float, optional) – opacity of the surface
npt (int, optional) – number of points along each direction to use for the plot.
fig (plotly.graph_objs._figure.Figure) – handle to existing plotly figure. This is used when one want to plot multiple surfaces on the same graph.
- Returns:
fig – Figure where the plot is drawn
- Return type:
plotly.graph_objs._figure.Figure
See also
plot2Dplot the yield surface in the biaxial stress space
draw_surface_normalshow the surface normal at a given location in the principal stress space
- scale_stress_to_yield_surface(stress)[source]
Automatically scale the stress to reach the yield surface.
For a given stress tensor \(\sigma\), find k such that \(f(k\sigma)=0\).
- Parameters:
stress (StressTensor) – stress to scale
- Returns:
scaled stress tensor
- Return type:
Examples
Find the tensile yield stress for von Mises criterion:
>>> from elasticipy.tensors.stress_strain import StressTensor >>> from elasticipy.yield_criteria import VonMisesCriterion >>> vm = VonMisesCriterion(yield_stress=100)
Define a reference stress:
>>> stress = StressTensor.tensile([1,0,0], 1)
Find where the yield surface is reached along the path given by the reference stress:
>>> vm.scale_stress_to_yield_surface(stress) Stress tensor [[99.99999999 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
- yield_function(stress)[source]
Return the yield function, with respect to the plasticity criterion.
- Parameters:
stress (StressTensor) – Stress tensor to compute the yield function from.
- Returns:
Negative if, and only if, the elasticity criterion is met
- Return type:
float or numpy.ndarray
- class elasticipy.yield_criteria.TrescaCriterion(yield_stress=1.0)[source]
Bases:
VonMisesCriterionTresca plasticity criterion, with associated normality rule
Create a plasticity criterion
- Parameters:
yield_stress (float) – Tensile yield stress
- draw_surface_normal(fig, stress, length=1.0, color='red', cone_scale=0.2, auto_scale=False, label=None)[source]
Plot the normal to the yield surface in the principal stress space
- Parameters:
fig (plotly.graph_objs._figure.Figure) – Figure where the plot is drawn
stress (StressTensor) – Location of the surface normal to plot. If the stress tensor is not diagonal, the corresponding eigenstresses are used instead.
length (float, optional) – Length of the normal arrow
color (str, optional) – Color of the glyph used to show the normal
cone_scale (float, optional) – Size of the cone used to show the normal
auto_scale (bool, optional) – If true, the stress will be scaled automatically so that the normal will appear on the yield surface
label (str, optional) – Name to display in legend
- Returns:
Handle to the figure
- Return type:
plotly.graph_objs._figure.Figure
See also
plot3Dplot the yield surface in the 3D principal stress space
plot2Dplot the yield surface in the biaxial tensile stress space
scale_stress_to_yield_surfacescale the stress to reach the yield surface
- static eq_stress(stress, **kwargs)[source]
Return the equivalent stress, with respect to the plasticity criterion.
- Parameters:
stress (StressTensor) – Stress to compute the equivalent stress from
kwargs (dict) – keyword arguments passed to the function
- Return type:
float or numpy.ndarray
- static normal(stress, **kwargs)[source]
Apply the normality rule
- Parameters:
stress (StressTensor) – Stress tensor to apply the normality rule
kwargs (dict) – Keyword arguments passed to the function
- Returns:
Normalized direction of plastic flow
- Return type:
- plot2D(color='red', fig=None, ax=None, alpha=0.3, xrange=None, yrange=None, npt=400, label=None, linewidth=1.0, linestyle='solid')[source]
Plot the elastic domain in the biaxial tensile space.
- Parameters:
color (str, optional) – Color to use for the plot.
fig (matplotlib.figure.Figure, optional) – Figure to plot on. If not provided, a new figure will be created.
ax (matplotlib.axes.Axes, optional) – Axes to plot on.
alpha (float, optional) – Transparency of the inside of the yield surface.
xrange (tuple, optional) – Set the x-range of the plot. If not provided, it will be set automatically.
yrange (tuple, optional) – Set the y-range of the plot. If not provided, it will be set automatically.
npt (int, optional) – Number of points along each direction to use for the plot.
label (str, optional) – Label for the plot. If not provided, the name of the yield criterion constructor will be used.
linewidth (float, optional) – Width of the lines in the plot. Default is 1.
linestyle (str, optional) – Style of the lines in the plot. Default is ‘solid’.
- Returns:
fig (matplotlib.figure.Figure) – Figure where the plot is drawn.
ax (matplotlib.axes.Axes) – Axes where the plot is drawn.
See also
plot3Dplot the yield surface in the principal stress space
Examples
Plot the von Mises yield surface:
from elasticipy.plasticity import VonMisesPlasticity VonMisesPlasticity().plot2D()
- plot3D(xrange=None, yrange=None, zrange=None, color='red', opacity=1.0, npt=100, fig=None)[source]
Plot the yield surface in the principal stress space
- Parameters:
xrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
yrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
zrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
color (str, optional) – color to use for plotting the surface
opacity (float, optional) – opacity of the surface
npt (int, optional) – number of points along each direction to use for the plot.
fig (plotly.graph_objs._figure.Figure) – handle to existing plotly figure. This is used when one want to plot multiple surfaces on the same graph.
- Returns:
fig – Figure where the plot is drawn
- Return type:
plotly.graph_objs._figure.Figure
See also
plot2Dplot the yield surface in the biaxial stress space
draw_surface_normalshow the surface normal at a given location in the principal stress space
- scale_stress_to_yield_surface(stress)[source]
Automatically scale the stress to reach the yield surface.
For a given stress tensor \(\sigma\), find k such that \(f(k\sigma)=0\).
- Parameters:
stress (StressTensor) – stress to scale
- Returns:
scaled stress tensor
- Return type:
Examples
Find the tensile yield stress for von Mises criterion:
>>> from elasticipy.tensors.stress_strain import StressTensor >>> from elasticipy.yield_criteria import VonMisesCriterion >>> vm = VonMisesCriterion(yield_stress=100)
Define a reference stress:
>>> stress = StressTensor.tensile([1,0,0], 1)
Find where the yield surface is reached along the path given by the reference stress:
>>> vm.scale_stress_to_yield_surface(stress) Stress tensor [[99.99999999 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
- yield_function(stress)[source]
Return the yield function, with respect to the plasticity criterion.
- Parameters:
stress (StressTensor) – Stress tensor to compute the yield function from.
- Returns:
Negative if, and only if, the elasticity criterion is met
- Return type:
float or numpy.ndarray
- class elasticipy.yield_criteria.VonMisesCriterion(yield_stress=1.0)[source]
Bases:
YieldCriterionvon Mises plasticity criterion, with associated normality rule
Create a plasticity criterion
- Parameters:
yield_stress (float) – Tensile yield stress
- draw_surface_normal(fig, stress, length=1.0, color='red', cone_scale=0.2, auto_scale=False, label=None)[source]
Plot the normal to the yield surface in the principal stress space
- Parameters:
fig (plotly.graph_objs._figure.Figure) – Figure where the plot is drawn
stress (StressTensor) – Location of the surface normal to plot. If the stress tensor is not diagonal, the corresponding eigenstresses are used instead.
length (float, optional) – Length of the normal arrow
color (str, optional) – Color of the glyph used to show the normal
cone_scale (float, optional) – Size of the cone used to show the normal
auto_scale (bool, optional) – If true, the stress will be scaled automatically so that the normal will appear on the yield surface
label (str, optional) – Name to display in legend
- Returns:
Handle to the figure
- Return type:
plotly.graph_objs._figure.Figure
See also
plot3Dplot the yield surface in the 3D principal stress space
plot2Dplot the yield surface in the biaxial tensile stress space
scale_stress_to_yield_surfacescale the stress to reach the yield surface
- static eq_stress(stress, **kwargs)[source]
Return the equivalent stress, with respect to the plasticity criterion.
- Parameters:
stress (StressTensor) – Stress to compute the equivalent stress from
kwargs (dict) – keyword arguments passed to the function
- Return type:
float or numpy.ndarray
- static normal(stress, **kwargs)[source]
Apply the normality rule
- Parameters:
stress (StressTensor) – Stress tensor to apply the normality rule
kwargs (dict) – Keyword arguments passed to the function
- Returns:
Normalized direction of plastic flow
- Return type:
- plot2D(color='red', fig=None, ax=None, alpha=0.3, xrange=None, yrange=None, npt=400, label=None, linewidth=1.0, linestyle='solid')[source]
Plot the elastic domain in the biaxial tensile space.
- Parameters:
color (str, optional) – Color to use for the plot.
fig (matplotlib.figure.Figure, optional) – Figure to plot on. If not provided, a new figure will be created.
ax (matplotlib.axes.Axes, optional) – Axes to plot on.
alpha (float, optional) – Transparency of the inside of the yield surface.
xrange (tuple, optional) – Set the x-range of the plot. If not provided, it will be set automatically.
yrange (tuple, optional) – Set the y-range of the plot. If not provided, it will be set automatically.
npt (int, optional) – Number of points along each direction to use for the plot.
label (str, optional) – Label for the plot. If not provided, the name of the yield criterion constructor will be used.
linewidth (float, optional) – Width of the lines in the plot. Default is 1.
linestyle (str, optional) – Style of the lines in the plot. Default is ‘solid’.
- Returns:
fig (matplotlib.figure.Figure) – Figure where the plot is drawn.
ax (matplotlib.axes.Axes) – Axes where the plot is drawn.
See also
plot3Dplot the yield surface in the principal stress space
Examples
Plot the von Mises yield surface:
from elasticipy.plasticity import VonMisesPlasticity VonMisesPlasticity().plot2D()
- plot3D(xrange=None, yrange=None, zrange=None, color='red', opacity=1.0, npt=100, fig=None)[source]
Plot the yield surface in the principal stress space
- Parameters:
xrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
yrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
zrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
color (str, optional) – color to use for plotting the surface
opacity (float, optional) – opacity of the surface
npt (int, optional) – number of points along each direction to use for the plot.
fig (plotly.graph_objs._figure.Figure) – handle to existing plotly figure. This is used when one want to plot multiple surfaces on the same graph.
- Returns:
fig – Figure where the plot is drawn
- Return type:
plotly.graph_objs._figure.Figure
See also
plot2Dplot the yield surface in the biaxial stress space
draw_surface_normalshow the surface normal at a given location in the principal stress space
- scale_stress_to_yield_surface(stress)[source]
Automatically scale the stress to reach the yield surface.
For a given stress tensor \(\sigma\), find k such that \(f(k\sigma)=0\).
- Parameters:
stress (StressTensor) – stress to scale
- Returns:
scaled stress tensor
- Return type:
Examples
Find the tensile yield stress for von Mises criterion:
>>> from elasticipy.tensors.stress_strain import StressTensor >>> from elasticipy.yield_criteria import VonMisesCriterion >>> vm = VonMisesCriterion(yield_stress=100)
Define a reference stress:
>>> stress = StressTensor.tensile([1,0,0], 1)
Find where the yield surface is reached along the path given by the reference stress:
>>> vm.scale_stress_to_yield_surface(stress) Stress tensor [[99.99999999 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
- yield_function(stress)[source]
Return the yield function, with respect to the plasticity criterion.
- Parameters:
stress (StressTensor) – Stress tensor to compute the yield function from.
- Returns:
Negative if, and only if, the elasticity criterion is met
- Return type:
float or numpy.ndarray
- class elasticipy.yield_criteria.YieldCriterion[source]
Bases:
ABCAbstract class for plasticity criteria
- draw_surface_normal(fig, stress, length=1.0, color='red', cone_scale=0.2, auto_scale=False, label=None)[source]
Plot the normal to the yield surface in the principal stress space
- Parameters:
fig (plotly.graph_objs._figure.Figure) – Figure where the plot is drawn
stress (StressTensor) – Location of the surface normal to plot. If the stress tensor is not diagonal, the corresponding eigenstresses are used instead.
length (float, optional) – Length of the normal arrow
color (str, optional) – Color of the glyph used to show the normal
cone_scale (float, optional) – Size of the cone used to show the normal
auto_scale (bool, optional) – If true, the stress will be scaled automatically so that the normal will appear on the yield surface
label (str, optional) – Name to display in legend
- Returns:
Handle to the figure
- Return type:
plotly.graph_objs._figure.Figure
See also
plot3Dplot the yield surface in the 3D principal stress space
plot2Dplot the yield surface in the biaxial tensile stress space
scale_stress_to_yield_surfacescale the stress to reach the yield surface
- normal(stress, **kwargs)[source]
Apply the normality rule
- Parameters:
stress (StressTensor) – Stress tensor to apply the normality rule
kwargs (dict) – Keyword arguments passed to the function
- Returns:
Normalized direction of plastic flow
- Return type:
- plot2D(color='red', fig=None, ax=None, alpha=0.3, xrange=None, yrange=None, npt=400, label=None, linewidth=1.0, linestyle='solid')[source]
Plot the elastic domain in the biaxial tensile space.
- Parameters:
color (str, optional) – Color to use for the plot.
fig (matplotlib.figure.Figure, optional) – Figure to plot on. If not provided, a new figure will be created.
ax (matplotlib.axes.Axes, optional) – Axes to plot on.
alpha (float, optional) – Transparency of the inside of the yield surface.
xrange (tuple, optional) – Set the x-range of the plot. If not provided, it will be set automatically.
yrange (tuple, optional) – Set the y-range of the plot. If not provided, it will be set automatically.
npt (int, optional) – Number of points along each direction to use for the plot.
label (str, optional) – Label for the plot. If not provided, the name of the yield criterion constructor will be used.
linewidth (float, optional) – Width of the lines in the plot. Default is 1.
linestyle (str, optional) – Style of the lines in the plot. Default is ‘solid’.
- Returns:
fig (matplotlib.figure.Figure) – Figure where the plot is drawn.
ax (matplotlib.axes.Axes) – Axes where the plot is drawn.
See also
plot3Dplot the yield surface in the principal stress space
Examples
Plot the von Mises yield surface:
from elasticipy.plasticity import VonMisesPlasticity VonMisesPlasticity().plot2D()
- plot3D(xrange=None, yrange=None, zrange=None, color='red', opacity=1.0, npt=100, fig=None)[source]
Plot the yield surface in the principal stress space
- Parameters:
xrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
yrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
zrange (tuple, optional) – range for the first principal stress. If not provided, (-1,1) will be used, except if the figure already contains data; in this case, the same ranges will be reused.
color (str, optional) – color to use for plotting the surface
opacity (float, optional) – opacity of the surface
npt (int, optional) – number of points along each direction to use for the plot.
fig (plotly.graph_objs._figure.Figure) – handle to existing plotly figure. This is used when one want to plot multiple surfaces on the same graph.
- Returns:
fig – Figure where the plot is drawn
- Return type:
plotly.graph_objs._figure.Figure
See also
plot2Dplot the yield surface in the biaxial stress space
draw_surface_normalshow the surface normal at a given location in the principal stress space
- scale_stress_to_yield_surface(stress)[source]
Automatically scale the stress to reach the yield surface.
For a given stress tensor \(\sigma\), find k such that \(f(k\sigma)=0\).
- Parameters:
stress (StressTensor) – stress to scale
- Returns:
scaled stress tensor
- Return type:
Examples
Find the tensile yield stress for von Mises criterion:
>>> from elasticipy.tensors.stress_strain import StressTensor >>> from elasticipy.yield_criteria import VonMisesCriterion >>> vm = VonMisesCriterion(yield_stress=100)
Define a reference stress:
>>> stress = StressTensor.tensile([1,0,0], 1)
Find where the yield surface is reached along the path given by the reference stress:
>>> vm.scale_stress_to_yield_surface(stress) Stress tensor [[99.99999999 0. 0. ] [ 0. 0. 0. ] [ 0. 0. 0. ]]
- yield_function(stress)[source]
Return the yield function, with respect to the plasticity criterion.
- Parameters:
stress (StressTensor) – Stress tensor to compute the yield function from.
- Returns:
Negative if, and only if, the elasticity criterion is met
- Return type:
float or numpy.ndarray