11
Journal of Scientific Research & Reports 7(3): 207-217, 2015, Article no.JSRR.2015.202 ISSN: 2320-0227 SCIENCEDOMAIN international www.sciencedomain.org Using Python to Solve the Navier-Stokes Equations - Applications in the Preconditioned Iterative Methods Jia Liu 1, Lina Wu 2 and Xingang Fang 3 1 Department of Mathematics and Statistics, University of West Flroida, Pensacola, Florida, 32514, USA. 2 Department of Mathematics, Borough of Manhattan Community College, The City University of New York, New York, NY 10007, USA. 3 Department of Computer Science, University of West Flroida, Pensacola, Florida, 32514, USA. Article Information DOI: 10.9734/JSRR/2015/17346 Editor(s): (1) Narcisa C. Apreutesei, Technical University of Iasi, Romania. Reviewers: (1) Anonymous, China. (2)Ette Harrison Etuk, Department of Mathematics Computer Science, Rivers State University of Science and Technology, Nigeria. Complete Peer review History: http://www.sciencedomain.org/review-history.php?iid=1127&id=22&aid=9129 Original Research Article Received: 9 th March 2015 Accepted: 3 rd April 2015 Published: 5 th May 2015 Abstract This article describes a new numerical solver for the Navier-Stokes equations. The proposed solver is written in Python which is a newly developed language. The Python packages are built to solve the Navier-Stokes equations with existing libraries. We have created discretized coefficient matrices from systems of the Navier-Stokes equations by the finite difference method. In addition we focus on the preconditioned Krylov subspace iterative methods in the linearized systems. Numerical results of performances for the Preconditioned iterative methods are demonstrated. The comparison between Python and Matlab is discussed at the end of the paper. Keywords: Python; Navier-Stokes equations; Iterative methods; Preconditioner. 2010 Mathematics Subject Classification: 65Y15; 65F10; 68N15 *Corresponding author: E-mail: [email protected];

Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

  • Upload
    others

  • View
    21

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Journal of Scientific Research & Reports7(3): 207-217, 2015, Article no.JSRR.2015.202

ISSN: 2320-0227

SCIENCEDOMAIN internationalwww.sciencedomain.org

Using Python to Solve the Navier-Stokes Equations- Applications in the Preconditioned Iterative Methods

Jia Liu1∗, Lina Wu2 and Xingang Fang3

1Department of Mathematics and Statistics, University of West Flroida, Pensacola, Florida, 32514,USA.

2Department of Mathematics, Borough of Manhattan Community College, The City University ofNew York, New York, NY 10007, USA.

3Department of Computer Science, University of West Flroida, Pensacola, Florida, 32514, USA.

Article InformationDOI: 10.9734/JSRR/2015/17346

Editor(s):(1) Narcisa C. Apreutesei, Technical University of Iasi, Romania.

Reviewers:(1) Anonymous, China.

(2)Ette Harrison Etuk, Department of Mathematics Computer Science, Rivers State University ofScience and Technology, Nigeria.

Complete Peer review History:http://www.sciencedomain.org/review-history.php?iid=1127&id=22&aid=9129

Original Research Article

Received: 9th March 2015Accepted: 3rd April 2015Published: 5th May 2015

Abstract

This article describes a new numerical solver for the Navier-Stokes equations. The proposed solveris written in Python which is a newly developed language. The Python packages are built to solvethe Navier-Stokes equations with existing libraries. We have created discretized coefficient matricesfrom systems of the Navier-Stokes equations by the finite difference method. In addition we focus onthe preconditioned Krylov subspace iterative methods in the linearized systems. Numerical resultsof performances for the Preconditioned iterative methods are demonstrated. The comparisonbetween Python and Matlab is discussed at the end of the paper.

Keywords: Python; Navier-Stokes equations; Iterative methods; Preconditioner.2010 Mathematics Subject Classification: 65Y15; 65F10; 68N15

*Corresponding author: E-mail: [email protected];

Page 2: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

1 IntroductionThe numerical solvers for Partial DifferentialEquations (PDEs) are developed greatly inrecent years. Most of them are based onthe traditional languages such as C, C++, orFortran etc. However, those languages are highperformances but lower level languages. Ingeneral Languages like C, C++ require relativestrong programming backgrounds. Thereforemore scientists start to develop the numericalapplications for PDEs in Python due to itshuge potential advantages in the computationalmathematics areas.

1.1 Why Python?Python is an interpreted, high-level, object-oriented, dynamic general-purpose programminglanguage. Since python 1.0 was published in1994, it has been one of the most popularprogramming languages (3rd place on PYPLindex, Feb 2014). The advantages of thePython programming language include rapiddevelopment, excellent readability, fast learningcurves, huge community support and greatcross-platform capability. It is extensivelyused in desktop application developments, webapplication developments, scriptings, systemmanagements as well as scientific computations.In the scientific computation area, Python hasthe following important features compared withMatlab:

• Code quality: Compared with theMatlab scripting language, Python is afull stack language supporting multipleprogramming paradigms includingobject-oriented, imperative, functionalprogramming, etc. It is capable ofmore computational tasks. With theunique indent block, Python code is morereadable. The Python module system is asophisticated way to organize source codefiles compared to Matlab which lacks thesupport on namespace. The zero-basedbracket array indexing is much morecompatible with most other programminglanguages. In addition Python is asignal processing system compared to theMatlab which is a one-based parenthesissystem.

• Portability: Python is a free and opensource on all platforms. The run timeenvironment is light-weighted (239MEPD Python full scientific computingdistribution) compared to the multi-gigabyte Matlab. It can be easily deployedanywhere while the installation of Matlabis limited by the license.

• Flexibility: Python is a perfect gluelanguage. It is not hard to findor write Python wrapper to provideAPI (application programming interface)of existing high performance softwarepackages written in C, C++, FORTRANor even Matlab. Thus, it provides a wayto quickly develop applications by reusingexisting code. In the case of Matlab’sclosed ecosystem, scientists have to relyon the packages only from MathWorks,the company which developed Matlab.Unfortunately, the underlying algorithmsare proprietary and expensive.

• Performance: Though performanceis a major concern of Python givenits interpreted, dynamic nature. Thisproblem can be usually circumvent bydelegating most computational tasks tohigh performance packages written inC, FORTRAN. Cython, the variation ofstandard Python (CPython), provided away to take the advantages of both therapid development capability of Pythonand the high performance of C languageby translating a superset of Pythonsyntax to C code. In many scenarios, itwill provide comparable performance toscientific packages.

• Availability of packages: Python andthe huge number of extension packagesare freely available (41311 on PyPI,a Python package repository on Mar.2014). There are also high qualitypackages for all aspects of scientificcomputing. Numpy/Scipy are popularPython numerical packages that providesimilar functionality and performance toMatlab. Matplotlib is a very useful packagefor plotting. Numpy/Scipy and Matplotlibtogether can cover most of the tasks doneon Matlab. Moreover, there are manyother very useful Python packages for

208

Page 3: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

scientific computing including the scientificnotebook iPython, the statistic packagepanda, the cross-platform GUI toolkitspyQt, wxPython and GTK, the all-in-onescientific Python distribution Pythonxy andcanopy express (former EPD Python), thetest framework unittest and nose.

• Cost: Matlab is very expensive forthe researchers while Python andcorresponding packages are totally free. Itis more favorable for students who wouldlike to learn the numerical analysis with nocost.

With the advanced features of Python, we areable to develop some efficient and easy-to-use softwares to solve PDEs. In this paper,we focus on using Python to solve the PDEsarising from the incompressible flow problems,especially the Navier-Stokes equations. We

are more interested in the applications ofthe preconditioned Krylov subspace iterativemethods. We will compare the performancesbetween Python and Matlab.

1.2 The Naviver-Stokes EquationsThe Navier-Stokes equations, which arenamed after Claude-Louis Navier and GeorgeGabriel Stokes, come from the motion of fluidsubstances. The equations are important withboth academic and economic interests. TheNavier-Stokes equations model the movementof the fluid from various types, such as theweather, ocean currents, water flows in a pipeand air flows around a wing. They are alsoused as the models to study the blood flow, thedesign of power stations, the analysis of pollution.The incompressible Navier-Stokes equations aregiven by the following PDEs:

∂u

∂t− ν∆u+ (u · ∇)u+∇p = f in Ω× (0, T ] (1.1)

∇ · u = 0 in Ω× [0, T ] (1.2)

Bu = g on Ω× [0, T ] (1.3)

u(x, 0) = u0 in Ω (1.4)

Here the variable u = u(x, t) ∈ Rd, where d = 2, or d = 3 is a vector-valued function representing thevelocity of the fluid, and the scalar function p = p(x, t) ∈ R represents the pressure. Ω ⊂ Rd,whered = 2, or d = 3. For an example, Ω is defined as [0, 1] × [0, 1] ⊂ R2. T > 0 is a constant. Here B isthe boundary condition operator such as the Dirichlet Boundary condition or the Neumann’s boundarycondition.

Assume Ω ⊂ R2. Denoting u = (u, v), and f = (f1, f2), we can write the equations (1.1)–(1.2) inscalar form as follows:

∂u

∂t− ν∆u+ u

∂u

∂x+ v

∂u

∂y+

∂p

∂x= f1 ,

∂v

∂t− ν∆v + u

∂v

∂x+ v

∂v

∂y+

∂p

∂y= f2 ,

∂u

∂x+

∂v

∂y= 0 .

209

Page 4: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

The pressure field, p, is determined up to anadditive constant. To uniquely determine p wemay impose some additional condition, such as∫

Ω

p dx = 0 . (1.5)

The source function f is given on a d-dimensionaldomain denoted by Ω ⊂ Rd, with ∂Ω theboundary of Ω. Here ν > 0 is a given constantcalled the kinematic viscosity, which is ν =O(Re−1). Here Re is the Reynolds number:Re = V L

ν, where V denotes the mean velocity

and L is the diameter of Ω (see [1]).

Numerical algorithms for the computationalsolutions of the Navier-Stokes equations havebeen discussed for several decades. Thisfield still remains active in the research area.In this paper, we will implement the efficientsolvers for the Navier-Stokes equations usingPython. Though we already have somenumerical solvers or softwares for solvingPDEs on line, very few of them consider thepreconditioned iterative solvers for the Navier-Stokes equations. We are the first to developa Python package which enables us to solvethe Navier-Stokes equations using differentpreconditioning techniques. We will comparethe performances of different precondtionersand the convergence rates of the iterativemethods. During our numerical experiences,we have used many mature libraries from theWeb in the package, including NumPy (http ://numpy.scipy.org), Scipy (www.scipy.org),

and Dolfin (www.fenics.org/dolfin).

2 Materials and Methods

2.1 Creating Matrices for theNavier-Stokes Equations

The unsteady (time-dependent) case leads tosequences of saddle point systems when fullyimplicit time-stepping schemes are used. Forexample, we can discretize the time derivativeterm ∂u

∂tusing backward Euler or Crank-Nicolson

schemes; see [2]. For the space discretization,either finite element methods or finite differencemethods will work. We first consider the Marker-and-Cell (MAC) discretization, which is due toHarlow and Welch (1965). See [3] for moredetails. The particularity of MAC scheme is thelocation of the velocity and pressure unknowns.Pressures are defined at the center of eachcell and the velocity components are defined atthe cell edges (or cell faces in 3D). Such anarrangement makes the grid suitable for a controlvolume discretization. We also can use Dolfinto generate the matrices for the Navier-Stokesequations using the finite element method.

First we can use backward Euler’s method todiscretize (1.1)–(1.2) with respect to the time anduse the Picard’s iteration to linearize equations(1.1)–(1.2). We obtain the a sequence oflinear problems which are also called the Oseenequations:

αu− ν∆u+ (uk · ∇)u+∇p = f in Ω× (0, T ]

∇ · u = 0 in Ω× [0, T ]

Here α is O(δt), where δt is the time step. And uk is the solution which is obtained from the previousstep. The initial guess u0 can be the solution from the Stokes equations which are

αu− ν∆u+∇p = f in Ω× (0, T ]

∇ · u = 0 in Ω× [0, T ]

The following finite difference expressions are utilized (for the two dimensional case) when wediscretize the equations with respect to the space:

210

Page 5: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

∂2u

∂x2|j+1/2;k =

uj+3/2,k − 2uj+1/2,k + uj−1/2,k

∆x2,

∂2u

∂y2|j+1/2;k =

uj+1/2,k+1 − 2uj+1/2,k + uj+1/2,k−1

∆y2,

∂2v

∂x2|j+1;k−1/2 =

vj+2,k−1/2 − 2vj+1,k−1/2 + vj,k−1/2

∆x2,

∂2v

∂y2|j;k−1/2 =

vj,k+1/2 − 2vj,k−1/2 + vj,k−3/2

∆y2,

∂u

∂x|j+1/2;k =

uj+3/2,k − uj−1/2,k

∆x,

∂u

∂y|j+1/2;k =

uj+1/2,k+1 − uj+1/2,k−1

∆y,

∂v

∂x|j+1;k−1/2 =

vj+2,k−1/2 − vj,k−1/2

∆x,

∂v

∂y|j;k−1/2 =

vj,k+1/2 − uj,k−3/2

∆y,

∂p

∂x|j+1/2;k =

pj+1,k − pj,k∆x

,

∂p

∂y|j;k−1/2 =

pj,k − pj,k−1

∆y.

With the above scheme, we obtain thefollowing linear system Ax = b , where

A =

A1 0 BT1

0 A2 BT2

B1 B2 0

, (2.1)

where A1, A2are discrete reaction-convection-diffusion operators. A1 is the approximationof αu − ν∆u + u ∂u

∂x+ v ∂u

∂y, and A2 is the

approximation of αv − ν∆v + v ∂v∂x

+ v ∂v∂y

. HereB1 ≈ ∂

∂xand B2 ≈ ∂

∂y. We denote the matrix A

in the block form:

A =

[A BT

B 0

], (2.2)

where

A =

[A1 00 A2

], (2.3)

and B = [B1 B2].

The right hand side b = [f1, f2, 0]T . The

discretized linear system Ax = b is the majorsystem we focus on. Notice here the matrix A isa large sparse matrix. Therefore the computationinvolving the matrix A should always consider thesparsity and use sparse operations.

Notice here the linear system Ax = b isthe linear system we need to solve at eachPicard’s iteration. Therefore, at each k-iterationin the Picard’s iteration, we have the solution x.Under certain conditions, the sequence xinf

k=1 willconverge to the solution of the nonlinear problem(1.1) to (1.4).

2.2 Numerical SolversCurrently, our most important application is toplay with the different numerical solvers for theSaddle point system Ax = b with the coefficientmatrix 2.1. We focus on Krylov subspace iterativemethods: such as the General Minimum ResidualMethod (GMRES) [4] and the Biconjugategradient stabilized method (BICGSTAB) [5]. Forboth methods, the preconditioning techniques areimportant for the Navier-Stokes equations. Thepreconditioner P is a matrix which approximatesA in some yet-undefined sense. It is obvious thatthe linear system

P−1Ax = P−1b (2.4)

has the same solution as

Ax = b . (2.5)

211

Page 6: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

However (2.4) may be easier to solve,which means GMRES or other Krylov subspaceiterative methods may converge faster. System(2.4) is preconditioned from the left, and we canalso preconditioned from the right:

AP−1y = b, x = P−1y . (2.6)

Many research work has been published inthe area of the preconditioning technique.Unfortunately, there is no universal ”ideal”preconditioner for all linear systems. Seea thorough discussion of the precondtioningtechniques in [6,7], ect. The choice of thepreconditioner is strongly case dependent whichis the most challenging topic in the iterativesolvers. We implemented the GMRES iterativesolvers with no preconditioner, and with differentchoices of preconditions. The performance ofthe iterative solver and the preconditioners canbe explored. At this stage, we have alreadytested the following different precondtioners withGMRES.

2.2.1 Block diagonal preconditioner

P =

[A OO I

].

where A is the approximation of A (in most ourcases, A is A or A+ αI where α is time variable,and α = O( 1

δt)).

2.2.2 Block triangular preconditioner

P =

[A OB I

].

Then the block LU factorization form of blocktriangular reconditioner is

P =

[In OO Im

] [A OO Im

] [In −A−1BO Im

](2.7)

2.2.3 Hermitian and Skew Hermitian(HSS) Preconditioner

P =1

2rHS

where

H =

[A+AT

2O

O O

],S =

[A−AT

2BT

B O

].

H = H+ rIn+m, S = S + rIn+m.

As we can see, H is the symmetric part of thecoefficient matrix A, i.e.

H =A+AT

2,

and S is the skew-symmetric part of thecoefficient matrix A, i.e.

S =A−AT

2.

In order to make H and S invertible, we shift bothmatrices by adding rIn+m, where r = 0 is anarbitrary parameter, and In+m is a identity matrixof size n+m.

The performances of the above threepreconditioners are discussed in both [6,8]. Herewe focus on the application of Python in thosenumerical solvers and the outcomes from thesoftware package.

3 Numerical ExperimentsIn this section we report on several numericalexperiments meant to illustrate the behavior ofthe Python applications on the preconditionedGMRES in a wide range of model problems.We consider Navier-Stokes problems in the twodimensional spaces.

3.1 Numerical SolutionsIn this session, we will show the example usingPython to solve the Navier-Stokes equationsand plot the solution. We use a few libraries:numpy and matplotlib. Here numpy is a librarythat provides matrix operations and matplotlibprovides the 2D plotting library that we coulduse to plot the results. We consider the two-dimensional lid-driven cavity problem. Thisis a classical problem from the Navier-Stokesequations. We take a square cavity with sides ofunit length and kinematic viscosity ν = 0.05. Theinitial condition is u,v,p = 0 everywhere, and theboundary conditions are:

212

Page 7: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

Figure 1: Simulation Results for the Driven Cavity Problem t = 1

Table 1: Sample Output: Iteration counts for the 2D Cavity problem64× 64 128× 128 256× 256

Block Diagonal Preconditioner 31 33 34Block triangular Preconditioner 16 17 18

HSS Preconditioner 49 52 55

• u = 1 at y = 2 ;• u,v = 0 on the other boundaries;• To satisfy the continuity, we need to

correct the pressure term and here are theboundary conditions for the pressure: ∂p

∂y=

0 at y = 0;p = 0 at y = 2; and ∂p∂x

= 0 atx = 0, 2

Figure 1 - 4 show the solutions of the abovedriven cavity problems with viscosity ν = 0.1.Figure 1 is the solution as t = 1, Figure 2 is thesolution as t = 200, Figure 3 is the solution ast = 500, and Figure 4 is the solution as t = 2000.We can see as t goes to around 500, the systemgradually to stabilize.

3.2 2D Equations with DifferentPreconditioners

In this session, we explore the iteration propertiesof the 2D Navier-Stokes equations with differentpreconditioners. We consider the Oseenequation in this case. We apply the Krylovsubspace iterative methods: GMRES with threedifferent preconditioner we introduced in theprevious section. We use the library scipy, numpyand matplotlib. In Table 1 we present results forthe iteration counts for 2D Oseen problem withdifferent precondtitioners. Here the exact solveris used in each preconditioning action. The meshsize increases from 64× 64 to 256× 256.

213

Page 8: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

Figure 2: Simulation Results for the Driven Cavity Problem t = 200

Figure 3: Simulation Results for the Driven Cavity Problem t = 500

Figure 5 shows the convergence curves forthose three preconditioned GMRES methods.

We did a few numerical experiments using Matlaband Python. The performance of both languagesare quite close.

1. The length of the codes are similar. BothMatlab and Python are script languages.They are easy to use and easy toimplement.

2. Both Matlab and Python can obtainthe images of the solutions, plot the

214

Page 9: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

Figure 4: Simulation Results for the Driven Cavity Problem t = 2000

Figure 5: Sample Output: GMRES iteration convergence for the Driven CavityProblem

eigenvalues, velocity streamlines etc.3. The speed are also similar. Here is

the comparison. We run the 2D Oseenproblem with constant wind using Matlaband Python on the same computer. Weused HSS preconditioning technique withGMRES iterations. Table 2 shows the

cpu time for both languages. The CPUtime for Python is higher than the CPUtime in Matlab. The reason is due tothe optimization of the sparsity operationsin Matlab. We currently are workingon improving the sparsity operations inPython too.

215

Page 10: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

Table 2: CPU time for the 2D Oseen problem with constant windMatrix Size Matlab CPU time Python CPU time

40 × 40 0.029 0.05176 × 176 0.13 0.45736 × 736 2.69 36.8

3008 × 3008 83 119

A good way to explore the capabilities ofthis package in Python is to download the codesat http : www.uwf.edu/jliu/research/Python.The Python codes are clean and simple butthey are easy to learn. With the developmentof our Python package, scientists and studentscan explore the properties of the preconditionedKrylov subspace methods. The other softwarein the preconditioning technique area is theIFISS developed by David Silvester (Schoolof Mathematics, University of Manchester),Howard Elman (Computer Science Department,University of Maryland), and Alison Ramage(Department of Mathematics and Statistics,University of Strathclyde). See [1]. This softwareis written in Matlab and it is a graphical packageof the numerical study of the incompressibleflows. This is a good way to study and explorethe numerical methods of the Navier-Stokesequations. But you need to have Matlab installedwhich costs around one thousand dollars. Itis expensive for the students who would like toexplore the numerical solutions for the Navier-Stokes equations. On the other hand, Pythonis free. In addition, Python is very similar withMatlab in many features. Both of them arescript languages and easy to learn. In ournumerical experiments, we would like to showthat we can use this free high-level languageto develop a package. Our package will helpto implement the Navier-Stokes equations offinite difference methods, explore a range ofpreconditioned Krylov subspace solvers, providea visualization tool and etc. Notice thatwith Python alone, the calculation speed isnot competitive with the softwares based onC/C++/Fortran, or even Matlab. But with thecombination of C/C++/Fortran, the Python scriptis able to run the meshes that have millions ofnodes on desktop computers, see [9].

4 ConclusionsIn this article, we have developed a numericalsolver for the Navier-Stokes equations usingPython. We use the preconditioned iterativemethods to solve the problem and we explorethe effectiveness and performances of thedifferent preconditioners for the Krylov subspacemethods. The numerical solutions are analyzedfor their basic properties. We also compare theperformances between Python and Matlab. Themajor contribution of this project is to develop afree, efficient software and numerical algorithmsfor the Navier-Stokes equations. It is the firsttime to study the preconditioning techniques inPython codes. The development of the Pythonpackage may benefit both scientists and studentsto analyze the numerical solvers of the Navier-Stokes equations, especially in observing anddeveloping the preconditioning techniques.

AcknowledgmentThe research from the first author was supportedby Faculty Scholarly and Creative ActivityAward 2013-2014 at the University of WestFlorida. Support for this project was providedby the Research and Sponsored Program at theUniversity of West Florida. The research fromthe second author was partially supported byPSC-CUNY Grant. Support for her project wasprovided by PSC-CUNY Award, jointly funded byThe Professional Staff Congress and The CityUniversity of New York.

Competing InterestsAuthors have declared that no competinginterests exist.

216

Page 11: Using Python to Solve the Navier-Stokes Equations ......scientific Python distribution Pythonxy and canopy express (former EPD Python), the test framework unittest and nose. • Cost:

Liu et al.; JSRR, 7(3), 207-217, 2015; Article no.JSRR.2015.202

References[1] Elman HC, Silvester DJ, Wathen AJ,

Finite Elements and fast iterative solvers:With applications in incompressible fluiddynamics.Oxford University Press; 2005.

[2] Turek S. Efficient solvers for incompressibleflow problems: An algorithmic andcomputational approach. Lecture Notesin Computational Science and Engineering.1999;6. Springer, Berlin.

[3] Harlow FH, Welch JE. Numerical calculationof time-dependent viscous incompressibleflow of fluid with free surface. Phys. Fluids.1965;8:2182-2189.

[4] Saad Y, Schultz MH, GMRES: A generalizedminimal residual algorithm for solvingnonsymmetric linear systems preconditionersfor the discrete steady-state Navier-Stokesequations. SIAM J. Sci. Stat. Comput.2002;7:856-869.

[5] Van der Vorst HA. Bi-CGSTAB: A fastand smoothly converging variant of Bi-CG for the solution of nonsymmetric linearsystems. SIAM J. Sci. and Stat. Comput.1992;13(2):631-644.

[6] Benzi M, Golub GH, Liesen J, Numericalsolution of saddle point problems. ActaNumerica. 2005;14:1-137.

[7] Elman HC, Silvester DJ, Wathen AJ.Performance and analysis of saddle pointpreconditioners for the discrete steady-stateNavier–Stokes equations. Numer. Math.2002;90:665-688.

[8] Benzi M, Liu J. An efficient solver for theincompressible Navier-Stokes equations inrotation form. SIAM J. Scientific Computing.2007;29:1959-1981.

[9] Logg A, Mardal A, Wells G, Automatedsolution of differential equations by the finiteelement method: The fenics book. Springer;2012.

———————————————————————————————————————————————-c⃝2015 Liu et al.; This is an Open Access article distributed under the terms of the Creative Commons Attribution

License http://creativecommons.org/licenses/by/4.0, which permits unrestricted use, distribution, and reproductionin any medium, provided the original work is properly cited.

Peer-review history:The peer review history for this paper can be accessed here (Please copy paste the total link in your browseraddress bar)www.sciencedomain.org/review-history.php?iid=1127&id=22&aid=9129

217