Abstract
A modelling approach that combines a previously developed 2D continuum finite element model with machine learning to support the design and evaluation of corrosion-inhibiting coatings. The FEM simulates the leaching of corrosion inhibition pigments from an organic coating and the resulting protection of the metal surface. This is conducted for a system of aluminium alloy 2024-T3 with an active protective coating loaded with lithium carbonate particles. A generated dataset from FEM results was used to train ML models to predict inhibitor concentration and corrosion current density based on geometric and material input parameters. A feature importance analysis was conducted to identify the most influential input variables, providing insight into the factors controlling the achievement of corrosion inhibition. Furthermore, a blind test was performed using five unseen cases that were not involved in the training phase. Finally, the trained models were applied to explore their use in coating design.
Similar content being viewed by others
Introduction
Aluminum alloys are widely used in various industries due to their favorable mechanical properties, lightweight nature, and corrosion resistance1. These properties can be adjusted by modifying the alloy composition, allowing for application-specific performance improvements2,3. Despite their inherent corrosion resistance, aluminium alloys can degrade in highly aggressive environments, such as extreme pH levels, high loads of chlorides, high humidity, and elevated temperatures, all of which can disrupt their passive oxide layer and accelerate localized corrosion processes4,5. To enhance their functionality and corrosion resistance, different corrosion protection methods have been attempted, including surface pretreatments and protective coatings6. Among these, hexavalent chromium-based compounds have historically been the most effective corrosion inhibitors7. However, due to their carcinogenic nature and environmental toxicity, their use is increasingly restricted and is being phased out8.
In response to the phase-out of hexavalent chromium-based coatings, research efforts have focused on identifying alternative corrosion protection strategies with comparable efficacy. Active protective coatings have emerged as a promising solution, as these systems offer passive protection by physically isolating the metal surface through coatings9. More importantly, they can also offer active protection capabilities in case of damage to the coating layer. Corrosion inhibitor pigments embedded within the coating matrix dissolve and migrate towards the exposed surface, where they interact with it, creating a new protective layer and restoring inhibiting ions or molecules. Although the search for an efficient corrosion inhibition pigment is still ongoing, lithium-based compounds have emerged as promising candidates. Their protection efficiency results from the high protection and irreversibility of the formed layer on the metal surface, along with their high throwing power10,11,12,13.
The selection, design, and validation of active protective coatings require extensive experimental efforts. This process typically begins with screening of numerous molecules to identify suitable candidates, followed by testing under both laboratory and operational conditions to evaluate their performance. Given the time and resources required for these steps, various numerical approaches have been introduced to support the development process, helping to reduce the experimental workload and accelerate coating optimization14,15,16. Recent advances in multiscale mechanistic modeling have enhanced our understanding of corrosion processes in pure aluminium14, as well as different aluminium alloys and their heterogeneous phases15,16. These efforts have led to the development of mechanistically representative and experimentally validated models that serve as a foundation for further extensions. Building on this groundwork, models have been developed to incorporate the effects of corrosion inhibitors, enabling simulation-based evaluation of protective strategies17,18,19. While these models offer the advantage of testing different configurations and parameters without extensive experimental campaigns, their complexity and the amount of details implemented increase computational demands. Specifically, many of the implemented mechanisms require smaller time steps and finer mesh sizes, leading to longer computation times and greater resource requirements.
In parallel, machine learning (ML) approaches have gained traction across multiple domains, including the identification of promising corrosion inhibitor candidates7,20,21,22. Although training ML models requires initial investment in data and computational resources, once trained, they offer fast predictions and scalability. This opens the door to hybrid approaches that combine the mechanistic depth of physics-based models with the efficiency and adaptability of ML, potentially accelerating the design and optimization of active protective coatings. Decision tree-based models, such as Random Forests (RF) and gradient boosted trees, have become increasingly relevant in materials science, particularly in scenarios where data availability is limited. Decision tree-based approaches are among the most accessible and effective machine learning tools for accelerating materials discovery and understanding structure-property relationships23. Unlike neural networks, which often require large datasets to generalize effectively, tree-based models can extract meaningful relationships from relatively small datasets. This makes them especially suitable for applications like corrosion prediction and inhibition, where experimental data is costly and sparse7,24,25, and for quantitative structure–property relationship modelling, where the goal is to link molecular descriptors to properties of the molecules22,26.
Meanwhile, workflows that combine multiscale mechanistic modelling with machine learning (ML) have been used in prior studies to predict corrosion, for example, in galvanic corrosion prediction27,28, and to investigate material failure driven by stress corrosion29,30. In these approaches, mechanistic models are first developed to represent the underlying processes, and their key outputs are assessed against an appropriate validation procedure. After validation, the mechanistic simulations are used to generate training data for an ML model. In studies of galvanic corrosion between aluminium alloys (AA) and stainless steel27,28, the input features included chloride ion concentration, geometric parameters, and the local temperature, while the learning target was the probability density function of the surface current per width. Using decision-tree-based ML methods, both studies demonstrated that this workflow can yield credible predictions at substantially reduced computational cost. However, to the authors’ knowledge, this strategy has not yet been applied to predicting corrosion protection provided by inhibitor pigments in an active protective coating. The present work addresses this gap by adopting a similar workflow, using a closely related dataset tailored to the objectives of this study.
In this study, decision tree-based models are used to predict corrosion inhibition on AA2024-T3, after two hours of simulation time, accounting for variations in geometric configurations and initial pigment volume concentrations, with lithium carbonate as the corrosion inhibition pigment. The training dataset for the ML model is generated using a predefined multiscale mechanistic finite element model (FEM) detailed in ref. 31, which accounts for the surface of AA2024-T3 coated with an active protective coating consisting of two distinct layers, topcoat and primer, with an artificial defect through the coating layers, exposing the alloy surface to an electrolyte film. The FEM solves for pigment release and the expected particles` movement and dynamic interactions within the coating, AA2024-T3 surface, and the surrounding electrolyte, over time. The results of this model include key corrosion descriptors—specifically, inhibitor ion concentration and corrosion current density—which serve as the targets for the ML model, while the geometric configuration and pigment concentration serve as input. The dataset comprises 231 data points, comprising the output of 231 FEM simulations for five varying input parameters: defect width, defect depth, primer thickness, water layer thickness, and initial pigment volume concentration of lithium carbonate within the coating. Two ML ensemble algorithms that utilize decision trees—RF and eXtreme Gradient Boosting (XGB)—were trained and evaluated using cross-validation (CV) to ensure robust performance and generalizability. Once trained, the ML models can deliver fast predictions, significantly reducing computational time compared to mechanistic simulations. This efficiency enables the use of ML for coating optimization by evaluating various geometric configurations and helping to identify those that provide the best corrosion protection. To gain further insight into the decision-making process of the ML models, a feature importance analysis was conducted. Feature importance quantifies the contribution of each input parameter to the model’s predictions, helping to identify which factors most strongly influence corrosion behavior. To further evaluate the generalization capability of the trained ML models, a blind test was conducted using five additional geometric configurations separate from the training dataset; their corrosion behavior was first simulated using the FEM and then predicted by the ML models to assess performance on completely unseen data. With the evaluated ML models, a test case is introduced for optimum coating design for a certain set of geometrical parameters.
Results and discussion
Impact of dataset size on model performance
Through processing the previously constructed 231 FEM cases, a dataset suitable for training an ML was generated. As outlined in subsection “Utilizing FEM simulations for dataset generation”, the input parameters were variations of the parameters listed in Table 4. Feature distribution across cases is plotted in Supplementary Fig. 1. More data points were dedicated to PVC variation, as it is one of the main controlling parameters for critical processes such as dissolution and leaching32, which are eventually reflected in the concentration of the released inhibitor particles. Variation in the remaining features was limited, considering they are mainly influence diffusion of the species across the solution domain. The output variables were derived based on the assumption that the region with the least protection on the aluminium alloy surface corresponds to the location with the lowest lithium-ion concentration. Consequently, for each simulation case, the dataset includes the minimum lithium-ion concentration value along with the corresponding current density at the same location. Both targets were extracted from the metal surface in 2 h of physical time. Distribution histograms of the two target metrics are provided in Supplementary Fig. 2.
The influence of dataset size on the predictive performance of the ML models was investigated by systematically increasing the amount of training data. The input features include defect width, defect depth, primer thickness, water layer thickness, and pigment volume concentration and are used to predict corrosion current density and inhibitor concentration. Detailed explanations of these input parameters and the outputs are provided in subsection “Utilizing FEM simulations for dataset generation” and Table 4.
Model training was conducted using a Scikit-learn pipeline, consisting of two primary steps: normalizing the input features to the range [0,1], followed by training of the respective machine learning model. Two ensemble-based regression algorithms were considered: XGB and RF. A fivefold CV approach was employed to evaluate model performance. In k-fold CV, the dataset is divided into k equal subsets; each subset is used once as a validation set, while the remaining k − 1 subsets are used for training. The procedure is repeated k times, and the resulting error metrics are averaged over all folds to obtain a robust performance estimate. The performance was evaluated using two different metrics: normalized root mean square error (NRMSE) and the coefficient of determination (R2). The NRMSE provides a scale-independent measure of prediction error, normalized by the range of the target values. The R2 score quantifies the proportion of variance in the target variable explained by the model.
To assess the impact of training dataset size, the full training process was repeated over four rounds. In the first round, 40% of the total dataset was used. In each subsequent round, an additional 20% of data was included, culminating in the use of all 231 samples by the final round. At each stage, the available data were subjected to a fivefold CV, with training and test sets increasing proportionally as more data were introduced. To reduce the influence of randomness in the data partitioning process and obtain more stable performance estimates, the CV procedure was repeated 10 times in every round. Figure 1 presents the results for each round, including the standard deviation across repeats, which decreases with increasing dataset size, suggesting greater stability and confidence in the model’s predictions. For every round, both training and test errors are recorded, and as expected, the training error is consistently lower than the test error. Overall, both errors decrease with an increasing number of training examples. As the dataset size increases, NRMSE decreases and R2 increases (see Supplementary Fig. 4), indicating enhanced predictive accuracy. When trained on only 40% of the data, the XGB model exhibits a test NRMSE of approximately 0.15, reflecting limited ability to capture the underlying data structure. In contrast, training on the full dataset yielded a test NRMSE of 0.11 and a training error of 0.09, demonstrating high accuracy. Across all rounds, the gap between training and test error is smaller for XGB than for RF, indicating more overfitting for RF, which justifies the focus on XGB in this paper, while RF results are provided in Supplementary Table 2. For comparison, a simple NN was trained as a baseline. Its best performance occurred at 80% of the dataset, achieving a training NRMSE of 0.15 with R2 = 0.40 and a test NRMSE of 0.15 with R2 = 0.30, which is notably lower than the tree-based models, which reinforces their advantage for this task. Details on the NN results can be found in Supplementary Fig. 5 and Supplementary Subsection Neural Network Hyperparameter Grid.
Sixfold cross-validation results for a XGBoost and b Random Forest models trained on progressively larger subsets of the dataset. Training size was increased in 20% increments, starting at 40% of the full dataset. Normalized root mean square error (NRMSE) decreases with larger training sets, indicating improved model accuracy. Shaded regions around the curves represent the standard deviation across repeats.
Despite the improvements in accuracy with increasing dataset size, the gap between training and test errors indicates residual overfitting, particularly at smaller dataset sizes, where variance across folds is higher. Although overfitting diminishes as more data are introduced, it cannot be fully excluded, which highlights the need for caution when extrapolating beyond the observed data range. Consequently, while the model shows promising performance within the available dataset, its ability to generalize to unseen or substantially different data cannot be fully confirmed and would benefit from further validation in future studies.
Figure 2 presents scatter plots comparing the predicted and actual values for the target variables across both training and test sets for the XGB model. The predictions align closely with the perfect correlation line, especially for inhibitor concentration, indicating that the models are capable of capturing the underlying trends in the data with high accuracy. This observation is supported by strong performance metrics (see Fig. 1). Among the targets, predictions for current density exhibit more scatter compared to inhibitor ion concentration, resulting in higher error values. Specifically, the NRMSE for current density is 0.19, compared to 0.03 for inhibitor concentration. Details on the performance across the different dataset sizes can be found in Supplementary Table 1. Nevertheless, the overall predictive performance remains robust across all targets.
Prediction of the training and test set of one of the folds in the sixfold cross-validation of the XGBoost model with the full dataset of 231 data points.
To understand the reasoning behind the performance of each target, it is necessary to revisit the processes occurring in reality and their mapping within the FEM framework. For inhibitor concentration, the governing processes can be separated into dissolution, influenced mainly by the initial PVC, and diffusion, which is more sensitive to changes in geometrical parameters. Meanwhile, current density is driven by a broader set of factors: the concentrations of redox reactants and products, their concentration-limiting behavior, the inhibitor concentration, and the evolving surface potential of the metal33. Each of these factors depends on the rates of multiple homogeneous reactions, which are themselves influenced by geometry parameters and initial PVC values. Furthermore, the working mechanism of lithium carbonate as an inhibitor adds an additional layer of complexity34. Its protective effect requires alloy corrosion to initiate the formation of double-layered hydroxide (LDH) and evolve it into a stable layer. As this process proceeds, current density values tend to vary accordingly, making it more difficult to predict its behavior. Though the LDH formation process is not explicitly implemented in FEM, the redox kinetics and consequently, the current density values of the metal surface are a response to the different initial lithium carbonate concentrations and thus are representatives of the level of layer formation.
Feature importance
To gain insights into the relative influence of each input parameter on the predictions of inhibitor concentration and current density, a feature importance analysis was conducted for both the XGB and the RF model trained on the full dataset of 231 cases. Feature importance in RF is derived from the average decrease in impurity (e.g., mean squared error) across all decision trees, offering a quantitative measure of how much each feature contributes to reducing prediction error35. The results of the RF feature importance can be found in Supplementary Fig. 6. In XGB, feature importance is evaluated based on the average gain, which quantifies the improvement in the objective function of the model contributed by splits involving each feature across all trees. The results are displayed in Fig. 3.
Evaluation of feature importance in the XGBoost model.
The features in the dataset are at most weakly correlated. Water layer thickness shows the highest correlation of 0.07 with both primer thickness and PVC, which still indicates only a very weak linear relationship (further correlation coefficients are provided in Supplementary Fig. 3). The most important feature is the water layer thickness, which influences the availability of oxygen, due to consumption near the electrode and the rate of replenishment from the air-electrolyte interface, as well as the average concentration of the inhibitor in the electrolyte. A thicker water layer increases the diffusion path length for dissolved oxygen, reducing oxygen flux to the metal surface where oxygen is consumed by the cathodic reduction reaction (Eq. (5)). This increases the likelihood that the system reaches an oxygen-transport-limited regime (diffusion-limited cathodic current density), thereby constraining the overall corrosion rate36. Additionally, a larger water layer dilutes the released inhibitor ions, reducing their concentration in the electrolyte and increasing the time to reach the critical inhibitor concentration.
PVC showed the second-highest importance in the XGB model. This reflects its crucial role in determining how much corrosion inhibitor enters the electrolyte and consequently reaches the electrode. Seeing as the amount of inhibitor ions on the metal surface is a direct influencer on the corrosion rate of the homogeneous surface (as implemented by FEM boundary conditions in Table 3, this feature is expected to play a significant role. According to the percolation model, the leaching behavior from the primer changes significantly with PVC—a finding also supported by previous work12,31,37. At lower PVC levels, the slower formation of the percolated water channels is limiting inhibitor release and preventing its arrival to the critical concentration needed for protection, near the alloy surface. In contrast, higher PVC values promote the formation of these pathways, enhancing inhibitor dissolution, leaching and consequently its availability in the electrolyte. This explains the strong influence of this feature.
On the other hand, defect depth was assigned the lowest importance by the XGB model. This can be rationalized by how the FEM assumes a homogeneous AA2024-T3 surface and predicts the local/current density rather than the total corrosion current. Increasing defect depth primarily increases the geometric surface area of the defect sidewalls (and thus could increase the total current), but when the output is normalized by area (current density), this geometric scaling is largely removed. Under these assumptions, defect depth does not substantially alter the kinetic boundary conditions of the electrode. As a result, the model recognizes it as a relatively minor contributor in comparison to the other features.
The comparably lower influence of defect width on corrosion current density can be rationalized similarly to defect depth. In contrast, defect width plays a more important role for the minimum inhibitor concentration target as it influences the lateral distance separating the coating (pigment reservoir) from the edge of the defect. A wider defect increases the diffusion/transport path from the coating edge into the defect, requiring a higher inhibitor availability to achieve the same protective effect, causing it to have a relatively higher importance compared to the defect depth feature.
The final feature is primer thickness, which shows an importance higher than defect depth but lower than defect width. Primer thickness can influence water uptake and pigment packing density, and consequently, the formation of percolated water channels and the release of inhibitor ions37. However, within the thickness range considered, their net impact appears secondary compared with defect width. This could explain the intermediate feature importance observed.
Blind test
To assess the performance of the ML model beyond the training data and evaluate its ability to generalize, a blind test was conducted. The objective was to determine whether the model could make accurate predictions for cases not included in the training dataset, and provide a more realistic indication of its applicability in practical settings. For this purpose, nine new simulation cases were generated using the same FEM approach that was used to generate the training data. These cases featured geometric configurations that had not been previously seen by the ML model but were within the variance set by the used training data and were specifically designed to test its predictive power under novel conditions. The blind test cases aim to cover the range of each individual input feature, as can be seen in Supplementary Fig. 1. The input parameters for these blind test cases are listed in Table 1.
Model robustness and blind-test prediction reliability were evaluated through ten repetitions of the full training procedure, including feature scaling, grid search, and subsequent XGB regressor construction with the optimal hyperparameters. A final model was subsequently trained on the complete training dataset with the optimized hyperparameters. The resulting ensemble of ten final models was applied independently to the blind test set. The mean of the ten predicted outputs was taken as the final prediction, which is presented in Fig. 4. During the evaluation of the blind test set, one case with an inhibitor concentration of 17.91 (Blind Test Case 9) was identified as a strong outlier. While its parameters are within the variance of the training data, it is located at the edge of the known data space (see Supplementary Fig. 2). Approximately 95% of the training samples exhibit inhibitor concentrations of 17.91 or lower, meaning that higher concentrations occur only infrequently in the training distribution. As a result, the model has limited exposure to such values, and reliable predictive performance in this concentration range cannot be ensured. This limitation is reflected in the prediction for the blind test case 9, where a substantial overestimation of the inhibitor concentration is observed. This finding demonstrates that the model validation stage is eminently crucial to probe the domain of applicability of a predictive model, especially if the available training data set is small. That means, blind-test cases located near the boundaries of the parameter space can exhibit increased errors, which can be attributed to sparse sampling and physical nonlinearities in these regions. This limitation is explicitly acknowledged, and future work could address it through more systematic sampling of the parameter-space boundaries. To facilitate a fair assessment of the developed model, test case 9 was excluded from the main analysis presented in the main body of the manuscript. A plot including this case is provided in Supplementary Fig. 7 for completeness. All subsequent analyses are based on the remaining eight blind test cases.
Prediction of inhibitor concentration and current density values compared to the obtained results for the FEM eight blind test setups stated in Table 1.
For the inhibitor concentration, the model demonstrated good predictive performance with an NRMSE of 0.04. Six out of eight cases were well predicted, with two notable outliers for cases 7 and 8 in Table 1. As both cases correspond to the maximum primer thickness included in the dataset (40 μm), the observed behavior likely reflects a limitation in model accuracy near the edges of the sampled feature space. This aligns with the trends observed during CV, where the inhibitor concentration consistently yielded lower prediction errors. In contrast, current density predictions were slightly less accurate, with an NRMSE of 0.19. This discrepancy indicates that the current density is a more challenging target variable for the model. This conclusion is reinforced by the sensitivity analysis, which shows that current density exhibits stronger nonlinear and asymmetric behavior than inhibitor concentration, likely due to higher intrinsic variability or more complex underlying dependencies, as already described in subsection “Utilizing FEM simulations for dataset generation”. A complete table containing the individual prediction values for current density and inhibitor concentration for the nine blind test cases, including the removed outlier (Table 3).
Coating optimization using an ML model
Since the developed ML models serve as a bridge between data-driven prediction and physics-based understanding through linking ML with FEM, one of the key advantages of the ML model is its ability to quickly predict inhibitor concentration and current density for different coating configurations. This is advantageous for the process of coating design, as it provides the possibility to test selected designs in different operation conditions and possible defect geometries to examine their effectiveness limits. Pursuing this through ML removes the need for time-consuming simulations or experiments while maintaining the prediction accuracy established in validated FEM.
For a proof of concept, Fig. 5 presents a case with parameter values of W2 = 100 μm, H3 = 100 μm and δ = 1000 μm and varying primer thickness H2, and PVC values, is evaluated. A crucial condition for an operation corrosion inhibitor is to surpass the critical concentration for inhibition. For the lithium carbonate pigment understudy, a critical concentration of 5 mM or 5 mol/m3 is needed12. In Fig. 5, a dashed line marks the critical inhibition concentration of lithium carbonate for AA2024-T3, as a reference. For the stated case, this critical threshold is reached in all primer thicknesses, but not for all initial PVC values. In the case of the 14 μm thickness, it is reached at PVC values higher than 9%. While for 24 μm thickness, it is reached at values higher than 7.5% PVC. Meanwhile, for the 40 μm primer thickness, the threshold is met at all PVC values. The impact on corrosion inhibition could be observed in the corresponding values of current density on the right axis. It is noted that at values below the critical concentration, current density values tend to increase or remain at high values. However, at concentrations exceeding the critical concentration, current density values tend to decrease with the increase of inhibitor concentration values, proving the prediction to be consistent. Similarly, examining the variations in the parameters of Table 4 could give an insight into the operation limits of the inhibition of lithium carbonate and the optimum design needed for the considered defects.
Maximum inhibitor concentration in mol/m3 on the left axis and minimum current density in A/m2 on the right axis. The effect of different primer thickness is demonstrated in the multi-figure with values of a 14 μm, b 24 μm, and c 40 μm. The dashed blue line represents the critical inhibition concentration for lithium carbonate on AA2024-T3.
To conclude, in this work, a workflow combining ML modelling and FEM is developed to optimize the design and evaluation of active protective coatings for aluminium alloy 2024-T3. A previously developed FEM was used to generate a dataset comprising 231 simulation cases with varying geometric parameters and multiple initial inhibitor pigment concentrations. Random Forest and XGBoost models were trained on this dataset, and the XGBoost model demonstrated strong predictive performance, achieving an R2 score of 0.73 and an NRMSE of 0.1. Overall, the performance for the prediction of inhibitor concentration (R2: 0.91 − NRMSE: 0.03) was more robust compared to current density (R2: 0.54 − NRMSE: 0.19). Feature importance analysis revealed that pigment volume concentration and water layer thickness were the most influential parameters. This observation is further substantiated by the feature-wise sensitivity analysis, which reveals that PVC and water layer thickness induce both high-magnitude and strongly asymmetric responses in the two targets, highlighting their nonlinear influence on the system behavior. In the following blind test, the ML model showed good predictive accuracy for inhibitor concentration with an NRMSE of 0.04 and acceptable performance for current density with an NRMSE value of 0.19. Finally, the trained ML model was applied to a test case aimed at exploring the optimal design and the operational limits of a coating with a fixed defect geometry. The model captured the relationship between inhibitor ion concentration and current density, showing a reduction in corrosion activity once a critical concentration was reached. Overall, this approach offers a basis for modelling complex corrosion systems while reducing computational demands compared to purely mechanistic simulations. By combining the physical accuracy of FEM with the predictive efficiency of ML, the workflow enables fast exploration of coating designs and operating conditions, supporting fast and effective optimization. Furthermore, this workflow enables coating designers to assess the operating limits of candidate coating formulations and their corrosion-protection performance using a small set of directly relevant descriptors. It is necessary to mention that this workflow might propagate the errors of FEM into ML. While the current FEM attempts to limit those errors through the choice of the model’s tuning parameters, the fact remains that the simplification could be causing estimation inaccuracies. Also, this workflow could only serve within the input range used for the ML training, and extrapolation outside this range would result in unreliable ML predictions.
Methods
Utilizing FEM simulations for dataset generation
A previously developed 2D continuum finite element model (FEM) is used to simulate corrosion on a homogeneous aluminium alloy 2024-T3 surface, along with the leaching of corrosion inhibition pigments from a coating covering the alloy surface and the consequent corrosion inhibition. A Multi-ion Transport and Reaction software tool, MIoTraS38, is used to build the model and solve it over time. For the purposes of this paper, the geometry seen in Fig. 6 is used, consisting of the AA2024-T3 surface covered with a coating consisting of two distinct layers: a primer, which is loaded with lithium carbonate as a corrosion inhibition pigment and a topcoat forming an isolation layer for the primer. An artificial U-shaped defect through the coating and the metal surface is introduced. The entire geometry is covered with a water layer. A structured triangular mesh is used, with a minimum element size of 2 μm near the electrodes and within the primer region. The element size is kept constant away from these regions up to a specified threshold distance, beyond which the mesh is gradually coarsened in both the horizontal and vertical directions using a growth factor of 1.1. This choice was informed by a mesh convergence analysis presented in ref. 31, where a mesh size of 2 μm was identified as achieving a suitable compromise between error reduction and computational efficiency. Physical time steps are kept limited in size to ensure sufficient accuracy of the simulated results and to avoid convergence issues. Consequently, the model makes use of an exponential time stepping technique with an initial time step of 0.01 seconds and a growth factor of 0.01 per time step. The time steps are limited to a maximum of 15 s. It is significant to point out that the FEM error will propagate in the dataset toward the ML model. In preparation for this, FEM attempted to limit error sources through the following approach for meshing and time stepping. This was also attempted through control of the solvers’ convergence criteria as stated in ref. 31.
Model geometry representing a 2D cross-section of a typical paint system with primer and topcoat, and an electrolyte layer covering the paint and the defect.
The full model, including the system of equations solved, defined species and input parameters, is described in a previous publication31. However, it is necessary to briefly introduce the main outlines of the model. Mass and charge conservation form the basis of the model and are given in Eqs. (1) and (2). The former equation (1) describes the temporal evolution of the concentration ck of species k, accounting for transport through the species flux Nk (e.g., diffusion and migration) and for homogeneous reactions represented by the volumetric source term Rk. The list of homogeneous reactions employed in the model can be found in Table 2.
Charge conservation is expressed by Equation (2), which relates the time variation of the free charge density q [C/m3] to the divergence of the local current density \(\vec{j}\,[{\rm{A}}/{{\rm{m}}}^{2}]\).
To represent the primer coating loaded with inhibitory pigments, additional equations are introduced. Pigments are assumed to be uniformly dispersed spherical particles with an average initial radius r0. Upon water ingress, the particles dissolve with respect to their solubility limit Ks and the released inhibitor ions are transported through the coating via water-filled pathways, i.e., leaching32. To capture the progressive increase in transport as dissolution proceeds and water channels develop, the effective diffusion coefficient of inhibitor ions in the primer is treated as time-dependent and expressed as:
where Daq is their diffusion coefficient in aqueous media and f(t) is an evolution factor. Factor f(t) is defined using Eq. (4). The first term represents baseline diffusion through water bound to the primer matrix, proportional to the bound-water fraction w and scaled by a constant f1. The second term accounts for the progressing transport associated with the formation of connected water channels as pigments dissolve. This contribution is parametrized by f2 and depends on the initial pigment volume fraction v(0), the remaining undissolved pigment fraction v(t) and a threshold void fraction vr (the volume fraction of created voids at the midpoint of percolation). Factor k takes into account the increased probability of path formation with the increase of the dissolved pigment fraction39,40. The final term rules out the initial percolation contribution so that it is zero at t = 0 (i.e, when v(t) = v(0))
Electrode reactions at the alloy surface are modeled as oxygen reduction (cathodic) and aluminium oxidation (anodic):
The corresponding boundary conditions are prescribed using a Butler-Volmer formulation, as follows:
where J denotes the total current density associated with the redox reactions. cox and cred are the concentrations of the oxidized and reduced species, respectively. V is the metal surface potential, and U is the potential of the electrolyte phase adjacent to the electrode, kan and kcath are the anodic and cathodic reaction rate constants, while α and β are the anodic and cathodic charge transfer coefficients. Their values depends on the concentration of the inhibitor Li2CO3 as presented in Table 3. The values were previously fitted through the use of dynamic polarization measurements in ref. 19. Integers nan and ncath represent the number of electrons involved in the anodic and cathodic half-reactions, respectively. The temperature T is assumed constant at 25 °C. Finally, F is the Faraday constant, and R is the gas constant.
Since the electrolyte layer is exposed to the atmospheric condition, a boundary condition of constant concentrations of oxygen and carbon dioxide is imposed at the top of the electrolyte layer to represent the air–electrolyte interface. The oxygen concentration is set equal to its saturation value at room temperature, ensuring that transport across the interface occurs only when oxygen is depleted within the electrolyte.
The FEM solution includes the change in the 2D concentration maps of the predefined species in the different solution domains, including electrolyte species, dissolved air species, metal corrosion reaction products or dissolved corrosion inhibitor ions and their follow-up reactions, in addition to the potential, and current density of the metal surface. However, for a targeted ML model, focus was placed on the most representing parameters of the FEM model. Geometry values and initial lithium carbonate pigment volume concentrations (PVC) are varied to construct multiple cases with varying initial conditions. A list of the specific model input parameters and their values could be found in Table 4. With the different combinations of the parameters, 231 model cases were constructed for a simulation time of two hours. Since the model assumes an effectively homogeneous alloy surface (i.e., no explicit IM particles), it cannot resolve microstructure-driven localized corrosion features. Consequently, the inhibition performance is summarized using a single-point worst-case descriptor within the model framework, corresponding to the least protected condition predicted by the simulation. Consequently, the targets were chosen to be: the minimum concentration of lithium-ion on the electrode surface resulting from the dissolution of lithium carbonate, and the corresponding corrosion current density at the same location. These output were chosen as the most indicative parameters to monitor the changes in the electrode oxidation reaction and how it is influenced in terms of corrosion inhibition.
A local sensitivity analysis was conducted and evaluated at 2 h of simulated time. The parameters listed in Table 4 were varied one at a time, with perturbations up to ±10% about their baseline values. For some parameters (primer thickness and defect depth), the perturbation magnitude was limited to approximately ±8% or ±9% because these quantities were restricted to integer-valued increments. The responses of the target outputs (i.e., minimum inhibitor ion concentration and the corresponding current density) are reported in Tables 5 and 6. Based on these results, sensitivity coefficients (defined as the change in output per unit change in input) were calculated. To facilitate comparison among the effects of different parameters, normalized sensitivity coefficients were also computed. It is observed that the minimum inhibitor concentration and current density have similarly low sensitivity to defect width and depth, with normalized sensitivities below 0.35 in all cases. In contrast, primer thickness has a markedly different effect on the two outputs: current density exhibits a strongly asymmetric response (normalized sensitivity of 3.75 for −8% and 0.01 for +8% perturbations), whereas inhibitor concentration responds symmetrically (1.07 for both perturbation directions). Variations in initial PVC and water layer thickness also induce asymmetric responses in both outputs; however, the asymmetry is more pronounced for current density, indicating higher nonlinearity.
Regression methods
The choice of targets is explained by the most representative descriptors of the state of the metal, whether corrosion or corrosion inhibition. The inhibitor ions are the main active components that motivate the process of protective layer formation. Meanwhile, current density is a direct indicator of the corrosion rate of the surface.
To predict inhibitor concentration and current density, two types of machine learning (ML) models were trained: Random Forest (RF) and eXtreme Gradient Boosting (XGBoost). RF is an ensemble learning method that builds multiple decision trees during training and outputs the mean prediction of the individual trees35,41. XGBoost is a more advanced ensemble method based on gradient-boosted decision trees42. It sequentially builds trees where each new tree attempts to correct the residual errors of the previous one, and includes regularization to enhance performance and reduce overfitting. The models were trained on a dataset comprising 231 data points, with each sample described by five input features: defect width (μm), defect depth (μm), primer thickness (μm), water layer thickness (μm), and pigment volume concentration (%). The models were used to predict four target variables: the minimum and maximum inhibitor concentration in mol/m3, as well as the minimum and maximum current density in A/m2.
Prior to training, all input features were scaled using the MinMaxScaler from the scikit-learn library43. This method transforms each feature to the range [0, 1]. Feature scaling is particularly important for tree-based models when used with hyperparameter tuning and regularization, as it ensures that features contribute equally to the model and improves convergence during optimization. To identify the optimal hyperparameters for both RF and XGBoost models, a grid search was conducted. This technique systematically explores a specified set of hyperparameter combinations and evaluates each using CV. The best-performing parameter set, based on the average CV score, was then selected for model training in each CV step.
To ensure robust model evaluation and prevent overfitting, a sixfold CV approach was employed. In this method, the dataset is randomly partitioned into six equally sized folds. During each iteration, one fold is reserved as the test set, while the remaining five are used for training. This process is repeated six times so that each fold serves as the validation set exactly once. The performance metrics are then averaged across all folds to provide a reliable estimate of model generalizability.
Data availability
The data used for this study is available at Zenodo via https://doi.org/10.5281/zenodo.18716376.
Code availability
The code used for this study is available at Zenodo via https://doi.org/10.5281/zenodo.18716376.
References
Sun, Y. The use of aluminum alloys in structures: review and outlook. Structures 57, 105290 (2023).
von Hehl, A. & Krug, P. Aluminum and Aluminum Alloys (Wiley Online Library, 2013).
Li, S.-S. et al. Development and applications of aluminum alloys for aerospace industry. J. Mater. Res. Technol. 27, 944–983 (2023).
Chugh, B. et al. Chapter 12—corrosion inhibition by aluminum oxide. In: Inorganic Anticorrosive Materials (Elsevier, 2022) pp 231–249.
Yasakau, K. A., Zheludkevich, M. L. & Ferreira, M. G. S. Role of intermetallics in corrosion of aluminum alloys. Smart Corrosion Protection. (Elsevier, 2018) pp 425–462.
Twite, R. L. & Bierwagen, G. P. Review of alternatives to chromate for corrosion protection of aluminum aerospace alloys. Prog. Org. Coat. 33, 91–100 (1998).
Winkler, D. A. et al. Impact of inhibition mechanisms, automation, and computational models on the discovery of organic corrosion inhibitors. Prog. Mater. Sci. 149, 101392 (2025).
Gharbi, O., Thomas, S., Smith, C. & Birbilis, N. Chromate replacement: what does the future hold?. npj Mater. Degrad. 2, 12 (2018).
Paz Martínez-Viademonte, M., Abrahami, S. T., Hack, T., Burchardt, M. & Terryn, H. A review on anodizing of aerospace aluminum alloys for corrosion protection. Coatings 10, 1106 (2020).
Visser, P., Lutz, A., Mol, J. M. C. & Terryn, H. Study of the formation of a protective layer in a defect from lithium-leaching organic coatings. Prog. Org. Coat. 99, 80–90 (2016).
Li, Z. et al. Review of the state of art of Li-based inhibitors and coating technology for the corrosion protection of aluminium alloys. Surf. Coat. Technol. 478, 130441 (2024).
Visser, P., Terryn, H. & Mol, J. M. C. On the importance of irreversibility of corrosion inhibitors for active coating protection of AA2024-T3. Corros. Sci. 140, 272–285 (2018).
Visser, P. et al. The chemical throwing power of lithium-based inhibitors from organic coatings on AA2024-T3. Corros. Sci. 150, 194–206 (2019).
Guseva, O., Schmutz, P., Suter, T. & von Trzebiatowski, O. Modelling of anodic dissolution of pure aluminium in sodium chloride. Electrochim. Acta 54, 4514–4524 (2009).
Ruiz-Garcia, A. et al. The corrosion products in a carbon steel/aluminum alloy galvanic couple under thin electrolyte films: an efficient model. Electrochem. Commun. 104, 106485 (2019).
Abodi, L.-C. et al. Modeling localized aluminum alloy corrosion in chloride solutions under non-equilibrium conditions: steps toward understanding pitting initiation. Electrochim. Acta 63, 169–178 (2012).
Moraes, C. V., Santucci, R. J., Scully, J. R. & Kelly, R. G. Finite element modeling of chemical and electrochemical protection mechanisms offered by Mg-based organic coatings to AA2024-T351. J. Electrochem. Soc. 168, 051505 (2021).
Denissen, P. J., Homborg, A. M. & Garcia, S. J. Requirements for corrosion inhibitor release from damaged primers for stable protection: a simulation and experimental approach using cerium loaded carriers. Surf. Coat. Technol. 430, 127966 (2022).
Abdelrahman, N. et al. Corrosion protection in a coating defect on AA2024-T3 by lithium carbonate inhibitor leaching: an experimentally validated FEM approach. Corros. Sci. 250, 112861 (2025).
Özkan, C. et al. Laying the experimental foundation for corrosion inhibitor discovery through machine learning. npj Mater. Degrad. 8, 21 (2024).
Busch, M. et al. Large language models predicting the corrosion inhibition efficiency of magnesium dissolution modulators. Corros. Sci. 255, 113080 (2025).
Würger, T. et al. Exploring structure-property relationships in magnesium dissolution modulators. npj Mater. Degrad. 5, 2 (2021).
Butler, K. T., Davies, D. W., Cartwright, H., Isayev, O. & Walsh, A. Machine learning for molecular and materials science. Nature 559, 547–555 (2018).
Coelho, L. B. et al. Reviewing machine learning of corrosion prediction in a data-oriented perspective. npj Mater. Degrad. 6, 8 (2022).
Zhi, Y., Yang, T. & Fu, D. An improved deep forest model for forecast the outdoor atmospheric corrosion rate of low-alloy steels. J. Mater. Sci. Technol. 49, 202–210 (2020).
Le, T., Epa, V. C., Burden, F. R. & Winkler, D. A. Quantitative structure–property relationship modeling of diverse materials properties. Chem. Rev. 112, 2889–2919 (2012).
de Oca Zapiain, D. M. et al. Accelerating fem-based corrosion predictions using machine learning. J. Electrochem. Soc. 171, 011504 (2024).
Marshall, R. S. et al. Galvanic corrosion between coated Al alloy plate and stainless steel fasteners, part 2: application of finite element method and machine learning to study galvanic current distributions. Corrosion 79, 157–173 (2023).
Sarwar, U. et al. Enhancing pipeline integrity: a comprehensive review of deep learning-enabled finite element analysis for stress corrosion cracking prediction. Eng. Appl. Comput. Fluid Mech. 18, 2302906 (2024).
Peng, Y. et al. Data-driven collapse strength modelling for the screen pipes with internal corrosion defect based on finite element analysis and tree-based machine learning. Ocean Eng. 279, 114400 (2023).
Abdelrahman, N. et al. An empirically based finite element method approach for modelling the leaching of lithium carbonate from an active primer system. Prog Organ Coatings 211, 109770 (2026).
Visser, P. et al. Li leaching from li carbonate-primer: transport pathway development from the scribe edge of a primer/topcoat system. Prog. Org. Coat. 158, 106284 (2021).
Guseva, O., DeRose, J. A. & Schmutz, P. Modelling the early stage time dependence of localised corrosion in aluminium alloys. Electrochim. Acta 88, 821–831 (2013).
Visser, P., Gonzalez-Garcia, Y., Mol, J. M. C. & Terryn, H. Mechanism of passive layer formation on AA2024-T3 from alkaline lithium carbonate solutions in the presence of sodium chloride. J. Electrochem. Soc. 165, C60 (2018).
Breiman, L. Random Forests. Mach. Learn. 45, 5–32 (2001).
Cheng, Y. L. et al. A study of the corrosion of aluminum alloy 2024-T3 under thin electrolyte layers. Corros. Sci. 46, 1649–1667 (2004).
Laird, J. S. et al. Li leaching from lithium carbonate-primer: an emerging perspective of transport pathway development. Prog. Org. Coat. 134, 103–118 (2019).
Wigny, F., Nelissen, G., Deconinck, J. & Degrez, M. Mass transfer between electrodes using multijets of electrolyte. In: Finds and Results from the Swedish Cyprus Expedition: A Gender Perspective at the Medelhavsmuseet, vol. 51, 101667 (2005).
Bunde, A., Heitjans, P., Indris, S., Kantelhardt, J. W. & Ulrich, M. Anomalous transport and diffusion in percolation systems. The Open-Access Journal for the Basic Principles of Diffusion Theory, Experiment and Application (2007).
Rottereau, M., Gimel, J. C., Nicolai, T. & Durand, D. 3d Monte Carlo simulation of site-bond continuum percolation of spheres. Eur. Phys. J. E 11, 61–64 (2003).
Ho, T. K. Random decision forests. In: Proceedings of 3rd International Conference on Document Analysis and Recognition, vol. 1, 278–282 (1995).
Chen, T. & Guestrin, C. XGBoost: a scalable tree boosting system. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp 785–794 (Association for Computing Machinery, 2016).
Pedregosa, F. et al. Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011).
Rumble, J. et al. CRC Handbook of Chemistry and Physics, vol. 102 (CRC Press, Boca Raton, FL, 2017).
Soli, A. L. & Byrne, R. H. CO2 system hydration and dehydration kinetics and the equilibrium CO2/H2Oco3 ratio in aqueous NaCl solution. Mar. Chem 78, 65–73 (2002).
Acknowledgements
Funding by the Helmholtz Association is gratefully acknowledged. This study was funded by the VIPCOAT project [H2020-NMBP-TO-IND-2020, Grant Agreement 952903]. The funders played no role in study design, data collection, analysis and interpretation of data, or the writing of this paper.
Funding
Open Access funding enabled and organized by Projekt DEAL.
Author information
Authors and Affiliations
Contributions
L.S., N.A., M.M., K.D., P.M., B.B., N.K., H.T., M.H.M., C.F., and M.L.Z. contributed to the conception and design of the study. N.A. and M.M. ran the FEM simulations and provided the training database. K.D., P.M., and B.B. provided the software and supported the software development and debugging. N.A., M.M. and M.H.M. evaluated the quality of the FEM outputs. L.S. and C.F. analyzed the data set and developed the regression models. L.S. and C.F. evaluated the quality of the presented models. L.S., N.A. and C.F. created the figures. L.S., N.A. and C.F. wrote the first draft of the paper. L.S., N.A., M.M., K.D., P.M., B.B., N.K., H.T., M.H.M., C.F. and M.L.Z. contributed to the paper revision, read, and approved the submitted version.
Corresponding authors
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary information
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Sahlmann, L., Abdelrahman, N., Meeusen, M. et al. Surrogate modelling of corrosion inhibition finite element simulations using machine learning. npj Mater Degrad 10, 38 (2026). https://doi.org/10.1038/s41529-026-00760-5
Received:
Accepted:
Published:
Version of record:
DOI: https://doi.org/10.1038/s41529-026-00760-5








