Skip to main content
In this example, we will fit the Ramberg-Osgood material model to steel tensile test results to demonstrate how to compute model parameters, and common steps in a tensile analysis.

Connect to Granta MI

Specify a database and table. Set the unit system explicitly to ensure repeatable results.

Get the folder containing test records

Records in the Tensile Test Data table are stored in folders grouped by Test Temperature. Get the parent folder to iterate through the different values of Test Temperature.
Previous cell output:

Fetch relevant attributes for the analysis

The attributes Test Temperature and Tensile Response (11 axis) are required for our analysis. Export both attributes plus the Pseudo-Attribute Name for efficiency. Filter out records that do not have values for the required attributes. Store the record objects in a dictionary keyed by the test temperature, and extract the unit symbols for use when displaying results.
Previous cell output:

Define the Ramberg-Osgood model

The Ramberg-Osgood model expresses the total stress as a function of the strain, the Elastic Modulus and two model parameters, conventionally K and n: Strain = Stress/Elastic Modulus + K*(Stress/Elastic Modulus)^n

Define a helper function to fit the model to a series

Using the scipy.optimize package, fit the Ramberg-Osgood model to the stress-strain data at each temperature. Provide initial values and constrain the parameters to positive and realistic values. These values are material dependent - for Steel we use the following: The goodness of fit can be estimated by inspecting the diagonal of the covariance matrix, which is returned by the curve_fit function. Take the square root to obtain the sum-of-squares error for each model parameter.

Define additional helper functions

Define three more helper functions to make the main loop easier to understand:
  • get_response_data iterates over the provided records and extracts the contents of the Tensile Response (11 axis) attribute into a numpy array.
  • compute_fitted_data takes the fitted model parameters and a stress range and computes the predicted stress-strain curve. This is used to plot the model results.
  • compute_yield_point takes a fitted stress-strain curve and the elastic modulus and performs a basic fit to calculate the 0.2% Offset Yield Stress and Strain of the material.

Fit to the data

For each set of test records, extract the stress-strain curve and fit to the Ramberg-Osgood model using the helper functions defined above. Combine all the test runs into one dataset and fit the model to the aggregate data. In your own scripts, you will also need to take into account multiple series, range data, and other features of your data such as Estimated and Not-Applicable flags.
Previous cell output:

Plot the results

Plot the source data for each temperature run, with common axis scales to make comparison easier. In addition to the response data and the fitted model, plot the elastic stress-strain line and the yield point at each temperature.
png