# Homework 5¶

• Type your name and email in the “Student details” section below.

• Develop the code and generate the figures you need to solve the problems using this notebook.

• For the answers that require a mathematical proof or derivation you can either:

• Type the answer using the built-in latex capabilities. In this case, simply export the notebook as a pdf and upload it on gradescope; or

• You can print the notebook (after you are done with all the code), write your answers by hand, scan, turn your response to a single pdf, and upload on gradescope.

• The total homework points are 100. Please note that the problems are not weighed equally.

Note

• This is due before the beginning of the next lecture.

• Please match all the pages corresponding to each of the questions when you submit on gradescope.

## Student details¶

• First Name:

• Last Name:

• Email:

import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set(rc={"figure.dpi":100, 'savefig.dpi':300})
sns.set_context('notebook')
sns.set_style("ticks")
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('retina', 'svg')

import requests
import os

"""
Downloads the file in the url and saves it in the current working directory.
"""
data = requests.get(url)
if local_filename is None:
local_filename = os.path.basename(url)
with open(local_filename, 'wb') as fd:
fd.write(data.content)


## Problem 1 - Analysis of experimental srtess-strain curves of alluminum 6061-T651¶

We are going to analyze the dataset collected by . They perform two types of experiments. We are going to focus on the “uniaxial tension experiment.” This is what it is all about:

Fig. 1 Geometry of the uniaxial tension specimen.

• They mounted the speciment (using the holes you see on the sides) on a machine that applied tension:

Fig. 2 The mounted specimen.

• They controlled the temperature of the specimen.

• They applied tension gradually until the speciment broke, recorging at each step the strain (% change in length) and the stress (force per cross section area in MPa - megaPascal).

I suggest that you skim through the paper if you want to understand more about the details of the experiment. Measuring the strains and stresses is not as straightforward as it sounds…

Our goal is to download the data, and for a fixed temperature, create a model for the stress-strain relation. We are going to do some of the low level stuff. But, I am going to guide you through this.

• First, download the complete zipped data from here and unzip it in the directory of your Jupyter notebook. You have two options. Either do it mannually as we did in Homework 3 or run the code segment below to do it from this Jupyter notebook:

url = 'https://md-datasets-cache-zipfiles-prod.s3.eu-west-1.amazonaws.com/rd6jm9tyb6-2.zip'
!unzip -o rd6jm9tyb6-2.zip
!unzip -o stress-strain-curves-of-aluminum-6061-t651-from-9-lots-at-6-temperatures-under-uniaxial-and-plain-strain-tension.zip

• Now read the data description here very carefully and find a filename that contains data from a uniaxial tension test of 200 degrees C. There multiple files that fit this description. Just pick one of them.

filename = # your choice here
print('The file I picked is: ', filename)

• Load the file in a dataframe and print it.

# your code here

• Plot the stress as a function of the strain. Hint: Please label your axes properly.

# your code here

• The ultimate tensile strength (or just “the strength”) of a material is the maximum stress that develops under tension before the material breaks. What is the strength of this alluminum alloy? Please, provide your answer below using the print() function with a precision of 2 decimal points. How does your answer compare with the strength range for allumunum alloys reported in wikipedia?

# your code here

• Let’s zoom in to low strains. Plot the first 200 observations points of the stress-strain curve.

# your code here

• Observe that the experimental data are behaving strangely at very small strains. As a matter of fact, we are getting a few negative strains at the beginning. Let’s throw these observartions away. Start by finding the index $$i$$ for which df['Strain'][i] becomes positive from the first time. You can do this by a visual inspection of df['Strain'][:30].

# your code here

• Make a new dataframe, call it clean_df where you have thrown away the initial data. Then plot the first 200 observations of clean_df.

# your code here

• Observe that initially the stress-strain relation is linear. This is the so-called elastic regime. If you deform the material within this regime, it will return to its undeformed state without any permanent deformation effects. If you deform the material beyond the elastic regime, then you start having what we call plasticity. We are now going to focus exclusively to the linear regime. Find an index $$j$$ so that clean_df[:j] is fully within the linear regime. Make a new dataframe, say linear_df containing only these data. You should probably pick $$j$$ by visual inspection. And it is not important to pick the maximum $$j$$ with this property. Just find one.

# your code here

• In the elastic regime, the stress $$\sigma$$ is a linear function of the strain $$\epsilon$$:

$\sigma = E\epsilon.$

The constant $$E$$ is called Young’s modulus and it has units of GPa (GigaPascal). Make a function sigma(epsilon, E) that calculates the stress given the strain for any Young’s modulus. Hint: Properly document the docstring of your function.

# your code here

# Try your function here:
sigma(linear_df['Strain'], 68)

• If you pay close attention to the data in linear_df they do not cross zero. This is due to a systematic bias in the experiment. However, this bias is not important for calibrating Young’s modulus $$E$$. Only the slope of the curve is important for finding $$E$$. So, let’s make yet another dataframe (I promise you this is the last one) called clean_linear_df which removes this systematic bias. The dataframe clean_linear_df should contain the same data as linear_df but

• The strains should all shifted by the minimum strain in linear_df. In other words, subtract from the strains in clean_linear_df the smallest strain in linear_df, i.e., subtract linear_df['Strain'].min().

• The stresses should all be shifted by the minimum stress in linear_df.

# your code here

• Use visual inspection to find a value for the Young’s modulus that matches the data in clean_linear_df. Hints: Remember that the stress $$\sigma$$ is in MPa so you will have to change the units correctly if you $$E$$ is expressed in GPa.

# your code here

• How does what you found compare to the wikipedia reported Young’s modulus for this material? Why do you think your is lower/higher? You may want to repeat the analysis above for another experiment with lower temperature (say at room temperature).

# your answer here