Controlling Lateral Size and Thickness of Layered Double Hydroxide (LDH) Used as Conversion Layer for Corrosion Protection of AZ31 Mg Alloy

: In the present study, Mg-Al layered double hydroxide (Mg-Al/LDH) was synthesized on the surface of AZ31 Mg alloy substrate via in-situ hydrothermal treatment. Synthesis parameters were changed to determine their effect on the lateral size of LDH. For this purpose, etching in nitric acid and anodizing in sodium hydroxide solution were performed as surface pretreatments. Moreover, the inﬂuence of LDH solution pH (10 and 11) on the lateral size of LDH coating was investigated. Morphology, chemical composition, and crystalline structure were characterized by scanning electron microscopy (SEM), energy-dispersive X-ray spectroscopy (EDS), Fourier transform infrared (FTIR) spectroscopy, and X-ray diffraction (XRD). The corrosion resistance of the coatings was investigated by H 2 measurements, salt spray, and electrochemical impedance spectroscopy (EIS). Moreover, the epoxy coating was applied on the best anti-corrosive LDH sample for assessing the compatibility and effectiveness of LDH on the corrosion properties of the substrate with the epoxy layer. At pH = 11, the lateral size of LDH was smaller than samples at pH = 10. In addition, small-sized LDH, as well as LDH/epoxy coating, revealed enhanced corrosion protection.


Introduction
The global market of magnesium alloys is expected to grow at the rate of 9.9% (compound annual growth rate (CAGR)) from 2020 to 2027 [1]. They are used in different industries as well as academic studies including biomedical devices, automotive, and aerospace sectors thanks to their high strength/weight ratio, machinability, good electrical and thermal conductivities. However, their usage has been limited due to their poor corrosion resistance [2,3]. Magnesium tends to corrode in aqueous electrolytes due to the low standard potential (−2.37 V SHE ). However, the actual corrosion potential (−1.7 V SHE ) is different from the standard potential as the result of the formation of an oxide/hydroxide layer on the surface. The formation of this oxide layer can be explained using the Pourbaix diagram. According to this diagram, for pH values more than 9, Mg(OH) 2 can be precipitated on the surface [4]. The corrosion of Mg alloys depends on the alloy composition as well as the environment. Second phases or impurities in Mg alloys can create micro-cells in presence of electrolytes and increase corrosion. Moreover, the passive layer on Mg alloy is not as protective as passive layers formed on other metals like aluminum and stainless steel and has only low corrosion resistance [4].
For these reasons, different strategies have been used for increasing the corrosion resistance of Mg alloys such as increasing aluminum content [5], decreasing impurities content [4], using rapid solidification for leading to a homogenous structure [6], and application of organic coating. Organic coatings are the most cost effective method in the industry for the protection of Mg alloys [7]. As a barrier layer, organic coatings have the ability to prevent Mg alloys from corrosion. However, the adhesion of the organic coating to the substrate should be increased by appropriate surface treatment to enhance the corrosion resistance of the substrate [8,9]. Surface treatments before applying organic coatings not only affect the adhesion but also the roughness, and film formation process [10]. These treatments include electroless plating [7], conversion layers [11,12], anodic oxidation [2,8], and so on. Anodization is among the well-known and facile techniques which can enhance wear and corrosion resistance [13]. However, due to the porous and brittle structure of anodic coatings, further modification is required. Layered double hydroxide (LDH) has been found as an effective method for improving the corrosion resistance of Mg alloys which can be used for sealing the anodic layer as well [14][15][16].
LDH is also known as anionic clays and hydrotalcite (hydro for water content and talcite for resembling talc) which can be formed with different combinations of metals and anions [17]. The chemical formula of LDH is presented by [M(II) 1-x M(III) x (OH) 2 ] x+ (A n-) x/n ·yH 2 O in which M(II) and M(III) are divalent and trivalent metal cations that form octahedral structure with A nas an interlayer anion, and the stoichiometric coefficient of x [17,18]. The appropriate ratio of metals is between 2:1 to 4:1 leading to the x range of 0.2 to 0.33. LDHs can be produced by facile methods and give corrosion resistance to the substrate by having high loading capacity as well as anion exchangeability which makes them suitable for practical usages [18]. When LDH coatings are in contact with corrosive media, interlayered anions can be released, and simultaneously corrosive species are adsorbed [19]. Despite the abovementioned properties of LDH coatings, their production on magnesium alloys has some limitations. They should be produced under high pressure and temperature. Moreover, pre-formed LDH which is not produced on the surface of substrates directly has low adhesion to the substrate [20].
The corrosion performance of the LDH layer is strongly dependent on the substrate, surface treatment before production of LDH, concentration, and type of cations involved in the synthesis process, pH of LDH solution, hydrothermal treatment time, and temperature which can modify the morphology, crystallinity, size, and thickness of LDH [14,15,21,22]. Asl et al. [23] worked on the production of Mg-Ce/LDH. They showed that using Ce ions in the structure of LDH can enhance corrosion resistance by forming deposited cerium hydroxide at defects. Wu et al. [21] investigated the effect of different cations on the anticorrosion property of LDH produced by in-situ hydrothermal treatment at 125 • C. They observed that Mg-Al LDH had the highest protective properties in comparison to Mg-Fe and Mg-Cr LDH. In another study [14], they showed that the LDH layer performance was increased when produced at pH between 10 and 11. XRD diagrams at pH less than 10, showed the high intensity of the Mg peak while there was no peak for Mg(OH) 2 , representing that Mg ions are not present in sufficient quantity for participating in the LDH structure. For the LDH layer prepared at pH more than 11 (around 12), the intensity of XRD peaks related to LDH and impedance modulus of the LDH layer at low frequency was decreased in comparison to LDH prepared at pH = 10.72 and 11.72 [14]. It was shown that increasing hydrothermal treatment temperature can enhance the structure and make the LDH layer denser [15].
In previous studies, the approximate Mg-Al/LDH flake size was around 1 to 2 µm prepared on anodized and grinded substrates [14,15,24]. However, to the best of our knowledge, the effect of LDH lateral size on the corrosion resistance of the substrate has not been reported yet. Rojas [25] used magnesium-aluminum LDH (Mg-Al/LDH) with intercalated carbonate for the removal of Cu cations and showed that decreasing size can increase buffering capacity due to the higher surface area. Therefore, there should be studies related to optimizing the size of LDH to increase their efficiency.
Only a few studies were related to the investigation of a complete protective system on magnesium alloys combining a LDH conversion layer and an epoxy coating [26]. In this study, Mg-Al/LDH layer is produced on AZ31 magnesium alloy submitted to different surface treatments: etching and anodizing. The hydrothermal treatment was performed at two pH in the alkaline region of pH (10 and 11). Physical and chemical characteristics of LDH were observed by SEM, EDS, XRD, and FTIR. Electrochemical impedance spectroscopy, H 2 production, and salt spray tests were carried out for assessing corrosion behavior. The effect of LDH lateral size as well as the surface pretreatment on the corrosion behavior of the substrate was investigated by measuring the volume collected hydrogen and EIS tests to achieve the most efficient LDH. After characterizing LDH, the best corrosion-resistant sample was used for assessing the effect of the LDH layer as a conversion layer on the corrosion performance of applied epoxy on the substrates by salt spray test. It was observed that the small-sized LDH produced at pH = 11 can have good compatibility with the epoxy layer and improved corrosion resistance of the substrate.

Materials and Surface Treatments
AZ31 magnesium alloy was used as substrate with composition of 2.5-3.5% Al, 0.7-1.3% Zn, 0.2% Mn, 0.05% Si, 0.05% Cu, 0.04% Ca, 0.005% Fe, 0.1% Ni (wt %) and balance Mg (supplied from KG Fridman AB (SWEDEN)). The microstructure of the substrate was reported in our previous study [27]. NH 4 NO 3 , Al(NO 3 ) 3 .9H 2 O, NaOH, and NaCl were purchased from RPL, EMPLURA, VWR Chemicals, and LAMERS AND PLEUGER, respectively. The commercial resin Epikote 828 (Brenntag) with an equivalent weight of 185-192 g/eq was used as epoxy resin. Diluent Epotec RD 106 para-tertialy butyl phenyl glycidyl ether (ThaiEpoxy group) with an equivalent weight of 220-250 g/eq was added to reduce the viscosity of the resin. The amine curing agent was Ancamine 2753, 3-aminoethyl-3,5,5 trimethylcyclohexylamine (Air product) with an equivalent weight per active H of 153 g/eq. AZ31 Mg alloy substrates with dimensions of 1 × 37 × 50 mm were first etched for 30 s in 2 M HNO 3 solution, and then again etched for 60 s in 0.25 M HNO 3 before rinsing in deionized water [27]. Etching can remove the oxide layer and make micron to nano-sized roughness on the surface for increasing wettability [28]. In the end, the samples were dried under a stream of air.
After pretreatment of substrates in acid, several samples were anodized by DCregulated power in a continuously stirred 2 M NaOH solution for 15 minutes under a low stable voltage of 4 V. The anodized substrates (with a thickness of 10 ± 2 µm) were rinsed with water and dried with air.
The LDH was synthesized on the pretreated surface of substrates using the in-situ hydrothermal treatment method in a Teflon-lined autoclave at 125 • C for 24 h at different pH solutions. Table 1 shows the conditions and codes used for samples. Specimens were immersed in the solution containing 0.1 M Al(NO 3 ) 3 and 0.6 M NH 4 NO 3 . The pH of the solution was adjusted by the slow addition of 2 M NaOH while stirring before immersing samples. Figure 1 shows the procedure for producing LDH. Epoxy resin, diluent, and hardener were used with the ratio of 10:5:3 for applying epoxy on the substrates. First, epoxy resin was mixed with diluent overnight and then hardener was added to the solution and mixed for 1 min. The epoxy coating was applied on the substrates using dip coater (KSV NIMA) with the speed of 600 mm/min and the samples were immersed in the solution for 30 s. Samples were kept at room temperature (23 ± 0.5 • C) for 1 day and were then post-cured at 120 • C for 1 hour. The thickness of the epoxy coating after curing was 12 ± 2 µm (measured by SEM). The samples were coded according to Table 2  Epoxy resin, diluent, and hardener were used with the ratio of 10:5:3 for applying epoxy on the substrates. First, epoxy resin was mixed with diluent overnight and then hardener was added to the solution and mixed for 1 min. The epoxy coating was applied on the substrates using dip coater (KSV NIMA) with the speed of 600 mm/min and the samples were immersed in the solution for 30 s. Samples were kept at room temperature (23 ± 0.5 °C) for 1 day and were then post-cured at 120 °C for 1 hour. The thickness of the epoxy coating after curing was 12 ± 2 µm (measured by SEM). The samples were coded according to Table 2.

Surface treatment
Code of samples with epoxy coating Etched E/Epoxy Anodized A/Epoxy LDH (coded according to Table 1) A1124/Epoxy

Characterization Techniques
The surface and cross-section morphologies, as well as the elemental composition of LDHs, were investigated by scanning electron microscope (SEM, Hitachi SU8020) equipped with an energy dispersive X-ray spectrometer analyzer (EDS, Thermo Scientific Noran System 7). For cross-section images, samples were embedded in resin (EpoFix resin and EpoFix hardener) and were grounded with 800, 1200, 2000, and 4000 SiC papers using Struer TegraForce-5. The thickness of samples and the lateral size of LDH was measured using ImageJ software from SEM images. Fourier-transform infrared spectroscopy (FTIR, Shimadzu IRTracer-100) in reflectance mode, in the wavenumber range from 500 to 4000 cm −1 at room temperature (23 ± 0.5 °C) was used to determine chemical groups. The LDH crystalline structures were investigated with X-ray diffraction (XRD, Panalytical Empyrean Theta-Theta) with CuKα radiation (λ = 0.154056 nm) and Ni filter with a step of 0.02° and a scanning rate of 1.2°/min in the 2θ range from 8° to 70°.
Hydrogen evolution experiments were carried out on samples with dimensions 1 × 37 × 37 mm in 100 mL of 0.1 M NaCl solution using eudiometers supplied by Neubert-Glas (NEUB2591). All tests were performed for 7 days at room temperature (23 ± 0.5 °C) without interruption and the volume of released hydrogen was recorded visually. The volume of resided or dissolved hydrogen in 0.1 M NaCl was ignored as the solubility of H2 in water is too low. The volume of released hydrogen was divided by surface area in contact with the NaCl solution. The collected hydrogen rate can be converted to the mass

Characterization Techniques
The surface and cross-section morphologies, as well as the elemental composition of LDHs, were investigated by scanning electron microscope (SEM, Hitachi SU8020) equipped with an energy dispersive X-ray spectrometer analyzer (EDS, Thermo Scientific Noran System 7). For cross-section images, samples were embedded in resin (EpoFix resin and EpoFix hardener) and were grounded with 800, 1200, 2000, and 4000 SiC papers using Struer TegraForce-5. The thickness of samples and the lateral size of LDH was measured using ImageJ software from SEM images. Fourier-transform infrared spectroscopy (FTIR, Shimadzu IRTracer-100) in reflectance mode, in the wavenumber range from 500 to 4000 cm −1 at room temperature (23 ± 0.5 • C) was used to determine chemical groups. The LDH crystalline structures were investigated with X-ray diffraction (XRD, Panalytical Empyrean Theta-Theta) with CuKα radiation (λ = 0.154056 nm) and Ni filter with a step of 0.02 • and a scanning rate of 1.2 • /min in the 2θ range from 8 • to 70 • .
Hydrogen evolution experiments were carried out on samples with dimensions 1 × 37 × 37 mm in 100 mL of 0.1 M NaCl solution using eudiometers supplied by Neubert-Glas (NEUB2591). All tests were performed for 7 days at room temperature (23 ± 0.5 • C) without interruption and the volume of released hydrogen was recorded visually. The volume of resided or dissolved hydrogen in 0.1 M NaCl was ignored as the solubility of H 2 in water is too low. The volume of released hydrogen was divided by surface area in contact with the NaCl solution. The collected hydrogen rate can be converted to the mass loss rate due to the production of one H 2 molecule by dissolving one atom of Mg using the ideal gas law [29,30].
The electrochemical impedance spectroscopy was performed in 0.1 M NaCl solution using a ModulLab controlled by XM-Studio®software. A classical three-electrode system, which consisted of a platinum counter electrode, an Ag/AgCl (sat. KCl) reference electrode, and AZ31 Mg alloy samples, as working electrodes with an exposed area of 1 cm 2 were used. EIS measurements were performed in a frequency range from 100 kHz to 100 mHz with 61 points using a 10 mV peak-to-peak sinusoidal voltage. Each experiment was performed at least three times.
For investigating the qualitative adhesion of the LDH to the substrate a tape with a size of 25 mm × 66 m supplied by Rubans de Normandie (8705B) was adhered to the samples on a stable holder. After 30 s, the tape was manually removed before SEM observation of the surface. Salt spray test was also performed (Q-LAB Model SSP) according to the ASTM B117 on intact and x-cut scratched samples with a width of 100 µm and angle of 30 • .

Physical and Chemical Characteristics of LDHs
To investigate the effect of experimental parameters on the morphology of coatings, SEM micrographs were determined. Figure 2 shows SEM images of the anodized and LDH structure on substrate samples. Figure 2 exhibits the blade-like surface of LDHs and their uniform and dense structure growth on Mg alloy substrates. In Figure 2a it can be seen that the cracks and micropores of the anodic layer are sealed with LDH structure in Figure 2d,e. According to Figure 2e, the LDH lateral size of sample A1124 is about eight times smaller than other samples (the lateral size for A1124 and A1024 is 0.16 ± 0.03 µm and 1.3 ± 0.4 µm, respectively). Moreover, at pH = 11 the structure is more compact and tangled. LDH layers consist of a compact inner layer and a porous outer layer [31,32]. The cross-section images of samples at different magnifications (Figure 2g-n) for both LDHs on etched and anodized substrates show the lower outer layer and higher inner layer thickness of LDH produced at pH = 11. 10 measurements were carried out for each sample and the average thickness is shown in Table 3. As can be seen in the micrographs, the lower outer layer thickness is attributed to the smaller lateral size of LDH sheets. Open spaces in larger lateral size LDH at pH = 10 can be observed vividly (these spaces are filled with epoxy in the images) while these spaces are too small and more compact for LDH at pH = 11. So even the thickness of the outer layer at pH = 11 is less than pH = 10, the structure is more compact. Surface treatment did not change the morphology of LDH considerably. For the formation of LDH, the Mg bivalent cation is supplied by the substrate and the Al trivalent cation is furnished by the electrolyte. loss rate due to the production of one H2 molecule by dissolving one atom of Mg usin the ideal gas law [29,30]. The electrochemical impedance spectroscopy was performed in 0.1 M NaCl solutio using a ModulLab controlled by XM-Studio® software. A classical three-electrode system which consisted of a platinum counter electrode, an Ag/AgCl (sat. KCl) reference elec trode, and AZ31 Mg alloy samples, as working electrodes with an exposed area of 1 cm were used. EIS measurements were performed in a frequency range from 100 kHz to 10 mHz with 61 points using a 10 mV peak-to-peak sinusoidal voltage. Each experiment wa performed at least three times.
For investigating the qualitative adhesion of the LDH to the substrate a tape with size of 25 mm × 66 m supplied by Rubans de Normandie (8705B) was adhered to the sam ples on a stable holder. After 30 s, the tape was manually removed before SEM observatio of the surface. Salt spray test was also performed (Q-LAB Model SSP) according to th ASTM B117 on intact and x-cut scratched samples with a width of 100 µm and angle o 30°.

Physical and Chemical Characteristics of LDHs
To investigate the effect of experimental parameters on the morphology of coating SEM micrographs were determined. Figure 2 shows SEM images of the anodized an LDH structure on substrate samples. Figure 2 exhibits the blade-like surface of LDHs an their uniform and dense structure growth on Mg alloy substrates. In Figure 2a it can b seen that the cracks and micropores of the anodic layer are sealed with LDH structure i Figure 2d,e. According to Figure 2e, the LDH lateral size of sample A1124 is about eigh times smaller than other samples (the lateral size for A1124 and A1024 is 0.16 ± 0.03 µm and 1.3 ± 0.4 µm, respectively). Moreover, at pH = 11 the structure is more compact an tangled. LDH layers consist of a compact inner layer and a porous outer layer [31,32]. Th cross-section images of samples at different magnifications (Figure 2g-n) for both LDH on etched and anodized substrates show the lower outer layer and higher inner laye thickness of LDH produced at pH = 11. 10 measurements were carried out for each sampl and the average thickness is shown in Table 3. As can be seen in the micrographs, th lower outer layer thickness is attributed to the smaller lateral size of LDH sheets. Ope spaces in larger lateral size LDH at pH = 10 can be observed vividly (these spaces are fille with epoxy in the images) while these spaces are too small and more compact for LDH a pH = 11. So even the thickness of the outer layer at pH = 11 is less than pH = 10, the struc ture is more compact. Surface treatment did not change the morphology of LDH consid erably. For the formation of LDH, the Mg bivalent cation is supplied by the substrate an the Al trivalent cation is furnished by the electrolyte. EDS mapping from the cross-section of samples as well as EDS graphs in Figure 3 show the elemental mapping of Mg, Al, and O. Al elemental distribution shows high concentration at the top layer which proves the formation of LDH. EDS graphs for etched samples are from the compact inner layer while for anodized samples are from the anodic plus compact inner layer (EDS graphs of the porous outer layer couldn't give us useful information as there is epoxy between the LDH sheets) which show the low concentration of Al element at these layers. EDS mapping from the cross-section of samples as well as EDS graphs in Figure  show the elemental mapping of Mg, Al, and O. Al elemental distribution shows high co centration at the top layer which proves the formation of LDH. EDS graphs for etche samples are from the compact inner layer while for anodized samples are from the anod plus compact inner layer (EDS graphs of the porous outer layer couldn't give us usef information as there is epoxy between the LDH sheets) which show the low concentratio of Al element at these layers.    the samples with LDH can be associated to CO 3 2− or NO 3 − , respectively, according to Wu et al. [21]. However, FTIR method is not reliable for demarcating NO 3 − and CO 3 2− when they are intercalated in LDH structure [33]. Therefore, determination of the intercalated anion can be done more accurately using XRD results and the crystal size of LDH. The existence of characteristic peaks for NO 3 − or CO 3 2− only in samples with LDH proves their formation [21]. The spectral peaks in the range 444~770 cm characteristic peaks for NO3 -or CO3 2-only in samples with LDH proves t [21]. The spectral peaks in the range 444~770 cm  XRD patterns of samples are shown in Figure 5. The characteristic Mg(OH)2, and LDH are marked in the figure according to JCPDS No. 00-03 0239 and 00-014-0191, respectively. Mg(OH)2 peak at 38.02° shows the dis for the production of LDH [14]. The obtained peaks for samples were comp terns related to Mg6Al2(CO3)(OH)16·4H2O. The characteristic diffraction drotalcite at (003) were observed in XRD patterns at around 11°, however could not be seen vividly. According to the literature, the intensity of (006 less than (003) [14,21]. In this case, the (006) peak may be too small to be A1024 and E1024 have more intense peaks in comparison to A1124, which the thicker porous outer layer LDH for samples at pH = 10. The size of inte and the stacking direction determine the interlayer spacing. In the reacti mation of LDH coating, CO3 2-anions can be supplied by the dissolution o Table 4 shows the d-spacing related to the samples. According to Table  ( [34]. It can be inferred that preparing the sample at pH = 11 n (decreases) the lateral size but also the crystal unit cell. In the study of Wa was shown that decreasing Mg:Al ratio for synthesizing LDH could inc spacing of LDH. The concentration of Mg can affect the layer charge dens XRD patterns of samples are shown in Figure 5. The characteristic peaks of Mg, Mg(OH) 2 , and LDH are marked in the figure according to JCPDS No. 00-035-0821, 00-007-0239 and 00-014-0191, respectively. Mg(OH) 2 peak at 38.02 • shows the dissolution of Mg for the production of LDH [14]. The obtained peaks for samples were compared with patterns related to Mg 6 Al 2 (CO 3 )(OH) 16 ·4H 2 O. The characteristic diffraction peaks of hydrotalcite at (003) were observed in XRD patterns at around 11 • , however, peaks at (006) could not be seen vividly. According to the literature, the intensity of (006) LDH peak is less than (003) [14,21]. In this case, the (006) peak may be too small to be seen. Samples A1024 and E1024 have more intense peaks in comparison to A1124, which can be due to the thicker porous outer layer LDH for samples at pH = 10. The size of intercalated anions and the stacking direction determine the interlayer spacing. In the reaction for the formation of LDH coating, CO 3 2− anions can be supplied by the dissolution of CO 2 gas [14]. Table 4 shows the d-spacing related to the samples. According to Table 4, c parameter (3d(003) = c) is 23.007 A • for A1124 which can be related to the CO 3 2− or OH − , while this amount is 24.35 A • and 24.087 A • for A1024 and E1024, respectively, relating to the intercalated NO 3 − [34]. It can be inferred that preparing the sample at pH = 11 not only affects (decreases) the lateral size but also the crystal unit cell. In the study of Wang et al. [35] it was shown that decreasing Mg:Al ratio for synthesizing LDH could increase the basal spacing of LDH. The concentration of Mg can affect the layer charge density and change the configuration of the intercalated anion [35]. Therefore, the lower d-spacing for A1124 can be the result of higher Mg cations concentration at the same Al concentration in LDH solution for all of the samples (explained in more detail in Discussion section) and changes in the charge density of the layers. the configuration of the intercalated anion [35]. Therefore, the lower d-spacing for A1124 can be the result of higher Mg cations concentration at the same Al concentration in LDH solution for all of the samples (explained in more detail in Discussion section) and changes in the charge density of the layers.  The qualitative adhesion of LDH to the substrates was investigated using tape. For this purpose, SEM images were taken before and after applying the tape. According to Figure 6, after peeling off the tape, for samples prepared at pH = 10, the LDH was removed from the substrate showing low adhesion to the substrate. However, for A1124 and E1124 samples peeling off the tape was hard and there was still LDH on the surface after removing the tape (only a small part of LDH was removed for sample E1124 which is shown in Figure 6f). Moreover, for A1124 residuals of tape were stuck on the surface showing the applicability of this sample for further use of organic coating on it.  The qualitative adhesion of LDH to the substrates was investigated using tape. For this purpose, SEM images were taken before and after applying the tape. According to Figure 6, after peeling off the tape, for samples prepared at pH = 10, the LDH was removed from the substrate showing low adhesion to the substrate. However, for A1124 and E1124 samples peeling off the tape was hard and there was still LDH on the surface after removing the tape (only a small part of LDH was removed for sample E1124 which is shown in Figure 6f). Moreover, for A1124 residuals of tape were stuck on the surface showing the applicability of this sample for further use of organic coating on it.  Figure 7. According to these micrographs, after 7 days no corrosion pits are seen. The SEM images exhibit that the coating still has a very typical nanosheet structure of LDH phases without evident damage. Compared to the SEM images of LDH  Figure 7. According to these micrographs, after 7 days no corrosion pits are seen. The SEM images exhibit that the coating still has a very typical nanosheet structure of LDH phases without evident damage. Compared to the SEM images of LDH films before immersion, the change is the LDH structure transformed from sharp to rounded edges (shown with circles in Figure 7), especially for samples E1024 and A1024, which is due to the dissolution of LDH edges. Moreover, the lateral size of LDH prepared at pH = 11 was increased after immersion as the result of the substrate dissolution and LDH recrystallization [36].  Figure 7. According to these micrographs, after 7 days no corrosion pits are seen. The SEM images exhibit that the coating still has a very typical nanosheet structure of LDH phases without evident damage. Compared to the SEM images of LDH films before immersion, the change is the LDH structure transformed from sharp to rounded edges (shown with circles in Figure 7), especially for samples E1024 and A1024, which is due to the dissolution of LDH edges. Moreover, the lateral size of LDH prepared at pH = 11 was increased after immersion as the result of the substrate dissolution and LDH recrystallization [36].   Figure 9 shows XRD for samples after immersing in 0.1 M NaCl solution for 7 days. The existence of LDH characteristic peaks at (003) and (006), after immersion, shows that even after immersion for 7 days we still have LDH structure on the substrates.
The d-spacing for A1124 is increased after immersion. By considering intercalated  Figure 9 shows XRD for samples after immersing in 0.1 M NaCl solution for 7 days. The existence of LDH characteristic peaks at (003) and (006), after immersion, shows that even after immersion for 7 days we still have LDH structure on the substrates.

H2 Evolution Experiment
In Figure 10, The collected hydrogen from eudiometer for etched and anodized as well as LDH samples after immersion in 0.1 M NaCl solution for 7 days, is expressed as the unit of mL per cm 2 . The d-spacing for A1124 is increased after immersion. By considering intercalated CO 3 2− or OH − anions as the result of data obtained before immersion, the increase in d-spacing can be related to the dissolution and recrystallization of LDH with intercalation of Cl − anion. This result is in agreement with previous studies [22]. However, for A1024 and E1024 the d-spacing was decreased as the intercalated anion is changed from NO 3 − to Cl − . XRD along with EDS results after immersion can show the intercalation of Cl anions in the LDH structure [22,38]. For sample E1124 before and after immersion characteristic peaks of LDH at (003) and (006) could not be observed due to the thin LDH outer layer. Moreover, the increased intensity of Mg(OH) 2 peak at around 38 • in all the samples (in comparison to the Mg peak at around 34.5 • ), implies the occurrence of substrate corrosion according to the reactions below [5].
Which leads to the overall reaction of:

H 2 Evolution Experiment
In Figure 10, The collected hydrogen from eudiometer for etched and anodized as well as LDH samples after immersion in 0.1 M NaCl solution for 7 days, is expressed as the unit of mL per cm 2 .

H2 Evolution Experiment
In Figure 10, The collected hydrogen from eudiometer for etched and anodized as well as LDH samples after immersion in 0.1 M NaCl solution for 7 days, is expressed as the unit of mL per cm 2 . The experimental data related to the accumulated hydrogen were fitted by a line to have an estimation for corrosion rate. Table 5 shows the mass loss rate, the equations for each estimated line, and R-squared (R 2 ) as a parameter for showing how close the data are to the modeled line (closer to 1 better the fitting). In these equations, y and t represent the volume of produced hydrogen per surface unit (mL/cm 2 ) and immersion time (h), respectively. The slope of these lines can be used as an approximation of the corrosion rate of samples due to having the unit of mL·h −1 ·cm −2 . The least collected hydrogen is for LDH samples produced on AZ31 Mg alloy at pH = 11 and previously anodized. The high amount of collected hydrogen for samples E1024 and A1024 shows poor corrosion resistance of these samples while immersed in NaCl solution. As can be observed, the trend of the corrosion rate for samples is as follows: Etched > A1024 > E1024 > Anodized > E1124 > A1124. This result indicates that the compact structure of the LDH outer layer of the samples treated at pH = 11 allows to significantly reduce the corrosion rate and to protect the magnesium substrate by formation of more isolating layer related to the decrease of the lateral size of LDH. Even if the anodizing layer increases the total thickness of the layer, this layer is only slightly more protective and does not play a significant role on the LDH morphology.

Electrochemical Test of LDH Samples
The Bode and Nyquist diagrams obtained from the EIS test, for etched AZ31 substrate, anodized, and samples with LDH immersed in 0.1 M NaCl solution for 1 h, 6 h, and 24 h are presented in Figures 11 and 12. Generally, the systems with the higher Z modulus at lower frequencies and the higher value of charge transfer resistance exhibit higher corrosion resistance [22,39]. For etched and anodized AZ31 samples, the impedance diagram shows the modulus at low frequency is in the order of 10 3 Ω·cm 2 and the impedance magnitude was increased after 24 h due to the formation of corrosion products and decrease in active areas [40]. The phase angle at high frequencies can be used to assess the integrity of coatings (LDHs structure) when exposed to corrosive electrolytes [32]. The phase angle at high frequency for AZ31, E1024, and A1024 close to zero demonstrate complete penetration of corrosive ions to the porous layer [41] while for E1124 and A1124 phase angle is less than 0 (around −50° and −58° for E1124 and A1124, respectively), manifesting that the coating has a higher capacitive behavior, unlike E1024 and A1024. It can be seen that for LDH samples at pH = 10 on both etched and anodized substrates, the impedance modulus at low frequency remained at the order of 10 3 Ω·cm 2 after 24 h. However, for samples A1124 and E1124, the impedance is around 2.89 × 10 4 and 1.92 × 10 4 Ω·cm 2 after 24 h, respectively, which is a bit larger for the anodized samples.
The phase angle at high frequencies can be used to assess the integrity of coatings (LDHs structure) when exposed to corrosive electrolytes [32]. The phase angle at high frequency for AZ31, E1024, and A1024 close to zero demonstrate complete penetration of corrosive ions to the porous layer [41] while for E1124 and A1124 phase angle is less than 0 (around −50 • and −58 • for E1124 and A1124, respectively), manifesting that the coating has a higher capacitive behavior, unlike E1024 and A1024. The time constant at the low frequency of the Bode and Nyquist phase diagrams shows the inductive loop which is due to the adsorption and coverage of Mg ions, involving monovalent and divalent ions, on the surface of etched, anodized, E1024, and A1024 substrates. For these samples, after 6 and 24 h of immersion, the inductive loop still existed, which points out the poor protective properties of the LDH layer. According to the literature, this loop is attributed to the high concentration of magnesium ions in relatively film-free areas or the relaxation of Mg(OH) + , and Mg + absorbed at the surface [42][43][44]. The The time constant at the low frequency of the Bode and Nyquist phase diagrams shows the inductive loop which is due to the adsorption and coverage of Mg ions, involving monovalent and divalent ions, on the surface of etched, anodized, E1024, and A1024 substrates. For these samples, after 6 and 24 h of immersion, the inductive loop still existed, which points out the poor protective properties of the LDH layer. According to the literature, this loop is attributed to the high concentration of magnesium ions in relatively film-free areas or the relaxation of Mg(OH) + , and Mg + absorbed at the surface [42][43][44]. The other time constant for these samples at medium frequency is a capacitance loop with a peak at around −60 • , which can be associated with the response of the charge transfer resistance and the double layer capacitance at the metal/solution interface [27,40].
By increasing the pH of the LDH solution to 11, the inductive loop was less visible until it disappeared for A1124. This shows increased corrosion resistance of substrates by producing LDH at pH = 11 due to the decrease of the lateral size of LDH outer layer and the formation of a more compact layer. Moreover, for samples prepared at pH = 11, we have three time constants (while there are two time constants for samples prepared at pH = 10) which depend on the single or multi-layered structure, and the charge transfer process (the time constants will be discussed in the following paragraphs) [32,45].
The EIS diagrams were fitted by three equivalent circuits Figure 13 and Table 6 present the corresponding fitted data. The EIS test can predict faradaic and non-faradaic components of an electrochemical process [46]. In a faradaic process, the charges can move directly across the metal/solution interface, while in a non-faradaic process, the movement of charges is delayed due to the adsorbed charged molecules at the interface. For this reason, faradic and non-faradaic processes show resistor and capacitor behaviors, respectively. However, experimental results demonstrated that the capacitor, non-ideally, shifts the phase of signals by nπ/2 and called it a constant phase element (CPE). n value varies between 0 and 1 which corresponds to pure resistance and pure capacitance, respectively. The impedance for CPE is shown by the equation below: In this equation Y 0 , and n are characteristic parameters of the CPE [47].
In circuit (a), R s corresponds to the electrolyte resistance, CPE dl is the constant phase element relative to the interface phenomenon (electrochemical double layer), and R ct is the charge transfer resistance. R 1 is a resistance associated with the inductance (L 1 ) [48]. This model was used for fitting bare samples and the LDH prepared at pH = 10 on etched and anodized samples. However, for etched substrate immersing for 24 h, circuit (b) was used as there was no inductive loop.
The equivalent circuit (c) in Figure 13 is used for E1124 and A1124 samples in which R out and R in are used as parameters to reflect the barrier properties of the outer porous and inner dense layers of the coatings, respectively, and their parallel corresponding CPE for reflecting the heterogeneity of coatings [32,49]. R out and CPE out define the behavior of the layers at high frequency while the time constant at medium frequency is described by R in and CPE in [45]. CPE dl and R ct are the parameters that reveal the electrical double layer capacitance at the interface and the resistance of the electron transfer across the metal surface, respectively. Also, the R ct is inversely proportional to the corrosion rate as it is related to the oxidation of magnesium. The general formula for pure capacitance is as follows: In this equation, ε, ε 0 , A, and d represent the dielectric constant of medium and vacuum, testing area, and distance, respectively [50]. According to this equation, the capacitance would decrease by increasing distance and decreasing surface. As shown in Table 6, the value of CPE dl for E1124 and A1124 is in order of 10 −7 Ω −1 ·s n ·cm −2 which can be attributed to the small-exposed surface caused by the protective layer. For sample E1124 at 1h and 6h, the n value is 1 for CPE dl which is representative of a purely capacitive behavior. For the bare substrate and the samples prepared at pH = 10, the CPE dl is approximately two orders of magnitude higher than E1124 and A1124. This is due to the increased exposed area to the aggressive solution caused by an unprotective layer. tance would decrease by increasing distance and decreasing surface. As shown in Table  6, the value of CPEdl for E1124 and A1124 is in order of 10 −7 Ω −1 ⋅s n ⋅cm −2 which can be attributed to the small-exposed surface caused by the protective layer. For sample E1124 at 1h and 6h, the n value is 1 for CPEdl which is representative of a purely capacitive behavior. For the bare substrate and the samples prepared at pH = 10, the CPEdl is approximately two orders of magnitude higher than E1124 and A1124. This is due to the increased exposed area to the aggressive solution caused by an unprotective layer.   (Table 6). For etched and anodized AZ31, Rct was increased with immersion time (Figure 14b). This means by increasing immersion time a Mg(OH)2 layer can be produced on the surface of the substrate and slightly protects it from corrosion [51]. For E1024 and A1024, after 24 h immersion, the Rct reduced from 4.84×10 3 and 3.19×10 3 Ω⋅cm 2 to 2097 and 2140 Ω⋅cm 2 , respectively which is less than the etched and anodized substrates. This indicates the inability of LDH at pH = 10 for protecting substrates which can be attributed to the large lateral size and less dense structure of LDH sheets which leads to partial and incomplete coverage of the surface as well as weak adhesion of the A1024 and E1024 than A1124 and E1124. These layers are not protective and hinder the uniform growth of Mg(OH)2 produced by the corrosion of the substrate and cannot improve the layer barrier properties with immersion time contrary to the cases of etched and anodized samples. As a result, corrosive species can penetrate easily through LDH and reduce the corrosion resistance of substrates. It was visually Figure 13. Equivalent circuits used for fitting the electrochemical impedance diagrams.  Figure 14 shows impedance modulus at the frequency of 0.1 Hz and R ct values for all the samples as well as R in and R out for E1124 and A1124 (Table 6). For etched and anodized AZ31, R ct was increased with immersion time (Figure 14b). This means by increasing immersion time a Mg(OH) 2 layer can be produced on the surface of the substrate and slightly protects it from corrosion [51]. For E1024 and A1024, after 24 h immersion, the R ct reduced from 4.84 × 10 3 and 3.19 × 10 3 Ω·cm 2 to 2097 and 2140 Ω·cm 2 , respectively which is less than the etched and anodized substrates. This indicates the inability of LDH at pH = 10 for protecting substrates which can be attributed to the large lateral size and less dense structure of LDH sheets which leads to partial and incomplete coverage of the surface as well as weak adhesion of the A1024 and E1024 than A1124 and E1124. These layers are not protective and hinder the uniform growth of Mg(OH) 2 produced by the corrosion of the substrate and cannot improve the layer barrier properties with immersion time contrary to the cases of etched and anodized samples. As a result, corrosive species can penetrate easily through LDH and reduce the corrosion resistance of substrates. It was visually observed that after the addition of NaCl solution to the electrochemical cell, the solution was spread on the surface of the samples prepared at pH = 10. This can be the result of increased roughness of the surface at this pH due to the fact that increasing roughness will increase hydrophilicity for surfaces with a contact angle of less than 90 degrees [28].
According to Table 6 and Figure 14b, the R ct after 1h immersion for E1124 and A1124 was 1.21 × 10 4 and 9.20 × 10 4 Ω·cm 2 , respectively, which shows a considerable increase in comparison to E1024 and A1024. This increase shows good corrosion resistance of produced LDH at pH = 11. At this condition, the smaller lateral sheet size led to the denser coating regarding the SEM micrographs (Figure 2 SEM). After 24 h immersion, R ct for E1124 and A1124 was 4056 and 7342 Ω·cm 2 , respectively, which indicates the effectiveness of LDH on the substrates. Moreover, the impedance modulus at low frequency after 24 h for A1124 is only 1.5 times more than E1124 while this value is 15 times more than A1024. This result shows the more significant effect of pH used during the LDH synthesis on the corrosion performance of the layer than the application of a previous anodic treatment at low voltage.

Salt Spray Results
The corrosion behavior of samples with and without epoxy coating was tested using the salt spray test. For this purpose, etched, anodized, and A1124, as the best anti-corrosive LDH sample with the most impedance modulus at the frequency of 0.1 Hz after 24 h (2.9 × 10 4 Ω⋅cm 2 ), were used. The results in Figure 15 show severe corrosion for etched and anodized samples after 6 h of exposure, while for A1124 after 1 day small pits were seen. For the samples with epoxy, etched and anodized substrates failed after 14 days while for However, in the case of LDH on the surface, the nanostructured film obtained at pH = 11 acts as a barrier for preventing the penetration of corrosive Cl − ions to the substrate and induces a dense outer layer and a more compact inner layer with measurable values in these conditions (Figure 14c). Moreover, Cl − ions diffused to the interface of coatings can be trapped into the interlayer and replaced NO 3 − , CO 3 2− , or OH − anions due to the ion exchangeability of the LDH [41,52,53]. These anions can make a boundary layer by forming Mg(OH) 2 or MgCO 3 precipitates and repairing existing microcracks in the film [54]. The better corrosion resistance of A1124 can be observed in Figure 14. It can be concluded that in this case, the effect of pH on the size of LDH and corrosion protection is more considerable than surface treatment. In the work of Wu et al. [14] with the Mg-Al/LDH, the EIS results showed a close amount of impedance modulus at low frequency for samples prepared at pH = 10 and 11 with nearly the same LDH lateral size. However, in this study, there is a big difference between the corrosion resistance of LDH prepared at pH = 10 and 11 (obtained from EIS and evolved H 2 results) which can be attributed to the lateral size difference.

Salt Spray Results
The corrosion behavior of samples with and without epoxy coating was tested using the salt spray test. For this purpose, etched, anodized, and A1124, as the best anti-corrosive LDH sample with the most impedance modulus at the frequency of 0.1 Hz after 24 h (2.9 × 10 4 Ω·cm 2 ), were used. The results in Figure 15 show severe corrosion for etched and anodized samples after 6 h of exposure, while for A1124 after 1 day small pits were seen. For the samples with epoxy, etched and anodized substrates failed after 14 days while for the A1124/Epoxy corrosion couldn't be observed even after 35 days. The salt spray test was also performed on x-cut samples with epoxy coating. The better corrosion resistance of A1124/Epoxy was observed according to Figure 16 by having fewer corrosion products on the cuts in comparison to Etched/Epoxy and Anodized/Epoxy. These results show good corrosion protection and compatibility of the LDH layer with the epoxy coating. The salt spray test was also performed on x-cut samples with epoxy coating. The better corrosion resistance of A1124/Epoxy was observed according to Figure 16 by having fewer corrosion products on the cuts in comparison to Etched/Epoxy and Anodized/Epoxy. These results show good corrosion protection and compatibility of the LDH layer with the epoxy coating. The salt spray test was also performed on x-cut samples with epoxy coating. The better corrosion resistance of A1124/Epoxy was observed according to Figure 16 by having fewer corrosion products on the cuts in comparison to Etched/Epoxy and Anodized/Epoxy. These results show good corrosion protection and compatibility of the LDH layer with the epoxy coating.

Discussion
For the formation of LDH, first the anodic coating or etched surface of AZ31 would be dissolved in a sufficient alkaline solution and form Mg 2+ and OH − [55]. The chemical and physical morphology of LDH is transformed according to the OH − concentration [55]. At high pH, temperature, and pressure (the condition inside of autoclave) more Mg is dissolved and there are more Mg 2+ cations [14]. To test this claim, the same procedure as LDH production was repeated on etched and anodized substrates but this time without Al(NO 3 ) 3 compound in the solution. According to Chen et al. [55] when there aren't any extra Al compounds in the solution, MgAl 2 (OH) 8 ·H 2 O as Al-rich compound, and consequently, LDH cannot be formed. Therefore, only a small amount of Mg-rich compound (Mg 2 Al(OH) 7 ) can be transferred to Mg 2 CO 3 (OH) 2 ·3H 2 O and Al 5 (OH) 13 (CO 3 )·5H 2 O [55], and the top layer is covered by Mg compounds. In Figure 17 cross-section SEM images and EDS of these samples can be seen.
In these images, unlike samples with LDH, the Al elements are evenly distributed and not concentrated on the surface. Moreover, the top layer containing Mg and O elements, shows a larger thickness at pH = 11, illustrating the existence of more Mg at this pH (moreover, Mg(OH) 2 is thermodynamically stable at pH > 10.2 [56] and has low solubility in water, with a solubility product constant of 1.5 × 10 −11 [57]). For this reason, while the formation of LDH at pH = 11, there would be more Mg 2+ cations. By having more concentration of Mg 2+ , the structure is changed to a smaller lateral size to have more area between the substrate and newly formed LDH for consuming Mg cations. Moreover, according to Olf et al. [58], the lower concentration of effective OH − in weak bases increases the growth and decreases the nucleation of crystals while for the strong base (higher effective OH − concentration) the nucleation of crystals increases. When the nucleation rate is higher than the growth rate small-sized crystals are made at the same time, however, at a slow nucleation rate, fewer crystals with bigger sizes are formed [59]. Therefore, we can conclude that at pH = 11 nucleation is more than pH = 10 which leads to a smaller size LDH. As a reason, small-sized LDHs would be produced which are more compact and can cover the surface better than bigger-sized LDH and are more protective (as previously proved) against corrosion.
LDH production was repeated on etched and anodized substrates but this time without Al(NO3)3 compound in the solution. According to Chen et al. [55] when there aren't any extra Al compounds in the solution, MgAl2(OH)8·H2O as Al-rich compound, and consequently, LDH cannot be formed. Therefore, only a small amount of Mg-rich compound (Mg2Al(OH)7) can be transferred to Mg2CO3(OH)2·3H2O and Al5(OH)13(CO3)·5H2O [55], and the top layer is covered by Mg compounds. In Figure 17 cross-section SEM images and EDS of these samples can be seen. In these images, unlike samples with LDH, the Al elements are evenly distributed and not concentrated on the surface. Moreover, the top layer containing Mg and O elements, shows a larger thickness at pH = 11, illustrating the existence of more Mg at this pH (moreover, Mg(OH)2 is thermodynamically stable at pH > 10.2 [56] and has low solubility in water, with a solubility product constant of 1.5 × 10 −11 [57]). For this reason, while the formation of LDH at pH = 11, there would be more Mg 2+ cations. By having more concentration of Mg 2+ , the structure is changed to a smaller lateral size to have more area between the substrate and newly formed LDH for consuming Mg cations. Moreover, according to Olf et al. [58], the lower concentration of effective OHin weak bases increases the growth and decreases the nucleation of crystals while for the strong base (higher effective OH − concentration) the nucleation of crystals increases. When the nucleation rate

Conclusions
The Mg-Al/LDH films were successfully produced on AZ31 magnesium alloy with different surface treatments by in-situ hydrothermal treatment at pH 10 and 11. Surface morphology, crystalline structure, and corrosion properties were investigated for each sample. The results showed that the lateral and crystal size of LDH and corrosion resistance were affected by pH changes more than surface treatment. LDH prepared at pH = 11 had small size, dense, uniform structure, and good adhesion to the substrate that could protect penetration of corrosive species more than samples prepared at pH = 10. Anodic coating prior to the formation of LDH could slightly enhance the corrosion resistance of substrates. The LDH sample showing the most improved corrosion performance was used for surface pretreatment before applying epoxy resin. The adhesion and compatibility of the epoxy coating applied on prior anodized samples are strongly improved by LDH growth at pH 11.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.