 Applied Mathematics, 2010, 1, 288-292 doi:10.4236/am.2010.14037 Published Online October 2010 (http://www.SciRP.org/journal/am) Copyright © 2010 SciRes. AM Artificial Neural Networks Approach for Solving Stokes Problem Modjtaba Baymani, Asghar Kerayechian, Sohrab Effati Department of Mathematics, Ferdowsi University of Mashhad, Mashhad, Iran E-mail: mhbaymani@yahoo.com, krachian@gmail.com, s-effati@um.ac.ir Received July 10, 2010; revised August 11, 2010; accepted August 14, 2010 Abstract In this paper a new method based on neural network has been developed for obtaining the solution of the Stokes problem. We transform the mixed Stokes problem into three independent Poisson problems which by solving them the solution of the Stokes problem is obtained. The results obtained by this method, has been compared with the existing numerical method and with the exact solution of the problem. It can be observed that the current new approximation has higher accuracy. The number of model parameters required is less than conventional methods. The proposed new method is illustrated by an example. Keywords: Artificial Neural Networks, Stokes Problem, Poisson Equation, Partial Differential Equations 1. Introduction CFD stands for Computational Fluid Dynamics, a sub-genre of fluid mechanics that uses computers (numerical methods and algorithms) to represent, or model, prob-lems that engage fluid flows. CFD software is usually used to solve equations in a discretized way. The domain is transferred into a grid or mesh – a regular/irregular and 2D/3D surface of cells. After discretization, an equation solver runs to solve the equations of fluid motion (Euler equations, Navier-Stokes equations, etc.). Algorithms from numerical linear algebra, like: Gauss-Seidel, suc-cessive over relaxation, Krylov subspace method or al-gorithms from Multigrid family are typically used. These methods involve millions of calculations, so, as it can be easily observed, computing is time consuming. Also in many problems, even with parallel programming and su- percomputers, only approximate solutions can be reached. There are various optimization methods of computer science which can be used for CFD. Simulated Anneal-ing, Genetic Algorithms, Evolution Strategy, Feed-For- ward Neural Networks are popular and we reimplemented in many projects. In  a framework is created for evolutionary optimi-zation which is then tested on aerodynamic design ex-ample. The framework was based on covariance matrix adaptation, with the feed-forward neural network as an approximate fitness function. An aerodynamic design procedure which combines neural networks with poly-nomial fits is introduced in  and  discussed an arti-ficial neural network which is an approximate model that is used for optimization of the blade geometry by simu-lated annealing method. Parallel stochastic search algo-rithm is introduced in  and tested on defining a shape of two airfoils. In this work, a performance neural net-work for solving Stokes equations is presented. Lagaris, et al.  used artificial neural networks (ANN) for solving ordinary differential equations and partial differential equations for both boundary value and initial value problems. Canh and Cong  presented a new technique for numerical calculation of viscoelastic flow based on the combination of neural networks and Brownian dynamics simulation or stochastic simulation technique (SST). Hayati and Karami  used a modified neural network to solve the Berger’s equation in one-dimen-sional quasilinear partial differential equation. The Stokes equations describe the motion of a fluid in (23)nRn or. These equations are to be solved for an unknown velocity vector 1(, )((, ))niinuxyu xyR and pressure (, )pxy R. We restrict our attention here to incompressible fluids filling all of nR (n = 2) as follow: 21122120pufinRxpufinyuu inxy    (1) M. BAYMANI ET AL. Copyright © 2010 SciRes. AM 289with boundary conditions: 00 0121 2(, ) (,),onuuu uuu . Here, 0u is given, C divergence-free vector field on , 12,ff are the components of a given, externally applied force ( e.g. gravity). The first and second equa-tions of (1) are just Newton’s law fma for fluid element subject to the external force 12(, )fff and to the forces arising from pressure and friction. The third equation of (1) says that the fluid is incompressible. For physically reasonable solutions, we want to make sure 12(, )uuu does not grow as (,)xy . Hence we will restrict our attention to the force f and initial con- dition 0u that satisfy 0() 1KxKux Cx, onnR, for anyand some K, () 1KxKfx Cx, onnR, for anyand some K. We accept a solution of (1) as physically reasonable only if it satisfies,()npu CR and ()ux dxC (bounded energy). 2. Description of the Method The usual proposed approach for problem (1) will be illustrated in terms of the following general partial dif-ferential equation:   211 1222 2123,,,0, ,,,0, ,,0, Gx xxxxDxGx xxxxDxGxxxxDxy  (2) subject to certain boundary conditions (BC’s) (for exam-ple Dirichlet and/or Neumann), where 1( ,...,),nnnxxxRDR denotes the definition do-main and 12(), (),()xxx are the solutions to be computed. If 112 23(,), (,), (,)tttxPxPxPdenote trial solu-tions with adjustable parameters 123,,PPP, the problem (2) is transformed to 123222123,,miniiiiPPPxDGx Gx Gx (3) subject to the constraints imposed by the BC’s. In the proposed approach, the trial solutions 11(, ),txP 22 3(,), (,)ttxPxP employ a feed forward neural net-work and parameters 123,,PPP correspond to the weights and biases of the neural architecture. We choose trial functions 11223(,), (,), (,)tttxPxPxP such that by construction satisfy the BC’s. This achieves by writing it as a sum of two terms   11111222223333,,,,,,tttxAxFxNxPxAx FxNxPxAxFxNxP (4) where 1(, )( )HkiiiNxPz and 1niijjijzwxu (1,2,3)k are single-outputs feed forward neural net-work with parameters 123,,PPP and n input units fed with the input vector x. The terms ()(1,2,3)iAx i contain no adjustable parameters and satisfy the bound-ary conditions. The second terms (,(,))(1,2,3)iiiFxNxP i is con-structed so as not to contribute to the BC’s, since 112 23(,), (,), (,)tttxPxPxP must also satisfy the BC’s. These terms employ a neural network whose weights and biases are to be adjusted in order to deal with the mini-mization problem. Note at this point that the problem has been reduced from the original constrained optimization problem to an unconstrained one (which is much easier to handle) due to the choice of the form of the trial solu-tion that satisfies by construction the BC’s. In the next section we present a systematic way to construct the trial solution, i.e., the functional forms of both Ai and Fi. We treat several common cases that one frequently encoun-ters in various scientific fields. As indicated by our ex-periments, the approach based on the above formulation is very effective and provides in reasonable computing time accurate solutions with impressive generalization (interpolation) properties. 3. Neural Network for Solvi n g S t o k e s Equations To solve problem (1) with [0,1] [0,1], we apply the operators x and y on the first and second equa- tions respectively. Then we obtain: 22121222() ()xyuu ppffxy xy    (5) Using the third equation in (1), the Equation (5) may be written as: 221222() ()xyppffxy  (6) this is the Poisson equation, and has infinitely many so-lutions. By imposing some boundary conditions, we are going to obtain an appropriate solution for Equation (6) M. BAYMANI ET AL. Copyright © 2010 SciRes. AM 290 by the neural network. The trial solution is written as ),,()1()1(),(),( PyxNyyxxyxAyxpt (7) where (, )Axy is chosen so as to satisfy the BC, namely 01000111(, )(1)()()(1)()[(1)(0)(1)]() [(1)(0)(1)].Axyxhyxh yygxxg xgygxxg xg   (8) where 010()(0,), ()(1,), ()(,0)hypy hypygxpx and 1() (,1)gxpx. Note that the second term of the trial solution does not affect the boundary conditions since it vanishes at the part of the boundary where Dirichlet BC’s are imposed. In the above PDE problems the error to be minimized is given by 22222(, )(, )()( ,)tiitii iiipxy pxyEpFx yxy (9) where 12()( )xyFff and (, )iixy is a point in Ω. By solving the optimization problem (9), the weights ,,iijivwu are obtained and then a trial solution for tp is obtained. By substituting the trial solution tp in the first equation of (1) we obtain: 11()tpufx  (10) which is a Poisson equation for 1u, by using (9) and by substituting 1tu and 1()tpfx for or p and F, res- pectively, we can obtain a trial solution for 1tu. To ob-tain 2u, we can substitute the trial solution tp in the second equation in (1) to obtain: 22)( fyput . (11) In a similar manner we can obtain 2tu. 4. Numerical Examples In this section we present one example to illustrate the method. We used a multilayer perceptron having one hidden layer with five hidden units and one linear output unit. For a given input vector 12(,)xxx the output of the network is 51(, )( )iiiNxP z where 21iijjijzwxu and 1() 1xxe. The exact ana- lytic solution is known in advance. Therefore we test the accuracy of the obtained solution. Example. Consider the problem (1) with Ω = [0,1] × [0,1]. We choose 1f and 2f such that the exact solu-tion for 12,uu and p be as follows: 22 2122222210(1) (132)10(1) (132)5( ).uxyx yyuyxyxxpxy  The domain Ω is first discretized by uniform mesh of size 1/3h (4 points). This initial mesh is succes-sively refined to produce meshes with sizes 1/4h and 1/5h (respectively 9 and 16 points). Table 1 reports the maximum error at nodal points (Maximum error) at the training set points and the distances 2tLpp and (1)tHpp between the exact solution and the training solution. In Figure 1 the error function tpp for N = 25 is depicted which shows the solution is very accurate. We used the Equation (10) and obtained the solution 1tu. Table 2 reports the maximum error at the training set points and the distances 112tuu and (1)11tHuu between the exact solution and the training solution. In a similar manner we obtained 2tu. Table 3 reports the maximum error at the training set points and the dis- Table 1. Maximum error at training set points and the dis-tances 2tpp and 1tHpp(). N = 16 N = 9 N = 4 1.8433e-75.1007e-4 0.0058 Maximum Error 4.1647e-157.5171e-8 1.0025e-5 2tpp 4.9101e-137.5120e-6 4.1569e-4 (1)tHpp Table 2. Maximum error at training set points and the dis-tances 112tuu and ()111tHuu . N = 25 N = 16 N = 9 1.733e-8 2.0723e-8 0.0372 Maximum error 2.576e-17 4.487e-17 4.091e-4 112tuu 1.632e-15 6.4928e-15 0.040 11(1)tHuu Table 3. Maximum error at training set points and the dis-tances 222tuu and ()122tHuu . N = 25 N = 16 N = 9 2.6507e-072.6141e-05 0.0379 Maximum error 1.3238e-141.2722e-010 4.0684e-04 222tuu 2.7010e-121.8825e-008 0.0407 (1)22tHuu M. BAYMANI ET AL. Copyright © 2010 SciRes. AM 291tances 222tuu and (1)22tHuu between the exact solution and the training solution. In Figures 2 and 3 the error functions 11tuu and 22tuu for N = 25 is depicted which shows the solu-tions are very accurate (even between training points). In Figures 4-7 differential of the error functions 11tuu and 22tuu respect to x and y, for N = 25 are de-picted, respectively, which show the solutions are dif-ferentiable. Aman and Kerayechian  used linear programming-methods to solve the above problem. They converted the Stokes problem to a minimization problem, then by dis-cretizing the minimization problem. They obtained a linear programming problem and solved it. Table 4 pre-sent the comparison between the proposed method and with Aman – Kerayechian method for 25 points. Figure 1. Error function tpp. Figure 2. The error function 11tuu. Figure 3. The error function 22tuu. Figure 4. The differential of error function 11tuu respect to x. Table 4. The comparison of our proposed method with Aman – Kerayechian method. Errors The proposed method Aman- Kerayechian methodMaximum error 11tuu 1.7335e-008 0.007885 (1)11tHuu 1.6328e-015 0.082281 Maximum error 22tuu 2.6507e-007 0.007885 (1)22tHuu 2.7010e-012 0.082281 Maximum error tpp 1.6392e-005 0.035104 2tpp 2.2448e-011 0.027446 M. BAYMANI ET AL. Copyright © 2010 SciRes. AM 292 Figure 5. The differential of error function 11tuu respect to y. Figure 6. The differential of error function 22tuu respect to x. 5. Conclusions In this paper a new method based on ANN has been ap-plied to find solution for Stokes equation. The solution via ANN method is a differentiable, closed analytic form easily used in any subsequent calculation. The neural network here allows us to obtain fast solution of Stokes equation starting from randomly sampled data sets and refined it without wasting memory space and therefore reducing the complexity of the problem. If we compare the results of the numerical methods (see ) with our method, we see that our method has some small error. Other advantage of this method, the solution of the Stokes problem is available for each arbi-trary point in training interval (even between training points). Indeed, after solving the Stokes problem, we Figure 7. The differential of error function 22tuu respect to y. obtain an approximated function for the solution and so we can calculate the answer at every point immediately. 6. References  Y. C. Jin, M. Olhofer and B. Sendhoff, “A Framework for Evolutionary Optimization with Approximate Fitness Functions, Evolutionary Computation,” IEEE Transac-tions, Vol. 6, No. 5, 2002, pp. 481-494.  M. H. Man, R. Nateri and K. Madavan, “Aerodynamic Design Using Neural Networks,” American Institute of Aeronautics and Astronautics Journal, Vol. 38, No. 1, 2000, pp. 173-182.  S. Pierret, “Turbo Machinery Blade Design Using a Na-vier-Stokes Solver and Artificial Neural Network,” ASME Journal of Turbomach, Vol. 121, No. 3, 1999, pp. 326- 332.  T. Ray, H. Tsai and C. Tan, “Effects of Solver Fidelity on a Parallel Search Algorithm’s Performance for Airfoil Shape Optimization Problems,” 9th AIAA/ISSMO Sympo-sium on Multidisciplinary Analysis and Optimization, Atlanta, Georgia, 2002, pp. 1816-1826.  I. E. Largris and A. Likas, “Artificial Neural Networks for Solving Ordinary and Partial Differential Equations,” IEEE transaction on neural networks, Vol. 9, No. 5, 1998, pp. 987-1000.  D. Tran-Canh and T. Tran-Cong, “Computation of Vis-coelastic Flow Using Neural Networks and Stochastic Simulation,” Korea-Australia Rheology Journal, Vol. 14, No. 4, 2002, pp. 161-174.  M. Hayati and B. Karami, “Feedforward Neural Network for Solving Partial Differential Equations,” Journal of Applied Sciences, Vol. 7, No. 19, 2007, pp 2812-2817.  M. Aman and A. Kerayechian, “Solving the Stokes Prob-lem by Linear Programming Methods,” International Mathematical Journal , Vol. 5, No. 1, 2004, pp. 9-22.