---
title: Using AFM Imaging to Observe Relationship of Corrosion and Temperature using Roughness Measurements on Carbon Steel
authors:
  - name: Eric Corona
    affiliation: Department of Physics and Astronomy, California State University Long Beach
    roles: writing
    corresponding: true
  - name: Brendan Winkler
    affiliation: Department of Physics and Astronomy, California State University Long Beach
    roles: writing
    corresponding: true
bibliography: references.bib
abstract: In this experiment, the focus was on inspecting the relationship between corrosion and temperature in steel samples. The typical correlation between these variables in steel is that as the temperature increases, the rate of corrosion will exponentially increase. This corrosion erodes the steel leaving the underlying material etched and rougher. More corrosion then corresponds to greater surface roughness. Combining the relationship of corrosion and temperature with corrosion and roughness indicates that higher temperatures during corrosion would correspond to an increase in roughness. Using Atomic Force Microscopy (AFM), this relationship could be examined by measuring the surface roughness of corroded steel samples. The steel samples were prepared by corroding them in a 3.5% saline solution maintained at variable temperatures (4℃, 20℃, 40℃, and 60℃) over a combined total of 10 hours. By measuring these samples’ roughness using AFM, the relationship between temperature of corrosion and roughness could be tested. Additionally, with the AFM images, the overall structural impact of temperature and corrosion on steel was evaluated.
---

## Introduction

Steel is a widely used material in a variety of industries with an annual demand amounting to about 1.8 billion tons. A major concern with steel, however, is the damages incurred through corrosion. These damages to steel end up costing around \$2.5 trillion globally annually which is about 3-4% of global annual GDP ( @Koch ). Given how prolific steel usage is and the large sum of its damages, this provides a significant incentive to understand how corrosion impacts the integrity of steel.

Corrosion can be understood as the degradation of metals when exposed to water and oxygen. With steel specifically, the water mediates a reaction of oxygen with the iron in the steel to form oxides and rust. This rust then flakes off of the original material gradually damaging the steel. The particular oxidation-reduction reaction responsible for corrosion in steel is as shown.$$
4 \, \text{Fe} (s) + 3 \, \text{O}_2 (g) \rightarrow 2 \, \text{Fe}_2\text{O}_3 (s)
$$

The oxygen forms bonds with the iron synthesizing an oxide which is responsible for the deterioration of steel. 

Several factors exist that can accelerate corrosion. One of these is the introduction of salt into water. When dissolved, this salt releases ions into that water that assist in the exchange of electrons between the iron and the oxygen to increase the rate of corrosion. To quantitatively visualize the impact salt has on the corrosion of steel, the rate of corrosion of plain steel in fresh water is about 1 mpy, meanwhile in seawater condition, which has a salinity of 3.5%, the corrosion rate increases to 15 mpy for plain steel within the first year ( @Mccaferty ). Another factor that alters the rate of corrosion is the temperature of the environment. With an increase in temperature, there is an increase of the mobility of chemical agents, thus increasing the reaction rate. Then for corrosion, there is a direct relationship between temperature and corrosion that grows exponentially. The higher the temperature, the more and more corrosion that occurs.( @Konovalova ).

With the incoming threat of climate change, the average ocean temperatures are expected to increase by 1-3℃ in the coming decades ( @Varela ). As the temperatures increase, they arein set to accelerate the corrosion of steel and further damage the infrastructure that relies on it. This places a need in understanding exactly how temperature and corrosion will affect steel based materials.

## Experiment

For our experiment, we set out to investigate the relationship between corrosion steel and temperature. Atomic Force Microscopy (AFM) is a candidate in evaluating the surface corrosion on steel samples.. The hypothesized result was that as corrosion increases with an increase in temperature, there would be more corrosion which should increase the surface roughness. What should be seen is a positive relationship between surface roughness and temperature comparable to the exponential relationship between corrosion and temperature ( @Konovalova ).

A commercially available 22 Gauge steel plate with dimensions of 150 mm x 450 mm x 1.5 mm is used for the purposes of the experiment.. This steel was non-galvanized and had no coatings to prevent corrosion, however the surface of the initial steel was rough. This poses a challenge when measuring roughness due to the ambiguity of whether that corresponds to the initial conditions of the steel or the corrosion. To mitigate pre-existing roughness, a 15 cm x 15 cm section of the steel plate was polished close to a mirror finish. A mirror finish would mean that the roughness was reduced to under 100 nm ( @Met) . In order to yield this reduced roughness, wetted sandpaper was used to polish the steel plate, with increasing levels of grit (400 grit, 800 grit, 1000 grit and 2000 grit). A 1.5 cm x 1.5 cm section of the polished plate was used as the control for the corrosion experiment.. 

To corrode the steel samples, a 3.5% saline solution that would mimic the salinity of ocean conditions was used. The solution was produced using 10 grams of table salt to 300 mL of distilled water.Samples of the steel were submerged in the saline baths to corrode. A crucial note is that the samples were soaked more than one time ( @Yoo ), informs that alternating soaking in saline solution and drying increased the rate of corrosion as compared to leaving the steel to corrode in a single session. To achieve this, our samples were submerged in solution for 5 hours, then taken out to dry for an hour, and finally submerged again for another 5 hours. Recall the purpose of the experiment is to vary temperature during sample corrosion. The solution itself was used as the medium to vary temperature. . The temperatures selected were: a sample near 0℃, a room temperature sample at 20℃, a sample heated to 40℃, and a final sample at 60℃. This presents a challenge of maintaining a constant temperature in the solution while corroding the sample. This further justifies the 5 hour corroding period, because it proves to be more feasible to maintain a stable temperature over two shorter time frames while still giving enough time for samples to corrode.  For the sample near 0℃ the sample could be refrigerated and the solution will create a stable temperature of about 4 ℃, the 20 ℃ solution was left in ambient, room temperature conditions. . As for the samples and 40℃ and 60℃, the solutions were heated to the desired temperature using a microwave, then placed the solution in an insulated thermos container and wrapped in a heating pad. The temperature for each solution was measured every hour to ensure that the temperatures were stable to within a few degrees Celsius. 

With 4 samples corroded at each of the four temperatures,  AFM images were taken to measure roughness of the respective samples. To prepare the samples for imaging, any excess rust was cleaned off using ethanol before being mounted the samples onto magnetic disks using double sided carbon tape. For our imaging, we used a Park XE7 AFM set to non-contact mode (NCM). Using this AFM, we were able to produce images for each of the corroded samples and analyze them for their roughness.

## Results

```{r}
library(nanoAFMr) 
library(magrittr) 
library(dplyr) 
library(scales) 
library(ggplot2)
```

```{r}
unpolished = AFM.import("Unpolished.tiff")
unpolished_flat = AFM.flatten(unpolished, method = 'plane')
#plot(unpolished_flat, graphType = 2)
```

Preliminary results were made  in order to see the effect of polishing on the steel sheet samples compared to the initial roughness of the steel sheet. A control sample was measured without any polishing and its topography varied about 500 nm in height ( @fig-unpolished ). The motivation for this sample was to check if increasingly rough samples were within the safe operating procedures of the AFM, as the roughness of the samples were expected to increase as they were corroded.

```{r}
#| fig-cap: Line profiles of an unpolished and polished sample of steel. While the unpolished steel varies about 500 nm in height, the polished steel stays within 50 nm of zero. The difference in height deviations confirms polishing as an effective method of reducing non-corrosive roughness.
#| label: fig-unpolished
unpolished_line = AFM.lineProfile(unpolished_flat,  89 , 36 , 133 , 18,unitPixels = T)
unpolished_plot = AFM.linePlot(unpolished_line, dataOnly = T)
unpolished_plot$x = unpolished_plot$x/1000

control_scan = AFM.import("Control.tiff")
control_flat = AFM.flatten(control_scan, method = "plane")
control_line = AFM.lineProfile(control_flat, 1 , 1 , 250 , 250 ,unitPixels = T)
control_plot = AFM.linePlot(control_line, dataOnly = T)
control_plot$x = control_plot$x/1000

unpolished_plot$type = "Unpolished Sample"
control_plot$type = "Polished Sample"

ggplot(unpolished_plot, aes(x,z, color=type)) + geom_line(size = 1.5) + geom_line(data = control_plot, aes(x = x, y = z, color = type), size = 1.5) + theme_bw() + theme(legend.position = c(0.7, 0.7)) + ylab("z (nm)") + xlab(expression("x (" * mu * "m)")) + xlim(0, 5)
control_plot$type = "Control"
control_plot$x = control_plot$x*1000
```

Alternatively, after polishing the samples, a control sample was measured with the AFM, and only varied within 50 nm in height.This proved the effectiveness of the polishing technique. Verifying this method allowed for further measurements with progressively higher corrosion for week two and three of the experiment.\
Using the Park AFM, five individual scans were taken for control, 4℃, 20℃, 40℃, and 60℃. Each scan was taken with an area of 5x5 μm and flattened using @Gredig2022 open source nanoAFM software ( @fig-afms ). Using a plane flattening method yielded results with minimal noise and artifacts within the topography scans.

```{r}
#| fig-cap: AFM images of each prepared sample- a) Control, b) 4℃, c) 20℃, d) 40℃ and e) 60℃- with their respective topographies overlayed on the top-righthand corner. All scans are 5 by 5 μm in area as shown in b). Note that d) has some significant artifacting of the geometry of the cantilever tip.
#| label: fig-afms
knitr::include_graphics("AFMImages.png")
```

## Analysis

```{r}
fileAFM = "FridgeLarge.tiff"
d = AFM.import(fileAFM)
```

```{r}
# #| fig-cap: Image of the raw, refigerated sample.
#plot(d)
```

```{r}
#Use the line by line flatten method to create flattened image
afmDataFlatLine = AFM.flatten(d, method="lineByLine")


#Create a few line profiles of our flake across it's width
d1 = AFM.lineProfile(afmDataFlatLine, 46 , 254 , 219 , 10 ,unitPixels = T) -> b
d11 = AFM.linePlot(b, dataOnly = T)
d11$z = d11$z #- 354
d11$type = "flatten: Line"
```

```{r}
# #| fig-cap: Image of the refigerated sample flattened using the line by line technique.
# #Plot image with lines
# plot(b, graphType = 4, addLines = T)
```

```{r}
afmPlane = AFM.flatten(d, method="Plane")
d2 = AFM.lineProfile(afmPlane, 46 , 254 , 219 , 10 ,unitPixels = T) -> dd
d22 = AFM.linePlot(dd, dataOnly = T)
d22$type = "flatten: Plane"
d0 = AFM.lineProfile(d, 46 , 254 , 219 , 10 ,unitPixels = T)
d00 = AFM.linePlot(d0, dataOnly = T)
d00$type = "raw"
d00$z = d00$z - 200
total = rbind(d00,d11,d22)
```

```{r}
# #| fig-cap: Image of the refigerated sample when flattened using plane method.
# plot(d, graphType = 2, addLines = T)
```

```{r}
# #| fig-cap: Graph compares the accuracy of each flattening method. The raw data has been offset by 200 nm for visual purposes.
# ggplot(total, aes(x,z, color=type)) + geom_line(size = 1.2) + ylab("z (nm)") + xlab('x(nm)') + theme_minimal() + theme(legend.position = c(0.2, 0.2))
```

```{r}
# #| fig-cap: HHCF at 20 degrees.
# AFM.hhcf(afmPlane, no = 1, numIterations = 100000, addFit = T)
```

```{r}
rough = AFM.math.params(afmPlane)
rough$type = "fridge" 
rough -> final_data
```

```{r}
##| fig-cap: Scna of the room temperature sample.
room_tiff = "RoomTemp.tiff"
room_raw = AFM.import(room_tiff)
#plot(room_raw, graphType = 2, addLines = T)
```

```{r}
##| fig-cap: Flattened image of the room temperature sample.
room_flat = AFM.flatten(room_raw, method='plane')
#plot(room_flat, graphType = 1)
```

```{r}
# #| fig-cap: HHCF at room temperature.
# AFM.hhcf(room_flat, no = 1, numIterations = 100000, addFit = T)
room_rough = AFM.math.params(room_flat)
```

```{r}
room_rough$type = "room"
room_rough -> final_data
room_profile = AFM.lineProfile(room_flat, 49 , 251 , 170 , 28 ,unitPixels = T)
room_line = AFM.linePlot(room_profile, dataOnly = T)
room_line$type = "20°C"
```

```{r}
#2:30
forty_deg = AFM.import("40Degrees.tiff")
forty_flat = AFM.flatten(forty_deg, method = "plane")
forty_profile = AFM.lineProfile(forty_flat, 38 , 37 , 191 , 219 ,unitPixels = T)
forty_line = AFM.linePlot(forty_profile, dataOnly = T)
forty_line$type = "40°C"
#3:10
sixty_deg = AFM.import("60degrees.tiff")
sixty_flat = AFM.flatten(sixty_deg, method = 'plane')
sixty_profile = AFM.lineProfile(sixty_flat, 202 , 26 , 31 , 199 ,unitPixels = T)
sixty_line = AFM.linePlot(sixty_profile, dataOnly = T)
sixty_line$type = "60°C"
#plot(sixty_deg, graphType = 1)
```

```{r}
# #| fig-cap: HHCF of the control sample.
# AFM.hhcf(control_flat, no = 1, numIterations = 100000, addFit = T)
control_rough = AFM.math.params(control_flat)
control_rough$type = "control sample"
```

```{r}
##| fig-cap: HHCF at 40 degrees C.
#AFM.hhcf(forty_flat, no = 1, numIterations = 100000, addFit = T, allResults = T)
forty_rough = AFM.math.params(forty_flat)
forty_rough$type = "forty degrees"
```

```{r}
# #| fig-cap: HHCF at sixty degrees
# AFM.hhcf(sixty_flat, no = 1, numIterations = 100000, addFit = T)
sixty_rough = AFM.math.params(sixty_flat)
sixty_rough$type = "sixty degrees"
```

Line profiles of the AFM scans could be used to qualitatively analyze and evaluate the topography of each sample ( @fig-profiles ). The control sample proves to be the least rough sample, remaining close to 0 nm in height spanning the surface of the sample. The corroded samples have varying heights spanning their respective surfaces within the hundreds of nanometers.

```{r}
room_line$x = room_line$x/1000
forty_line$x = forty_line$x/1000
sixty_line$x = sixty_line$x/1000
d22$x = d22$x/1000
control_plot$x = control_plot$x/1000
d22$type = "4°C"

```

```{r}
#| fig-cap: Overlayed line profiles of all samples over a distance of 5 μm. The control outlined as magenta remains close to 0 nm. The 4°C and 20°C have the largest deviation from the base height at 0 nm as opposed to the predicted higher temperature samples which stay within 450 nm in height distribution. 
#| label: fig-profiles
ggplot(control_plot, aes(x,z, color=type)) + geom_line(size = 1.5) + geom_line(data = d22, aes(x = x, y = z, color = type), size = 1.5) + geom_line(data = room_line, aes(x=x, y=z, color = type), size = 1.5) + geom_line(data = forty_line, aes(x=x, y=z, color = type), size = 1.5) + geom_line(data = sixty_line, aes(x=x, y=z, color=type), size = 1.5) + theme_minimal() + theme(legend.position = c(0.53, 0.25)) + ylab("z (nm)") + xlab(expression("x (" * mu * "m)")) + xlim(0, 5)
```

```{r}
final_data = rbind(control_rough, rough, room_rough, forty_rough, sixty_rough)
#print(final_data[,-1])

```

These line scans show an unexpected trend that there is more overall variation in topography in the lower temperature samples than the higher temperature samples. Further analysis was done by calculating the roughness of each sample. Roughness can be categorized into five different degrees, the two relevant ones being average roughness or arithmetic roughness (Ra) and root mean square roughness or geometrical roughness (Rq). The overall unevenness of the surface is what both arithmetic roughness and RMS roughness measure, which is an indicator of how much the corrosion eroded and altered the surface of the steel. Comparing the roughness values of the samples could reveal a general trend in respect to temperature.

```{r}
#| fig-cap: Plotted values of the arithmetic roughness(nm) at each recorded temperature. The dashed line represents the roughness of the control sample. 
#| label: fig-ra
rough_list <- data.frame( x =  c(rough$Ra, room_rough$Ra, forty_rough$Ra, sixty_rough$Ra), 
                        y = c(4, 20, 40, 60))
#ggplot(rough_list, aes(y, x)) + geom_bar(stat = "identity", fill = "blue", color = "black") + ylab("Roughness") + xlab( expression("Temperature (" * degree * "C)")) + theme_bw()

ggplot(rough_list, aes(y, x)) + geom_point(size=5) + geom_hline(aes(yintercept = control_rough$Ra, color = "Control"), linetype = "dashed", size = 2) + ylab("Arithmetic Roughness (nm)") + xlab( expression("Temperature (" * degree * "C)")) + scale_color_manual(name = "Line Type", values = c("Control" = "red"))+  theme_minimal() 
```

Arithmetic roughness shows that there is not a clear trend between roughness and temperature ( @fig-ra ). In fact, roughness shows to be decreasing as temperature increases until it reaches about 40℃ before increasing again. Geometrical roughness shows an identical trend ( @fig-rq ).

```{r}
#| fig-cap: Plotted values of the geometric roughness(nm) at each recorded temperature. The dashed line represents the roughness of the control sample
#| label: fig-rq
grough_list <- data.frame( x =  c(rough$Rq, room_rough$Rq, forty_rough$Rq, sixty_rough$Rq), 
                        y = c(4, 20, 40, 60))

ggplot(grough_list, aes(y, x)) + geom_point(size=5) + geom_hline(aes(yintercept = control_rough$Rq, color = "Control"), linetype = "dashed", size = 2) + ylab("Geometric Roughness (nm)") + xlab( expression("Temperature (" * degree * "C)")) + scale_color_manual(name = "Line Type", values = c("Control" = "red"))+  theme_minimal() 
```

```{r}
# Load data (example)
library(knitr)
r_final <- data.frame(
  Sample = c("Control", "4°C", "20°C", "40°C", "60°C"),
  Ra = c(control_rough$Ra, rough$Ra, room_rough$Ra, forty_rough$Ra, sixty_rough$Ra),
  Rq = c(control_rough$Rq, rough$Rq, room_rough$Rq, forty_rough$Rq, sixty_rough$Rq)
)
colnames(r_final) <- c("Sample", "Average Roughness (nm)", "Geometric Roughness(nm)")

# Create table
kable(r_final)
```

The data does not follow the accepted model of increasing roughness or corrosion as temperature is increased. Further analysis of the experimental procedure and method could reveal insights of the data. @fig-afms d) shows signs of artifacting of the geometry of the cantilever tip. The earlier measurements of the low temperature samples contain almost no artifacting and noise when compared to the later measurements of the higher temperature samples. Similarly, the topography of @fig-afms b) and @fig-afms c) ranges about a micrometer in height while later measurements only range 400 nm in height. This could additionally be seen when comparing the line profiles of 4℃ and 60℃ ( @fig-foursixty ).

```{r}
#| fig-cap: Line profiles of the 4℃ and 60℃ samples.The 4℃ has a large range in heights comapred to the 60℃ sample. Comapred to accepted models, this result is unexpected and the opposite of what is expexted. The 60℃ was predicted to have a more uneven surface.
#| label: fig-foursixty
ggplot(d22, aes(x,z, color=type)) + geom_line(size = 1.5) + geom_line(data = sixty_line, aes(x=x, y=z, color=type), size = 1.5) + theme_minimal() + theme(legend.position = c(0.45, 0.25)) + ylab("z (nm)") + xlab(expression("x (" * mu * "m)"))
```

This could potentially arise from an systematic error with the cantilever, which naturally degrades over its lifetime. This concern motivated more conservative measurements of corroded regions with the higher temperature samples. 5x5 μm measurements are not representative of the entire surface of the sample. By taking a large scanning area, or by patching small individual scans of a sample, the roughness of a sample will be more accurately measured. On top of that, the corrosion on the samples themselves was non-uniform where corrosion was often localized to only specific areas

Another complication was in the preparation which varied from sample to sample. The 4℃ and 20℃ samples were prepared in solutions exposed to air, which aerates the sample with oxygen thus higher oxidation. Alternatively, the higher temperature samples were prepared in isolated and insulated environments with limited exposure to ambient air.

## Conclusion

The model between corrosion and temperature has been accepted to be a positive trend. The higher the temperature, the more corrosion will occur. Typically the effects of corrosion are measured through SEM. However, AFM is an accessible method in measuring corrosion and could be related to the roughness of a given sample. 

The data this experiment produced had limited success in following the expected model. A few possibilities revolve around the structure of the experiment itself. Corrosion on a surface is not uniform and is prone to pitting ( @Pitting ). By acquiring a larger set of data spanning the area of a sample, the resulting calculated roughness will be more reflective of the sample’s corrosion. Similarly, a larger sample size of temperature will create a model that is more accurate. Using a cantilever that has not degraded significantly from sample to sample would naturally yield more consistent and therefore more comparable results. 

One achievement was optimizing the sample preparation through polishing commercially available steel, which provided a more uniform surface. Another improvement for future samples would be preparing samples in a uniform method. A consistent environment for all samples would provide data that is ideally only varied by temperature. This would ultimately provide an accurate way of demonstrating the dependence of temperature on corrosion of steel.

## Acknowledgements 

A special thank you to our peers in Phys 545/445, in particular, Alex Goytia and Fernanda Razo for their support. Dr. Gredig provided an essential package required to do all the analysis for the AFM and has been a guide in lab along with Felipe Kosareff. Michelle Mckenzie and Camille Beard provided insights on writing reports about AFM. Thank you to the faculty and staff of the Physics Deparment whom held a holiday dinner on the day of presentations.
