crack_growth_curve#

The crack_growth_curve module contains the ParisCurve class and all the funcitons strictly related to its correct functioning. The function relies on the AbstractCrackGrowthCurve class, which can be used as a abstract class for the definition of new growth models such as NASGRO law.

The ParisCurve class#

class py_fatigue.ParisCurve(slope: int | float | list | ndarray, intercept: int | float | list | ndarray, threshold: int | float = 0, critical: int | float = inf, environment: str | None = None, curve: str | None = None, norm: str | None = None, unit_string: str = 'MPa √mm', color: str | None = None)#

Define a crack growth curve inthe form of Paris’ law that can have an arbitrary number of slopes/intercepts as well as a threshold and critical stress intensity factor. For example:

>>> #
>>> #         ^                log da/dN - log ΔK
>>> #         │                                *
>>> #         │                                *
>>> #         │                                *
>>> #         │                                *
>>> #         │                             *  .
>>> #         │                          *  │  .
>>> #         │                       *     │ m2
>>> #         │                    *        │  .
>>> #         │                 *-----------┘  .
>>> #         │              *                 .
>>> #         │           .*│                  .
>>> #         │        . *  │ m1               .
>>> #         │     .  *    │                  .
>>> #         │  .   *------┘                  .
>>> # (da/dN)1+    *                           .
>>> #         │  . *                           .
>>> #         │.   *                           .
>>> # (da/dN)2+----|---------------------------|--------------->
>>> #             ΔK0                         ΔKc
>>> #                          Number of cycles

The slope-intercept couples ((m1, log_a1), (m2, log_a2)), and the endurance value (Ne) are the parameters necessary to fully describe this trilinear Paris’ law. If the endurance is not set, it defaults to Inf.

Example

>>> from py_fatigue import ParisCurve
>>> import numpy as np
>>> # Define a Paris' law with 5 slopes and 5 interceps
>>> SIF = np.linspace(1,2500, 300)
>>> SLOPE_5 = np.array([2.88, 5.1, 8.16, 5.1, 2.88])
>>> INTERCEPT_5 = np.array([1E-16, 1E-20, 1E-27, 1E-19, 1E-13])
>>> THRESHOLD = 20
>>> CRITICAL = 2000
>>> pc = ParisCurve(slope=SLOPE_5, intercept=INTERCEPT_5,
                  threshold=THRESHOLD, critical=CRITICAL, norm="The norm",
                  environment="Environment", curve="nr. 4")
>>> pc_.get_knee_sif()
array([ 63.35804993, 193.9017369 , 411.50876026, 504.31594872])

Define crack growth rate curve (Paris’ law). See class docstring for more information.

Parameters:
  • slope (Union[int, float, list, np.ndarray]) – Paris curve slope

  • intercept (Union[int, float, list, np.ndarray]) – crack growth rate axis intercept

  • threshold (Union[int, float]) – propagation threshold, below which crack growth rate is null

  • critical (Union[int, float]) – critical propagation stress intensity factor, imminent failure

  • environment (str, optional) – Paris’ law envirnoment, by default None

  • curve (str, optional) – Paris’ law category, by default None

  • norm (str, optional) – Paris’ law norm, by default None

  • unit_string (str, optional) – units, by default “MPa”

  • color (str, optional) – RGBS or HEX string for color, by default None

Public Data Attributes:

threshold_growth_rate

Calculates the crack growth rate at threshold, if threshold SIF is defined.

critical_growth_rate

Calculates the crack growth rate at critical, if critical SIF is defined.

Inherited from AbstractCrackGrowthCurve

linear

Preventing attribute modification outside of constructor

slope

Preventing attribute modification outside of constructor

intercept

Preventing attribute modification outside of constructor

threshold

Preventing attribute modification outside of constructor

critical

Preventing attribute modification outside of constructor

unit

Preventing attribute modification outside of constructor

threshold_growth_rate

Calculates the crack growth rate at threshold, if threshold SIF is defined.

critical_growth_rate

Calculates the crack growth rate at critical, if critical SIF is defined.

Public Methods:

format_name([html_format])

Reformat ParisCurve name.

get_knee_growth_rate([check_knee, ...])

Calculates the crack growth rate at the knee, if the Paris' law is more than linear.

get_knee_sif([check_knee, significant_digits])

Calculates the SIF at the knee, if the Paris' law is more than linear.

get_growth_rate(sif_range)

Return cycles value(s) for stress range(s).

get_sif(growth_rate)

Return SIF range(s) for the endurance(s) N.

plot([sif, growth_rate, dataset_name, ...])

Use matplotlib to plot the Paris' law and a da/dN vs ΔK history dataset.

Inherited from AbstractCrackGrowthCurve

__init__(slope, intercept[, threshold, ...])

Define crack growth rate curve (Paris' law).

__str__()

Crack growth curve __str__ method

__eq__(other)

Compare different crack growth curves and assert that they contain same attributes values

format_name([html_format])

Reformat ParisCurve name.

get_knee_growth_rate([check_knee, ...])

Calculates the crack growth rate at the knee, if the Paris' law is more than linear.

get_knee_sif([check_knee, significant_digits])

Calculates the SIF at the knee, if the Paris' law is more than linear.

get_growth_rate(sif_range)

Return cycles value(s) for stress range(s).

get_sif(growth_rate)

Return SIF range(s) for the endurance(s) N.

Private Data Attributes:

_abc_impl

Inherited from AbstractCrackGrowthCurve

_abc_impl

Private Methods:

_repr_svg_()

SVG representation of the crack growth curve instance

Inherited from AbstractCrackGrowthCurve

_repr_svg_()

SVG representation of the crack growth curve instance


_repr_svg_() str#

SVG representation of the crack growth curve instance

Returns:

the SVG object

Return type:

str

format_name(html_format: bool = False) None#

Reformat ParisCurve name.

Parameters:

html_format (bool, optional) – Choose whether the name format shall be HTML or not, by default True

property threshold_growth_rate: float#

Calculates the crack growth rate at threshold, if threshold SIF is defined.

Returns:

threshold crack growth rate

Return type:

float

property critical_growth_rate: float#

Calculates the crack growth rate at critical, if critical SIF is defined.

Returns:

critical crack growth rate

Return type:

float

get_knee_growth_rate(check_knee: Collection | None = None, significant_digits: int = 2) ndarray#

Calculates the crack growth rate at the knee, if the Paris’ law is more than linear.

Parameters:
  • check_knee (Iterable, optional) – Iterable of SIF values to check for the knee, by default None

  • significant_digits (int, optional) – Number of significant digits to round the knee to, by default 2

Returns:

knee crack growth rate

Return type:

np.ndarray

get_knee_sif(check_knee: Collection | None = None, significant_digits: int = 2) ndarray#

Calculates the SIF at the knee, if the Paris’ law is more than linear.

Parameters:
  • check_knee (iterable, optional) – SIF values to check the knee SIF against, by default None

  • significant_digits (int, optional) – number of significant digits to check the knee SIF against, by default 2

Returns:

knee SIF

Return type:

np.ndarray

get_growth_rate(sif_range: int | float | list | ndarray) float | ndarray#

Return cycles value(s) for stress range(s).

Parameters:

sif_range (int or float or list or 1darray) – SIF range(s) to find the corresponding crack growth rate(s) for.

Returns:

crack growth rate(s) for the SIF range(s) indicating sif_range.

Return type:

float or 1darray

get_sif(growth_rate: int | float | list | ndarray) float | ndarray#

Return SIF range(s) for the endurance(s) N.

Parameters:

cycles (int or float or list or 1darray) – crack growth rate(s) to find the corresponding SIF range(s) for.

Returns:

SIF range(s) for corresponding crack growth rate(s).

Return type:

float or 1darray

plot(sif: list | None = None, growth_rate: list | None = None, dataset_name: str | None = None, dataset_color: str = '#000', fig: Figure | None = None, ax: Axes | None = None, **kwargs: Any) Tuple[Figure, Axes]#

Use matplotlib to plot the Paris’ law and a da/dN vs ΔK history dataset.

Example

Use matplotlib to plot the Paris’ law and a da/dN vs ΔK history

>>> fig, ax = pc.plot()
Parameters:
  • sif (list, optional) – SIF value(s) in the dataset, by default None

  • growth_rate (list, optional) – Crack growth rate(s) in the dataset, by default None

  • dataset_name (str, optional) – history dataset name, by default None

  • dataset_color (str, optional) – history dataset color, by default “#000”

  • fig (matplotlib.figure.Figure, optional) – figure object, by default None

  • ax (matplotlib.axes.Axes, optional) – axis object, by default None

  • **kwargs (Any, optional) – additional keyword arguments

Returns:

The figure and axes.

Return type:

matplotlib.figure.Figure, matplotlib.axes.Axes