Prediction of steady flows passing fixed cylinders using deep learning

Considerable attention has been given to deep-learning and machine-learning techniques in an effort to reduce the computational cost of computational fluid dynamics simulation. The present paper addresses the prediction of steady flows passing many fixed cylinders using a deep-learning model and investigates the accuracy of the predicted velocity field. The deep-learning model outputs the x- and y-components of the flow velocity field when the cylinder arrangement is input. The accuracy of the predicted velocity field is investigated, focusing on the velocity profile of the fluid flow and the fluid force acting on the cylinders. The present model accurately predicts the flow when the number of cylinders is equal to or close to that set in the training dataset. The extrapolation of the prediction to a smaller number of cylinders results in error, which can be interpreted as internal friction of the fluid. The results of the fluid force acting on the cylinders suggest that the present deep-learning model has good generalization performance for systems with a larger number of cylinders.

www.nature.com/scientificreports/ the prediction of the steady flow induced by moving cylinders. In the second study, another deep-learning model that treats the velocity of the cylinders is constructed by extending the present model. The remainder of this paper is organized as follows. Section "Simulation method" describes details of the CFD simulation method, namely the SPM, used in preparing the dataset. Section "Problem setup" presents the problem addressed in this study, namely a steady flow passing many fixed cylinders. Section "Deep-learning model" presents the constructed deep-learning model. Section "Results and discussion" presents the results and a discussion, where the accuracy of the predicted velocity field is examined. Section "Conclusion" presents conclusions drawn from the results of the study.

Simulation method
This section presents details of the CFD simulation conducted to prepare the dataset.
The study deals with two-dimensional flows around cylinders. A number of methods have been proposed to deal with fluid flow around solid objects, and the SPM 23 is used in the present study because the description of the solid objects (i.e., cylinders in this study) in the SPM is tractable as input data for deep learning, as shown in the next section. In the SPM, the interface between the fluid and a solid object (i.e., cylinder) is described by a continuous smoothed function that takes a value of 1 inside the solid and 0 outside the solid. This allows the direct and efficient numerical simulation of the fluid with the solid objects on a fixed Cartesian grid without a remeshing process. The details of the SPM have been presented in previous reports 23,25,26 , and only an overview of the method is given here.
First, the smoothed function representing the cylinders is described. The smoothed function of the ith cylinder at position R i is defined as a function of the spatial coordinates x: where A is the radius of the cylinder, ξ is the interfacial thickness, and d is the lattice spacing. Accordingly, when there are N cylinders in the system, the smoothed function for all the cylinders is Using the function φ , the total velocity field u is expressed as where u c and u f respectively represent the velocity fields of the cylinder region and fluid region. It is noted that the velocity field of the cylinder region u c takes the value 0 in the present study because this study considers fixed cylinders.
The time development of the total velocity field u is given by the Navier-Stokes (NS) equation: where ρ is the density of the fluid, p is the pressure, and ν is the kinematic viscosity. The pressure p is determined so as to retain the incompressibility condition: ∇ · u = 0 . The term φf c represents the body force acting on the fluid due to the existence of the cylinders. In the SPM, the force is determined so as to make the velocity field of the cylinder region consistent with the cylinder velocity. (The details are given later in Eq. 11.) It is noted that the SPM imposes a no-slip boundary condition on the fluid-structure interface because the tangential velocity difference is reduced by the viscous stress even on the interface 23 . Meanwhile, the hydrodynamic force F H i acting on the ith cylinder is obtained as where V c represents the volume integration of the cylinder region.
In the present simulation, the NS equation (6) is solved adopting a fractional step scheme on a semi-staggered grid 27 as follows. First, the evolution equation that removes the pressure and body force terms is considered: where the forward difference is applied in the time discretization. The term �τ is the pseudo-time increment used in obtaining the steady-state values. The velocity ũ * is the provisional total velocity, and u n is the total velocity obtained in step n. Next, the pressure term is considered. The term is determined so as to make the provisional total velocity divergence free by solving the Poisson equation:  28 . Considering the pressure term, the divergence-free provisional velocity ũ n+1 is obtained as The term for the body force acting on the fluid is then considered. The term is determined so as to make the fluid velocity in the cylinder region consistent with the cylinder velocity 26 : Eventually, the velocity field in step n + 1 is obtained as where p n+1 is an additional pressure term included so as to make the velocity u n+1 divergence free.
In the present study, the steady flow is obtained by fixing the cylinder position and solving the NS equation iteratively. The iteration ends when the unsteady effect becomes negligible in terms of the total velocity field; in other words, the total velocity field u n+1 is considered the same as that in the previous step u n . Here, the criterion with which to interrupt the iteration is set as where u n+1 (i, j) and v n+1 (i, j) ( u n (i, j) and v n (i, j) ) are respectively the x-and y-components of the total velocity field of the present step (the previous step) at the calculation point (i, j). It is noted that the obtained steady flow slightly depends on the pseudo-time increment �τ . The pseudo-time increment �τ is therefore fixed to a single value throughout the present study as described in the next section.

Problem setup
This section describes in detail the addressed problem, namely a steady flow passing fixed cylinders. Figure 1 is a schematic diagram of the analysis domain used in solving this problem. A velocity inlet boundary condition and a pressure outlet boundary condition are imposed on the left and right walls of the analysis domain, respectively. A no-slip boundary condition is imposed on the top and bottom walls. As a result, the flow direction is from left to right. Cylinders are randomly placed in a way that they do not overlap each other or boundaries in the analysis domain. (The cylinders are represented as circles in Fig. 1.) The interaction between the cylinders and fluid is described using the SPM (see "Simulation method"), and a no-slip boundary condition is imposed on the interfaces of the cylinders.
The training data are prepared in the CFD simulation described in "Simulation method". The parameters of the simulation are set as follows. The units of length and time are given by the lattice spacing d and d 2 /ν , no-slip wall no-slip wall pressure outlet velocity inlet The flow obtained in the simulation is considered to be steady for the following reasons. First, in the present study, the Reynolds number based on the cylinder diameter is Re c ≡ 2ūA/ν = 0.8 , which is smaller than the typical Reynolds number ( Re c 40 ) where the unsteady flow is observed 1,30 . Second, in the present simulation, temporal increases and decreases in the fluid velocity were not observed, and the amount of change in a simulation step (defined in Eq. 13) converged.

Deep-learning model
This section describes the architecture of the deep-learning model used in the present study. With the cylinder arrangement given as the input, the present model outputs the fluid velocity field. In the model, the cylinder arrangement is described by the smoothed profile function φ and treated as an array of values with the size of 128 × 128 . (The detail is shown later.) The fluid velocity field is treated as an array of values with the size of 128 × 128 × 2 , since the velocity defined at each calculation point is a vector quantity and has two components (that is, x-and y-components). The present model is based on a model proposed by Hennigh 19,20 . Hennigh's model uses U-net with gated residual blocks 24,31 , which allows for the efficient learning of global information of the boundary of structures. Several modifications to Hennigh's methodology are made so that it is applicable to the present problem. Figure 2 is a schematic representation of the network architecture used to solve the present problem. The present model is different from Hennigh's model 19 in the following three respects. The effectiveness of the modifications is investigated by additional studies. The result is shown in Supplementary Information. Input data. When using Hennigh's model 19 , the information of the boundary of structures is input in a binary fashion; that is, the fluid and structure regions are respectively represented as 0 and 1. When using the present model, the information is input as the field of the smoothed profile function φ . In the smoothed profile function, the fluid-structure interface is represented as values between 0 and 1, and the position of the interface is described in more detail than in the binary representation.

Degrees of freedom.
To predict the more complex flow, the present model has more degrees of freedom than Hennigh's model. Compared with Hennigh's model 19 , the number of down-sample and up-sample operations is increased. The filter size is also increased with reference to a wide residual network 32 . Figure 2 presents The present model is trained so as to minimize the loss function where u pred (i, j) and v pred (i, j) are respectively the x-and y-components of the predicted velocity at the calculation point (i, j). Similarly, u true (i, j) and v true (i, j) are respectively the x-and y-components of the true velocity at the calculation point (i, j). The mini-batch size and learning rate are respectively set to 8 and 1 × 10 −5 throughout the learning process. The present study utilizes TensorFlow 35 version 1.12.0 to create the deep-learning model and runs it on a single node of NVIDIA ® Tesla ® V100 GPU. Figure 3 shows the training and validation losses per mini-batch during the learning. The loss decreases with an increase in the number of epochs, and it is confirmed that the present model successfully learns the steady flow. No overfitting is observed during the learning process. During the learning, the validation loss tends to be lower than the training loss. This is due to the disabling of the dropout layers during the validation. When the keep probability of the dropout layer is set to 1 (i.e., the dropout layer is disabled throughout the learning and validation processes), the two losses take almost the same value. Hereinafter, the prediction made by the model at 1000 epochs is investigated. Next, the true and predicted velocity fields are compared for unknown cylinder systems that are not learned in the training and validation datasets (Fig. 4). In the figure, the columns from left to right show input data that represent the cylinder arrangement (i.e., the smoothed profile function φ ), the magnitude of the true velocity u true (i, j) 2 + v true (i, j) 2 , the magnitude of the predicted velocity u pred (i, j) 2 + v pred (i, j) 2 , and the magnitude of the difference between the true and predicted velocities �u(i, j) j) . In the comparison, the number of cylinders www.nature.com/scientificreports/ N is varied from 16 to 80 in intervals of 16. It is noted that the systems for which N = 16 and 80 have not been seen by the model during the training. For the "difference" field, the range of the color bar is set 10 times narrower than that for the "true" and "prediction" fields. In the results for all N, the predicted velocity fields agree well with the true velocity fields. It is, however, qualitatively seen from the results of the "difference" field that the prediction with small N has lower accuracy than that with large N. For small N, the deep-learning model predicts the velocity at the calculation points far from the cylinder interface. To achieve the prediction accurately, the model needs to learn global information during the training process. The flow velocity is investigated at each calculation point to examine the predicted velocity field in detail. Figure 5 shows scatter plots (a,b) and histograms (c,d) of the true and predicted velocity values at all calculation points ( N = 48 ). The results show that the predicted velocities agree with the true velocities, but there is a slight difference in the height of the peaks in the histograms. The peaks are observed at u = 0 and v = 0 , and  www.nature.com/scientificreports/ they can be attributed to the boundary condition. The result therefore implies that the predicted velocity values at the boundary fluctuate. The predicted flow field is next investigated from a physical perspective. A fluid flowing past many fixed cylinders, which is the problem addressed in this study, can be considered as a fluid flowing through a complex geometry such as the geometry of a porous medium. It is therefore expected that the averaged fluid flow passing randomly placed cylinders can be described by the Darcy-Lapwood-Brinkman (DLB) equation, which treats the bulk velocity of a flow passing through a porous medium by introducing a Darcy friction term 36,37 . The DLB equation is written as where L ′ y ≡ L y /2 √ k and y ′ ≡ y/2 √ k . In the derivation, ν = ν eff is assumed. By fitting the average velocity profile of the predicted flow with Eq. (17), the permeability k is obtained for each number of cylinders N and the dependence of k on N is investigated. The results are shown in Fig. 6(a) (blue closed symbols). Here, the velocity profiles to be fitted with Eq. (17) are obtained by averaging the 10, 000 different velocity profiles on the outlet boundary (i.e., the velocity value at x = L x ) for each N. In the figure, the permeability k obtained in the same manner from the training data is shown with red open symbols. The permeability obtained from the predicted velocity profiles agrees well with that obtained from the training data. Meanwhile, the value of k obtained from the predicted velocity profiles increases rapidly as N decreases. Theoretically, the permeability k should diverge to infinity at N = 0 . In the present study, however, the predicted velocity profile at N = 0 is well described by the DLB equation with k ≃ 608 (Fig. 6b). This result indicates that, at N = 0 , the resistance force is acting on the fluid in the form of internal friction, although the flow satisfies the incompressibility condition and preserves the mean flow velocity. It is considered that the present deep-learning model learns the flow field such that it reproduces the physics of the DLB equation, and it has an error determined by the internal friction when N is small. Given the range of N in the training dataset, the error found when N is small is probably due to the large extrapolation to lower values of N. The issue is not crucial when preparing the training data with appropriate cylinder numbers that match the conditions of the prediction.

Results and discussion
Lastly, the force acting on a cylinder is compared between the prediction and ground truth. The force acting on the ith cylinder F H i is obtained as follows. First, for the obtained steady-state flow velocity field, the pseudotime evolution is performed (see Eqs. [8][9][10]. The body force acting on the fluid φf c (and φ i f c ) is then obtained from the velocity field using Eq. (11). The force F H i is then obtained from Eq. (7). Hereinafter, the forces obtained from the true and predicted flow fields are respectively referred to as the "true force" and "predicted force". Figure 7 presents scatter plots (a and b) and histograms (c and d) of the true and predicted forces F H true and F H pred ( N = 48 ). (In the notation of the forces, the subscript letter i is omitted because it is no longer necessary to specify the cylinder number.) The figure shows the gathered results of 100 patterns of the cylinder arrangement. A comparison of the true and predicted forces acting on each cylinder confirms the accuracy of the predicted velocity field. The average relative error for the forces acting on cylinders �|F H true − F H pred |/|F H true |� (Fig. 8a) is investigated next. The results show that the error increases as the number of cylinders N decreases. To examine this result in detail, the average absolute errors for the x-and y-components of the forces �|F H x,true − F H x,pred |� and �|F H y,true − F H y,pred |� are also investigated (Fig. 8b, circles). The figure also shows the average values of x-and y-components of forces �|F H x,true |� and �|F H y,true |� obtained in the numerical simulation (triangles). Meanwhile, �|F H x,true |�

Conclusion
This study constructed a deep-learning model that can predict a steady flow passing objects and addressed the prediction of steady fluid flow passing many fixed cylinders. The constructed deep-learning model is based on Hennigh's model 20   www.nature.com/scientificreports/ is input. The SPM was used to generate the training dataset 23,25 . In the SPM, the shape and arrangement of objects (i.e., cylinders in the present study) are described by a smoothed profile function. The present deep-learning model uses values of the smoothed profile function as the input data. Training and validation losses showed that the present model successfully learns the steady flow passing fixed cylinders. No overfitting was observed during the training. The present study investigated the accuracy of the predicted velocity field focusing on the velocity profiles of the fluid flow and the fluid force acting on the cylinders. The results show that the flow is successfully predicted by the present model when the number of cylinders is equal to or close to that set in the training dataset. The extrapolation of the prediction to a smaller number of cylinders results in error relating to internal friction of the fluid. The results of the fluid force acting on the cylinders also suggest that the present deep-learning model has good generalization performance for systems with a larger number of cylinders.
Here, the benefit of applying the deep-learning technique to the present problem should be explained in terms of computation time. In the present study, the computation time for the learning of the model is T learn ∼ 70 h . On the other hand, the computation time for the CFD simulation to obtain one example is T sim ∼ 4 min with a single node of Intel ® Xeon ® CPU E5-2697A v4 processor. Judging from the computation times, there seems to be no benefit of applying the deep-learning technique to address the present problem. However, it is worth applying to the present problems considering its "scalability". The deep-learning model can predict the flow in a very short period of inference time T inf ∼ 1 s once it is trained. To obtain flows around solids of different shapes and arrangements using the model, it takes time T inf since no re-training is required. On the other hand, typical CFD simulations require re-calculation, and it takes time T sim to obtain the flow in the same situation. Therefore, the deep-learning model is useful to reduce the computation cost in the repeated calculation with changing shape and arrangement of objects, which is often required in the field of engineering. In this case, the more times the calculation is repeated, the more efficiently the calculation is done by the model.
The ultimate aim of the present research is to accelerate the CFD simulation of a fluid with solid objects using deep-learning techniques. The present deep-learning model has the potential to be used for the acceleration of the simulation of a multiphase flow because the model is able to predict the flow velocity field around many fixed cylinders with a very short inference time. The present model, however, takes only the positions and shapes of solid objects as the input, which is insufficient for replacing the fluid calculation of multiphase flow simulations. If the calculation in the SPM is to be replaced with a deep-learning model, the velocities of solid objects should be input into the model in addition to the positions and shapes of the solid objects. Following the present study, another deep-learning model that treats the velocities of solid objects by extending the present model was therefore constructed. The results will be presented in an adjoining paper.

Data availability
The data that support the findings of this study are available from the corresponding author upon reasonable request.