# A Machine Learning Model to Detect Flow Disturbances during Manufacturing of Composites by Liquid Moulding

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Model Description

## 3. Dataset Synthetic Generation

#### 3.1. Mould Filling Model

**x**and t stand for the position of a given point in the fabric and the time, respectively. Assuming flow continuity, $\nabla \xb7\mathbf{v}(\mathbf{x},t)=0$, the governing equation for the pressure field can be obtained as

**S**is known as the Darcy–Forchheimer sink term

**D**and

**F**stand for material parameters. The second term in Equation (4) is related to inertial effects which are negligible for the case of liquid moulding of composites under low Reynolds number flow. In this situation, the inertial terms related to the velocity can be neglected, recovering the standard Darcy equation with the factor

**D**being the inverse permeability of the fabric. In two-phase flow, the interface between the two fluids, namely resin and air in liquid moulding, is tracked by means of the volume of fluid (VOF) approach by using $\alpha $ as a phase variable. This variable ranges between $\alpha =1$ and $\alpha =0$ for the resin and air fluids, respectively. Within this approach, the $\alpha $ variable is continuously updated during simulation time by using the advection equation given by

^{®}(Open source Field Operation And Manipulation) [17] is a free open source Computational Fluid Dynamics (CFD) software that can be used to solve the problems related with filling in liquid moulding of composites. OpenFoam includes

`interFoam`a solver for two-phase incompressible, isothermal and immiscible fluids tracking interfaces with the VOF method. Details and performance of the algorithms used to track interfaces as well as pressure and velocity solvers for two-phase flow can be found in [18].

#### 3.2. Mould Filling Simulations Containing Dissimilar Material Regions

`interFoam`solver corresponded to water and air, for simplicity. Their density and kinematic viscosity were set to 1000 Kg/m${}^{3}$ and $\nu ={10}^{-6}\phantom{\rule{3.33333pt}{0ex}}{\mathrm{m}}^{2}$/s for the water, and 1 Kg/m${}^{3}$ and $\nu ={10}^{-8}\phantom{\rule{3.33333pt}{0ex}}{\mathrm{m}}^{2}$/s for the air, respectively. Despite the simplicity of the model presented in this work, more complicated problems including different mould shapes, inlet and outlet configurations among others can be addressed and used for synthetic training of the artificial intelligence method.

#### 3.3. Dataset Generation

`PyDOE`software package [19]. This number of simulations were enough to maintain the accuracy of the model. Mould filling simulations were run sequentially by OpenFoam for each of the ${\alpha}_{1},{\alpha}_{2},{\alpha}_{3},{\alpha}_{4}$ and $\beta $ combinations provided with the Latin Hypercube method. The automation of the computational process was carried out by using

`PyFoam`, a Python library that manipulates and control OpenFoam running cases. Instances of the problem corresponding to each of the ${\alpha}_{1},{\alpha}_{2},{\alpha}_{3},{\alpha}_{4}$ and $\beta $ combinations were generated by modifying OpenFoam dictionaries

`topoSetDict`and

`controlDict`. Once an individual simulation finished, normally in a few minutes in a regular laptop, the pressure probes dataset is stored. This process is followed by a new job submission until the whole dataset is created. Lastly, the dataset generated including the pressure sensor signals are stored as a bi-dimensional array that contains time and sensor position together with their corresponding 5-tuple model variables ${\alpha}_{1},{\alpha}_{2},{\alpha}_{3},{\alpha}_{4}$ and $\beta $. Datasets were serialized into a Python

`pickles`to provide easy access in subsequent training tasks.

## 4. Building, Training and Deploying Machine Learning Models

^{®}API (application programming interface) and their main features are presented in this section. Keras is a high-level neural network API, written in Python and capable of running on top of TensorFlow

^{®}, CNTK

^{®}, or Theano

^{®}[20]. This work has selected, among those available in the published literature, a kernel architecture made with a CNN. The main purpose is to describe a novel methodology to build and deploy a machine learning algorithm able to track flow disturbances produced during manufacturing of composites by liquid moulding rather than establish the most effective and robust model architecture that can be used.

#### 4.1. CNN Machine Learning Networks

- Convolution2D (
`Conv2D`). This corresponds to an image operation based on the application of a given set of filters to enhance specific features of the image. If the input image is**A**(see Figure 5 with footprint of $9\times 100$) the 2D convolutions of this individual image may be obtained, namely**B**, by applying the kernel function**F**, as$$\mathbf{B}(i,j)=\mathbf{F}\ast \mathbf{A}=\sum _{k}\sum _{l}{F}_{k,l}{A}_{i-k,j-l}$$**F**stands for the filter applied and ∗ the convolution operator. The operation can be parametrized by using different filter sizes, strides, paddings, activation functions or kernel regularization. Filters of size $({n}_{k},{n}_{k},{n}_{channel})$ are intended to highlight specific features in time and space produced by the presence of the dissimilar material region in the mould. Input image dimensions are given by $({n}_{w},{n}_{h},{n}_{canal})$, where ${n}_{channel}=1$ for greyscale images, and output image dimensions are calculated by $({n}_{w}-{n}_{k}+1,{n}_{h}-{n}_{k}+1,1)$. For instance, the first`Conv2D`layer in Figure 6 uses a $(4,4,1)$ kernel with an input grayscale image object of $(9,100,1)$. This filter operation produces an output image of $(9,50,32)$ for this first convolution. Filters normally make use of a certain step, named`stride`, that move the convolution filter along the x and y axis of the input image. Padding is the parameter which maintains the size of the output images resulting from the convolution**B**. Keras uses the`padding=’same’`technique to avoid image edge trimming. Lastly, when convolution is completed, a ReLu (Rectified Linear Unit $f\left(x\right)=max(0,x)$) is used as cut-off function thus avoiding negative outputs that can be generated. - MaxPooling (
`MaxPooling2D`). This is applied to reduce the dimensions of the convolution filtered images with the purpose of obtaining more efficient and robust characteristics. The model uses a $2\times 2$ pooling filter, taking the maximum value of the pixels in the neighborhood as the result for a given point. For instance, Figure 6 shows MaxPooling operations used to reduce the image size from $9\times 50$ to $8\times 25$ in the first convolution. - Batch normalization (
`BatchNormalization`). This seeks to alleviate the movements produced in the distributions of internal nodes of the network with the intention of accelerating its training. Those movements are avoided via a normalization step, constraining means and variances of the layer inputs. Furthermore, it reduces the need for dropout, local response normalization and other regularization techniques [23]. - Flatten (
`Flatten`). This operation splits up the characteristics, transforming them and preparing for obtaining a vector-type object [24]. It is used as training input of the subsequent fully-connected neural network (FCNN). - Dense (
`Dense`). The fully-connected layer is implemented by one or several dense functions. Each layer obtains n inputs from the precedent layer or, in case of the first dense layer, n inputs from the`Flatten`layer. Then, these inputs are balanced by the neural network weights and bias, and transformed into a set of outputs for the following layer according to their specific activation functions. The final dense layer contains a five-component vector-type to perform the regression on the values of ${\alpha}_{1},{\alpha}_{2},{\alpha}_{3},{\alpha}_{4}$ and $\beta $. Particularly, the neural network used in this work contains three fully connected layers, containing 128, 256 and 512 neurons respectively.

#### 4.2. Training Machine Learning Models

`Adadelta`were used to this end. The exact rules governing a specific use of gradient descent are defined by the

`Adadelta`[25] Keras optimizer. Training was carried out after not more than 5000 epochs by using 64 as the batch size and lasted around 16 h with a 10 cores Intel Xeon W-2155CPU-3.30 GHz machine. The evolution of training and test losses against the number of epoch training cycles is presented in Figure 7. The best model configuration obtained produces a minimum MSE of $\approx {10}^{-2}$ after training which was judged accurately enough for modelling purposes.

#### 4.3. Deploying Machine Learning Models

`json`format (JavaScript Object Notation) and

`hdf5`Hierarchical Data Format (HDF) respectively. Once the network was trained, it could be deployed subsequently and evaluated at any time by loading the model, weights and the new unseen data without the need of retraining.

## 5. Discussion

#### Model Robustness

## 6. Conclusions and Final Remarks

- Machine learning and artificial intelligence strategies open revolutionary opportunities in material science and, more specifically, in materials and parts manufacturing. The ability of these technologies to deal and overcome complex physical and engineering problems that relate different datasets, as sensors and dissimilar material regions in this work, is highly aligned with Industry 4.0 concepts. In the future, this will enable the development of efficient cyber-physical systems to detect defects automatically during manufacturing while guaranteeing the implementation of the appropriate corrective actions.
- Some of the major concerns and drawbacks of the application of machine learning methods in manufacturing of structural composites are related with enormous costs and development times associated with the experimental generation of the large datasets required for training. A way of easing the burden on experimental tasks is to involve the cooperative help of simulation results to create augmented datasets. Of course, it could be argued that the accuracy of processing simulation tools to predict the involved variables is dubious, specially if manufacturing disturbances should be taken into account. This paper has presented a fully simulation-based machine learning model, although the purpose in future implementations will be to combine both experimental and model datasets.
- Many modelling techniques involve machine learning algorithms and include different architectures and methods. It should be noted that similar or even better results could be obtained by using other approaches not examined here. The aim of the paper was not to provide the optimum model configuration but to analyze the ability of machine learning to detect automatically flow disturbances occurring during liquid moulding by testing a simple problem. A future objective will entail examining of integration into a complete system able to detect manufacturing disturbances while implementing automatically the required corrective actions to maintain a constant quality of the manufactured part.

## Author Contributions

## Funding

## Conflicts of Interest

## References

- González, C.; Vilatela, J.; Molina-Aldareguía, J.; Lopes, C.; LLorca, J. Structural composites for multifunctional applications: Current challenges and future trends. Prog. Mater. Sci.
**2017**, 89, 194–251. [Google Scholar] [CrossRef] [Green Version] - Llorca, J.; González, C.; Molina-Aldareguía, J.; Segurado, J.; Seltzer, R.; Sket, F.; Rodríguez, M.; Sádaba, S.; Muñoz, R.; Canal, L. Multiscale modeling of composite materials: A roadmap towards virtual testing. Adv. Mater.
**2011**, 23. [Google Scholar] [CrossRef] [PubMed] - Roth, Y.C.; Weinholdt, M.; Winkelmann, L. Liquid Composite Moulding - Enabler for the automated production of CFRP aircfraft components. In Proceedings of the 16th European Conference on Composite Materials, ECCM 2014, Seville, Spain, 22–26 June 2014; pp. 22–26. [Google Scholar]
- Advani, S.; Hsiao, K.T. (Eds.) 1—Introduction to composites and manufacturing processes. In Manufacturing Techniques for Polymer Matrix Composites (PMCs); Woodhead Publishing Series in Composites Science and Engineering; Woodhead Publishing: Sawston, UK, 2012; pp. 1–12. [Google Scholar] [CrossRef]
- Rudd, C.D.; Long, A.C.; Kendall, K.N.; Mangin, C.G.E. Liquid Moulding Technologies; Woodhead Publishing: Sawston, UK, 1997. [Google Scholar] [CrossRef]
- Siddig, N.A.; Binetruy, C.; Syerko, E.; Simacek, P.; Advani, S. A new methodology for race-tracking detection and criticality in resin transfer molding process using pressure sensors. J. Compos. Mater.
**2018**, 52, 4087–4103. [Google Scholar] [CrossRef] - Zhou, B.; Lapedriza, A.; Xiao, J.; Torralba, A.; Oliva, A. Learning deep features for scene recognition using places database. Adv. Neural Inf. Process. Syst.
**2014**, 1, 487–495. [Google Scholar] - Xiao, J.; Hays, J.; Ehinger, K.A.; Oliva, A.; Torralba, A. SUN database: Large-scale scene recognition from abbey to zoo. In Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, San Francisco, CA, USA, 13–18 June 2010; pp. 3485–3492. [Google Scholar] [CrossRef]
- Mezzasalma, S.A. Chapter Three The General Theory of Brownian Relativity. Interface Sci. Technol.
**2008**, 15, 137–171. [Google Scholar] [CrossRef] - Bock, F.E.; Aydin, R.C.; Cyron, C.J.; Huber, N.; Kalidindi, S.R.; Klusemann, B. A review of the application of machine learning and data mining approaches in continuum materials mechanics. Front. Mater.
**2019**, 6. [Google Scholar] [CrossRef] [Green Version] - Wu, J.; Yin, X.; Xiao, H. Seeing permeability from images: Fast prediction with convolutional neural networks. Sci. Bull.
**2018**, 63, 1215–1222. [Google Scholar] [CrossRef] [Green Version] - Iglesias, M.; Park, M.; Tretyakov, M.V. Bayesian inversion in resin transfer molding. Inverse Probl.
**2018**, 34, 1–49. [Google Scholar] [CrossRef] - Lähivaara, T.; Kärkkäinen, L.; Huttunen, J.M.J.; Hesthaven, J.S. Deep convolutional neural networks for estimating porous material parameters with ultrasound tomography. J. Acoust. Soc. Am.
**2018**, 143, 1148–1158. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Zhu, Y.; Zabaras, N. Bayesian deep convolutional encoder–decoder networks for surrogate modeling and uncertainty quantification. J. Comput. Phys.
**2018**, 366, 415–447. [Google Scholar] [CrossRef] [Green Version] - Bruschke, M.V.; Advani, S.G. A finite element/control volume approach to mold filling in anisotropic porous media. Polym. Compos.
**1990**, 11, 398–405. [Google Scholar] [CrossRef] - Bruschke, M.V.; Advani, S.G. A numerical approach to model non-isothermal viscous flow through fibrous media with free surfaces. Int. J. Numer. Methods Fluids
**1994**, 19, 575–603. [Google Scholar] [CrossRef] - Weller, H.G.; Tabor, G.; Jasak, H.; Fureby, C. A tensorial approach to computational continuum mechanics using object-oriented techniques. Comput. Phys.
**1998**, 12, 620–631. [Google Scholar] [CrossRef] - Deshpande, S.S.; Anumolu, L.; Trujillo, M.F. Evaluating the performance of the two-phase flow solver interFoam. Comput. Sci. Discov.
**2012**, 5, 014016. [Google Scholar] [CrossRef] - PyDOE. The Experimental Design Package for Python. Available online: https://pythonhosted.org/pyDOE/ (accessed on 9 June 2020).
- Chollet, F.; KERAS. Available online: https://github.com/fchollet/keras (accessed on 9 June 2020).
- Cun, Y.L.; Boser, B.; Denker, J.S.; Howard, R.E.; Habbard, W.; Jackel, L.D.; Henderson, D. Handwritten Digit Recognition with a Back-propagation Network. In Advances in Neural Information Processing Systems 2; Morgan Kaufmann Publishers Inc.: San Francisco, CA, USA, 1990; pp. 396–404. [Google Scholar]
- LeCun, Y.; Bengio, Y.; Hinton, G. Deep learning. Nature
**2015**, 521, 436–444. [Google Scholar] [CrossRef] - Ioffe, S.; Szegedy, C. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv
**2015**, arXiv:1502.03167. [Google Scholar] - Jin, J.; Dundar, A.; Culurciello, E. Flattened convolutional neural networks for feedforward acceleration. arXiv
**2014**, arXiv:1412.5474. [Google Scholar] - Zeiler, M.D. ADADELTA: An Adaptive Learning Rate Method. arXiv
**2012**, arXiv:abs/1212.5701. [Google Scholar]

**Figure 1.**General description of the problem. Square RTM mould containing a rectangular dissimilar material region with relative permeability of $\beta =K/{K}_{0}$, size $2b\times 2h$ and centered at $({x}_{0},{y}_{0})$. ${K}_{0}$ and K stand for the permeability of the dissimilar region and the surrounding media, respectively.

**Figure 2.**(

**a**) Definition of the model containing a dissimilar rectangular region with center coordinates $({x}_{0},{y}_{0})$, size $2b\times 2h$ and permeability $K=\beta {K}_{0}$, (

**b**) $3\times 3$ network of pressure sensors equally distributed on the mould surface.

**Figure 3.**Snapshots of the flow progress through the mould for different non-dimensional times $\widehat{t}$ = 0.02, 0.1, 0.2, 0.4, 0.8 and 1.0. The mould contains a square region of size $0.25L$ centered at ${x}_{0}=0.25L$ and ${y}_{0}=0.25L$ with relative permeability of $\beta =0.1$. Flow progress from left to right. Red and blue colours correspond to phase values of $\alpha =0$ and $\alpha =1$, respectively. For the sake of clarity, white dashed lines corresponding to the dissimilar material region were superimposed.

**Figure 4.**Non-dimensional pressure evolution $\widehat{p}(\widehat{t})$ for the nine sensors distributed in the mould containing a $0.25L$ square dissimilar material region at (

**a**) ${\alpha}_{1}=0.25,\phantom{\rule{0.277778em}{0ex}}{\alpha}_{2}=0.25$, (

**c**) ${\alpha}_{1}=0.5,\phantom{\rule{0.277778em}{0ex}}{\alpha}_{2}=0.5$ and (

**e**) ${\alpha}_{1}=0.75,\phantom{\rule{0.277778em}{0ex}}{\alpha}_{2}=0.75$. Dashed lines corresponds with the pressure sensor evolution in the absence of dissimilar material region. The pressure changes $\mathsf{\Delta}\widehat{p}(\widehat{t})$ in (

**b**,

**d**,

**f**) are as the difference, or perturbation, between the local pressure value with and without dissimilar material region. For visualization purposes, the non-dimensional time was arbitrarily extended to $\widehat{t}=2$.

**Figure 5.**(

**a**) Sensor footprints corresponding to the plot cases presented in Figure 4. The vertical and horizontal axis of the images corresponded with the non-dimensional time $\widehat{t}$ and sensor position $i=1,9$. The color intensity reflects the sensor non-dimensional pressure $\widehat{p}$, (

**b**) Pressure perturbation $\mathsf{\Delta}\widehat{p}(\widehat{t})$ evolution footprint. For visualization purposes, the non-dimensional time was arbitrarily extended to $\widehat{t}=2$.

**Figure 7.**Training and test MSE (mean square error) losses evolution against the number of epochs training cycles. The data include losses obtained with and without the application of techniques to alleviate overfitting (data augmentation, ${L}_{2}$ regularization and dropout).

**Figure 8.**Comparisons between the ground truth values of the variables, (

**a**) ${\alpha}_{1}$, (

**b**) ${\alpha}_{2}$, (

**c**) ${\alpha}_{3}$, (

**d**) ${\alpha}_{4}$ and (

**e**) $\beta $ including training (green) and test (red) data sets, (

**f**) Histograms of the absolute error corresponding to each of the variables used in the regression.

**Figure 9.**Comparisons between the ground truth and predictions for five randomly selected dissimilar material regions in terms of position and (

**a**) size for the test data set using the $3\times 3$ sensor network size, (

**b**) Same results as previously shown but with different sensor network of $2\times 2$, $3\times 3$ and $4\times 4$.

**Figure 10.**Snapshots of the flow progress through the mould for different non-dimensional times $\widehat{t}$ = 0.02, 0.2, 0.4, 0.8 and 1.0 corresponding to the predicted values for the case shown in Figure 3. Flow progress from left to right. Red and blue colours correspond to phase values of $\alpha =0$ and $\alpha =1$, respectively. For the sake of clarity, white dashed lines corresponding to the dissimilar material region were superimposed.

**Figure 11.**(

**a**) Corrupted pressure signal with white noise following the Gaussian distribution $N(0,0.01)$, (

**b**) MSE as a function of white noise standard deviation $\sigma $.

**Figure 12.**Comparisons between the ground truth and predictions for different dissimilar material realizations: (

**a**) Circular, (

**b**) Double size rectangular, (

**c**) Two equal rectangles, (

**d**) Two equal rectangles with CNN model trained with a new double rectangle data set.

Layers | Specifications |
---|---|

Conv2D | 32 $4\times 4$ filters with $2\times 1$ stride and padding same |

activation ReLu + ${L}_{2}$ Regularization $5\times {10}^{-4}$ | |

Batch Normalization | - |

MaxPooling2D | $2\times 2$ filter with $2\times 1$ stride |

Conv2D | 64 $4\times 4$ filters with $2\times 1$ stride and padding same |

activation ReLu + ${L}_{2}$ Regularization $5\times {10}^{-4}$ | |

Batch Normalization | - |

MaxPooling2D | $2\times 2$ filter with $2\times 1$ stride |

Flatten | - |

Fully Connected | 128 (activation ReLu+ Dropout 0.4) |

Fully Connected | 256 (activation ReLu+ Dropout 0.25) |

Fully Connected | 512 (activation Softmax+ Dropout 0.5) |

Fully Connected | 5 (${\alpha}_{1}$, ${\alpha}_{2}$, ${\alpha}_{3}$, ${\alpha}_{4}$, $\beta $) |

**Table 2.**Fraction of the total data with absolute error falling within the $\pm 10\%$ and $\pm 20\%$ bands.

Error | ${\mathit{\alpha}}_{1}$ | ${\mathit{\alpha}}_{2}$ | ${\mathit{\alpha}}_{3}$ | ${\mathit{\alpha}}_{4}$ | $\mathit{\beta}$ |
---|---|---|---|---|---|

$\pm 10\%$ | 0.5% | 3.0% | 49% | 35% | 42% |

$\pm 20\%$ | 0.2% | 0.0% | 16% | 3% | 15% |

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

González, C.; Fernández-León, J.
A Machine Learning Model to Detect Flow Disturbances during Manufacturing of Composites by Liquid Moulding. *J. Compos. Sci.* **2020**, *4*, 71.
https://doi.org/10.3390/jcs4020071

**AMA Style**

González C, Fernández-León J.
A Machine Learning Model to Detect Flow Disturbances during Manufacturing of Composites by Liquid Moulding. *Journal of Composites Science*. 2020; 4(2):71.
https://doi.org/10.3390/jcs4020071

**Chicago/Turabian Style**

González, Carlos, and Joaquín Fernández-León.
2020. "A Machine Learning Model to Detect Flow Disturbances during Manufacturing of Composites by Liquid Moulding" *Journal of Composites Science* 4, no. 2: 71.
https://doi.org/10.3390/jcs4020071