Introduction

Over the last two decades, the benefits of utilizing polymer and composite structures have become increasingly evident. These structures offer numerous advantages, including lightweight strength, corrosion resistance, and design flexibility [1]. These features reduce costs and increase value in industries where performance and durability matter. Recognizing the advantages of polymer and composite structures, various industries have adopted these materials to revolutionize their manufacturing processes and product designs. Among these, the automotive sector stands out as a prime example of innovation in material application. Between the various methods, the sheet molding compound (SMC) process has emerged as the preferred choice for manufacturing composite structures in the automotive industry, primarily due to its exceptional high-volume production capabilities.

In the SMC, polyester resin and glass or carbon fibers are combined and heated to produce a hot substance that is then compressed in a mold [2]. The process is illustrated in Fig. 1.

Fig. 1
figure 1

Squeeze flow phenomenon observed in a confined narrow gap [3]

However, the process has its challenges because critical process parameters, such as curing time, mold closing speed, molding pressure, and precharge specifications (including geometry, placement, and size), significantly influence the final product’s quality in the compression molding process [4]. The mechanical properties of the final structure are considerably influenced by the incorporation of glass or carbon fibers within the resin [5]. This influence stems from the alteration of the SMC material’s concentration and flow behavior within the mold due to the presence of fibers. Consequently, numerous researchers have focused on understanding the SMC process of reinforced polymers [6,7,8].

Simulating and optimizing the manufacturing process is crucial to produce high-quality polymer and composite structures, especially reinforced polymers. Since the SMC cycle test costs are not cheap, computer simulations are used as a reference [9]. However, in contemporary scientific research, the consensus is that numerical modeling is a resource-intensive approach, mainly when dealing with complex phenomena. Therefore, surrogate models emerge as an attractive solution to speed up optimization processes [10, 11]. Surrogate models can be built employing different techniques, among the most popular one finds Genetic Algorithms(GA) [12], Proper Generalized Decomposition(PGD) [13, 14], sparse-PGD [15], and Neural Networks [16].

Neural networks possess significant advantages in the domain of data analysis and optimization. Their notable adaptability allows them to effectively tackle diverse tasks, including pattern recognition, image classification, and natural language processing. This versatility positions neural networks as a powerful tool for complex data analysis [17]. Additionally, the capability of neural networks to comprehend intricate non-linear relationships make them quite adept at handling complex data patterns and achieving high predictive accuracy across various real-world applications [18,19,20].

In this paper, a surrogate for the SMC process is proposed based on the use of the POD model reduction method and the use of neural networks. The objective is to optimize the SMC parameters using a rapid simulation model in a reverse engineering context [21]. Therefore, the initial shape of the mass is optimized using this surrogate so that at the end of the process the mass coincides with the edge of the mold, thus minimizing the rebound of the resin in the mold. In this regard, established optimization methodologies such as gradient descent [22], Newton’s method, Levenberg-Marquardt [23, 24] algorithm could be employed.

The paper is organized into several sections. Section 2 introduces the mathematical formulation and assumptions used for simulating compression and material flow. In Section 3, the numerical implementation and methodology introduced in the previous section are presented in detail. Additionally, Section 4 provides an explanation of the surrogate model construction, specifically the Feedforward neural network that is used to optimize the SMC process. Section 5 presents a numerical example to demonstrate the application of the surrogate for compression molding behavior and optimization of precharge. Finally, Section 6 provides conclusions and perspectives.

Modeling of SMC process

In this section, we outline the mathematical modeling employed that will be used to numerically simulate a Sheet Molding Compound (SMC) process necessary to build a surrogate model. Our focus lies in capturing the evolution of the flow-front for each initial shape during the process. Given the complexity of the process and the need to prioritize optimizing precharge dimensions, it is practical to simplify the SMC process at this stage. Consequently, we have chosen to neglect the effect of fiber orientation in the material flow kinematics. In order to describe this process, it’s essential to identify and explain the key relationships and equations that govern the compression process. These will be detailed in the following section.

Squeeze flow approximation

In modeling the compression process, we assume they behave as a Newtonian fluid. Also, the motion of fibers does not influence the main flow field of resin. The initial equation for modeling molding processes such as Resin Transfer Molding (RTM) [25] or Sheet Molding Compound (SMC) [7] is derived from the Navier-Stokes equations. To simplify further the model , we make use of the narrow gaps hypothesis ( \(\frac{2h}{L} \ll 1\)), as illustrated in Fig. 2. Additionally, by assuming the validity of the narrow gaps hypothesis, the lubrication theory becomes a valuable tool for significantly reducing computational complexity in the modeling process [3].

Fig. 2
figure 2

Squeeze flow phenomenon observed in a confined narrow gap

So, the governing equation for flow becomes:

$$\begin{aligned} \nabla P = \eta \Delta \textbf{v} \ , \end{aligned}$$
(1)

where P is the pressure, \(\textbf{v} = (u,v,w)\) is the velocity vector and \(\eta \) is the dynamic viscosity while \(\nabla \) and \(\Delta \) represent respectively the gradient and Laplacian operator. In what follows, the velocity gradient in the thickness direction is much larger than in the x and y (in-plain gradients) direction and the component of velocity in z direction (w) is neglected with respect to the in-plain component:

$$\begin{aligned} {\left\{ \begin{array}{ll} \frac{\partial u}{\partial z} \gg \frac{\partial u}{\partial x} \hspace{2mm}, \hspace{2mm} \frac{\partial u}{\partial z} \gg \frac{\partial u}{\partial y}\\ \frac{\partial v}{\partial z} \gg \frac{\partial v}{\partial x} \hspace{2mm}, \hspace{2mm} \frac{\partial v}{\partial z} \gg \frac{\partial v}{\partial y}\\ w \approx 0 \end{array}\right. }. \end{aligned}$$
(2)

Therefore, in the Eq. 1, \(P = P(x,y)\). By performing the integration with the z-variable and enforcing no-slip boundary conditions at both gap walls, we obtain:

$$\begin{aligned} \textbf{v}(x,y,z) = \frac{1}{2\eta } \nabla P (z^2 -h^2) \ , \end{aligned}$$
(3)

representing the velocity of the flow. The velocity averaged over the gap thickness is then:

$$\begin{aligned} \tilde{\textbf{v}}(x,y) = \frac{1}{2h} \int _{-h}^{+h} \textbf{v}(x,y) \,dz = - \frac{h^2}{3\eta } \nabla P \ , \end{aligned}$$
(4)

while the flow-rate (\(\textbf{q}(x,y)\)) is given by:

$$\begin{aligned} \textbf{q}(x,y) = 2h \tilde{\textbf{v}}(x,y) . \end{aligned}$$
(5)

Finally, the mass conservation is given by:

$$\begin{aligned} \nabla \cdot \textbf{q}(x,y) = U \ , \end{aligned}$$
(6)

where the compression rate U is assumed to be constant. Now, by replacing expression Eq. 5 into Eq. 6, and considering \({\tilde{U}} = \frac{U}{2h}\), we have:

$$\begin{aligned} -\frac{h^2}{3\eta } \Delta P = \tilde{U} \ . \end{aligned}$$
(7)

It is important to note that as the fluid is subjected to compression, its thickness reduces progressively with time and can be described by the following relation:

$$\begin{aligned} h(t) = {h_{0}} - \frac{U \times t}{2} \ , \end{aligned}$$
(8)

where \(h_0\) is the initial thickness. Ultimately, Eq. 7 can be reformulated in weak form, as:

$$\begin{aligned} \frac{h^2}{3\eta } \int _{\Omega _{f}(t)} \nabla {\hat{P}} \cdot \nabla P \ d\Omega = \int _{\Omega _{f}(t)} {\hat{P}} \tilde{U} \ d\Omega \ . \end{aligned}$$
(9)

where the fluid domain at time \(t\) is defined by \(\Omega _{f}(t)\) and \({\hat{P}}\) is a test function. By discretizing the weak formulation, we can calculate the pressure, and then according to Eq. 4, we have the average velocity for the fluid domain.

Flow front tracking

To consider the temporal evolution of the fluid boundary (\(\Omega _{f}(t)\)) in Eq. 9, two main approaches can be employed, namely, the fixed or modified mesh techniques [26]. Since the modified mesh involves re-meshing at each time step and it can be highly costly [27], to lower the computational burden, we adopted the fixed mesh approach [25, 28, 29].

This approach consists of using an auxiliary function \(I(\textbf{x},t)\), defined across the entire domain (\(\Omega \)), to account for the continuous updating of the boundary. In particular, within the fluid domain \( \Omega _{f}(t)\), \(I\) is equal to one, while in the empty domain (\( \Omega _{e}(t) = \Omega -\Omega _{f}(t)\)), it is zero:

$$\begin{aligned} I(\textbf{x},t) = {\left\{ \begin{array}{ll} 1 \qquad \text {if} \ \textbf{x}\in \Omega _{f}(t) \\ 0 \qquad \text {if} \ \textbf{x}\in \Omega _{e}(t) \end{array}\right. }. \end{aligned}$$
(10)

At time equals 0, I variable is determined by the initial shape of precharge which is defined in advance, this means:

$$\begin{aligned} I(\textbf{x},t=0) = I_{init} \ . \end{aligned}$$
(11)

The time evolution of the fluid domain is governed by a scalar and linear advection equation that can be expressed as follows:

$$\begin{aligned} \frac{\partial I(\textbf{x},t)}{\partial t} + \textbf{v}(\textbf{x},t) \cdot \nabla I(\textbf{x},t) = 0 \ . \end{aligned}$$
(12)

To solve the transport (12), we used the volume of fluid technique along with the Total Variation Diminishing (TVD) method [30].

In order to use the fixed mesh approach we need to extend the Eq. 9 to the whole domain. Thus considering:

  • Null pression in the the empty region of the mold:

    $$\begin{aligned} P=0 \ \text {in} \ \Omega _{e}(t) \ . \end{aligned}$$
    (13)
  • Flow model in the fluid region:

    $$\begin{aligned} \nabla \cdot \left( - \frac{h^2}{3\eta } \nabla P \right) = \tilde{U} \ \text {in} \ \Omega _{f}(t) \ . \end{aligned}$$
    (14)

Using these assumptions, combining the Eqs. 13 and 14, and introducing the I function, the weak formulation defined in the whole domain reads:

$$\begin{aligned} \int _{\Omega } ( I \nabla \hat{P} ( \frac{h^2}{3\eta } \nabla P) + \ (1-I) \hat{P}P ) \ d\Omega = \int _{\Omega } I \hat{P} \tilde{U} \ d\Omega \ . \end{aligned}$$
(15)

A schematic illustration of the model is presented in Fig. 3. To achieve time evolution of SMC process, Eqs. 15 and 12 are solved.

Fig. 3
figure 3

Mass variations across compression moulding

Numerical implementation

In order to build a workflow that can be easily adapted to simulate a diverse spectrum of shapes, we parameterize the shape of the initially precharge with the help of the Non-Uniform Rational B-Splines (NURBS) method [31]. In particular, a set of m control points is essential to create the curve shape for the initial fluid (precharge). The first and \(m^{th}\) control points are intentionally set to be identical, ensuring the creation of a closed curve. Additionally, we strategically position the second and the \((m-1)^{th}\) along the same line to eliminate sharp corners, promoting smoothness and continuity. Therefore, \((m-2)\) independent points are considered to parameterize the shape. Figure 4 shows a shape generated with this methodology.

Fig. 4
figure 4

Illustration of the shape generated by NURBS

After fixing the independent points and generating the initial shape configuration, the SMC process has been simulated, employing Finite Element Method (FEM) and Control Volume (CV) techniques in MATLAB. Figure 5 illustrates the approach used to create the numerical simulation model for Sheet Molding Compound (SMC) process.

Fig. 5
figure 5

Numerical simulation of compression molding process

We consider the elements of the mesh that are inside this curve as full elements (\(I(x,0)=I_{init}=1, x \in \Omega _{f}\)). Subsequently, Eq. 15 is solved to determine the pressure and velocity profile along the fluid boundary. Based on the flow pattern evolution, the fluid domain boundary is updated based on Eq. 12. Figure 6 shows the snapshot of the flow front capturing the boundary evolution.

Fig. 6
figure 6

Recovery of the boundary at each time-step

At each time step, the boundary is determined by considering the center of mass of each element falling within the boundary (where the value I ranges between 0 and 1). Then, by interpolating between these points and sampling with a constant number of points (n), following a uniform discretization of the angular polar coordinate, ensuring that the number of points used to describe the boundary remains fixed for each time step. This process ensures consistency in the number of points on the boundary, providing stability in the representation of the flow front tracking.

The boundaries describing all the points are ultimately saved in the format of (\(\textbf{X}_{t},\textbf{Y}_{t}\)):

$$\begin{aligned} \textbf{X}_{t} = \left( \begin{array}{cc} x_{1} \\ \vdots \\ x_{n} \end{array}\right) _{t} , \textbf{Y}_{t} = \left( \begin{array}{cc} y_{1} \\ \vdots \\ y_{n} \end{array}\right) _{t} \ , \end{aligned}$$
(16)

where \(t = \{1,...,N_t\}\) define the time-step of the simulation, and n is the number of chosen points that discretize the boundary curve. Or in a more compact expression for each time step:

$$\begin{aligned} \textbf{R}_{t}= \left[ \begin{array}{cc} \textbf{X}_{t} \\ \textbf{Y}_{t} \end{array}\right] \ . \end{aligned}$$
(17)
Fig. 7
figure 7

Feedforward neural network algorithm

Fig. 8
figure 8

Updated feedforward neural network algorithm by SVD

To study different mold shapes, we process (by compressing) various primitive shapes. To create initial shapes, we used a Latin Hypercube Sampling method to produce different control points for the NURBS curves. This sampling method is particularly advantageous because it ensures that the obtained samples accurately reflect the underlying distribution of the data compared to other random sampling methods, and it also reduces the sample size.

Finally, K sampled initial shapes are simulated, and the evolution of the boundary for each case and time step is stored in a matrix.

$$\begin{aligned} \textbf{D} = \left[ \underbrace{[\textbf{R}^1_{1},...\textbf{R}^1_{N_t}]}_{\displaystyle {\text {1st simulation}}} ,... \underbrace{[\textbf{R}^K_{1},...\textbf{R}^K_{N_t}]}_{\displaystyle \text {Kth simulation} }\right] \ . \end{aligned}$$
(18)

In the following section, we will utilize the stored boundary to construct the surrogate model.

Surrogate model

Our main goal is to figure out the best initial shape for each unique mold shape. Therefore, we need to apply an inverse analysis to the SMC model. In order to intelligently process, analyze data, and apply reverse analysis, a data-driven model is proposed. One data-driven model that can significantly reduce computational costs consists of Neural Networks (NN) along with model-order reduction techniques.Neural Networks are capable of learning non-linear relationships and identifying complex patterns in data, which is crucial for solving the SMC problem due to the intricate geometry to which the deformed mass can evolve.

In order to create a Neural Network (NN) model, data of different initial shapes is required. The previous section introduces a numerical model that defines the changing boundaries of the shape during the compression process.

Fig. 9
figure 9

Reverse analysis strategy to identify the precharge state

Fig. 10
figure 10

Results at various time steps of a mass compression using the FEM solver

Fig. 11
figure 11

In black, the initial shape used to compare the performance of the trained NN with the FEM solver. The mass has been compressed for 10 seconds, and the results from the two approaches are compared. In particular, in blue, the approximation of the neural network, and in red, the solution of the FEM solver

Fig. 12
figure 12

Mold shape chosen to verify the inverse procedure

Fig. 13
figure 13

Results of the inverse procedure: the shape of the mass identified in as the initial shape to use for the chosen mold (dashed curve) is depicted in violet. In the inverse analysis, the output compression time for this shape is 9.9 seconds

Fig. 14
figure 14

Comparison of the compressed (9.9 seconds) initial shape identified by the inverse procedure with the shape of the mold used as input for the inverse procedure

A Feedforward Neural Network (FFNN) is a machine learning tool that links input data to output data. In this case, each vector of Control Points (CP) (that represents the initial shape by \((m-2)\) independent points) and time connected to a specific boundary in that time \((R_{t})\) as the output (Fig. 7). Through this method, we can develop a neural network model that has the capability to forecast the compressed mass at any given time. Utilizing this approach enables us to have various solutions for every initial mass geometry. Therefore, we can select the appropriate time for compressing the mass based on the mold geometry.

This study trained the FFNN from K samples and their associated flow front evolution stored in matrix \(\textbf{D}\). To establish an analytical correlation between input and output, i hidden layers consisting of j neurons are implied, and the activation function implemented in the hidden layer could depend on the complex patterns and relationships within the data.

However, training a neural network model can be challenging due to its complex nature and high computational demands. To mitigate these challenges and prevent over fitting, and computing time savings, we can reduce the complexity of neural network models by decreasing the output size. This approach conserves computational resources and leads to more efficient training of FFNN models. Therefore, the Model Order Reduction technique will be applied to the output dataset (D), after which we can train the model using the reduced data.

One of the methods to reduce the dimension is the Singular Value Decomposition (SVD) [32, 33], which is applied to the matrix D obtaining:

$$\begin{aligned} \textbf{D} = U \mathbf {\Sigma } {\hat{V}} \hspace{2mm}, \hspace{2mm} \textbf{D} \in {\mathbb {R}}^{2n\times ( K\cdot N_t)} \ . \end{aligned}$$
(19)

Where \(U \in {\mathbb {R}}^{2n\times 2n}\) and \(V \in {\mathbb {R}}^{( K\cdot N_t)\times ( K\cdot N_t)}\) are unitary and such that \(\mathbf {\Sigma } \in {\mathbb {R}}^{2n\times ( K\cdot N_t)}\) is a matrix with real, non-negative entries on the diagonal and zeros out the diagonal. By using the SVD and pre-multiplying (19) by \(\hat{U}\), we have :

$$\begin{aligned} \hat{U} D = \mathbf {\Sigma } \hat{V} = \lambda \ . \end{aligned}$$
(20)

Where \(\lambda \) matrix is essentially a projection of the D matrix onto a lower dimensional to simplify computations and improve analysis. Therefore, the FFNN is trained by a new dataset \(\lambda \) that consists of the z first decomposition models. Figure 8 shows a schematic representation of the neural network architecture used in this paper.

Inverse analysis for precharge reconstruction

Given our objective of determining the optimal initial shape based on the mold shape, we must employ an inverse analysis approach to the neural network model developed to generate boundary profiles in response to various initial shapes. In particular, to minimize the objective function:

$$\begin{aligned} f = {\Vert \lambda ^{mold}- \lambda ^{NN} \Vert }_2 ^2 \ . \end{aligned}$$
(21)

where \(\lambda ^{mold}\) is the arbitrary mold shape, \(\lambda ^{NN}\) is generate for a random initial shape parameters and \(\Vert \cdot \Vert _2 \) represents the classic \(L_2\) norm. We adopted gradient descent techniques, thus the initial shape parameters \(\textbf{X}_{k}\) will be updated in each iterate accordingly:

$$\begin{aligned} \textbf{X}_{k+1} = \textbf{X}_{k}- \alpha {\nabla f} \ , \end{aligned}$$
(22)

with \(\alpha \) being the learning rate. Figure 9 shows the inverse analyses applied to reach the initial shape for particular mold shapes.

Fig. 15
figure 15

(\(\textbf{a}\)) Shape of the mold (dash line) used as input for the inverse analysis, initial shape identify by the inverse analysis (violet line) ; (\(\textbf{b}\)) Comparison of the compressed (7.2 seconds) initial shape identified by the inverse procedure with the shape of the mold

Case study analysis

In this section, we analyze the methodology outlined in the previous section through a numerical case study. Following the rationale presented in Section 4, we construct a surrogate model by simulating 200 molding processes using a FEM solver. In these simulations, the key parameter variations involve the shape of the initial mass, which is represented by nine independent control points of a NURBS. For all shapes considered, a body thickness of 20 mm and a dynamic viscosity of 0.1 Pa/s are imposed. The molding process assumes a compression rate of 1 mm/s and a compression time of 10 seconds. Figure 10 illustrates one of the simulations, showing the boundary shape propagation at different time step during the compression. Throughout all numerical simulations, mass conservation is ensured by monitoring the relative error given by :

$$\begin{aligned} Error = 100 \times \frac{\left| M_{end} - M_{int} \right| }{M_{int}} \ , \end{aligned}$$
(23)

where \(M_{int}\) denotes the mass of the fluid before the compression process starts, and \(M_{end}\) represents the compressed mass. The error in mass conservation observed at the end of all simulations performed was no greater than \( 2.5\% \) , which is acceptable, considering the size of the mesh elements used for the simulation.

The simulated shapes are divided into training and test sets with an 80-20% split ratio. The shapes in the training set are then used to construct the \(\textbf{D}\) matrix Eq. 18 and then the SVD method is applied to identify the first 7 modes that best represent these shapes. These modes, combined with time, serve as inputs for a NN designed to simulate the SMC process (Section 4). In this configuration, the NN consists of a single hidden layer containing 50 neurons, with the hyperbolic tangent (\(\tanh \)) activation function employed. Once the NN is trained, it is tested over the test set. Figure 11 shows the output of the NN of one of the shapes from the test set compressed for 10 seconds wrt to the numerical reference (FEM). The relative error (RE) between the two results (FEM and NN) is calculated as follows:

$$\begin{aligned} RE = 100 \times \frac{\Vert \textbf{x}_i - {\textbf{x}'}_i\Vert _2}{\Vert \textbf{x}_i\Vert _2}, \end{aligned}$$
(24)

where, \(\textbf{x} = (x,y)\) and \(\mathbf {x'} = (x',y')\) represent the coordinates of the boundary points of the reference and the NN approximation, respectively. The relative error (24) for all the shapes in the test set was no greater than \(1.3\%\).

After training the Neural Network (NN), we can utilize inverse analysis to deduce the geometry of the initial shape based on the mold’s geometry (Section 4.1). Suppose we have a new shape of the mold (Fig. 12) that is outside the train-test set.

Applying the inverse procedure we obtain as initial of mass the one showed in Fig. 13. According to the inversion algorithm, the identified shape will reach the mold’s boundary within 9.9 seconds.

To validate the outcome of inverse procedure, the identified initial shape is compressed for 10 seconds and compared with the mold in Fig. 14. The relative error between the compressed mass and mold shapes is \( 0.06 \ \%\).

To demonstrate the effectiveness of the presented method, different shapes of the mold have been considered. Figure 15 displays the results of the inverse procedure in the case of a mold with star shape. For this case the relative error between the compressed mass and mold shapes is \( 0.3 \ \%.\)

Conclusions and perspectives

The primary focus of our investigation was to pinpoint the optimal initial shape, a critical factor in preventing material return during compression and ensuring the successful attainment of the intended molded shape. To achieve this objective, we employed a Feedforward neural network trained using data from the high fidelity model. In particular, the inverse analysis was conducted within the neural network framework using gradient descent (GD) techniques. The results suggest the ability to predict the optimal shape corresponding to a specific compression duration. As a result, this research can create a background for investigating the behavior of fibers in order to improve the physical properties of the final product in the SMC process.