Skip to main content
Analyze high-cycle fatigue test data and fit a fatigue model using SciPy, using an approach suitable for automation with either MI Data Flow or as a simple scheduled task (cron job).

Connect to Granta MI

Specify a database and tables.

Search for records with statistical data

This script will perform a fatigue analysis on the first record whose Statistical Analysis Status is set to ‘In Progress’, but it can easily be generalised to operate on multiple statistical data records. First, perform a criteria search to find the target record.
Previous cell output:

Get the source data for the record

Get the R-Ratio and Test Temperature values from the record, and fetch the corresponding test results. Then read the attribute values from the test result records into a pandas DataFrame for plotting and analysis.
Previous cell output:

Fit the data

Fit the fatigue test data using the SciPy curve_fit() function, and create a new DataFrame for the fitted data and the lower bound. Define an expression for fitting as follows: y = 10^(-A1)x^(A2) To maximize the fit precision, normalize the y values to a single order of magnitude. The y values are of the order of 100 MPa, so use a scale factor of 0.01. Based on the expression being used, multiplying by a scale factor requires adding log10 of the scale factor to the A1 result.
Cyclic life Type Maximum stress
0 5000.000000 Fitted Data 527.961676
1 5870.634799 Fitted Data 520.791950
2 6892.870589 Fitted Data 513.719590
3 8093.105189 Fitted Data 506.743272
4 9502.332991 Fitted Data 499.861692

Plot the data

Create a scatter plot of the source data (Maximum stress vs Number of cycles).
png Add the fitted curve and the minimum curve to the plot, and set the x-axis scale to logarithmic.
png

Import the fitted data to Granta MI

Replace the data in the original record’s functional attribute Maximum Stress v Cycles (Equivalent Stress) with the fitted data. Use Session.update() to push the changes to Granta MI.
Previous cell output:
Add a record link group, and use Session.update_links() to push the changes to Granta MI.
Previous cell output: