fracmechpy: Fracture Mechanics
Overview
fracmechpy is a Python package that calculates the fatigue crack growth rate (da/dN) and the stress intensity factor range (ΔK) for Compact Tension (CT) specimens with the Secant method based on ASTM E647.
Features
- Computes fatigue crack growth rate (da/dN)
- Computes stress intensity factor range (ΔK)
- Implements ASTM E647 standard
- Includes error handling for ASTM E647 validity limits
- Newly added: Incremental Polynomial Regression (IncPoly) method for crack growth rate calculation.
Installation
Installing from PyPI (Future Deployment)
If fracmechpy is available on PyPI, you can install it using:
pip install fracmechpy
Installing from Source
To install the package manually:
- Clone the repository:
git clone https://github.com/dhaselib/fracmechpy.git
- Navigate to the directory:
cd fracmechpy
- Install using pip:
pip install .
Ensure you have NumPy installed using:
pip install numpy
Functions
Secant(N, af, ab, W, p_max, p_min, B)
This function calculates the fatigue crack growth rate (da/dN) and the stress intensity factor range (ΔK) for a CT specimen.
Parameters:
N(numpy array): Number of cyclesaf(numpy array): Crack length at the front face of the specimenab(numpy array): Crack length at the back face of the specimenW(float): Width of the specimenp_max(float): Maximum applied loadp_min(float): Minimum applied loadB(float): Thickness of the specimen
Returns:
dadN(numpy array): Fatigue crack growth rate (da/dN)dK(numpy array): Stress intensity factor range (ΔK)
IncPoly(N, af, ab, W, p_max, p_min, B, n)
This function calculates the crack growth rate (da/dN) using the Incremental Polynomial Regression method for a CT specimen.
Parameters:
N(numpy array): Number of cyclesaf(numpy array): Crack length at the front face of the specimenab(numpy array): Crack length at the back face of the specimenW(float): Width of the specimenp_max(float): Maximum applied loadp_min(float): Minimum applied loadB(float): Thickness of the specimenn(int): Number of neighboring points for regression
Returns:
dadN(numpy array): Incremental crack growth rate (da/dN)dK(numpy array): Stress intensity factor range (ΔK)
Limitations on Choosing the Value of n
-
Dataset Size: Ensure that
nis smaller than the length of the dataset. Ifnexceeds the available data points, the method may fail to run, leading to errors or empty results. -
Accuracy vs. Data Availability: A larger
nimproves regression accuracy but may result in fewer available data points, especially in smaller datasets. Conversely, smallernmight yield less stable results but can handle more data points. -
Edge Effects: For data points near the beginning or end of the dataset, the number of available neighbors may be limited. If
nis too large, it may not be possible to compute regression near the edges. -
Performance Considerations: Large values of
ncan increase memory usage and slow down performance, especially for larger datasets. Start with smaller values ofnand increase it as needed.
Example Usage
import numpy as np
from fracmechpy import Secant, IncPoly
# Sample input data
N = np.array([70000, 90000, 100000, 110000,120000,130000])
af = np.array([1.90, 3.09, 3.78, 4.45, 6.19, 6.84])
ab = np.array([0.89, 2.07, 2.81, 3.53, 5.09, 6.21])
W = 50 # Width in (mm)
p_max = 4000 # Maximum load in (N)
p_min = 400 # Minimum load in (N)
B = 5 # Thickness in (mm)
n = 1 # Number of neighboring points for regression
# Compute crack growth rate and stress intensity factor range using Secant method
dadN_secant, dK_secant = Secant(N, af, ab, W, p_max, p_min, B)
print("Secant Method - da/dN:", dadN_secant)
print("Secant Method - dK:", dK_secant)
# Compute crack growth rate and stress intensity factor range using IncPoly method
dadN_incpoly, dK_incpoly = IncPoly(N, af, ab, W, p_max, p_min, B, n)
print("IncPoly Method - da/dN:", dadN_incpoly)
print("IncPoly Method - dK:", dK_incpoly)
Error Handling
The function enforces ASTM E647 validity limits for crack growth increments (da). If the increment exceeds the standard-defined limits based on α = aᵥₑ/W , the function prints an error message and returns None.
License
This package is distributed under the MIT License.
Contact
For questions or contributions, please reach out to the author at dhaselib@gmail.com.
### Key Updates:
1. **New Section for `IncPoly`**: Added a description of the `IncPoly` method in the functions section.
2. **Updated Example Usage**: Added an example that demonstrates the usage of both `Secant` and `IncPoly` functions.
3. **Feature Addition**: Mentioned the addition of the `IncPoly` method in the Features section.
4. **Limitations of `n`**: Provided detailed information about the limitations on choosing the value of `n`, including dataset size, accuracy vs. data availability, edge effects, and performance considerations.
This should now fully reflect the functionality of the `IncPoly` method and the limitations for the `n` parameter.
Release files for fracmechpy 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fracmechpy-0.0.3.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fracmechpy-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / fracmechpy-0.0.3.tar.gz
| Download URL | fracmechpy-0.0.3.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e26308fd656ea3a0a844f00d03fa4498332dad12589403f607a629c3339cbce6
|
|
BLAKE2b-256 checksum How to use checksums |
d0c09a2414fe18ad139e1645efdb869458ca27a7580a20394be34921a91d8b8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / fracmechpy-0.0.3-py3-none-any.whl
| Download URL | fracmechpy-0.0.3-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad2dc85a6f85df759ba08e5c41dcaac58dda368b6b9316c7838fb269e2eec5b8
|
|
BLAKE2b-256 checksum How to use checksums |
91fe4ee3c75baaaf64952ff4ddb5de98c6fc1e9bd1ce72a3fd68eae6ffa8507d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|