mean_stress#
The mean_stress module contains all the functions and classes related to the mean stress, such as mean stress correction.
MeanStress#
- py_fatigue.mean_stress.mean_stress#
alias of <module ‘py_fatigue.mean_stress.mean_stress’ from ‘/home/runner/work/py_fatigue/py_fatigue/py_fatigue/mean_stress/mean_stress.py’>
corrections#
The py_fatigue.msc.corrections
module collects all the
mean stress corrections implemented in py_fatigue.
classes.
- py_fatigue.mean_stress.corrections.dnvgl_mean_stress_correction(mean_stress: ndarray, stress_amplitude: ndarray, detail_factor: float | int = 0.8, plot: bool = False) ndarray #
Calculates the mean stress correction according to par. 2.5 of`DNVGL-RP-C203 <https://bit.ly/3dUZ1OY>`_ which includes an attenuation factor \(p\) for the stress ranges if the following cases:
base material without significant residual stresses \(\rightarrow p = 0.6\). This option neglects fully compressive cycles.
welded connections without significant residual stresses \(\rightarrow p = 0.8\). This option multiplies the stress range of fully compressive cycles by p.
Given that the stress ranges are \(\Delta \sigma\), the corrected stress ranges are:
\[\Delta \sigma_{corr} = f_m \cdot \Delta \sigma\]where:
\[f_m = \frac{\sigma_{max} + p \cdot \vert \sigma_{min} \vert}{\sigma_{max} + \vert\sigma_{min} \vert}\]with:
\[\frac{\sigma_{amp}}{\vert \sigma_m \vert} \leq 1, \quad \sigma_{amp} = \frac{\sigma_{max} - \sigma_{min}}{2} \,\land \, \sigma_m = \frac{\sigma_{max} + \sigma_{min}}{2}\]- Parameters:
mean_stress (np.ndarray) – The mean stress of the fatigue test (\(\sigma_m\)).
stress_amplitude (np.ndarray) – The stress amplitude of the fatigue test (\(\sigma_{amp}\)).
detail_factor (float, optional) – mean stress attenuation factor (\(p\)), defaults to 0.8 in welded connections without significant residual stresses.
plot (bool, optional) – If True, the mean stress correction is plotted, defaults to False.
- Returns:
The mean stress corrected ranges (\(\Delta \sigma_{corr}\)).
- Return type:
np.ndarray
- py_fatigue.mean_stress.corrections.walker_mean_stress_correction(mean_stress: ndarray, stress_amplitude: ndarray, gamma: float = 0.5, plot: bool = False) ndarray #
Calculates the mean stress correction according to Walker model.
The correction is given by:
\[\Delta \sigma_{corr} = {\sigma_{max}} ^ {(1 - \gamma)} \, \sigma_{amp} ^ {\gamma}\]with:
\[\sigma_{max} = \sigma_{mean} + \sigma_{amp}\]- Parameters:
mean_stress (np.ndarray) – The mean stress of the fatigue test (\(\sigma_{mean}\)).
stress_amplitude (np.ndarray) – The stress amplitude of the fatigue test (\(\sigma_{amp}\)).
gamma (float, optional) – The gamma Walker exponent (\(\gamma\)), defaults to 0.5.
plot (bool, optional) – If True, the mean stress correction is plotted, defaults to False.
- Returns:
The mean stress corrected ranges (\(\Delta \sigma_{corr}\)).
- Return type:
np.ndarray
- py_fatigue.mean_stress.corrections.swt_mean_stress_correction(mean_stress: ndarray, stress_amplitude: ndarray, plot: bool = False) ndarray #
Calculates the mean stress correction according to Smith-Watson-Topper model. It is equivalent to the Walker model with gamma = 0.5.
The correction is given by:
\[\Delta \sigma_{corr} = \sqrt{\sigma_{max} \cdot \sigma_{amp}}\]with:
\[\sigma_{max} = \sigma_{mean} + \sigma_{amp}\]- Parameters:
mean_stress (np.ndarray) – The mean stress of the fatigue test (\(\sigma_{mean}\)).
stress_amplitude (np.ndarray) – The stress amplitude of the fatigue test (\(\sigma_{amp}\)).
plot (bool, optional) – If True, the mean stress correction is plotted, defaults to False.
- Returns:
The mean stress corrected ranges (\(\Delta \sigma_{corr}\)).
- Return type:
np.ndarray
- py_fatigue.mean_stress.corrections.goodman_haigh_mean_stress_correction(amp_in: ndarray | list[float], mean_in: ndarray | list[float], r_out: float | ndarray | list[float], ult_s: float, correction_exponent: float, initial_guess: ndarray | None = None, plot: bool = False, logger: Logger | None = None) tuple[ndarray, ndarray] #
This function extends the standard Goodman-Haigh correction formula which computes the corrected stress amplitude at zero mean stress (\(R=-1\)) for a given set of input stress amplitudes and mean stresses.
\[\sigma_{amp, \text{out}} = \frac{\sigma_{amp, \text{in}}} {1 - \left(\frac{\sigma_{mean, \text{in}}}{\sigma_{ult}} \right)^{n}}\]The correction exponent \(n\) is a material property that can be obtained from experimental data.
The current implementation extends the standard Goodman-Haigh formula by correcting the stress amplitude from an initial load ratio \(R_{in}\) to any other load ratio \(R_{out}\), as long as the material’s ultimate strength is known. The corrected stress amplitude \(\sigma_{amp, \text{out}}\) is computed using the following implicit nonlinear equation:
\[\sigma_{amp, \text{out}} = \frac{1}{ \frac{1 - \left( \frac{(1 + R_{\text{in}}) \cdot \sigma_{amp, \text{in}}} {(1 - R_{\text{in}}) \cdot \sigma_{ult}} \right)^{n}}{\sigma_{amp, \text{in}}} + \sigma_{amp, \text{out}}^{n-1} \cdot \left( \frac{(1 + R_{\text{out}})}{(1 - R_{\text{out}}) \cdot \sigma_{ult}} \right)^{n}}\]where:
\(R\)in = \(\sigma_{min} / \sigma_{max} = (\sigma_{mean} - \sigma_{amp}) / (\sigma_{mean} + \sigma_{amp})\) is the input stress ratio,
\(R\)out is the output stress ratio,
\(\sigma_{amp}\)in is the input amplitude,
\(\sigma_{amp}\)out is the output amplitude,
\(\sigma_{ult}\) is the ultimate strength of the material, and
\(n\) is the correction exponent.
The solver is based on the Newton-Raphson method, which is implemented internally at
py_fatigue.utils.numba_newton()
,py_fatigue.utils.compile_specialized_newton()
, andpy_fatigue.mean_stress.corrections.__goodman_equation()
.- Parameters:
- Returns:
Computed amp_out values, and corresponding mean_out values.
- Return type:
tuple[np.ndarray, np.ndarray]
See also
py_fatigue.utils.numba_newton()
,py_fatigue.utils.compile_specialized_newton()
, :func:`py_fatigue.mean_stress.corrections.__goodman- Raises:
ValueError – If the input arrays have different shapes or if there are negative stress amplitude values in amp_in.
Warning – If the number of points in the input arrays is too large for plotting.
Examples
>>> import numpy as np >>> from py_fatigue.mean_stress.corrections import ( ... goodman_haigh_mean_stress_correction ... ) >>> amp_in = np.array([100, 200, 300]) >>> mean_in = np.array([0, 0, 0]) >>> r_out = np.array([-1, 0, 0.5, 0.75, 0.9]) >>> ult_s = 1000 >>> correction_exponent = 9 >>> amp_out, mean_out = goodman_haigh_mean_stress_correction( ... amp_in, mean_in, r_out, ult_s, correction_exponent, plot=True ... )