A substantial part of corrosion research relies on the analysis of polarization curves to obtain corrosion currents, Tafel slopes, and other parameters, such as exchange current densities. This, often manual, analysis remains highly subjective, which hampers the reproducibility of corrosion research and makes a comparison of reported Tafel slopes, corrosion rates, or exchange current densities from different literature sources difficult. One reason is that the analysis is strongly influenced by the selected range of the measured data. To improve this, we developed a Python library for the reliable analysis of polarization curves. A particular novelty is an algorithm designed to fit polarization curves under mixed activation-diffusion control, which is a situation often encountered in corrosion research. This algorithm reduces the subjectivity related to the measured or selected potential range. Moreover, the algorithm offers the possibility to diagnose and quantify the accuracy of the fit. We use experimentally measured polarization curves to test the proposed approach and show that for curves without a clear, purely activation-controlled Tafel region in the cathodic branch, accurate and consistent analysis is only possible by applying the mixed activation-diffusion control technique. Re-evaluation of literature data shows that by applying the library the variability in reported Tafel slopes can be greatly reduced. Thus, here the proposed approach and the related open-access Python library for the analysis of polarization curves may foster reproducibility and enhance the comparability of data measured in corrosion research.
The measurement of polarization curves to obtain information such as Tafel slopes, corrosion rates, and exchange current densities is common practice in corrosion science and engineering. The use of these curves and parameters varies from understanding the corrosion process, showing the effect of corrosion inhibitors,1-2 applying them in electrochemical techniques such as linear polarization resistance (LPR) and Tafel extrapolation,3-5 to using them in (macro-cell) corrosion modeling.6-10 However, it is well known that the extraction of information from polarization curves is not straightforward. Often experimentally measured polarization curves deviate from the ideal shape expected from theory, due to, for instance, the influence of the polarization on the metal surface and environment during the measurement, changes in the (non) uniformity of the corrosion process, and time effects related to a changing environment.11 This forces scholars to manually select a certain range from the measured data for further analysis. Not surprisingly, the documentation of extracted parameters from these polarization curves shows huge variation in the literature.
The subjectivity in this analysis is mainly caused by choices made by the scholar concerning the range of data and the technique applied to evaluate the polarization curve. Traditionally, Tafel slopes are determined by linear fitting of the Tafel region. However, this method is very subjective to the researcher, who first must identify and select this Tafel region. The deviation caused by this subjectivity increases when the linear Tafel region is less obvious or not visible at all, when the currents are not purely under activation control of a single half-cell reaction.
Nowadays, it is more common to apply techniques that use a mathematical fitting of a theoretical representation of the current-potential relationship to the measured polarization curve, also outside of the Tafel region. These techniques have the potential to reduce the subjectivity in the determination of Tafel slopes. Mansfeld21-22 developed a method to fit the polarization curve at small over-potentials, in the pre-Tafel region, which formed the basis of a later developed software (POLFIT†) to analyze polarization curves.23 In the pre-Tafel region around the corrosion potential, the semilogarithmic curve is not linear yet, as currents are controlled by both the anodic and cathodic reactions. Numerous other authors expanded on this idea, increasing the accuracy of the fitting, and finding novel (mathematical) approaches to obtain the Tafel slopes and corrosion current from the nonlinear part of the polarization curve.24-27 The main purpose of most of these methods was to increase the accuracy of the LPR method, used for the determination of corrosion rates, or even to define the corrosion rate directly, without using the polarization resistance.
The fitting of the pre-Tafel region only uses a relatively small part of the polarization curves to determine both the Tafel slopes and the corrosion rate. Rybalka, et al.,28 showed that these parameters can only be obtained accurately when a sufficient portion of the measured polarization curve is used in the fitting. For most fitting techniques, including also higher over-potentials beside the pre-Tafel regime, and thus using a larger range of data for the fitting, can increase the accuracy of the determined Tafel slopes, as long as the voltage drop related to the resistance of the electrolyte (IR-drop) is properly taken care of. However, the discussed techniques can only be accurately applied when all fitted data is solely under activation control. Agbo and Danilovic 29 developed a procedure that takes into account higher over-potentials in the fit, and at the same time excludes any current data that is under diffusion control. However, this method will not be able to obtain accurate Tafel slopes for data that are already at relatively low over-potentials under mixed activation and diffusion control. Polarization curves that show domains of such mixed activation and diffusion control are frequently encountered when one of the cathodic reactions is the reduction of oxygen. If there is limited oxygen available at the surface of a metal sample, the cathodic branch of the polarization curve will reach the plateau with currents under diffusion control at low over-potentials.
To be able to also fit data under both activation and diffusion control, we developed a library for the Python programming language, named “PolCurveFit”, which is freely available through GitHub.30 The library contains a procedure that fits a theoretical curve that includes both activation and diffusion-controlled currents in the cathodic branch of the polarization curve. Because this technique can still be dependent on the range of data included by the user, the procedure applies a certain weight distribution, to limit the subjectivity of the choice of the potential range.
In the present work, we describe the Python library “PolCurveFit,” which contains functions to apply different techniques: the “traditional” Tafel extrapolation technique, the fitting of a theoretical curve to data under pure activation control, and finally an algorithm for the fitting of data under mixed activation and diffusion control, minimizing human factors. This library enables to obtain corrosion currents, Tafel slopes, and other parameters, such as exchange current densities, from measured polarization curves. We test the library with two measured polarization curves, one with a clearly defined Tafel region and one where this Tafel region is overshadowed by the diffusion-controlled domain. Using these curves, we show the effectiveness of the algorithm of applying a specific weight distribution to fit data under mixed activation-diffusion control.
Methodology Behind the Python Library “PolCurveFit”
Tafel Extrapolation (Linear Fit)
The simplest technique is the “traditional” fitting of a linear line to the data. This option is suitable for data that is solely under activation control on the anodic or on the cathodic branch, meaning one can fit the Tafel slope in a by the user-defined Tafel region. Note that only one branch of data, either the anodic or cathodic can be selected for the fitting (see Figure 2). The standard output consists of the Tafel slope (V). Optionally, the corrosion potential can be given as additional input. In this case, the algorithm yields the corrosion rate, as extrapolated from the Tafel line.
“Activation Control” Fit
“Mixed Activation-Diffusion Control” Fit
By including the diffusion-controlled currents, a large part of the measured polarization curve can be fitted, and there is no need to select part of the data. However, including the purely diffusion-controlled domain also introduces an additional problem. While most information about the anodic and cathodic Tafel slopes is contained in the purely activation-controlled domain, the fitting algorithm tends to give the most weight to the domain that includes the biggest amount of data points. The number of data points can be significantly different, depending on the actual experimental data, e.g., the potential range over which measurements were taken. For curves that only contain a very small activation-controlled domain for the cathodic branch, this domain may be under-represented with respect to the diffusion-controlled domain (see Figure 2), especially when long cathodic branches are experimentally measured. This may be counteracted by simply cutting off some of the diffusion-controlled data. However, to not lose any information, we propose a different approach described below, allowing the user to apply a certain weight distribution to the data, giving the data in the purely activation-controlled domain a larger weight.
To validate the “PolCurveFit” library and show the effect of the specific weight distribution for the “mixed activation-diffusion control” fit, two polarization curves were measured with a rotating disk electrode (RDE) of carbon steel in a 0.3 M NaCl solution. The exposed surface of the carbon steel disk (S235JR) had a diameter of 8 mm. Before the measurement, the sample surface was ground and polished with diamond paste down to 1 μm, until the sample had a mirror-like surface.
The polarization curve was measured by linear sweep voltammetry (LSV) in a three-electrode setup, with an Ag/AgCl/Sat.KCl reference electrode and a stainless steel counter electrode, with an equal surface area to the carbon steel sample. The linear sweep had a scan rate of 0.5 mV/s, starting at −1.5 VAg/AgCl/Sat.KCl up to −0.3 VAg/AgCl/Sat.KCl. Before the measurement of the polarization curve, the sample was polarized at −1.5 VAg/AgCl/Sat.KCl for 5 min. The first polarization curve was measured with a rotation speed of 300 rpm. The second curve was measured with a rotation speed of 3,000 rpm and the solution was aerated, by bubbling it with air, to ensure that the Tafel region of the oxygen reduction would clearly be visible. Both curves were measured three times to ensure reproducibility. To be able to correct for the IR-drop in the three-electrode setup, electrical impedance spectroscopy (EIS) was applied to obtain the solution resistance, R. For all experiments, this resistance was approximately 40 Ω.
The Validation Data
The plateau (B) for the curves of both rotation rates defines the limiting current density, iL, which is related to the diffusion of oxygen to the surface of the sample. For a rotation rate of 3,000 rpm and aeration of the solution, the diffusion layer is smaller and the bulk oxygen concentration is higher compared to the measurement at 300 rpm, thus resulting in a higher iL. As a result, the Tafel region of oxygen reduction (A) is more clearly visible in the “3,000 rpm aerated” curve, and the Tafel slope of oxygen reduction can be more easily determined. By applying the “traditional Tafel extrapolation” (linear fit) to the branch in domain A of the “3,000 rpm aerated” curves (Figure 4), a cathodic Tafel slope of approximately 0.24 V/dec is obtained, a value corresponding well to the range measured for polarization curves in similar environments by other authors.17 Note that the linear part of the “3,000 rpm aerated” curves in domain A in Figure 4, even for this extreme case of high rotation speed and additional bubbling with air, only spans over less than one order of magnitude on the current axis. The “Tafel extrapolation” technique is recommended to be used only when the linear Tafel region spans over at least one order of magnitude.4
For the curves obtained with a rotation speed of 300 rpm, iL is lower, which masks the activation-controlled part. Thus, the Tafel region is hardly visible and a linear fit cannot be correctly applied in the activation-controlled domain (A). Instead, the Tafel slope can only be defined with one of the nonlinear curve fitting procedures. The polarization curves measured for different rotation rates allow us to validate the curve-fitting procedure. As both curves should theoretically have a similar Tafel slope for oxygen reduction, the curve “3,000 rpm aerated” can be used to check if the correct Tafel slope can be obtained for the curve “300 rpm.”
The “Activation Control Fit”
The original “activation control” fit, as defined by Mansfeld,21 was developed to be used in the pre-Tafel region. The results here show that for the curves measured at 3,000 rpm, the obtained Tafel slopes are relatively consistent and close to the value of 0.24 V/dec, obtained with the Tafel extrapolation technique. At a very small cathodic window, the technique results in more accurate values when more pre-Tafel data of the anodic branch is included in the fitting.
On the other side, for the curves measured at 300 rpm, the obtained Tafel slopes are very dependent on the cathodic and anodic window, and the values have a much larger standard deviation. Moreover, when 40 mV of the anodic branch is included, the obtained Tafel slopes are consistently overestimated. Apparently, for the polarization curves measured at 300 rpm, the “activation control” fit cannot be applied reliably. The fitting is highly sensitive to the parts of the anodic and cathodic branches that are included in the fitting and there is limited confidence in whether the chosen data yields adequate results. This is most likely because for this condition of a lower rotation speed of the RDE, there is less pronounced hydrodynamic flow and the currents close to the OCP are already under mixed activation and diffusion control.
“Mixed Activation-Diffusion Control” Fit
By taking into account the diffusion-limited currents, the mixed activation-diffusion control fit should be able to obtain accurate results, also for curves that do not show a clear Tafel region. Furthermore, by applying a specific weight distribution (see “Mixed Activation Diffusion Control” Fit section), the obtained results should be independent of the amount of measured data in the purely diffusion-controlled domain (domain B in Figure 4). Therefore, in the following section, the results are evaluated on two main points: First, the results should show accurate values for the obtained parameters (e.g., a cathodic Tafel slope close to 0.24 V/dec as obtained for the “3,000 rpm” curve in the Tafel region). Second, they should show good stability, or limited “variability,” where the “variability” is in this work defined as the dependency of the results on the cathodic window, wc (for a more quantitative treatment of the “variability,” please refer to the Sensitivity Analysis: Finding W and wac section).
On the other side, for the curves measured at 300 rpm, the effect of the weight distribution is much more pronounced. Figure 6(a) shows that when the data is not weighted, the obtained cathodic Tafel slopes are very unstable. The obtained results fluctuate strongly with varying “size” of the polarization curve used as input data, even at high cathodic windows, wc. When applying the weight distribution, the variability decreases for wc larger than around 0.17 V. Moreover, at higher weight percentages, W, the obtained Tafel slopes are closer to the target value of 0.24 V/dec.
Besides showing the importance of the application of the weight distribution, Figure 6 also shows for both types of curves, that the cathodic window, wc, should be large enough to obtain reliable and stable results. For the curve measured at 3,000 rpm, as noted before, wc should be larger than −0.19 V. Smaller wc result in highly variable values for iL (compared to the value visually obtained in Figure 4) and βO2. Similarly, for the curve measured at 300 rpm, depending on W, the values become stable at wc larger than approximately −0.17 V. According to Figure 4, this means that accurate results can only be obtained when at least part of the purely diffusion-controlled domain (domain B in Figure 4), is included in the fitting.
The most important reason to apply a rigorous mathematical curve-fitting method over the “traditional” Tafel extrapolation is to obtain results that are less influenced by subjective choices made by the user. The “activation control” fit describes the most commonly applied fitting procedure. However, as Figure 5 has shown, this only works for data that has a clear Tafel region. When the measured curve has a low iL, masking the Tafel region, the results depend heavily on the amount of data that was fitted. Moreover, even at very small over-potentials, where one would assume the currents to be solely under activation control, it was not possible to obtain accurate results for the Tafel slopes, for these curves without a visible Tafel region. Data without a clear Tafel region can only be fitted correctly by including the diffusion-controlled domain in the fitting, thus using the “mixed activation-diffusion control” fit. Applying a weight distribution to the different portions of the measured polarization curve can largely decrease the subjectivity in the fitting. However, as especially Figure 7 shows, it is very important to define the window activation control wac and the applied weight percentage in this window, W, correctly.
In this work, we have measured polarization curves for the same material in similar environments, apart from the oxygen content available at the sample surface. This allows us to test the accuracy of the “mixed activation-diffusion” fit, for curves without a clear Tafel region, and to optimize the settings for W and wac. The Tafel slope of the curve measured at 300 rpm, which does not show a clear Tafel region, should, in the case of proper fitting, be similar to the Tafel slope determined for the “3,000 rpm” curve, which does show a clear Tafel region. Based on the results shown in Figures 6 and 7, accurate Tafel slopes can be obtained with for example a W of 90% and a wac of 30 mV for the “300 rpm” curve. This means that almost all of the weight is put on the data points very close to the corrosion potential, in the activation-controlled domain. Still, we can be confident in a correct fit, as the resulting iL (see Figure 6) corresponds well to the visually determined iL from Figure 4. This means that although very little weight is applied to the diffusion-controlled domain, it is still able to perform a correct fit in this domain, as long as part of the purely diffusion-controlled data is included in the fitting.
The difficulty is to obtain “correct” settings for W and wac, without any prior knowledge about the Tafel slopes. From the measured curves in this work, we observed that accurate Tafel slopes were generally obtained, when the obtained Tafel slopes reach a stable value at a higher cathodic window, e.g., the results for W = 90% and wac = 30 mV, show Tafel slopes with little variability (independent of the cathodic window), at a cathodic window larger than around −0.19 V (see Figure 7[c]). Therefore, to obtain a good estimation for appropriate settings of W and wac, we propose performing a sensitivity analysis described below, which aims to find the settings that result in stable and accurate results for the limiting current density and the least variable, and thus most stable results for the cathodic Tafel slope.
Sensitivity Analysis: Finding W and wac
The proposed sensitivity analysis first performs a multiparameter-sweep, computing the cathodic Tafel slopes for different combinations of the window activation control, wac, the applied weight percentage in this window, W, and the cathodic window, wc. Second, the optimal combination of W and wac is determined, namely the combination that yields the least variable results for the cathodic Tafel slope. Here, “least variable,” means the least dependency on the chosen cathodic window.
Figure 8 gives an overview of the main steps of the sensitivity analysis. The applied ranges for wc and wac are first visually determined from the polarization curve. These ranges are then fed into the algorithm to perform the multiparameter-sweep. The following ranges are considered:
The window activation control, wac, ranges from 0.01 V up to wdc. For the sweep, we suggest an increment of 0.01 V. wdc [V/Ecorr] is defined as the visually determined start of the purely diffusion-controlled domain (see Figure 8). wac is only varied up to wdc, because the goal of the applied weight distribution is to give higher importance to activation-controlled currents. This means that wac should always be well in the activation-controlled domain. This domain is not clearly visible for all curves, so we recommend not choosing values for wac higher than wdc. For the curves in this work, wdc is 0.17 V for the “300 rpm” curve and 0.19 for the “3,000 rpm” curve (see Figure 4).
The weight percentage, W, is suggested to generally be taken in the range of 50% up to 95% with an increment of 5% for the sweep.
The cathodic window, wc, ranges from wdc to the maximum cathodic window (max. wc). Here it is assumed that at wc larger than the start of the purely diffusion-controlled domain, wdc, the cathodic Tafel slopes start to reach stable values (as can be observed in Figures 6 and 7). For the sweep we suggest an increment of 10 mV. The maximum value for wc should solely contain domains A and B of the polarization curve (see Figure 8). In the examples given in this work, this is approximately −0.44 V/Ecorr and −0.60 V/Ecorr for the curves measured at 300 rpm and 3,000 rpm, respectively. At higher overpotentials, a new reaction comes into play, namely the HER. As this reaction is not considered in the fitted equation, this part has to be excluded.
For the curve measured at 3,000 rpm, the curves are more stable, and the variability is similar between different settings, as the effect of the weight distribution is smaller. The choice for an optimal W and wac is therefore also less critical. However, the same procedure can be applied here. Figure 9(a) shows that the most stable results are obtained around W = 80%. Larger W have similar values for the mean variability, but a larger standard deviation is associated with the range of wac. Figure 9(b) shows that for a W of 80%, there is an initial minimum around 70 mV, and an absolute minimum at 190 mV. In combination with Figure 9(c), this shows the importance of taking a value of wac smaller than at least half of wdc (see Figure 8), to ensure that the currents in the window activation control are dominantly under activation control. Figure 9(c) shows that using the absolute minimum at 190 mV, larger than wdc, as the value for wac, would lead to an underestimation of the Tafel slope. Using the settings of W = 80% and wac = 0.07 V, a limiting current density of 3.72 A/m2 is obtained, which corresponds to the value determined in Figure 4.
The library PolCurveFit contains a function to perform the above-described sensitivity analysis, visualizing both the dependency of the Tafel slopes on the cathodic window, W and wac, as well as the standard deviation, quantifying the variability of the obtained Tafel slopes. We believe that performing this sensitivity analysis is not only good practice to obtain proper settings for the weight distribution, but will simultaneously supply the user with a sense of confidence about the obtained results. First, it will show if the measured polarization curve includes enough data to obtain stable results, e.g., if the data includes a sufficient part of the purely diffusion-controlled domain, such that limiting current densities and Tafel slopes are obtained, that are independent of the amount of purely diffusion-controlled currents included. Even though you would visually be able to indicate the limiting current density and therefore assume enough data for an accurate fit are included, this might not necessarily be true. Second, by performing the sensitivity analysis, one also obtains an indication of the uncertainty of the obtained parameters. The more sensitive the fit is to the settings of the weight distribution, the larger the uncertainty of the obtained parameters. For instance, the determination of the optimal settings for the “300 rpm” curve shows that similarly stable results can be obtained with a wac of 30 mV. However, a slight change in this setting of only 10 mV causes a change of almost 0.04 V for the determined cathodic Tafel slope. This information is especially important when one wants to compare obtained parameters to literature values, or other experiments.
Re-Evaluation of Literature
The evaluated polarization curves were all measured for mild steel in a sodium chloride solution. However, the range in documented values is relatively large. The measurement environment and methodology certainly play a role in explaining this observed range. The bulk oxygen concentration and diffusion layer are most certainly different for the varying studies and factors such as the scan rate influence the shape of the measured polarization curve. However, Figure 10 shows that a major part of the spread can be explained by inconsistent analysis of the polarization curves. The cathodic Tafel slope is often largely overestimated for curves that showed diffusion-controlled domains in the cathodic branch. By applying the PolCurveFit library to analyze these polarization curves, the total range is reduced to less than one thirds.
The evaluated literature works consist primarily of inhibitor studies. Here, multiple polarization curves are analyzed and compared to show the effect of the inhibitor. For this relative comparison, obtaining accurate values for the Tafel slopes is often not necessary, as the curves are evaluated by the same author. However, to be able to compare different works, consistent evaluation of polarization curves by different authors is necessary. Moreover, in fields such as corrosion modeling, accurate values for these Tafel slopes are often important. For instance, for the case of modeling of macrocell corrosion, Ge and Isgor34 showed that parameters such as the Tafel slopes and exchange current densities have a considerate effect on the modeled corrosion rate. The current spread in literature makes it difficult to find reliable values for these parameters. The library PolCurveFit could be the first step toward the consistent evaluation of polarization curves between different works, allowing us to increase our knowledge of these parameters.
Finally, even with consistent analysis of polarization curves, there will remain a visible spread of Tafel slopes. As highlighted before, these parameters are still strongly dependent on the measurement methodology. The local environment at the metal surface, as well as scan direction and scan rate, influence the shape of the polarization curve, and therefore directly the Tafel slopes and other fitted parameters. Furthermore, other uncertainties may arise when the main kinetics at the surface consists of more than one dominant anodic and one dominant cathodic reaction. All fitting procedures are limited by the assumed theoretical curve. The described techniques will only work correctly, as long as the assumed theoretical curve is a good representation of the measured kinetics. This means the technique cannot be applied correctly on polarization curves containing multiple anodic or cathodic reactions overlaying each other.
The presented work described a novel approach for the reliable analysis of polarization curves. This approach was implemented in the open- access Python library “PolCurveFit,” which was developed to make the analysis of polarization curves convenient and straightforward for scholars working in the field of corrosion research. Besides implementing existing fitting procedures, like “Tafel extrapolation” and the fitting of purely activation-controlled curves, the library also includes a new technique to accurately fit mixed activation-diffusion-controlled polarization curves, by applying a specific weight distribution. Tests were performed on two types of polarization curves, with and without a clearly defined Tafel region, which were measured in similar environments, save the available oxygen content. These tests showed that fitting both the diffusion and activation-controlled domain of the polarization curves is the only reliable option to obtain Tafel slopes for curves without a clear Tafel region in the cathodic branch. Based on this study, the following major conclusions and recommendations can be derived.
To obtain consistent and reliable results with the “mixed activation-diffusion control” fit, we recommend applying a specific weight distribution, where data close to the corrosion potential (Ecorr) is assigned a higher weight than data in the purely diffusion-controlled domain. The results presented in this work have shown that this weight distribution results in both more accurate and more stable values for the cathodic Tafel slope, meaning they are independent of the amount of purely diffusion-controlled data taken into account in the fitting. Thus, the application of the weight distribution largely reduces the subjectivity, which arises from the otherwise generally manual choice of the range of potentials measured, in the analysis of the polarization curve.
To gain confidence in the obtained results and to be able to quantify the associated error range, we strongly recommend performing a sensitivity analysis for the fitting procedure. This ensures that the obtained fitting results are independent of the portion of the polarization curve selected for the analysis. Such a sensitivity analysis is included in the Python library “PolCurveFit.” Especially for curves without a clear Tafel region, it is important to identify optimal fitting procedure settings, to be able to obtain accurate values for parameters such as the cathodic Tafel slopes. Moreover, for all types of curves, it is important to identify if a sufficient part of the purely diffusion-controlled domain was included in the fitting.
Analyzing polarization curves and obtaining parameters such as the Tafel slopes and corrosion rate remains a challenge, especially for curves that do not show a clear, purely activation-controlled Tafel region. The presented algorithm and technique of fitting mixed activation-diffusion-controlled curves, try to overcome the problem of an “overshadowed” Tafel region and to reduce the subjectivity inherent to the generally manual approach of selecting data from a measured curve for Tafel slope or curve fitting.
The authors are grateful to the Swiss National Science Foundation for the financial support (Projects No. PP00P2_163675 and No. PP00P2_194812).