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.
Note
The curve can account for mean stress effect according to Walker’s model. The walker_exponent is set to 0 by default, meaning no correction is applied, i.e. the base curve is valid for R=0.
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
load_ratio (Union[int, float]) – load ratio. Used for mean stress-corrected Paris’ law
walker_exponent (Union[int, float]) – Walker’s exponent. Used for mean stress-corrected Paris’ law
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 √mm”
color (str, optional) – RGBS or HEX string for color, by default None
Public Data Attributes:
load_ratio
Preventing attribute modification outside of constructor
walker_exponent
Preventing attribute modification outside of constructor
walker_intercept
Walker-corrected intercept.
threshold
Returns: Union[int, float]: Threshold SIF
critical
Returns: Union[int, float]: Critical SIF
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:
__init__
(slope, intercept[, threshold, ...])Define crack growth rate curve (Paris' law).
from_knee_points
(knee_sif, knee_growth_rate)Create a Paris curve from a set of knee points, i.e. build slopes and intercepts from pairs of SIF and crack growth rate.
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).
from_knee_points
(knee_sif, knee_growth_rate)Create a Paris curve from a set of knee points, i.e. build slopes and intercepts from pairs of SIF and crack growth rate.
__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_
()
- __init__(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) None #
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
load_ratio (Union[int, float]) – load ratio. Used for mean stress-corrected Paris’ law
walker_exponent (Union[int, float]) – Walker’s exponent. Used for mean stress-corrected Paris’ law
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 √mm”
color (str, optional) – RGBS or HEX string for color, by default None
- classmethod from_knee_points(knee_sif: ndarray | List[float], knee_growth_rate: ndarray | List[float], environment: str | None = None, curve: str | None = None, norm: str | None = None, unit_string: str = 'MPa √mm', color: str | None = None) ParisCurve #
Create a Paris curve from a set of knee points, i.e. build slopes and intercepts from pairs of SIF and crack growth rate. The first and last knee points are used to set the threshold and critical SIF values.
- Parameters:
knee_sif (Union[np.ndarray, List[float]]) – SIF values at the knee
knee_growth_rate (Union[np.ndarray, List[float]]) – crack growth rate at the knee
environment (str, optional) – Paris’ law environment, 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
- Returns:
Paris curve instance
- Return type:
- 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 walker_intercept: ndarray#
Walker-corrected intercept.
\[a_w = \frac{a}{(1 - R)^{\frac{m}{1 - \gamma}}}\]Preventing attribute modification outside of constructor
- Returns:
Corrected intercept
- Return type:
np.ndarray
- property threshold_growth_rate: float#
Calculates the crack growth rate at threshold, if threshold SIF is defined.
- Returns:
threshold crack growth rate
- Return type:
- property critical_growth_rate: float#
Calculates the crack growth rate at critical, if critical SIF is defined.
- Returns:
critical crack growth rate
- Return type:
- 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