# Fast Prediction of Flow Field around Airfoils Based on Deep Convolutional Neural Network
## 2 Methods
### Train and Evaluation Methods  
In this work, the CNN-DCNN model is trained by supervised learning, in which the labeled data along with the input matrices are fed to network. In the training process, the model parameters are optimized iteratively towards the direction that minimizes the loss between the predicted results (\(\hat{P}\), \(\hat{U}\)) and the labeled outputs (\(P,U\)). To obtain optimal parameters, loss is quantificationally by an L2 loss function with L2 regularization to avoid overfitting, the loss function is defined as  
\[J=\frac{1}{2N}\sum_{n=1}^{N}\left[\left(P_{n}-\hat{P}_{n}\right)^{2}+\left(U_{ n}-\hat{U}_{n}\right)^{2}\right]+\lambda\|W\|_{2}^{2} \tag{11}\]  
where \(P_{n}\) and \(U_{n}\) denote \(n\)th flow field results by CFD simulation, \(\hat{P}_{n}\) and \(\hat{U}_{n}\) represent the corresponding prediction by CNN-DCNN, \(N\) is the number of training data, \(\lambda\) is the  
Figure 4: The schematic of a deconvolutional layer: (**a**) computation procedure of a 2D deconvolution; (**b**) operating flow of a deconvolution layer (numbers are for illustration purpose only). regularization coefficient, and \(\lambda\|W\|_{2}^{2}\) performs the L2 regularization. To eliminate the effect from the airfoil interior points, the original loss function is modified as follows:  
\[J^{\prime}=\frac{1}{2N}\sum_{n=1}^{N}\left[\left(\left(P_{n}-\hat{P}_{n}\right) \times\delta_{n}\right)^{2}+\left(\left(U_{n}-\hat{U}_{n}\right)\times\delta_{ n}\right)^{2}\right]+\lambda\|W\|_{2}^{2} \tag{12}\]  
where \(\delta_{n}\) is the binary mask matrix of the \(n\)th airfoil, which is filled with 0 and 1, for points inside and outside of the airfoil, respectively. To minimize the loss function defined in Equation (12), the Adaptive Moment Estimation (Adam) algorithm is used to update the model parameters, due to its performance advantage [45]. For ease of description, \(W\) and \(b\) in Equation (1) are collectively referred to as network parameters and represented by \(\theta\) since their updating rules are the same. The Adam algorithm employs both the first and second moments to improve the update of parameters:  
\[V_{d\theta}=\beta_{1}V_{d\theta}+(1-\beta_{1})d\theta \tag{13}\]  
\[S_{d\theta}=\beta_{2}S_{d\theta}+(1-\beta_{2})d\theta^{2} \tag{14}\]  
where \(\theta\) represents the network's parameters set including the weight \(W\) and the bias \(b\), \(d\theta\) refers to the gradients of the loss function with respect to \(\theta\), \(\beta_{1}\) and \(\beta_{2}\) are the exponential decay rates of the moment estimation, \(V_{d\theta}\) and \(S_{d\theta}\) are the first and second moment estimations. Considering that both \(V_{d\theta}\) and \(S_{d\theta}\) are initialized by zero vectors and also bias towards zero during update, the following correction is carried out to adjust these biases within each training iteration,  
\[V_{d\theta}^{corrected}=\frac{V_{d\theta}}{1-\beta_{1}^{t}} \tag{15}\]  
\[S_{d\theta}^{corrected}=\frac{S_{d\theta}}{1-\beta_{2}^{t}} \tag{16}\]  
where the superscript \(t\) of \(\beta\) is the exponential operator. Finally, the network parameters \(\theta\) are updated in an iterative manner through  
\[\theta=\theta-\alpha\frac{V_{d\theta}^{corrected}}{\sqrt{S_{d\theta}^{corrected} +\varepsilon}} \tag{17}\]  
where \(\alpha\) is the learning rate and \(\varepsilon\) is a small scalar to avoid singularity. Moreover, it is worth mentioning that the learning strategy of mini-batch gradient descent is applied in the training process to improve computational efficiency and model robustness [46]. Random deactivation rate (dropout) of 0.2 is further used for all layers to prevent overfitting.