1 Introduction

Magnesium alloys possess outstanding advantages of high specific strength, good castability, hot formability, and excellent resistance to creep and fatigue at high temperatures. These materials are widely used in several industrial domains such as automotive and aerospace [1, 2]. Although the attractive properties cited above, Mg-alloys present manufacturing issues such as fusion welding that reduce their application field in engineering. As an efficient technique, friction stir welding (FSW) has the potential to be a good alternative that avoids the formation of solidification defects and cracks resulting from conventional fusion welding processes [3, 4].

FSW becomes the most successful joining process of light structural materials such as AZ31 alloy [5, 6]. The literature reports numerous research works dealing with the effect of FSW parameters and tool geometry on microstructure, crystallographic texture, mechanical properties, residual stress, and corrosion resistance of the AZ31 friction stir welds. The FSW of AZ31 alloy results in a weld joint that contains four main regions that are (i) base metal (BM), (ii) heat-affected zone (HAZ), (iii) thermo-mechanical affected zone (TMAZ), and (iv) nugget zone (NZ). Such microstructural heterogeneity affects the mechanical properties and the corrosion behavior of the AZ31 FSW joints [5,6,7,8]. Post-weld heat treatment (PWHT) was adopted as a solution to improve the quality of the AZ31 FSW joints. It is well documented that PWHT of the AZ31 FSW joints is beneficial to improve their mechanical properties in the temperature range of 200—300 °C for holding times varying between 0.5 and 1 h [9, 10]. It was concluded that the PWHT can change the grain size, the size of the second phase particles, and their relative amount.

The corrosion behavior of the AZ31 FSW joint has been studied [8, 11,12,13]. Many papers reported that the grain refinement of AZ31 alloy occurred through severe plastic deformation (SPD) such as FSW [11], equal channel angular processing (ECAP) [14], and rolling [15], significantly improves its corrosion resistance. However, other studies have been less accurate when assessing the effect of microstructural refinement on the corrosion resistance of the AZ31 alloy [16, 17]. Also, the electrochemical response of the AZ31 alloy containing a poor amount of alloying elements is greatly dependent on the reduction of the average grain size [18]. Hasani et al. [19] denied the effect of grain size of the AZ91 FSW joint and attributed the improvement of its corrosion resistance to the dissolved Al atoms from Mg17Al12. Besides, the increase in the corrosion resistance of the friction stir processed AZ91 was attributed to the increase of the Mg17Al12 inter-metallic compounds (IMCs) fraction. Otherwise, the presence of cathodic intermetallic particles such as Mg17Al12 and Al8Mn5 contributes to the decrease of the corrosion rate [20]. Due to a more homogeneous distribution of secondary phases, the corrosion resistance of the AZ80 alloy is improved [21]. Bland et al. [22] reported that the small and closely spaced Al-rich intermetallic particles enhance the overall cathodic kinetics and corrosion resistance of AZ31 alloy. By increasing the amount of Al8Mn5 IMC, the corrosion resistance is gradually improved. These IMCs could mitigate the micro-galvanic corrosion in Mg–Al alloys [23]. However, the presence of discontinuous Mg17Al12 and Al-Mn IMCs accelerates the corrosion rate of the extruded AZ31 alloy [19, 24]. As the size of the IMCs and the distance between them increase, the micro-galvanic corrosion becomes more severe [25]. Also, the presence of twins within the microstructure may increase the corrosion resistance values. They bring out more grain boundaries that act as a corrosion barrier [26]. Nevertheless, other studies show that a progressive removal of twins improves the corrosion resistance of AZ31B alloy [27]. From the foregoing, it is obvious that there are many conflicting conclusions regarding the effect of microstructural features, such as grain boundaries and second phase, which possess a primordial influence on the corrosion resistance of AZ31 alloy. A great deal of attention has been paid to the role of the second phase on the corrosion mechanism of AZ31 alloys. However, information concerning the effect of grain boundaries on electrochemical behavior needs to be further detailed.

Regardless of what the different areas of the AZ31 FSW joint are exposed to, the NZ particularity has been the subject of many studies in terms of microstructure, crystallographic texture, or mechanical properties. The NZ derives its importance from large microstructural transformations such as dynamic recrystallization under severe plastic deformation and a large amount of heat during FSW [11]. However, the literature reports limited research works on the effect of PWHT on the corrosion resistance of the NZ in the AZ31 FSW joint. In this work, the microstructural evolution of the NZ of AZ31 friction stir weld joints subjected to PWHT in the temperature range of 200—400 °C) for 1 h and 4 h was investigated. The effects of grain boundary density and IMC nature on the corrosion behavior over the FSW process and PWHTed AZ31 joint have been highlighted. Kelvin probe force microscopy (KPFM) analysis was conducted to measure the Volta potential at the grain boundaries and correlate it with the NZ microstructure evolution after PWHT.

2 Experimental procedures

2.1 Material and FSW experiment

The material used in this investigation was AZ31 magnesium alloy received in the form of 8.5 mm sheet thickness with the given chemical composition in Table 1. The plates were prepared and cut in the desired dimension (200 × 100) mm2. These plates were friction stir welded using a Ruku-Ruku-RUM 5 milling machine employing a threaded conic tool made of H11 tool steel as illustrated in Fig. 1. The different welding parameters are given in Table 2. The as-welded joints were subjected to subsequent PWHT for 1 h and 4 h in the temperature range of 200–400 °C, followed by air cooling. The FSW joints subjected to different PWHT conditions were examined in this work.

Table 1 Chemical composition of AZ31
Fig. 1
figure 1

Friction stir welding configuration: a Experimental FSW device. b Used FSW tool

Table 2 Tool dimensions and used process parameters

2.2 Microstructural characterization

The metallographic preparation of the samples consisted of mechanical polishing up to the paper 4000. A finishing polishing was performed on a felt sheet using a suspension with particle sizes of 0.25 µm. The specimens were then cleaned with ethanol to remove any encrusted particles and finally etched with a solution of 4.2 g picric acid, 10 ml acetic acid, 70 ml ethanol, and 10 ml distilled water. Microstructural characterization was carried out on a cross-section perpendicular to the welding direction. Macrographic views of the weld joint were observed using a Nikon SMZ745T optical microscope. The microstructural evolution after welding and post-weld heat treatment was conducted using a Nikon Elipse LV100ND optical microscope. The chemical composition and the size of the intermetallics compounds were analyzed using a ZEIS JEMINI 300 SEM microscope equipped with an EDS system. The different phases present in the NZ and BM after PWHT were identified by X-ray diffraction using a D8 Advanced-Bruker diffractometer with Co-Kα radiation (λ = 1.79 Å) between 30 and 90 deg with a step size of 0.01°.

2.3 Electrochemical tests

Electrochemical tests were conducted in a three-electrode cell, according to the ASTM G3-89 [28], using an AMETEK –PARSTAT 3000 Potentiostat controlled by VersaStudio software. A grid of platinum and a saturated calomel electrode Ag/AgCl (0.192 V) were used as auxiliary and reference electrodes, respectively. The considered working electrodes had exposure areas of 0.25 cm2 for both BM and NZ. They were connected to a copper wire, sealed in epoxy resin, and ground with abrasive SiC papers to 1200 grades then rinsed with distilled water and ethanol respectively. Each working electrode was isolated and immersed at room temperature in synthetically sea water (3.5 wt% NaCl, pH = 8) for 1 h to reach the open circuit value. The electrochemical impedance spectroscopy (EIS) was performed, and the scanning frequency was taken in the range of 20 kHz to 0.01 Hz. After EIS measurement, the working electrode was immediately followed by a polarization test by applying a potential in the range of − 300 to + 300 mV with respect to the OCP with a scan rate of 0.167 mV s−1.

2.4 KPFM measurements

The surface morphology and the measured potential at grain boundaries were revealed by the SCANAsyst Icone atomic force microscopy (AFM). The KPFM measurements were conducted with an atomic force microscope (AFM) Nanoscope IV software AFM, from Bruker. The tips used were Nanoprobe SPM tips of PFQNE-AL type with a length of 39–45 µm and 300 kHz resonant frequency. The potential values obtained were referred to the used tip to prevent the influence of topographic features on the potential mapping. The topography of the sample surface was obtained where the cantilever was lifted up 75–100 nm.

3 Results and discussions

Figure 2a displays the macrographic view of the investigated AZ31 FSW joint. The different regions of the weld joint are clearly illustrated. The NZ (Fig. 2a) is well depicted with a conical threaded shape of the pin in the central region, whereas the TMAZ is observed on both sides (i.e.), the advancing side (AS) and the retreating side (RS). It should be noticed that the HAZ is hardly detected at the limit borders of the TMAZ. Such structural heterogeneity is strongly attributed to the irregular distribution of the heat flow and the plastic deformation rate during the FSW process which had a direct effect on both the grain structure and morphology. PWHT at 200 °C (Fig. 2b, d) did not induce any macrographic change for the different regions of the weld joint. Increasing PWHT to 400 °C (Fig. 2d, e) resulted in remarkable grain coarsening throughout the weld joint (NZ, TMAZ, and HAZ). PWHT for 4 h holding time (Fig. 2c, e) showed similar macrographic behavior to what was observed for 1 h holding time. The BM displays a uniform grain morphology in all PWHT conditions.

Fig. 2
figure 2

Cross-section macrostructures: a as welded AZ31 joint; b and c AZ31 joint after PWHT for 1 h at 200 °C and 400 °C, respectively; d and e AZ31 joint after PWHT for 4 h at 200 °C and 400 °C, respectively

Figure 3a and b display optical micrographs of both BM and NZ of the AZ31 FSW joint. The microstructure of the as-received AZ31 alloy (Fig. 3a) consists of equiaxed grains with an average grain size of 21 µm. Some twins are visible throughout the microstructure due to the thermomechanical history of the material [2, 24]. Figure 3b represents the microstructure of the NZ that consists of fine equiaxed grains with an average grain size of about 9 µm. During the FSW process, the AZ31 alloy undergoes a high strain rate at elevated temperatures, which allows the occurrence of dynamic recrystallization in the NZ. This resulted in the refinement of its final microstructure as reported in previous works [1, 3, 4].

Fig. 3
figure 3

Optical micrographs and BSE images in the BM (a and c) and NZ (b and d)

Figure 3c and d show the backscattered electron (BSE) images in both BM and NZ of the AZ31 FSW joint. A random distribution of the intermetallic compounds is observed in these two zones along the grain boundaries with a stick-like shape (Fig. 3c) and polygonal morphology (Fig. 3d). According to EDS analysis, these particles are rich in Al and Mn and the average atomic ratio (Al/Mn) of these particles is equal to 1.91 and 1.6 for BM and NZ, respectively. These values lie in the rank of Al8Mn5 IMC. Indeed, during the FSW process, the Al8Mn5 particles formed in the NZ are crushed into fine particles and distributed randomly at the grain boundaries (Fig. 3d). The average size of Al8Mn5 IMCs varied from 7 µm in the BM to 2 µm in the NZ. Consequently, the FSW process does not lead to the dissolution of the Al8Mn5 IMCs but brooks them into tiny and dispersed polygonal particles within the microstructure. It would be expected that the Mg17Al12 particles would dissolve due to the high temperature reached during the FSW [30] or, at least, the number of Mg17Al12 particles that remained in the NZ decreased further [12].

Figure 4 presents the BM microstructures after PWHT at 200 °C and 400 °C. It is noticed that whatever the PWHT temperature and the BM microstructures remain unchanged and homogeneous with an average size of 21 ± 2 µm. Indeed, no statically recrystallized grains are observed in this zone. This indicates that the static recrystallization activation energy is not enough to promote the nucleation of new grains. Since the dynamic recrystallization induced from the manufacturing process of the AZ31 alloy (hot-rolling), the stored energy has been diminished, and thus, the driving force for static recrystallization has been diminished too. Simultaneously, the twins observed in the BM (mostly present in the as-rolled AZ31 plates with basal texture) [26, 27] inhibit the nucleation process during recrystallization [28, 29].

Fig. 4
figure 4

Optical micrographs in the BM after PWHT for 1 h at a 200 °C and b 400 °C

Figure 5 displays the evolution of the average grain size of the NZ as a function of the PWHT temperature for 1 h and 4 h holding times with the corresponding micrographs. Two ranges of grain growth velocities are found as a function of PWHT temperature (Fig. 5a): slow grain growth below 300 °C and rapid grain growth above 300 °C that becomes slow again above 350 °C. The microstructure is more homogeneous, and the average grain size is almost stable in NZ in the temperature range of 200—300 °C (Fig. 5b, ce, f) with 10 µm average value. However, in the temperature range of 300–400 °C, the average grain size grows up to 470 µm and 776 µm after 1 h and 4 h holding time, respectively. This is due to the low driving force of recrystallization. Then, the grain growth rate becomes higher and it takes place by consuming its surrounding ones [10]. For a given temperature, increasing PWHT holding time from 1 to 4 h resulted in a slight increase in the grain size (Fig. 5bg). These results are in good agreement with those found in previous research works [10]. The observed grain growth in the NZ after PWHT can be related to the reduction of the stored energy accumulated during FSW.

Fig. 5
figure 5

Average grain size of the NZ in the temperature range of 200—400 °C with the corresponding optical micrograph (b, c, d) for 1 h and (e, f, g) for 4 h

Also, the dispersion of the fine Al8Mn5 IMCs contributes to the formation of homogeneous fine-grain microstructure accompanied by sluggish grain growth in the temperature range of 200–300 °C for 1 h and 4 h (Fig. 5bc, e, f). Above 300 °C, the free-strain grains exhibit discontinuous grain growth and the microstructure becomes heterogeneous. Simultaneously, the observed grain growth in the NZ of the PWHT joints in the temperature range of 350—400 °C depends on the PWHT temperature due to the weak effect of the holding time (Fig. 5).

Figure 6ad present the BSE images of the NZ after PWHT at 200 °C.1 h, 300 °C.1 h, 250 °C.4 h, and 350 °C.4 h, respectively. Different morphologies of IMCs are obtained after PWHT such as stick-like shapes or polygonal networks with tiny and coarse particles. These IMCs appear in the form of continuous clusters (Fig. 6c) and discontinuous ones (Fig. 6a, b, d) with an average size of about 2–5 µm. According to the EDS analysis, the calculated average atomic ratios (Al/Mn) of the different IMCs (A, B, C, and D) are in the range of 1.4 and 2.2, which correspond to the ranges of stoichiometric ratios of the existing Al8Mn5 and the newly precipitated Al11Mn4. It is noticed that the ratio Al/Mn evolves during PWHT and the most probable interpretation of this transformation is the formation of Al11Mn4 IMC. According to recent studies [35, 36], the size, and fraction of the globular Al11Mn4, IMCs formed around the Al8Mn5 particles increases with PWHT and long holding time. Since the diffused Al from the Mg matrix to Al8Mn5 participates through the transformation of Al8Mn5 → Al11Mn4, a local increase in Al content is expected. Besides, many dispersed Al-Mn IMCs within the microstructure are not identified because of their small size.

Fig. 6
figure 6

BSE Images of the IMCs throughout the NZ at a and b 200 °C and 300 °C for 1 h and c and d 250 °C and 350 °C for 4 h

Figure 7a and b present the XRD patterns of the BM and NZ after PWHT in the temperature range 200—400 °C for 4 h. They indicate that the Al8Mn5 is the main IMC in both BM and NZ microstructures. The results from SEM–EDS (Fig. 6) and XRD (Fig. 7) examination confirmed the presence and the stability of coarse Al8Mn5 IMC in the BM and NZ after PWHT in the temperature range 200–400 °C. Besides, a peak with low intensity appears at (2θ = 48.2°) in the NZ (Fig. 7b) which corresponds to Al11Mn4 IMC. The Mg17Al12 could not be identified in the BM due to its limited fraction in the Mg matrix. In the BM, the coarse Al8Mn5 particles are not dissolved by increasing the PWHT temperature. They have remained in the matrix because of their high stability limit over the temperature range of 598–642 °C [37]. Thus, PWHT does not affect the presence and the size of the Al8Mn5 particles in the BM. Xiao et al. [38] reported that this type of precipitate contributes to the stability and homogeneity of the BM microstructure. They also mentioned that the grain growth that occurred in the NZ after PWHT in the temperature range of 300—400 °C was attributed to the presence of tiny Al8Mn5 IMC.

Fig. 7
figure 7

XRD patterns of respectively a BM and b NZ at the as-welded state and after PWHT at 200 °C and 400 °C for 4 h

The potentiodynamic polarization (PDP) curves of the NZ after PWHT for 1 h performed in 3.5%NaCl solution are given in Fig. 8. Tafel extrapolation results of these PDP curves are shown in Table 3. It can be observed that the current density (Icorr) of the NZ (19.48 A/cm−2) is lower than the Icorr of the BM (35.04 A/cm−2). This indicates that the corrosion resistance of the NZ is improved with respect to the BM.

Fig. 8
figure 8

PDP curves of the NZ in 3.5 wt% NaCl solution after PWHT at different temperatures for 1 h

Table 3 Potentiodynamic polarization parameters in 3.5 wt% NaCl solution after welding and PWHT at different temperatures

From Fig. 8 and Table 3, it can be seen that the PDP curves of the NZ obtained after PWHT for 1 h tend to shift towards the lowest current density values with increasing the PWHT temperature. This indicates that the corrosion rate decreases with increasing PWHT temperature. After PWHT, the lowest corrosion rate value (5.44 µA/cm−2) is obtained at 300 °C for 1 h where fine grains are obtained in the NZ microstructure (Fig. 5). This indicates the finer the NZ grains are, the better is their corrosion resistance.

Some anodic brunch (Fig. 8) shows an inflection point corresponding to the passivity breakdown indicating that the NZ has undergone a higher localized breakdown. Williams et al. [39] revealed that the breakdown point is a region of intense local anodic activity. From the open-circuit potential (OCP) curves of the NZ illustrated in Fig. 9, the breakdown potential Eb (marked out by a circle) was found to be equal to the Ecorr at the maximum value. A sharp decrease in the Ecorr to more negative values is then observed owing to the dissolution of the unstable formed passive film. A further increase of Ecorr was observed on the curve (Fig. 9). This might be explained by the progressive thickening of the passive film formed on the NZ surface. Thus, the anodic branch can be divided into two regions: (i) the passive region where the potential E is in the [Ecorr, Eb] domain and (ii) the breakdown regions where the potential E is above the Eb value.

Fig. 9
figure 9

OCP of the NZ in 3.5 wt% solution after PWHT at different temperatures for 1 h

The EIS measurements of the NZ are conducted after immersion for 1 h in 3.5 wt% NaCl solution. Figure 10 shows the Nyquist and Bode plots of the NZ post-weld heat-treated in the temperature range of (200—400 °C) for 1 h. The Nyquist plots reveal the presence of two different types of impedance diagrams: Type (I) consists of one capacitive loop at high and medium frequencies and an inductive loop at low frequencies. Type (II) consists of two capacitive loops in the range of the applied frequency. The diameter of the capacitive loop is associated with the charge-transfer resistance (Rct) which is related to the corrosion resistance of the material. The diameter of the inductive loop Rl could be attributed to the metal dissolution phenomenon during the corrosion process. It is correlated to the breakage of the native corrosion-produced film by pitting corrosion. The change in the inductive loop size may be suggestive of the diminution of thickness or deterioration of the passive film [40]. It can be suggested that the degree of the inductive EIS response is depending on the thickness of the formed corrosion film [40]. The different Nyquist plots are fitted with the ZSimpWin 3.22 software where the chi-square value varies between 10−4 and 10−3. The fitted parameters are presented in Table 4.

Fig. 10
figure 10

Nyquist plots (a) and Bode phase (b) in 3.5 wt% NaCl solution of the NZ after PWHT for 1 h; c, d equivalent circuits

Table 4 Fitting of Nyquist plots in 3.5 wt% NaCl solution of the NZ after PWHT at different temperatures

In Fig. 10a, the capacitive loop at high and medium frequencies indicates an overall increase of the Rct values with increasing the PWHT temperature from 200 to 400 °C for 1 h. The NZ post-weld heat-treated at 300 °C displays the highest corrosion resistance with Rct value of about 5060 Ω.cm2. The Bode diagrams (magnitude and phase angle diagrams) are plotted in Fig. 10b. The |Z| values and phase angle are significantly reduced when the PWHT temperature and holding time are increased. The highest |Z| values are attributed to the passivation of the NZ surface (at 300 °C for 1 h) by the passive film. The shift of the peak position to high frequencies confirms the breakdown of the passive film. The decrease in the phase angle values in the high-frequency region of the NZ after PWHT for 1 h is attributed to the decrease in the capacitance value of the passive film. Thus, during PWHT, the values of |Z| and phase angle increase, indicating an increase in the protection provided by the passive film.

From Fig. 10 and Table 4, the equivalent electrical circuits are drawn and given in Fig. 10c, d. The components of the electrical equivalent circuits, CPE, Rct, Rl, and L shown in Fig. 10c and d, are the electrolyte resistance, the constant phase element (associated with the electrical double layer due to the depression of the Nyquist plots at low frequencies), the charge transfer resistance, the resistance of the inductive response, and the inductor respectively. Two different equivalent circuit models are proposed: type I (Fig. 10c) and type II (Fig. 10d).

The CPE behavior (Fig. 10c, d) should be associated with the capacitance of the passive film. The change in CPE values with the thickness of the passive film is a consequence of the change in its roughness. In addition, the capacitance value decreases with increasing the PWHT temperature. Thus, this increase is principally due to the reduction of the density of the grain size boundaries, and the increased capacitance indicating the destruction of the formed passive film due to the diffusion of Cl- anions through and into the passive film.

To investigate the impact of the grain boundary barrier on the corrosion resistance of the investigated AZ31 FSW joint, KPFM measurements on the NZ surface are obtained over a 20 × 20 µm2 scan area, as shown in Fig. 11. For a given grain, the average Volta potentials are obtained from the average of six (06) line profiles drawn within this grain. The measured Volta potential values are 79.4 + 6.0 mV for the highlighted grains of the NZ (Fig. 11b). The Volta potential values measured at the grain boundaries of the NZ are about 9 V (Fig. 11c) are higher than those measured at the grain. High Volta potential is distributed along the grain boundaries (brightest zone) which is ascribed to the effect of the grain boundary barrier due to the variation of the chemical composition. The bulk grain shows uniform distribution of the Volta potential. It should be mentioned that the measured Volta potential of the BM is about 22.3 ± 1.9 mV.

Fig. 11
figure 11

Kelvin probe force microscopy analysis showing a surface area of 20 × 20 µm2 of the NZ: a 2D surface topography, b potential difference map, and c and d potential distribution along the line scans A and B drawn in b

The electrochemical behavior of AZ31 friction stir welds is rather complex; it may be influenced by the following factors: (i) the grain boundary density and twins and (ii) the size and distribution of the different Al-Mn IMCs. The corrosion resistance Rct of the NZ after PWHT was studied. It came out that after FSW, the corrosion resistance of NZ became higher than that of BM (Fig. 10). This is in agreement with previous works that showed that NZ is more resistant to corrosion than BM [11, 13, 41]. This is mainly due to the fine grains obtained through the dynamic recrystallization mechanism in NZ during the FSW process, where the grain boundaries act as barriers against corrosion propagation [24]. As it can be seen in Fig. 11, the grain boundaries present high Volta potential (~ 9 V) relative to the matrix in the NZ. Thus the grain boundaries exhibit a clear cathodic behavior; this could be attributed to the Al atoms dissolved from the Al12Mg17 intermetallic migrating to the grain boundaries or to form Al11Mn4 as the temperature of the FSW process may exceed the eutectic point of the AZ31 alloy [21].

In NZ, increasing the PWHT temperature rises its corrosion resistance. Furthermore, in the 200—300 °C temperature range where the microstructure was characterized by slow grain growth and fine microstructure (Fig. 5), the relative stability of the electrochemical behavior of the NZ could be due to the homogeneous and refined grains and the corrosion resistance reaches its maximum at 300 °C for 1 h. The high density of grain boundaries acts as a barrier against corrosion phenomena. The corrosion resistance is improved when the grain size decreases. This is associated with a reduction in the cathodic reaction and implies the formation of the passive film. Thus, improving the corrosion resistance of the AZ31 FSW joint was strongly dependent on grain refinement, where the grain boundaries act as a barrier to corrosion propagation. Furthermore, due to the high density of grain boundaries, the NZ surface has more nucleation sites for the formation of a stable and adherent passive film [42]. Grain boundaries bring out the more favorable site where the passive film nucleates as the grain size decreases. The twin density may also contribute to the improvement of the corrosion resistance of the NZ of AZ31 FSW joints as reported by Qingshan et al. [26]. For this purpose, a ratio R = I(10–11)/I(0002) is calculated from the x-ray diffraction spectra (where I is the intensity of the considered peaks). This ratio (R) represents the activation degree of the contraction twins [43]. It increases from 0.18 (for 200 °C.1 h) to 0.31 (for 300 °C.1 h), which means that the more are the activated twins, the higher is the corrosion resistance of the NZ. Thus, the decrease of the Icorr from 27.16 to 5.44 A cm−2 could be attributed to the contraction twins that have been activated under the effect of the PWHT temperature.

As described previously in the PDP testing results (Fig. 8), the passivity range on the anodic branch confirms the formation of the passive film on the surface of the NZ. The passivity range expanded with the reduction in grain size. Besides, the improvement in passivity is manifested by an increase in the |Eb-Ecorr| difference (Table 3). The |Eb-Ecorr| reduction corresponds to the coarsening of the grains of the NZ treated at 350—400 °C temperature range. Therefore, it is reasonable to suggest that the improvement in corrosion resistance of the NZ may be due to the enhanced passivity as the grain size becomes reduced [42].

It is well-reported that Al8Mn5 and Al11Mn4 IMCs had a cathodic behavior during the corrosion process [20, 43, 44], and may promote galvanic corrosion in Mg alloy. However, Liao et al. [46] reported that these IMCs have little effect due to the small galvanic current, which may be attributed to the small size and the little amount of Al-Mn IMCs. Also, The Al8Mn5 IMCs have low Al/Mn ratios than that of Al11Mn4 IMCs. These Al11Mn4 IMCs could act as less efficient micro-cathodes in the α-Mg matrix, decreasing the cathodic reaction rate, therefore, the corrosion rate [47]. The Al-Mn IMCs with a high Al/Mn ratio (more enriched in Al) act as barriers against corrosion propagation. These Al-enriched zones can improve the passivity of the passive film formed on this zone. Furthermore, Al-Mn IMCs containing a high Al/Mn ratio do not seem to contribute to corrosion resistance improvement [47]. The depletion of the Mg matrix from the Al atoms, where the Al atoms contribute to the formation of Al11Mn4 IMCs as described above, leads to an increased Al/Mn ratio. This cathodic activity of IMCs decreases, and only the grain boundaries effect remains [35].

After PWHT, the BM exhibits a slight enhancement of the Rct (Fig. 12) values that can be attributed to twin suppression [16, 27]. Increasing PWHT temperature decreases the twin density. The unchangeable grain size over the temperature range of (200—400 °C) has an insignificant effect on the corrosion resistance of the investigated AZ31 alloy. Thus, the effect of grain size is less pronounced in the corrosion of the twinned microstructure. Low twin density reduces the anodic dissolution of the matrix [27].

Fig. 12
figure 12

Rct evolution of the BM as a function of PWHT temperature for 1 h and 4 h

The conducted PWHT led to static recrystallization followed by remarkable grain growth in the NZ and thermal stability in the BM. In the NZ, the reduction of the grain boundary density decreases Rct. The transformation of Al8Mn5 IMCs to Al11Mn4 did not affect the corrosion resistance of the NZ and reduce the cathodic activity.

4 Conclusion

In this study, the effect of PWHT temperature and time on the microstructure and corrosion behavior of the NZ of AZ31 alloy friction stir welds is investigated. The main conclusions are as follows:

  • Whatever the holding time, the average grain size in the NZ is unchanged in the temperature range of 200—300 °C. However, important grain growth is noticed for temperatures above 300 °C

  • During the PWHT operation, the ratio Al/Mn evolves due to the formation of globular Al11Mn4 IMC around the Al8Mn5 particles, which increases with PWHT temperature and holding time.

  • The corrosion resistance in the friction-stir welded joint is strongly dependent on the grain size, while the IMCs have a negligible effect.

  • KPFM measurements reveal that the grain boundaries exhibit a cathodic behavior and high Volta potential values with respect to those of the matrix.

  • The microstructural and electrochemical investigations conducted in this work lead to conclude that the NZ post-weld heat-treated at 300 °C for 1 h had the highest corrosion resistance