Introduction

Cold spray is an innovative and versatile coating technique that has gained increasing attention in various industries, including aerospace, automotive, and electronics, due to its ability to deposit high-quality materials onto a wide range of substrates at low temperatures (Ref 1, 2). Unlike traditional thermal spraying methods, cold spray utilizes supersonic gas streams to accelerate fine powder particles to velocities exceeding their critical bonding speed, leading to their plastic deformation and cohesive bonding upon impact with the substrate (Ref 3, 4). This process offers numerous advantages, such as reduced thermal degradation of materials, lower energy consumption, and the ability to coat temperature-sensitive substrates (Ref 5, 6).

Despite the many advantages of cold spray coatings, the presence of residual stresses within these coatings remains a critical concern. Residual stresses are inherent in the cold spray process due to the rapid bonding of particles, as well as the significant thermal and mechanical gradients involved (Ref 7, 8). These residual stresses can have a profound impact on the performance and longevity of cold spray coatings, affecting factors such as adhesion, wear resistance, and corrosion susceptibility (Ref 9,10,11,12). Hence, the accurate characterization of residual stress distribution in cold spray coatings is essential for optimizing coating performance and ensuring component reliability. Understanding the origins and spatial variations of these stresses is crucial for tailoring coating properties to meet specific engineering requirements. A multitude of recent studies have been undertaken to assess residual stresses within cold spray coatings across a diverse spectrum of materials. For instance, Loke et al. (Ref 13) explored the behavior of aluminum 6061 splats during cold spraying at various angles. Their computational model predicted peak shear stresses at impact angles between 60 and 65° and maximum interfacial equivalent plastic strains at 50°. Additionally, the analysis of residual stress profiles revealed an increasing negative gradient from the coating surface towards the substrate interface. Marzbanrad et al. (Ref 14) identified several factors influencing residual stress formation, with heat input and transfer rate emerging as pivotal factors. Their findings illustrated the capacity to manipulate residual stress patterns, enabling the generation of both tensile and compressive stresses in distinct coatings. Another study provided essential processing guidelines for managing porosity and mitigating residual stresses, ensuring the production of durable Ti-6Al-4V coatings via cold spraying (Ref 15). Boruah et al. (Ref 16) assessed the impact of geometrical variables and track patterns on residual stresses. Their research, combining experiments and analytical modeling, unveiled tensile stresses near the deposit surface, compressive stresses near the interface, and variations dependent on layer count, substrate thickness, layer thickness, and track pattern. Dang et al. (Ref 17) investigated the impact of residual stress in a HiPIMS titanium nitride thin film on cold-spray titanium coatings. Their study not only assessed mechanical properties but also focused on characterizing and understanding residual stress behavior, shedding light on its influence for aerospace applications.

Some studies have demonstrated that post-heat treatments effectively alleviate residual stresses, leading to enhanced interfacial bond strength and improved adhesion through reduced porosity and better particle bonding with the substrate (Ref 18, 19). Meng et al. (Ref 20) employed 2D and 3D finite element (FE) simulations along with hole drilling measurements to investigate cold-sprayed copper coatings. Their findings revealed that residual stress was influenced by mesh size, substrate dimension, and simulation duration, whereas material failure had localized effects. Additionally, the study highlighted the role of thermal softening, driven by increased temperature and plastic deformation, in reducing residual stress. Lin et al. (Ref 21) explored how bonding influenced residual stress development in cold-sprayed Al-6061 coatings on Al-6061 substrates. They found that bonding affected the local residual stress near interfaces, with kinetic peening introducing compressive stress and bonding inducing relaxation. The system’s final residual stress depended on the balance between these effects, dictated by the local bonding environment.

In recent years, machine learning (ML) has made significant strides in various coating processes (Ref 22,23,24,25). Despite this progress, the utilization of ML in cold spraying coatings has been somewhat limited. To gain insights into the expanding landscape of ML applications in cold spraying, notable examples from recent research are explored. Wang et al. (Ref 26) identified the critical velocity as the focal point in cold spray applications. Their study demonstrated that ML methods, especially those integrating feature selection techniques, offer valuable insights for optimizing the cold spray process. Another study emphasized the broader scope of ML in transforming both thermal and cold spray processes, shedding light on the transformative potential of digital technologies in coating applications, including cold spraying (Ref 27). Addressing the prediction aspect, Canales et al. (Ref 28) focused on ML techniques’ predictive capabilities for describing the window of deposition and efficiently forecasting deposition outcomes in cold spraying. Another noteworthy contribution was found in an investigation, focusing on predicting particle properties specifically in plasma spraying processes, showcasing the versatility of ML in different coating techniques (Ref 29). Mauer et al. (Ref 30) represented a significant effort in advancing ML applications in thermal spray processes, contributing to the understanding of process diagnostics and control, demonstrating ML’s potential in enhancing the efficiency of thermal spray coating. Lastly, Valente et al. (Ref 31) focused on the critical aspect of powder flowability in cold spray additive manufacturing.

Remarkably, there is a significant dearth of research on characterizing residual stress in this context; therefore, our study endeavors to rectify this crucial gap. The primary objective is to develop a robust ML model with the capacity to accurately predict and characterize residual stress in cold spray coatings. Specifically, the model is designed not only to predict the levels of tensile and compressive stresses but also to discern the impact of various parameters. This includes an exploration of how materials properties of substrate/coating and processing variables influence cold spraying. By doing so, our research seeks to unravel the intricate correlations between these parameters, leading to insights into achieving an optimized state of the cold spray process. Our approach emphasized the integration of finite element method (FEM) simulations as a cornerstone for acquiring essential input data crucial for training ML models. This integration strategically incorporates a comprehensive array of input features, including material properties, processing parameters, and FEM variables. The pivotal significance of this method lies in its ability to generate rich and diverse datasets through FEM simulations, providing a robust foundation for ML training. This dataset not only enhances the accuracy of the ML model but also contributes significantly to advancing our understanding and control of residual stress—a key determinant influencing the performance and integrity of cold spray coatings in various industrial applications. Finally, it is worth to mention that the primary objectives of this work are to enhance materials design for cold spraying, reduce the need for trial-and-error experiments to achieve optimum conditions, and improve the interpretability of coating features under various processing parameters. These objectives are academically and industrially advantageous for both materials science and manufacturing processes.

Modeling Principles

Finite Element Modeling

In this initial phase of our ML modeling endeavor, the foundation of success lies in acquiring high-quality training data. Consequently, this study conducted extensive FEM simulations under a wide spectrum of conditions to obtain the requisite dataset. While the primary focus of this research centers on ML modeling, this subsection provides a concise overview of the FEM simulation process and its fundamental principles. It is crucial to highlight that the reliability of FEM simulation procedure, essential for our data collection purposes, has undergone prior validation through experimental investigations in other studies (Ref 20, 32). The mentioned references specifically focused on the coating process, encompassing a diverse array of input features and targeting residual stresses for their results. Given that our study shares a similar goal of understanding and analyzing residual stresses within the context of the coating process, the robustness and applicability of the mentioned models in those studies affirm their suitability for our specific research objectives.

To characterize the elastoplastic responses of both the particle and substrate in cold spray, the Johnson-Cook plasticity model and isotropic elasticity approach were utilized. Specifically, the Johnson-Cook model was employed for presented purpose (Ref 20, 33):

$$ \overline{\sigma } = \left[ {A + B\left( {\overline{\varepsilon }^{pl} } \right)^{n} } \right]\left[ {1 + C\ln \left( {\frac{{\dot{\overline{\varepsilon }}^{pl} }}{{\dot{\overline{\varepsilon }}0^{pl} }}} \right)} \right]\left[ {1 - \left( {\frac{{T - T_{{{\text{ref}}}} }}{{T_{{\text{m}}} - T_{{{\text{ref}}}} }}} \right)^{m} } \right] $$
(1)

The Johnson-Cook model, widely applied in the exploration of dynamic impact behaviors within cold spray, effectively amalgamates aspects such as thermal softening, strain hardening, and strain rate hardening into a comprehensive framework (Ref 34). Modeling the progressive damage and failure of materials during the cold spray process is achievable through the application of the Johnson-Cook dynamic failure approach, which is precisely characterized as follows (Ref 20, 35):

$$ \overline{\varepsilon }_{{{\text{pf}}}} = \left[ {d_{1} + d_{2} \exp \left( {d_{3} \frac{p}{q}} \right)} \right]\left[ {1 + d_{4} \ln \left( {\frac{{\dot{\overline{\varepsilon }}^{pl} }}{{\dot{\overline{\varepsilon }}0^{pl} }}} \right)} \right]\left[ {1 + d_{5} \left( {\frac{{T - T_{{{\text{ref}}}} }}{{T_{{\text{m}}} - T_{{{\text{ref}}}} }}} \right)^{m} } \right] $$
(2)

In this study, different materials, including iron, copper, aluminum, and titanium, were chosen for cold spraying onto their corresponding substrate counterparts. Moreover, thermo-mechanical properties influenced by temperature variations were employed. The material undergoes thermal softening with elevated temperatures, consequently impacting the deposition characteristics.

The Abaqus/Explicit software was employed to simulate the cold spray procedure, incorporating a fully coupled analysis of thermal stresses. Various models, including Eulerian 2D single-particle, 3D single-particle, and 3D multiple-particle configurations, were investigated as part of the study (Ref 20). In the course of the Eulerian analysis, materials were introduced into the particle and substrate regions, while the surrounding space remained unoccupied. Notably, the mesh remained unchanged, enabling the seamless flow of materials throughout the impact process. The selected element type was the 3D 8-node linear Eulerian brick element, incorporating hourglass control, reduced integration, and thermal coupling. Previous studies suggest that the primary origin of residual stress stems from significant plastic deformation within the coating materials. This is particularly observed when both particles and substrates have identical material compositions, provided that the deposition temperature remains below 400 °C (Ref 20, 36). Consequently, the simulation framework deliberately omitted considerations related to heat transfer effects. To investigate residual stresses in the single-particle model, both 2D and 3D models were utilized. In the 2D model, a single element was employed in the thickness direction, as Abaqus/Explicit mandates the use of 3D elements for Eulerian analysis. However, the 2D model offers a substantial reduction in computational expenses, making it a pragmatic choice for conducting parametric investigations.

Figure 1a provides a visual representation of the 2D single-particle model, comprising three key elements: a particle with a diameter of 15-45 µm, a square substrate with dimensions 3 mm in both height and length, and an all-encompassing Eulerian body. The study further explored the influence of mesh size on the resultant residual stress, employing distinct mesh sizes from 0.3 to 1.2 µm. To commence the cold spray impact sequence, an initial velocity was imparted to the particle. The initial velocities ranged from 400 to 900 m/s, and temperatures spanned from 25 °C to 250 °C.

Fig. 1
figure 1

Examples depicting (a) 2D setup of a single particle model in FE simulation, (b) configuration of the 2D mesh and schematics showcasing regions monitored for residual stress, and (c) 3D arrangement of multiple particles within the FE simulation

Recent studies have shown that the presence of an oxide layer had minimal impact on plastic deformation. Consequently, in our modeling approach, we chose not to include the oxide layer, operating under the assumption that it would not exert any influence on the resultant residual stresses. The boundary conditions were applied as follows: confining the Z direction of the model to approximate the 2D model, constraining the X and Y directions of the bottom and right surfaces, and constraining the X direction of the left surfaces (See Fig. 1b) (Ref 20). In the context of 3D simulation, Fig. 1(c) offers a depiction of 3D multiple-particle models. In this particular model, particles were situated on the upper surface of the substrate, and the multiple particles were generated randomly by employing a random seed. It is important to note that the distance between colliding particles is less than the time it takes for an individual particle to complete its deposition. As a result, the next particle will collide with a depositing particle upon impact. This scenario aligns with numerous other studies in the field of cold spray, where the modeling of multiple particles in close proximity is a common approach (Ref 37, 38). Therefore, the model is expected to correspond with experimental results and provide reliable calculations of residual stress. To prevent the emergence of artificial stresses caused by the substrate boundaries, non-reflecting Eulerian boundary conditions were implemented on the lateral and lower surfaces of the substrate (Ref 20). This allowed for the modeling of a substrate with characteristics resembling those of a semi-infinite one. The particle count remained consistent across all samples at 30 particles, while the remaining processing parameters mirrored those employed in the 2D simulations. Moreover, due to computational constraints, the mesh used for the 3D models did not go finer than 1 µm, resulting in a range between 1 and 3 µm.

Again it is worth to mention that the FE model’s reliability is highlighted by the consistent use of boundary conditions that align with previous studies (Ref 20). While certain materials exhibit significant strain rate sensitivity, posing challenges for the Johnson-Cook model, our decision to employ it finds support in the agreement between the model and cold spray experiments for iron, copper, aluminum and titanium observed in past studies. Notably, this investigation did not consider interface bonding due to the Eulerian method’s assumption of perfect bonding. However, this omission introduces certain limitations and implications. The absence of interface bonding consideration may result in an overestimation of overall bonding strength, impacting the accuracy of predictions for residual stresses and mechanical properties. Neglecting variations in interface bonding quality can also lead to some slight unrealistic stress distributions, potentially compromising the realism of coating behavior predictions. It is essential to emphasize that, despite these potential implications, this omission does not significantly impact the final results of our study.

The extraction and evaluation of output results for the training process were carried out via FEM analysis. In the subsequent section, a detailed exposition of the input and output parameters will be provided, facilitating a comprehensive understanding of the study.

ML Development Based on Expectation-Maximization (EM) Learning

In our ML implementation, the critical input and output parameters associated with the cold spraying process were identified. The input parameters encompassed a wide range of material characteristics for aluminum, iron, copper and titanium, including melting temperature, thermal conductivity, hardness, specific heat, mechanical strength, as well as FEM parameters like mesh size (Xs-ranging from 0.3 to 3 μm), processing parameters such as initial velocities (Vi-ranging from 400 to 900 m/s), temperatures (T-spanning from 25 °C to 250 °C), and particle size (Sp-ranging from 15 to 45 μm).

On the other hand, the output features were derived from the residual stress profile of the cold spraying process, as depicted in Fig. 2(a). Data collection was conducted at a time point of 1000 ns, ensuring the reliability of the residual stress profile results. The stress curves depicted in Fig. 2(a) were derived by selecting a specific line within the coating, extending from the surface to the depth. This particular line was intentionally chosen to encompass the maximum tensile and compression stresses, thereby offering a comprehensive representation of stress fluctuations within the coating. Through this deliberate selection, a subtle insight into the distribution and variation of stresses across different layers of the coating was achieved. The stress profile displayed clear stages: Initially, there was a swift rise in tensile stress, reaching a maximum value; this was followed by a decline in tensile stress, ultimately becoming negative and transitioning into the minimum compressive stress. Finally, the compressive stress magnitude gradually decreased. This stress variation extended from the surface to the body of the material, as illustrated in Fig. 2(b). In this work, the maximum peak values of residual stress in the tensile region (Ut) and compressive region (Uc) were considered as the output targets. Moreover, 340 sets of data were prepared specifically for the training process, emphasizing the critical role of these simulations in providing a comprehensive and diverse dataset for the machine learning model to learn from.

Fig. 2
figure 2

(a) Various illustrations depicting the distribution of residual stress at different depths of the sample, highlighting temperature effects. (b) 2D mapping displaying stress distribution across a sample

In this investigation, the proposed approach is strengthened by the inclusion of a novel mixture of expert’s framework, based on the principles of expectation-maximization (EM) learning, schematically presented in Fig. 3. The principles of EM learning have consistently proven valuable in addressing complex challenges spanning a wide range of fields, from statistics to machine learning (Ref 39, 40). This versatile framework depicts the iterative optimization approach, making it an ideal candidate to tackle the multifaceted challenge of predicting residual stress in cold spray coatings. The EM algorithm’s inherent elegance reside in its two-step iterative process. In the Expectation (E-step), the algorithm refines its estimates of latent variables, which are unobserved or hidden aspects of the system under investigation. Subsequently, the Maximization (M-step) leverages these revised estimates to optimize the model’s parameters, ensuring they align with the data and maximize the likelihood of the observed information (Ref 41). This cyclic process of refining and enhancing continues iteratively until a point of convergence, which represents a model well-versed in the intricacies of predicting residual stress in cold spray coatings. The effectiveness of the EM algorithm lies in its adaptability, particularly its capacity to accommodate incomplete or missing data (Ref 39). This adaptability, coupled with its ability to tackle complex problems, makes EM learning an attractive option for predicting residual stress in cold spray coatings.

Fig. 3
figure 3

A descriptive diagram outlining the Machine Learning methodology introduced in this research, illustrating its systematic framework for analyzing residual stresses. DNNs are the deep neural networks and GNN is the gating neural network for determining the contribution of each DNN in the target prediction

In the process of establishing the ML model, the collected data firstly undergoes data normalization, which is applied to both the input and target datasets (See Fig. 4). Earlier research has underscored the importance of data normalization during the training phase of artificial intelligence models (Ref 42). The findings indicate that an effective range for standardization, e.g., [0.2 0.8], can enhance the ML performance when undergoing the training phase. In this study, the determination of the most suitable normalization interval for our dataset was undertaken. This pursuit involved systematic experimentation, ultimately identifying the [0.21, 0.79] range as yielding the most favorable outcomes. This specific range was identified through methodical exploration, wherein various normalization intervals were considered, and the selection was grounded in the achievement of optimal ML performance for the dataset. Performance metrics, such as accuracy, convergence speed, and overall predictive precision, were assessed systematically, ensuring stability and generalization across diverse data points. Hence, the subsequent equations are applied for data normalization:

$$ L_{{{\text{new}}}} = 0.21 + \frac{{\left( {0.79 - 0.21} \right)(L - \min \left( L \right)}}{\max \left( L \right) - \min \left( L \right)} $$
(3)
Fig. 4
figure 4

Visualization depicting the standardized structure employed during the training procedure using DNNs and GNN for specifying the contribution of each DNN on the target prediction

In the subsequent phase, the training procedure was conducted using three DNNs with standardized structures consistently applied to all AI cores, as visually represented in Fig. 4. These DNN configurations consisted of four hidden layers, each distinct in the number of neurons present within them, specifically [25 25 20 20], [20 20 25 25] and [20 23 23 20], respectively. This particular choice was made after careful consideration, finding a compromise between the DNN’s computational efficiency and the time required for the training process. Within the DNN architecture, the input layer was equipped with nine ports designed for receiving input data, while the output layer featured a single port dedicated to relaying the predicted value of the target parameter, which, in this context, was the residual stress.

To facilitate the training process, the widely used backpropagation algorithm was employed, recognized for its effective handling of error rates and well-established convergence characteristics (Ref 43). The training regimen comprises 1000 iterations, during which the weights undergo updates. At each iteration, scrutiny is applied to performance criteria, specifically RMSE and R2. If these criteria align with performance convergence, indicated by the gradient in weight updating, the training process concludes, transitioning to the subsequent step—the validation process. Consequently, the training process persists until either the prescribed number of iterations is completed or performance effectiveness attains the predetermined benchmarks, specifically an R2 exceeding 0.9 and an RMSE below 10%. The focus was on adjusting the weight and bias parameters of neurons within the hidden layers to minimize the root mean square error (RMSE), ensuring that the DNN was appropriately fine-tuned for optimal performance.

Upon the completion of the training phase, the process shifted to the application of EM learning. The primary objective of EM at this stage was to accurately determine the individual contributions of each AI core to the final prediction of the target data, specifically the residual stress within cold spray coatings. A critical departure from traditional methodologies was undertaken in training the gating networks (GNN). Gating networks are used to regulate the flow of information within the network. They do this by selectively allowing certain information to pass through while inhibiting or gating other information. This helps in mitigating the vanishing gradient problem and capturing long-term dependencies in sequences. In this work, instead of following the conventional Mixture of Experts (MoE) approach, a modified gating network was introduced, defined as follows (Ref 44):

$$ g\left( {x,v} \right) = \frac{{\alpha_{j} p(x|v_{j} )}}{{\mathop \sum \nolimits_{i} \alpha_{j} p(x|v_{j} )}},\quad \mathop \sum \limits_{i} \alpha_{j} = 1 $$
(4)

where \(v = \left\{ {\alpha_{j} ,v_{j} ,\quad j = 1,2,3} \right\}\) and the density function can be written as follows:

$$ p\left( {x|v_{j} } \right) = \alpha_{j} \left( {v_{j} } \right)^{ - 1} b_{j} \left( x \right)\exp \left\{ {c_{j} \left( {v_{j} } \right)^{ - T} t_{j} \left( x \right)} \right\} $$
(5)

Accordingly, one can obtain the global description for MoE as fallows using Eq. (4) and (5) and the Bayes’ rule:

$$ P\left( {x|y,\theta } \right) = \mathop \sum \limits_{j} \frac{{\alpha_{j} p\left( {x|v_{j} } \right)}}{{P\left( {x,v} \right)}}P(y|x,\theta_{j} ) $$
(6)

where θj comprises the weighting and biasing parameters for the gating network. The inclusion of these parameters in the modified gating network holds significant advantages. Unlike conventional MoE methodologies, this modification brings several significant improvements to the model (Ref 39). Firstly, by integrating weighting and biasing coefficients, the modified gating network offers a more comprehensive optimization process compared to conventional MoE methodologies. The weighting coefficients, represented by αj, assign varying levels of importance to each AI core based on their historical performance and domain expertise. This allows the AI cores to specialize in particular aspects of the problem, thereby enhancing their predictive capabilities. Simultaneously, the biasing coefficients, represented by θj, address systematic errors or biases in the outputs, ensuring more accurate and reliable predictions. By fine-tuning the contributions of each core, the model can effectively mitigate the impact of individual core weaknesses while leveraging their strengths. Incorporating these enhancements into the gating network not only enhances the model’s adaptability and optimization but also provides a robust framework for predicting residual stress in cold spray coatings.

Results and Discussion

Model Validation

Determining the most suitable hyper-parameters for ML models is a crucial endeavor to ensure the models are both reliable and precise. Achieving this fine-tuning of model performance entails a meticulous process involving a mix of the grid search algorithm and the trial-and-error techniques, all carried out within the context of the cross-validation procedure. To quantitatively evaluate the regression accuracy of the ML model, we utilized two established evaluation metrics: RMSE and R2. These metrics provide a quantitative means to assess the accuracy of the ML model, offering insightful perspectives on its predictive capabilities. RMSE, by measuring the average magnitude of the prediction errors, allows to gauge the accuracy of the model in predicting residual stress in cold spray coatings. Lower RMSE values indicate a closer alignment between predicted and actual values, reflecting higher accuracy. On the other hand, R2, as a measure of the model’s fit quality, assesses how well the predicted values capture the variability in the actual data (Ref 45).

Figure 5 presents the performances of the ML model with their respective hyper-parameters in the fourfold cross-validation process, assuring the reliability and applicability of the results. In the pursuit of a well-balanced ML model, the strategic selection of optimal smoothing factors and the determination of the number of hidden neurons play pivotal roles. This deliberate choice fosters equilibrium between underfitting and overfitting, culminating in an augmented ability of the model to generalize effectively. By considering these parameter values, a harmonious fit to the training data is achieved, steering clear of unnecessary complexity. This approach not only ensures a refined fit to the known data but also fosters heightened adaptability to previously unseen data, thereby elevating the overall performance of the model. The incorporation of evaluation metrics such as RMSE, which emphasizes error magnitude, and R2, which assesses model fit against a simple mean, further contributes to the model’s precision, preventing oversimplification, and gauging its capacity to capture meaningful variations without succumbing to noise. As can be seen in the figure, the examination resulted in the selection of smoothing factors, 0.13 for predicting maximum compressive residual stress (Uc) and 0.15 for maximum tensile residual stress (Ut), striking a balance between underfitting and overfitting, thus improving the model’s generalization capacity. Furthermore, the outcomes indicate the optimal number of hidden neurons for the model architecture as 20-25 for both Uc and Ut, enhancing overall performance.

Fig. 5
figure 5

Optimizing (a) the number of hidden neurons and (b) the smoothing factor within the ML model

The diligent examination of regression metrics within the ML model plays a pivotal role in assessing its overall performance, offering valuable insights into its predictive precision, and generalization ability, all of which are critical for ensuring the model’s reliability and effectiveness. In Fig. 6, the regression plots vividly showcase the trends in the output targets and the distribution of deviation data, underscoring the remarkable predictive performance of our ML model. Notably, the presence of only a few outliers, which deviate from the primary trend, suggests that their impact on the overall model performance is likely minimal. Despite their existence, the majority of the data adheres closely to the predicted values, affirming the robustness and effectiveness of the model in capturing the underlying patterns in the dataset. Furthermore, it is noteworthy that the model demonstrates higher predictive performance for Uc compared to Ut, indicating a higher level of predictability for residual stress within the material’s depth (body). This observation suggests that characterizing tensile residual stress at the particle-substrate interface inherently involves greater variability. Several factors contribute to these variations, including complexities associated with interfacial bonding, the presence of severe local temperature gradients, and the involvement of different energy transfer mechanisms (Ref 16, 46). These intricacies likely lead to sharp fluctuations in stress patterns, making it more challenging to predict surface residual stress compared to the relatively consistent compressive stress distribution observed within the substrate’s depth. Nevertheless, the model effectively predicts both output targets. Additionally, Fig. 6 illustrates minimal and comparable deviations in both the training and test sets, indicating the model’s proficiency in predicting mechanical properties across a wide spectrum of residual stresses. This success can be attributed to the thorough training and careful calibration of the ML model, which involves optimizing input data for enhanced performance.

Fig. 6
figure 6

Parity plots showcasing predicted versus observed values for (a) compressive residual stresses and (b) tensile residual stresses, accompanied by their respective data deviations

A thorough comparison between the expectation-maximization ML model and conventional models not only underscores the high performance of the former but also sheds light on the shortcomings of some of the latter. As given in Fig. 7, the comparison of the expectation-maximization ML model with conventional ML models reveals significant insights into its reliable predictive capabilities for Uc and Ut. The results demonstrate that the expectation-maximization ML model consistently outperforms other models in predicting these critical output targets. For Uc, our developed ML model achieved an outstanding R2 value of 0.968 and a low RMSE of 3.5%, indicating its high precision and goodness-of-fit. In contrast, the conventional ML models, such as Random Forest (RF), Gradient Boosting (GB), Support Vector Regression (SVR), and Decision Tree Regression (DTR), displayed lower R2 values and higher RMSE values. Notably, the DTR model exhibited the lowest performance, with an R2 value of 0.826 and an RMSE of 18.5%. The expectation-maximization ML model also excelled in predicting Ut, achieving an R2 value of 0.915 and an RMSE of 8.8%. Once again, this performance surpassed that of the conventional ML models. RF, GB, SVR, and DTR exhibited lower R2 values and higher RMSE values, with RF and DTR displaying the weakest predictive capabilities. The notable strength of the EM model resides in its aptitude for capturing and elucidating intricate relationships between input parameters and the output target. This capability underscores the adaptability and fine-tuning features of the model, as evidenced by its adept handling of the inherent complexities within the dataset. These attributes collectively contribute to the model’s predictive accuracy for residual stress, emphasizing its robustness in discerning patterns and relationships in the data. On the contrary, the performance of conventional models, specifically DTR for Uc and RF for predicting Ut, displayed significant shortcomings. These models grappled with the intricate intricacies and interdependencies inherent in the data, leading to notably diminished R2 values and elevated RMSE values. The challenges faced by these models could be attributed to their inherent simplicity and inability to adapt to complex data patterns. Additionally, the lack of feature engineering and the limited depth of decision trees in DTR may have hindered their capacity to discern subtle relationships in the dataset, resulting in suboptimal predictive accuracy. Furthermore, the randomization aspect of RF models, while useful for reducing overfitting, may have introduced additional variability, leading to a less accurate representation of the underlying data patterns.

Fig. 7
figure 7

Comparative performance analysis of ML models: (a) R2 (Uc), (b) RMSE (Uc), (c) R2 (Ut), (d) RMSE (Ut)

Parametric Scale Characterization of the ML Model

Pearson correlation analysis is an essential tool within ML models, enabling the discovery of feature interrelationships. Understanding the correlations between input variables and the target variable is pivotal for feature selection, model refinement, and enhancing interpretability (Ref 47, 48). Strong positive or negative correlations often signal redundancy, facilitating the elimination of less informative variables. Conversely, detecting weak correlations can emphasize the unique contributions of individual features.

Using Pearson analysis, the comprehensive characterization of diverse parameters offered valuable insights into the intricacies of the cold spraying process. These insights informed a systematic refinement and optimization of our ML model. The understanding of each parameter’s impact allowed for precise adjustments, enhancing the model’s predictive accuracy. This approach ensured that the model not only captured complex relationships within the process but also demonstrated adaptability to variations in input parameters. While it may have been suitable to present the scatterplots and Pearson analysis in Sect. “Modeling Principles”, the outcomes are provided here for an in-depth characterization of input-output relationships, accompanied by a more detailed discussion.

Figure 8 illustrates scatterplots depicting input–output relationships alongside their corresponding Pearson coefficient values. Upon initial examination, it becomes apparent that the correlation coefficient values exhibit a complexity in the interrelationships between features, neither very strong nor notably weak. Additionally, it is noteworthy that the absolute coefficient values pertaining to tensile residual stresses are comparatively lower. This phenomenon can be attributed to the heightened impact of processing parameters and the FEM simulation procedure on surface residual stresses, where interfacial interactions are most pronounced and varied. Concerning mesh size, Ut displays a modest negative correlation with an R value of − 0.43, while Uc exhibits a stronger negative correlation with Xs, represented by an R value of − 0.64. These observations indicate that increasing mesh size has a diminishing effect on both maximum compressive and tensile residual stresses. The negative correlations can be ascribed to various factors. Larger mesh sizes allow for less precise representation of material behavior, resulting in less accurate simulations of the cold spraying process (Ref 49). This can disrupt material flow during particle impact, diminishing the accumulation of compressive and tensile stresses. Additionally, larger mesh sizes reduce the simulation’s numerical resolution, potentially overlooking fine-scale interactions and stress variations. Moreover, accurate contact modeling is vital for capturing particle-substrate interactions in cold spray simulations. Larger mesh sizes can introduce errors into the contact algorithm, impacting peening and bonding effects during impact, further contributing to the negative correlations.

Fig. 8
figure 8

Scatterplots illustrating the relationship between input and output parameters, alongside Pearson coefficient values

In the context of temperature, it is noteworthy that both maximum compressive residual stress (Uc) and tensile residual stress (Ut) exhibit negative correlations, with R values of − 0.71 and − 0.54, respectively. These correlations underscore the pivotal role of temperature control in the effective management of both types of residual stresses within the cold spray process. The observed negative relationships between temperature and maximum residual stresses can be ascribed to several fundamental mechanisms intrinsic to the cold spray process. Firstly, elevated temperatures contribute to thermal softening of materials, consequently diminishing their resistance to deformation. This phenomenon translates into an increased propensity for plastic deformation of both particles and substrates upon impact (Ref 46). Furthermore, higher temperatures generally result in reduced strain rate sensitivity, mitigating the abrupt rise in flow stress at elevated strain rates. Consequently, this mitigation effect leads to a reduction in both tensile and compressive stresses, as the material exhibits greater resistance to deformation (Ref 50). Another influential factor associated with elevated temperatures is the facilitation of more substantial plastic deformation of the particles upon impact. This effect serves to ameliorate the development of tensile stresses. In essence, these mechanisms collectively elucidate the importance of precise temperature control as a means to minimize both compressive and tensile residual stresses, thereby optimizing the overall cold spray process.

Regarding initial velocity, both maximum compressive residual stress (Uc) and tensile residual stress (Ut) display robust positive correlations, with R values of 0.65 and 0.61, respectively. These correlations underscore the notable impact of initial velocity on augmenting both types of residual stresses within the cold spray process. The observed positive relationships between initial velocity and maximum residual stresses can be attributed to several underlying factors. Firstly, higher initial velocities result in increased kinetic energy of the impacting particles, translating into more substantial plastic deformation upon impact. This, in turn, leads to the build-up of higher tensile and compressive stresses within the material (Ref 51, 52). Additionally, elevated initial velocities can contribute to greater particle-substrate interactions, resulting in enhanced peening and bonding effects. These effects further promote the development of both tensile and compressive residual stresses.

Concerning particle size, both Uc and Ut display moderate positive correlations, with R values of 0.49 and 0.38, respectively. These correlations suggest that larger particle sizes contribute to higher levels of both types of residual stresses in the cold spray process. Several factors can explain these positive relationships. Firstly, larger particles typically possess greater kinetic energy upon impact due to their increased mass. This results in more substantial plastic deformation and energy transfer during impact, leading to the development of higher tensile and compressive stresses within the material (Ref 53). Additionally, larger particles may have a greater contact area with the substrate, enhancing bonding and peening effects during impact. This can further contribute to the build-up of both tensile and compressive residual stresses.

In addition to processing parameters, it is essential to investigate the influence of material properties on ML model performance. Table 1 presents four distinct material types characterized by their physical and mechanical properties, which were integrated into the training process. This enables to assess the relative importance of material properties in shaping residual stress variations during the cold spraying process. Figure 9 presents parallel plots that offer insights into the trends related to material property weight factors in this context. It is crucial to emphasize that the concept of a weight factor is distinct from the exact parameter values; instead, it signifies the importance of each parameter in predicting the output target. The figure reveals that at low residual stress levels, mechanical strength plays the most pivotal role, while an increase in residual stress corresponds to a heightened influence of thermal conductivity. This could be because higher stresses generate more heat during the cold spray process, making thermal conductivity a critical factor in predicting the resulting residual stresses (Ref 54). Furthermore, melting temperature and specific heat serve as moderate and consistent parameters in predicting residual stress across a wide range. This stability suggests that these properties play a consistent role in predicting residual stress, regardless of stress magnitude. Nevertheless, it is evident that thermal conductivity and mechanical strength surpass others in terms of importance. The dominance of thermal conductivity and mechanical strength in predicting residual stresses could be attributed to the complex interplay of these properties in materials deformation.

Table 1 materials properties of examined metals
Fig. 9
figure 9

Weight factor variations of key material properties (mechanical strength (MS), thermal conductivity (TC), melting temperature (MT), specific heat (SH)) in relation to residual stress variations for optimizing ML performance. The plots depict the influence of residual stress (sum of tensile and compressive stresses) on weight factors, indicated by line thickness and color intensity

In the final analysis, we focus on the prediction performance of the expectation-maximization ML model, considering the integrated weight factors of material properties, processing parameters, and FEM variables—specifically, mesh size (as illustrated in Fig. 10). As the Ut value increases, a notable trend emerges, highlighting the enhanced influence of processing parameters, while the impact of weight factors linked to material properties and FEM variables shows a moderate and diminishing influence. This observation suggests that, in the context of maximum tensile residual stress, variations in processing parameters play a pivotal role in shaping the outcome, potentially overshadowing the intrinsic characteristics of materials and the effects of FEM variable (mesh size). Conversely, as the Uc value increases, the weight factors associated with material properties take center stage, experiencing a pronounced amplification. Throughout this transition, the weight factors attributed to processing parameters and FEM variables display a moderate and declining impact. This shift emphasizes the growing significance of material properties, particularly in the prediction of maximum compressive residual stress. It is worth noting that mesh size (FEM variable) is a critical factor influencing overall prediction efficiency, contributing to model accuracy by representing the granularity of the simulated material. An optimized mesh size allows for a more detailed and precise characterization of material interactions, providing higher resolution for the ML algorithm to discern subtle variations in cold spraying dynamics. However, in comparison to processing parameters and material properties, mesh size holds a relatively lesser importance in the ML model.

Fig. 10
figure 10

Weight factors of main input categories upon the increase in values of (a) tensile stress, (b) compressive stress

In comparing the maximum predictions of stresses, it is observed that the differential significance of material properties and processing parameters can be ascribed to the tensile and compressive stress modes. Acknowledging the importance of all processing parameters and material features in cold spraying, it is discerned that when predicting Ut, the focus of weight factors shifts to processing parameters at high tensile stress values, connected to the material’s ability to withstand stretching or pulling forces. The role of processing parameters, specifically initial velocity and temperature, appears more significant, with heightened velocities influencing the behavior of deformation and temperature affecting the softening or hardening of materials. This becomes crucial in effectively countering tensile stresses at high levels. Consequently, processing parameters become crucial factors in shaping tensile residual stresses, especially under intensified conditions (Ref 55). Conversely, Uc is linked to the material’s resistance to forces that squeeze or compact it. Material properties, particularly those related to hardness and mechanical strength, assume greater significance in determining the material’s effectiveness in resisting compression (Ref 54, 56). Although processing parameters retain significance, their weight factors for Uc might demonstrate greater stability, given that the principal challenge resides in the inherent material response to compression, as opposed to external factors such as velocity or temperature. In summary, the conclusion highlights the possibility of achieving desired properties for coated samples by striking a balance between processing parameters and alloy type (material properties). This approach not only minimizes the need for extensive trial and error but also reduces the time and costs associated with numerical simulations or real experiments.

The preceding results also underscore the intricate nature of predicting residual stress in the cold spraying process, highlighting the indispensable role of machine learning algorithms in deciphering this complexity. Utilizing the developed model offers the capability to finely adjust processing parameters and select optimal materials, encompassing both substrate and coating, to achieve optimized residual stress in the coating. The statistical space defined by the ML model enables precise modifications in temperature, particle size, and velocity under real-world laboratory conditions to attain desired mechanical features. Furthermore, the comprehensive inclusion of various materials in the coating process, such as aluminum, iron, copper, and titanium, extends the predictive capabilities of the model across a spectrum of alloys. For instance, the model’s adaptability allows for the anticipation of residual stress in aluminum coatings with mechanical properties akin to those studied. This versatility proves invaluable when considering specific material requirements for diverse industrial applications, guiding material selection with precision. In this study, our ML model has proven effective in accurately predicting residual stress. However, it is essential to highlight areas for improvement in future investigations to mitigate limitations in this model. For instance, expanding the number of processing parameters as input features may address deficiencies in predicting tensile stress. By incorporating additional factors such as particle morphology, substrate surface conditions, or spray distance, the model might capture more intricacies of the cold spray process. These factors contribute to a more comprehensive representation of the cold spray process, capturing intricacies that might significantly influence residual stress outcomes. Particle morphology influences the impact and bonding mechanisms, substrate surface conditions affect adhesion, and spray distance can impact the deposition process. Additionally, enhancing the variety of materials (substrate and coating) used in FEM simulation could further enhance the applicability of the ML model. Integrating experimental data from real-world conditions and adapting the ML algorithm accordingly can significantly enhance the prediction efficiency and reliability of the model. As the field advances, incorporating these evolving features into our predictive model holds the promise of refining our ability to anticipate and optimize residual stress outcomes in cold spraying applications.

Conclusions

Utilizing an ML model based on the expectation-maximization approach, this study predicts maximum residual stresses, encompassing tensile and compressive states, in the cold spraying process on varied substrates. The required data were acquired through FEM simulations. The key findings of this investigation are summarized below:

  • Regression analysis of the EM model underscored its remarkable predictive capacity for residual stress, particularly demonstrating higher efficacy in compression mode compared to tensile mode. The strength of the EM model is attributed to its adeptness in capturing intricate relationships between input parameters and residual stress outcomes in the cold spray process. However, it is essential to note potential limitations, such as adaptability to real-world scenarios and the range of materials it can predict.

  • The investigation at lower residual stress levels revealed the critical importance of substrate and particle mechanical strength in predictive accuracy. In contrast, with increased residual stress levels, the substantial influence of thermal conductivity became more pronounced. This relationship indicates that heightened stress levels during the cold spray process generated additional heat, thereby magnifying the importance of thermal conductivity in predicting resulting residual stresses.

  • As tensile stress levels rise, a discernible trend emerges, shedding light on the amplified influence of processing parameters in shaping the prediction process. In contrast, as compressive stresses escalate, the prediction process becomes notably reliant on material properties’ weight factors to a considerable extent.

  • Acknowledging the need for further exploration, future research could focus on expanding processing parameters, incorporating diverse material types, and exploring alternative ML approaches. These improvements aim to enhance the model’s applicability in industrial settings, minimizing the need for numerous trial-and-error experiments and providing more efficient predictive capabilities.