You are on page 1of 20

Page |1

Department of Mechanical, Materials & Manufacturing Engineering

3rd Year Individual Project MM3BPR

Tim Wong 4100673 Professor Henry Power

Proving The Solubility Of A Navier-Stokes Solution Using A Modified Method Of Particular Solutions

BEng Mechanical Engineering 2011/12

Page |2

Abstract This report contains details on the use of the Modified Method of Particular Solutions (MAPS) scheme, with the ambition of developing a more accurate and time efficient method for solving two dimensional problems with regards to the Navier-Stokes equation for incompressible fluid flow. The scenario examined is a lid-driven cavity flow problem, with the assumption of a linear superposition of the Stokes particular solutions, and an assumption of non-linearity for the convective terms of the full Navier-Stokes equation, considered as a non-homogeneous Stokes system, with the equation's base term ad Multiquadratic (MQ) Radial Basis Functions (RBF) as source terms. These equations are then solved by Picard iteration, and the resultant general solutions are independent of boundary conditions. Two solvers are compared in the report, firstly a simple Gauss direct solver is, which is compared with a Single Value Decomposition (SVD) method. The SVD solver was found to be more accurate than the original solver, but less efficient on computing power. The scheme can be considered mass conservative, as although the continuity equation is not expressly imposed in the formulation of the scheme, the Particular solutions satisfy the mass conservation equation already. In addition, pressure-velocity coupling is not an issue, as the pressure particular solutions are found from the velocity particular solutions. The scheme outlined above is then compared with pre-obtained results, calculated using the numerical solutions of the analytical Kovasnay flow problem at different Reynolds Numbers, Re. (1) Convergence and its dependence on the Shape Parameter is analyzed by finding the Root Mean Square (RMS) error for the uniform distributions of collocation points; i.e. for several pairs of nodal points, and the MQ Shape Parameter. The correlations show that the MAPS scheme for both solvers is, for a wide range of Shape Parameters, generally stable when compared with the pre-obtained results up to a Reynolds number of 3200. solutions can be found for a range of nodal distributions, and increasingly accurate results can be found using an SVD solver, at the expense of computing efficiency.

Page |3 Contents
Title Page .............................................................................................................................................. 1 Abstract................................................................................................................................................. 2 Nomenclature........................................................................................................................................ 4 Aims & Objectives ............................................................................................................................... 4 Introduction & Background .................................................................................................................. 4 The Modified Method Of Particular Solutions For Solving Navier-Stokes System Of Equations ........ 7 The Simple Gaussian Solver ......................................................................................................... 10 The Singular Value Decomposition Solver .................................................................................. 10 Pre-Estimated Solutions ............................................................................................................... 11 Lid Driven Cavity Flow Scenario Numerical Results ................................................................. 12 The Extension To, & Affects of Higher Reynolds Numbers ...................................................... 14 Computing Efficiency ................................................................................................................... 15 Conclusions ........................................................................................................................................ 16 Recommendations ............................................................................................................................... 16 Acknowledgements& References ....................................................................................................... 16 Bibliography ....................................................................................................................................... 17 Appendices ......................................................................................................................................... 18 Figures and Tables ...................................................................................................................... 18 MATLAB Code ............................................................................................................................. 18 Main Code .................................................................................................................................. 18 Memory Analysis Code .............................................................................................................. 20 Supervision Records ................................................................................................................... 20

Page |4 Nomenclature1 SP= Shape Parameter MQ= Multiquadratic RBF=Radial Basis Function SVD =Singular Value Decomposition Re = Reynolds Number

Aims & Objectives The main aim of the project is to assess the possible improvements to be implemented to the MAPS, relating to the solving of a two dimensional Navier Stokes Flow Problem. Specifically; Coding, Implementing and Analyzing the use of different Solvers within the Picard iterations scheme Assess the sensitivity of the numerical solutions with respect to the value of the Shape parameter Comparing the Solvers for efficiency and range up to higher Reynolds Numbers Producing results in good agreement with existing numerical data

Introduction & Background Within the field of Computational Dynamics, it can be said that the numerical solution of Navier-Stokes systems of equations are the most challenging to solve. This is when assuming an incompressible fluid, and in terms of the basic variables p, . Schemes such as the SIMPLE (2) and PISO (3) types can transform the p- coupled non-linear problem into a system of linear problems, these techniques have been used with wide success when using standard methods such as Finite Volume (FVM) and Finite Element (FEM). However these pairings require a large amount of computing effort in terms of power and time to solve the systems of equations. One solution to this is to avoid the p- coupling in 2-D Navier-Stokes systems, by using vorticity formulations to decouple the pressure field from the governing equations. This line of research has still not been fully explored, and still suffers from problems. A large drawback is that the continuity equation is not explicitly imposed in the formulation, and hence mass-conservation cannot be guaranteed. Some schemes, such as the Velocity Correction Method (4) purport to correct the mass imbalance; however it seems that if improved coupling strategies for the primitive variables can be implemented, then the numerical solutions in terms of p- will provide more accurate pressure fields. Opposing this increase in accuracy however, for such methods as FEM, FD etc. as mentioned above, is their reliance upon a computational mesh (5), which takes up considerable time and effort to generate a high quality, accurate Mesh. To decrease the amount of effort and time associated with the mesh generation, meshless numerical schemes have been developed, allowing non-connected nodal distributions to be used, instead of connected elements. These schemes such as the global Radial Basis Function (RBF) (6), used in the final scheme for this project, which uses a direct meshless collocation method, has had considerable success in solving boundary value problems governed by Partial Differential Equations (PDEs). RBF
1

All other terms will be explained within the working present below

Page |5 collocation methods have an advantage in that they are completely meshless, and hence dimensionally independent of the formulation, they also avoid the spectral convergence of some of the RBF interpolants, e.g. MQ. Despite RBF global collocation methods inherent advantages, they still suffer a fundamental problem in the form of the uncertainty relationship (7). In essence this describes a relationship in which better conditioning is associated with worse accuracy and vice-versa. System size is also a factor, as it is increased, the problem becomes more troublesome. To combat this, approaches such as RBF-specific matrix preconditioners (8) have been developed. Despite the improvements in Global approaches, there are still many drawbacks to the approach, matrix size is still a limiting factor, and ill conditioning still proves to a large issue. Hence recent developments have suggested local RBF interpolation schemes to be more efficient, and work for a greater range of shape parameter values. They also avoid many of the ill conditioning problems at a local level. However, when using the local formulations, the numerical scheme results in a looser meshless character as partial local connectivity is need between the interpolation nodes, this results in additional, more complex programming. Using an indirect approach, where RBFs can be used to approximate the complex high order derivatives present in the PDE to be solved, provides more stability and reduces convergence issues. This type of scheme integrates the approximated derivatives with respect to the corresponding coordinates, (9) & (10) and only the collocation points along the line of integration are considered to express a local formulation. This allows accurate solutions to be obtained for a greater range of shape parameter values, as the integration process allows for smoother behavior. RBF meshless numerical solutions of Navier Stokes systems of equations use velocity or stream function and vorticity formulations, to avoid the problem of the p- coupling formulation. Despite some success (11) in using a global approach, due to the aforementioned ill conditioning problems, a local approach has been much more successful at predicting viscous flow fields. The MQ Differential Quadrature method (MQDQ)(12) (13)has been proposed for spatial discretization, and combined with the fractional step method, can be used to couple the pressure and velocity in transient problems, obtaining good results. It was been found however, that it is important to find an efficient way of finding the correct value of the shape parameter (SP), as this is a highly critical value relating to the accuracy of the final numerical solution. Work by Divo and Kassab(14) and Sanjasiraju and Chandhini(15) has developed explicit locally based transient time stepping algorithms(16) for the p- formulation (14), overall combined with either the fractional step method, mentioned above, or the Mark and Cell (MAC) method, and provided good results. The locally explicit transient schemes allowed the results to be more stable and less affected by the SP. Work mentioned above into Global schemes (11) has been extended into a more local approach, using a weighted time stepping algorithm, The Crank-Nicholson, which uses a simple Picard iterative scheme. This proved more than enough to deal with the produces system of nonlinear equations. When compared with the Global scheme, results were similar, but required far less computational time and effort. Added to these developments, a RBF interpolation scheme (4), again working with a velocity-vorticity relationship, has used a velocity correction method to solve many of the mass conservation problems inherent in this scheme. Excellent results have been found up to Reynolds numbers of 10,000 using a nodal configuration of 161x161. Another recent development has been of an integrated RBF method (17) for use with linear PDEs whose differential operator L(.( )), can be wholly or partially expressed as a radial component in polar or spherical coordinates;

Page |6
Equation 1

= 1

+ 2

= ( )

It was suggested to approximate the radial component of the PDE (1 . ), in terms of an RBF interpolation, and to then integrate the produced non-homogenous ODE. So producing an approximate field variable representation by superposition of the corresponding particular solution, similar to the indirect scheme proposed (9). The difference being that rather than only the higher order derivatives being approximated by integration by a Cartesian grid, the complete integration of the L1r operator with no reference to any grid is found, resulting in;
Equation 2

Figure 1: Showing the Proposed Solution Domain, and the Internal () and Boundary () Nodes

=
=1

( )

With corresponding field variables for use with linear PDEs whose differential operator L(.( ), can be wholly or partially expressed as a radial component in polar or spherical coordinates;
Equation 3

=
=1

( ).

In this way the particular solution () is given by the solution of the non-homogeneous equation (below, equation 4), using the RBF () as the non-homogeneous term;
Equation 4

= ()

By using substituting the ( ) approximation into the full ( ) and the boundary conditions, taking into account equation 2, one can obtain a fully meshless integrated RBF solution of the boundary value problem, with no relations to any form of Cartesian Grid. This approach is the Method Of Approximated Particular Solutions (MAPS). For the case of a linear boundary problem;
Equation 5

( = , where &
Equation 6

( = , where Again, as above, the PDEs L(u) operator is expressed only in terms of radial coordinates, plus a boundary operator B. These are then reduced to find the solution of the produced linear system of equations;

Page |7
Equation 7

This is valid for N points, (Nb + Ni = N, Boundary points and Internal points respectively), as shown on Figure 1. The solution is found by solving for the values of . The solution processes (or solvers) are discussed in a later section. For this paper, the method proposed is a global approach, using a meshless collocation method based on the MAPS. Intending to solve a two-dimensional system of Navier Stokes equations, for a p- formulation, this should allow the ability to predict flow fields for a good range of medium and high Reynolds numbers, whilst avoiding matrix ill conditioning problems. Tor the approximations of the non-linear inertial terms, a simple Picard iteration scheme is to be used, it is favored over more complex non-linear solvers as it is found to provide an acceptable level of accuracy without having to further complicate the computing efforts. To predict the approximate velocity and pressure fields, a Stoke Particular Solution is found using Oseens decomposition formula (18). This fills the need to find a close form expression for the particular solution. A p- coupling strategy is not needed in the proposed scheme, as the velocity particular solution satisfies the continuity equation exactly, and as the particular solution for the pressure is found directly from the velocity solution, it is also satisfactory. The Modified MAPS scheme proposed is compared for both solvers, against pre-existing numerical results for the Kovasnay flow problem. Various Shape Parameter and nodal distributions are assessed, and both solvers are used to find results up to Re = 3200

The Modified Method Of Particular Solutions For Solving Navier-Stokes System Of Equations This section describes the methods and techniques used in a global MAPS in order to solve an incompressible steady state Navier Stokes system of equations in terms of its primitive variables (p-). Below in equations 8 and 9, are shown the mass and momentum conservation equations, with i and j representing 1 and 2 for the two dimensional problems described in this paper.
Equation 8

=0
Equation 9

2 = + The natural boundary conditions are defined in terms of their given velocity and/or surface traction values;

Page |8

Equation 10

= , where
Equation 11

= = +

= , where

To express the velocity and pressure fields in terms of linear superposition of particular solutions, ( , ), we can define the non-homogenous Stokes system of equations as;
Equation 12

Equation 13

, the non-homogenous term in the momentum equation is defined as the MQ RBF or, = ( 2 + 2 )2 , this is only dependent on the Euclidean distance r, between the field point and the trial point . In order to find a close form expression of the particular solution, Oseens decomposition formula is used to find the corresponding fundamental solution of the Stokes system, the Stokeslet ( (19) & (20)). Defining the velocity field () in terms of the auxiliary potential, ensures that the continuity equation is already satisfied;
Equation 14
1

By substituting equation 14 into equation 12, we can find a non-homogenous biharmonic equation of the potential . Hence, using the RBF as the non-homogenous term, and the relationship between the pressure and the auxiliary potential , as follows;
Equation 15

Equation 16

By integrating equation 15, the resulting expression for is found. The Wolfram Mathematica Online Integrator tool was used to perform the integration (21). All corresponding singular components of the resulting expression have been omitted, as they are regarded as complementary solutions of the biharmonic problem.

Page |9
Equation 17

The corresponding expressions for the particular solutions velocity and pressure fields are found by substituting the above expression into the potential into equations 14 and 16. (The equations of velocity and its derivatives are given in the Appendices) An important point to observe is that the obtained particular solution is not singular in a bonded domain . (Again see appendices). Hence the approximated velocity and pressure fields, , can be found and defined by a linear superposition of N particular solutions at N trial points ;
Equation 18

Equation 19

Where = By substituting these equations with the approximation of the directional derivative of the velocity into a linear version of the momentum equation (equation 9) shown below as;

Equation 20

Using as the guess value of the velocity given by the previous solution of the Picard iteration, we obtain the homogeneous linear superposition of the MQ functions. These represent the approximate momentum equation;

Equation 21

Within equation 21, equation 9 has been used in reference to the last term on the left hand side, as;

P a g e | 10

Equation 22

In order to find the complete set of equations necessary to complete the collocation process, either equation 18 or 19 must be substituted into the corresponding boundary condition (equation 10 or 11). Collocating the resulting expression, at either the 1 boundary for or 2 for , for each of the k=1,2 components, enables the first rows of the matrix system (equation 23) to be found. Further collocation of equation 21 at the internal nodes Ni, for each of the k=1,2 components allows the last two rows to be obtained, as shown below in equation 23;
Equation 23

The general form of the boundary condition is expressed as 1 , 2 , = ( ) where is the boundary operator and is the corresponding value of the boundary condition. If unidirectional flow has already developed, it is necessary to define a zero tangential velocity at cross sections with prescribed pressure boundary conditions. As mentioned before, the continuity equation does not need to be explicitly imposed in the produced system of equations as the formulation is already mass conservative. The used superposition particular solutions also exactly satisfy the continuity equation. It is also important to note there is no need for a p-v coupling strategy as there is an already inherent relationship between the respective particular solutions (as shown by equation 16). With respect to the non-linearity of the Navier-Stokes system of equations, they can be solved by using a direct Picards iteration method. Used to linearize the momentum equation, a guess at the velocity field is found from the previous iteration (see equation 20), an initial value is set corresponding to the problem in consideration. The stopping criterion of the Picard iterations is defined by the L2-norm of the difference between the variable = 1 , 2 , in the present iteration and the values in the previous one, i.e. 1 .

The Simple Gaussian Solver Within the simple Picard iterative scheme, one must choose a solver for the purpose of solving a system of linear equations in the form = . In the simplest scheme we can use a simple Gauss Solver, in MATLAB this is defined as mldivide and signified by a simple backslash. It is the simplest way of solving the system of equations (equation 23) for . To solve, the Galois array A is divided into b to produce the particular solution of the linear equation = . The MATLAB code for this method is shown in lines 78 & 79 of the appendices. It is expected that improvements can be made upon this solver. The Singular Value Decomposition Solver SVD (22) & is a well established method of solving a linear system of non-homogeneous equations. It is expected in this project to provide an improved method with which to solve

P a g e | 11 two-dimensional Navier-Stokes systems of equations, within a Picard iteration Scheme. It has also been indicated to provide more stable results, with the scheme less likely to be sensitive to changes in the SP value. The equations to be solved can be considered to be in the form = , SVD allows matrix A to be decomposed into;
Equation 24

= where the U and VT are unitary orthogonal matrices containing the eigenvectors of and respectively and is the transpose of V. S is a diagonal matrix containing the square roots of the eigenvectors of U and VT. Each of the diagonal values of S are the (non-negative) singular values of A. To solve for x, the rank of matrix A is found, i.e. the number of singular values of A. The Pseudoinverse of A, A+ is then found;
Equation 25

where the diagonal matrix S+ is calculated by finding the reciprocals of the singular values present within diagonal of S. The solutions to x+ (or in the MAPS case, ) are found using;
Equation 26

= (= ) The MATLAB code for this method is shown in lines 79-84 of Main Code section of the appendices. Pre-Estimated Solutions One way in which the scheme can be made more efficient is with the use of pre-estimated solutions, for example, as is done in this project, when starting the Picard for a higher Reynolds number, we can pre insert the previous value of the previous, lower, Reynolds number, that has been previously solved for the same nodal distribution. As mentioned above, this use is the equivalent of setting an appropriate guess for . This reduces the number of iterations needed, as the original estimate, is more accurate than when starting from zero. It also helps produce a more stable result, and in some cases to converge at all. In this project, all results produced for Reynolds numbers over 1000 used this additional process. When using Reynolds numbers lower than 1000, it is found that solving for both a lower and then a higher Reynolds number took more time and computing power than just solving from a guess of zero. It is also noted that there is very little difference between the qualities of results for each method for = 1000

P a g e | 12 Lid Driven Cavity Flow Scenario Numerical Results


Figure 2: Chart to show the sensitivity of L2 Norm with changes to the value of the Shape Parameter using a Simple Gaussian Solver Figure 3: Chart to show the sensitivity of L2 Norm with changes to the value of the Shape Parameter when using a Single Value Decomposition Solver

Converging
Non Converging

1.E+04 Converging 1.E+03 Non-Converging 1.E+02

1.00E+04

1.00E+03
1.00E+02 L2 Norm 1.00E+01 1.00E+00 1.00E-01 1.00E-02 1.E-01 1.E+00

L2 Norm

1.E+01

1.E+00 1.E-05 1.E-04 1.E-03 1.E-02 1.E-01 1.E+00 1.E-01 1.E-02 1.E-05 1.E-04 1.E-03 1.E-02

Shape Parameter

Shape Parameter Value

Figures 2 and 3 show the sensitivity displayed by the L2 Norm parameter, when the value of the SP was changed. As we can see, both Solvers display broadly similar characteristics. The data is based upon the lid driven cavity scenario with = 400 and a nodal distribution of 31x31. From these graphs, they look broadly similar, both show the expected characteristic shape, and numerically they are both within reasonable parameters.
Figure 4: Showing the RMS Error sensitivity with respect to the value of the Shape Parameter

6.50E-04 SVD 6.00E-04 5.50E-04 5.00E-04 Gaussian

RMS Error

4.50E-04 4.00E-04 3.50E-04 3.00E-04 2.50E-04 2.00E-04 3.E-04 5.E-04 Shape Parameter Values 1.E-03 5.E-03 1.E-02 1.E-02

P a g e | 13 It is only when we examine Figure 6, above, that we see the differences between the two solvers. Figure 6 shows a clear advantage in the SVD solver. The RMS error is significantly smaller for the larger values within the range of Shape Parameter values. Results were also compared between the Pre-existing Ghia (1) values for 1 & 2 , as shown in figures 5 and 6. Again, examination of the graphs above adds to the premise that the SVD solver provides a more accurate method of solving the system of linear equations resident within the Picard iteration scheme. Certainly at = 3200 as shown above, the results show only a very slight improvement in their agreement with the pre-existing Ghia results. The same has been found for all vales of Re up to 3200. The effect becomes more pronounced as Re increases, this is a good argument for the implementation of an SVD solver at higher values of Re.
Figure 5: Showing the obtained u1, u2 velocity profiles upon the lines x1=0.5, x2=0.5, using the SVD solver

Figure 6: Showing the obtained u1, u2 velocity profiles upon the lines x1=0.5, x2=0.5, using the Gaussian solver

P a g e | 14 Figure 7 shows the number of iterations needed to converge to within the tolerance set by the L2 Norm for a range of SP values. Generally for both solvers, the sensitivity to the SP value was remarkably consistent. It is however worth noting that the SVD approach seemed more stable when using smaller shape parameters, most notable down to 1 105 . This in itself is not particular significant, as better results are achieved with higher Shape Parameter values, however it does represent a larger range of shape parameter values, which in turn results in good stability, and hence convergence and good quality results. Any results above the dotted line represent scenarios where the solutions did not converge, generally the maximum number of iterations to try was set at 50, and some even exceeded this number.
Figure 7: Showing the amount of iterations needed to converge on a solution for various Shape Parameters, based upon a Reynolds number of 400

Iterations To Convergance

10

Did Not Converge

SVD
Gaussian

Shape Parameter

The Extension To, & Affects of Higher Reynolds Numbers Figures 8 and 9 show the Flow lines of the lid driven cavity scenario for a Reynolds number of 3200, and a nodal distribution of 51x51 for each solver. Both Solvers provide very good results, however as shown below, again the SVD solver provides a more comprehensive representation of the flow lines at a Reynolds number of 3200. The notoriously underresolved areas in the bottom corners are more detailed, as is the centre, and the flow lines directly under the approach flow of the lid driven cavity flow scenario.

P a g e | 15
Figure 8: Flow Lines Shown For Re=3200 Using a SVD Solver Figure 9: Flow Lines Shown For Re=3200 Using A Direct Gauss Solver

Both solvers have been used to reach a Reynolds number of 3200, both showing good results (figures 8 & 9). When reaching these higher Reynolds numbers, they were found using an estimate for from the solutions for = 1000. The differences in terms of efficiency between the two solvers were as expected, with the SVD solver taking slightly longer. For = 3200 the SVD solver took 19.6 hours, and 14.6 hours for the Gaussian solver (Table 1, Appendix). It is also important to note that a smaller value of the Shape Parameter had to be used for the extension to higher Reynolds numbers. This is due to the ill conditioning of the interpolating matrix that occurs as Re increases. Although the author attempted to reach higher than 3200, i.e. = 5000, time constraints meant it was not possible to pursue this to a great extent, although promising work was done towards this goal. It is confidently predicted that higher values of Re could be achieved with greater nodal distributions, and points within them, this is mentioned further in the recommendations section below, but sadly time constraints did not allow this to be pursued within the scope of the project. Computing Efficiency
Figure 10: Showing the Time Taken to Converge for various values of the Shape Parameter, using variables of Re=400 and a 31x31 Nodal Distribution

5 Gaussian 4 SVD 3 2 1 0 1.E-01 1.E+00

1.E-05

1.E-04

1.E-03

1.E-02

Shape Parameter

The computing efficiency of each solver has also been investigated within the project, shown to the left, figure 10 shows the overall time to converge for the various SP values. As we can see the Gaussian method seems very slightly quicker overall for the range of values, which is as mentioned above. It is worth mentioning that the multiple computers used were not being used heedlessly. Due to the fact that the majority of the university computers were not up to the job of processing the amount of data, individual computers had to be used, and

Time Taken To Converge (hrs)

P a g e | 16 as many of the scripts took 5+ hours to run, it was impossible to not use them for other work during that time. Hence some of the processing and memory operations may have been compromised from their optimum performances when running the scripts.

Conclusions The aim of the project discussed in this report has brought to the fore a number of conclusions, based upon the results discussed above. The overall method has as discussed has not changed to a great extent, but by working with the scheme and corresponding code over the past 6 months, small tweaks and additions have been added to further analyze and improve the MATLAB code. Use of both solvers, Gaussian, and SVD, has raised further possibilities and questions with respect to the MAPS. The SVD solver proved to be more accurate, and have greater detail, as witnessed by the graphs above. For all converging values of the SP, it averaged an RMS Error of 3.5395E-04, compared with the average for the Gaussian Solver of 3.9620E-04, almost a 12% increase in accuracy.

The Gaussian Solver however, proved to take the least time, averaging 10% quicker than the SVD Solver. As expected, it also took up less computing power, averaging for a relatively low Reynolds number of 400 and a medium nodal distribution of 31x31, 30Mbs less needed per iteration. At low Reynolds numbers and coarser nodal distributions then, where computing power is at a premium, the Gaussian solver is more useful. In the instance where computing power is not an issue, for instance in many of many now common medium to high end computers, an SVD solver must be considered, as it provides an increase in both accuracy and stability.

Recommendations Other Solvers o LU decomposition o Etc. Higher Re testing o Re=5,000 o Re=10,000 Refined Meshes o 101x101 o 161x161 Use of headless operating system, i.e. without the clutter of multiplexing, or other processor or memory demands.

Acknowledgements& References The current report is part of work currently ongoing by H. Power2, C. A. Bustamante3 and W. F. Florez2. Thanks are given to Dr. Bustamante for the original version of the MATLAB 4
2

School of Mechanical, Materials and Manufacturing Engineering, University of Nottingham, University Park, Nottingham, NG7 2RD, UK 3 Instituto de Energa, Materiales y Medio Ambiente, Universidad Pontificia Bolivariana, Circ. 1 No. 74-34, Medelln, Colombia 4 http://www.mathworks.co.uk/products/matlab/ 4 http://www.mathworks.co.uk/matlabcentral/

P a g e | 17 code and a very large thanks to Professor Power for his insights and advice on this project. I also have to thank the MIT Open Courseware project (23) video for help with solving Linear equations using SVD. I am also indebted to the good people at MATLAB Central5, whose forums have been ever helpful when searching for the correct functions or operators to use. Further thanks are due to Joshua Greenslade, for use of his computer when running high end scripts.

Bibliography
1. High-re solutions for incompressible flow using the navier-stokes equations and a multigrid. U. Ghia, K. N. Ghia, C. Shin. Journal of Computational Physics 48, 1982, Vols. 387411. 2. A calculation procedure for heat, mass and momentum transfer in three-dimensional. S. V. Patankar, D. B. Spalding. 1972, Int. J. Heat Mass Transfer 15, pp. 17871806. 3. Solution of the implicitly discretised fluid flow equations by operator-splitting. R. I. Issa. 1986, J. Comput. Phys. 62, pp. 40-65. 4. Numerical solution of non-isothermal fluid flows. G. C. Bourantas, E. D. Skouras, V. C. Loukopoulos, G. C. Nikiforidis. 2010, J. Comput. Methods Eng. Sci., pp. 187-212. 5. Direct solution of navierstokes equations by radial basis functions. O. I. G. Demirkaya, C. Wafo Soh. 2008, Engineering Analysis, pp. 1848-1858. 6. Multiquadrics -a scattered data approximation scheme with applications to computational fluid dynamics-ii. Kansa, E. J. 1990, Comput. Math. Appl. 19, pp. 127-145. 7. Schaback, R. Multivariate interpolation and approximation by translates of basis functions. [book auth.] L. L. Schumaker C. K. Chui. Approximation Theory VIII:Wavelets and Multilevel Approximation. College Station : World Scientific Pub Co Inc, 1995, pp. 1-8. 8. On approximate cardinal preconditioning methods for solving pdes with radial basis functions. Brown, D. 2005, Eng. Anal., pp. 343-353. 9. Approximation of function and its derivatives using radial basis function networks. Mai-Duy, T. T.-C. N. 2003, Appl. Math., pp. 197-220. 10. Numerical solution of diferential equations using multiquadric radial basis function networks. N. MaiDuy, T. Tran-Cong. 2001, Neural Networks 14, pp. 185-199. 11. Radial basis function meshless method for the steady incompressible navier stokes equations. P. P. Chinchapatnam, K. Djidjeli, P. B. Nair. 2007, International Journal of Computer Mathematics 84 (10), pp. 1509-1526. 12. Numerical computation of three-dimensional incompressible viscous flows in the primitive. H. Ding, C. Shu, K. Yeo, D. Xu. 2006, Comput. Methods Appl. Mech. Engrg. 195, pp. 197-220. 13. Local radial basis function-based differential quadrature method and its application to solve. C. Shu, H. Ding, K. Yeo. 2003, Comput. Methods Appl. Mech. Engrg. 192, pp. 941-954. 14. An efficient localized radial basis function meshless method for fluid flow and conjugate heat. E. Divo, A. J. Kassab. Journal of Heat Transfer 129 : 124-136, 2007. 15. Local radial basis function based gridfree scheme for unsteady incompressible viscous flows,. Y. Sanyasiraju, G. Chandhini. Journal of Computational Physics 227 : s.n., 2008. 16. A radial basis function collocation approach in computational fluid dynamics,. B. Sarler. s.l. : CMES Comput. Model Eng. Sci., 2005. 17. The method of approximated particular solutions for solving certain partial differential equations,. C. Chen, C. Fan, P.Wen. 2010, Vol. Numer. Meth. Part. D. E. 18. Boundary Integral Methods in Fluid Mechanics. H. Power, L. Wrobel. Comput. Mech : s.n., 1995. 19. J. Happel, H. Brenner. Low Reynolds Number Hydrodynamics. The Hague : Martinus Nijhoff Publishers, 1983. 20. Free vibration multiquadric boundary elements applied to plane elasticity,. M. F. Samaan, Y. F. Rashed. 2009, Vol. Appl. Math. 21. The Wolfram Mathematica Online Integrator. Wolfram Mathematica. [Online] 2012. http://integrals.wolfram.com/index.jsp. 22. Singular Value Decomposition (SVD) Tutorial. Massachusetts Institute of Technology. [Online] http://web.mit.edu/be.400/www/SVD/Singular_Value_Decomposition.htm. 23. MIT Math Lecture - Linear Algebra - 29 - Singular Value Decomposition. http://ocw.mit.edu/index.htm, 2008.

P a g e | 18 Appendices

Figures and Tables


Table 1: Showing some of the numerical results for various Nodal Distributions, and Re and SP values
Modified Method Of Particular Solutions 'Gaussian (mldivide)' Node Configuration 21x21 41x41 51x51 41x41 51x51 51x51 41x41 51x51 51x51 51x51 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 31x31 51x51 51x51 Reynolds Number, Re 100 100 100 400 400 400 800 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 1000 3200 Shape Parameter, c 1.00E-02 1.00E-02 1.00E-02 1.00E-02 5.00E-03 5.00E-02 1.00E-02 2.50E-02 1.25E-02 7.50E-03 1.00E-06 1.00E-05 1.00E-04 1.25E-04 2.50E-04 5.00E-04 1.00E-03 5.00E-03 1.00E-02 1.10E-02 1.15E-02 1.25E-02 2.50E-02 3.75E-02 5.00E-02 5.00E-02 1.00E-01 1.00E-02 1.00E-03 Converged? Y Y Y Y Y N Y N N Y N(Max) N (Max) N (Max) Y Y Y Y Y Y N(Max) N (Max) N (Max) Y Y Iterations 5 5 5 5 5 14 6 25 25 25 5 5 5 5 5 7 25 50 25 7 11 Time(hrs) 0.1933 5.3722 6.6408 2.9281 6.5808 8.1303 8.1289 4.2380 4.0577 0.9213 0.8845 0.9321 0.8485 0.8577 1.1973 4.1050 8.3614 4.5099 14.6206 8.9013E-01 5.2321E-01 4.8898E-02 5.0909E-02 2.2272E-01 L2 Norm Converged? Y Y N(Max) N(Max) N(Max) Y Y Y Y Y Y Y N(Max) N(Max) Y Y 'Single Value Decomposition (SVD)' Iterations 5 5 25 25 50 5 5 5 5 5 5 7 25 7 5 Time (hrs) 5.1287 4.7108 0.9708 0.9601 0.9416 0.9693 1.2166 0.9801 1.3196 4.5353 19.6580 L2 Norm 8.9928E-02 7.5300E-02 4.8899E-02 4.9276E-02 5.0900E-02 8.7543E-02 2.2271E-01 3.6524E-01 4.8828E+00 2.6225E+01 1.0500E+03 -

3.6517E-01 6.5739E+03 -

MATLAB Code Main Code Included below is a copy of the main code, functions called are not included, however they are explained within the existing comments;
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. % Code for the solution of the 2-D laminar flow problems (Lid Driven Cavity Flow) by the Global Method of % approximated Particular Solutions w/ refined mesh and pressure computation) tic; %start time measurement clearall loadnodes.dat %File containing node coordinate %load RENS.txt %File containing initial solution x=nodes(:,2:3); s1=size(x); n=s1(1); [bp,ip,n1,n2,bk]=geosor2a(x,n); %bp(:,1:2) contains the coordinates of boundary points and bp(:,3:4) the velocity values at boundary %ip(:,1:2) contains the coordinates of internal points %Global system computing aa*al=bb den=400; %Assuming Density (Re=den*L*U/mu, if L=1,U=1,mu=1 then Re=density) sp=0.0125; %Shape Parameter (c) aa=zeros(2*(n1+n2),2*(n1+n2)); bb=zeros(2*(n1+n2),1); tolp=0.01; %Tolerance k=1; %initialise count nmax=50; %Max Iterations up0=zeros(n1+n2,3); u1=zeros(n1+n2,n1+n2);

11. 12. 13. 14. 15. 16. 17. 18. 19. 20.

P a g e | 19
21. u2=zeros(n1+n2,n1+n2); 22. pp=zeros(n1+n2,n1+n2); 23. %up0=RENS(:,1:3); %Uncomment when a initial guess different to zero has to be set. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. while (k<nmax) fori=1:n1+n2 for j=1:n1+n2 if (i<=n1 & k==1) xi(1:2)=bp(i,1:2); if (j<=n1) zj(1:2)=bp(j,1:2); else zj(1:2)=ip(j-n1,1:2); end ra=sqrt(dot(xi-zj,xi-zj)); if (bk(i)==0) %Dirichlet boundary condition aa(i,j)=solfun(xi,zj,ra,sp,1,1); %solfun computes the velocity particular solutions aa(i+n1,j)=solfun(xi,zj,ra,sp,1,2); aa(i,j+n1+n2)=aa(i+n1,j); aa(i+n1,j+n1+n2)=solfun(xi,zj,ra,sp,2,2); pp(i,j)=solfunp(xi,zj,ra,sp,1); %solfunp is called to compute the pressure particular solutions 41. pp(i,n1+n2+j)=solfunp(xi,zj,ra,sp,2); 42. elseif (bk(i)==1) %Outflow x-direction condition 43. 44. 45. 46. 47. 48. aa(i,j)=solfunp(xi,zj,ra,sp,1); aa(i+n1,j)=solfun(xi,zj,ra,sp,1,2); aa(i,j+n1+n2)=solfunp(xi,zj,ra,sp,2); aa(i+n1,j+n1+n2)=solfun(xi,zj,ra,sp,2,2); u1(i,j)=solfun(xi,zj,ra,sp,1,1); u1(i,n1+n2+j)=solfun(xi,zj,ra,sp,1,2);

49. end 50. bb(i,1)=bp(i,3); 51. bb(i+n1,1)=bp(i,4); 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. elseif (i>n1) xi(1:2)=ip(i-n1,1:2); if (j<=n1) zj(1:2)=bp(j,1:2); else zj(1:2)=ip(j-n1,1:2); end ra=sqrt(dot(xi-zj,xi-zj)); grad(1:2)=dsolfun(xi,zj,ra,sp,1,1); %dsolfun is called to compute the gradients of the velocities aa(i+n1,j)=radfun(ra,sp,1)-den*dot(up0(i,1:2),grad); %radfun is used to compute the MQ RBF value grad(1:2)=dsolfun(xi,zj,ra,sp,1,2); aa(i+n1,j+n1+n2)=-den*dot(up0(i,1:2),grad); aa(i+n1+n2,j)=aa(i+n1,j+n1+n2); grad(1:2)=dsolfun(xi,zj,ra,sp,2,2); aa(i+n1+n2,j+n1+n2)=radfun(ra,sp,1)-den*dot(up0(i,1:2),grad); u1(i,j)=solfun(xi,zj,ra,sp,1,1); u1(i,n1+n2+j)=solfun(xi,zj,ra,sp,1,2); u2(i,j)=u1(i,n1+n2+j); u2(i,n1+n2+j)=solfun(xi,zj,ra,sp,2,2); pp(i,j)=solfunp(xi,zj,ra,sp,1); pp(i,n1+n2+j)=solfunp(xi,zj,ra,sp,2); xp(i,1:2)=xi; end end end

75. %------------------------------------------------------------------------76. % Solving the linear system aa*al=bb 77. %al=aa\bb; % (1) ML divide - Simple Gauss Solver- This the most simple 78. %way to solve the system in Matlab as well as the most time consuming. 79. 80. 81. 82. 83. 84. % % % % % % [U,S,V] = svd(aa,0); % (2) Single Value Decomposition - Quicker? d = diag(S); r = sum(d > 0); b1 = U(:,1:r)'*bb; w = d(1:r).\b1; al = V(:,1:r)*w;

85. % Computing velocity values at nodes (Once the alpha values are known, the 86. % velocities and pressure are computed) 87. %-------------------------------------------------------------------------

P a g e | 20
88. up=zeros(n1+n2,3); 89. xp(1:n1,1:2)=bp(1:n1,1:2); 90. fori=1:n1 91. if (bk(i)==0) 92. up(i,1)=bb(i,1); 93. up(i,2)=bb(i+n1,1); 94. up(i,3)=dot(pp(i,:),al(:)); 95. elseif (bk(i)==1) 96. up(i,1)=dot(u1(i,:),al(:)); 97. up(i,2)=bb(i+n1,1); 98. up(i,3)=bb(i,1); 99. end 100. end 101. up(n1+1:n1+n2,1)=u1(n1+1:n1+n2,:)*al; 102. up(n1+1:n1+n2,2)=u2(n1+1:n1+n2,:)*al; 103. up(n1+1:n1+n2,3)=pp(n1+1:n1+n2,:)*al; 104. tol1(k)=abs(max(up(:,1)-up0(:,1))) %/abs(max(up0(:,1))) 105. 106. 107. %Saving results dlmwrite('RENS.txt',up, 'delimiter', '\t', 'precision', 6); %saving RENS data dlmwrite('RADNS.txt',xp, 'delimiter', '\t', 'precision', 6); %saving RADNS data dlmwrite('toles.txt',tol1, 'delimiter', '\t', 'precision', 6); %saving tolerances data if (tol1(k)<tolp) k=nmax; else k=k+1 up0=up; end end %Time measurements Time_Taken_in_seconds=toc dlmwrite('info.txt', Time_Taken_in_seconds, 'delimiter', '\t', 'precision', 6); %saves timing data %Effect of C, and L2 Norm values for Calculating Range of C AL=abs(al); %find absolutes of velocities n=numel(AL); %No. of elements in AL Nsize=size(aa); N=Nsize(:,1); %Number of nodes A = AL(1:2:end,:); % u1's B = AL(2:2:end,:); % u2's Linf=(abs((1/N)*(A-B))); %calculates Linfinite. L2=mean(Linf) %L2 Norm % L1=((1/N)*(u1-u2)); %L1 method (e-21) % L1=abs(mean(mean(L1))) dlmwrite('L.txt', L2, 'delimiter', '\t', 'precision', 6); %saves L2 norm data %fin

108. 109. 110. 111. 112. 113.

114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126.

Memory Analysis Code


%Memory Analysis %--------------------------------------disp([num2str(i),' out of ',num2str(n1+n2)]) whos a1111 = whos; z1111 = 0; for t = 1:size(a1111,1) z1111 = z1111 + getfield(a1111,{t},'bytes'); end disp([num2str(z1111)])

%----------------------------------------

For each iteration, this code measures the amount of memory used by each item within the overall script. It was instrumental in figuring out how to solve many of the memory issues encountered within the project. Supervision Records

You might also like