You are on page 1of 133

An Introduction to Computational Fluid Dynamics

An Introduction to Computational Fluid Dynamics

A Workshop hosted at: Department of Mathematics and Computer Science The University of the West Indies St. Augustine, Trinidad. April 22-25, 2003 Invited Speaker: Sergio Rojas, Ph.D. Email: sergio@cecalc.ula.ve http://www.cecalc.ula.ve/ sergio/

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Outline
1 Incompressible Fluid Flow Equations 1.1 1.2 1.3 1.4 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . Unsteady Navier-Stokes equations . . . . . . . . . . . . . . Steady Navier-Stokes equations . . . . . . . . . . . . . . . Navier-Stokes equations in dimensionless form . . . . . . . 1.4.1 1.4.2 Low High uid ow . . . . . . . . . . . . . . . . . . uid ow . . . . . . . . . . . . . . . . . .

6 6 8 8 9 9 10 11 11 14

2 On Computational Fluid Dynamics (CFD) 2.1 2.2


2

Why CFD? . . . . . . . . . . . . . . . . . . . . . . . . . . Importance of CFD . . . . . . . . . . . . . . . . . . . . . .


Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

2.3

Steps of a CFD simulation . . . . . . . . . . . . . . . . . . 2.3.1 2.3.2 2.3.3 2.3.4 Pre-Processing . . . . . . . . . . . . . . . . . . . . Processing . . . . . . . . . . . . . . . . . . . . . . Post-Processing . . . . . . . . . . . . . . . . . . . . Problems of a CFD simulation . . . . . . . . . . . . Online CFD sample results . . . . . . . . . . . . .

16 16 17 18 18 19 24 26 30 30 40

2.4

Some CFD sample results . . . . . . . . . . . . . . . . . . . 2.4.1

3 Some aspects of numerical computations 4 Finite Difference Approximation of Differential Equations 4.1 4.2
3

Example: a one dimensional problem . . . . . . . . . . . . A solved example . . . . . . . . . . . . . . . . . . . . . . .


Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

4.3

Example: a two dimensional problem . . . . . . . . . . . .

58 64 64 66 68 69 71 72 77 82 82 83

5 Finite Element Method (FEM) 5.1 5.2 5.3 Intuitive introduction: the area of a circle . . . . . . . . . . Generalities . . . . . . . . . . . . . . . . . . . . . . . . . . Steps of the FEM: a one dimensional model problem . . . . 5.3.1 5.3.2 Formulating the weak form of the problem . . . . . Choosing approximating functions for the unknown 5.3.2.1 5.3.2.2 5.3.2.3 5.3.3 5.4
4

One dimensional lineal elements . . . . . One dimensional quadratic elements . . . One dimensional higher order elements . .

Choice of the weight function . . . . . . . . . . . .

Putting all together . . . . . . . . . . . . . . . . . . . . . .


Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

5.5

One dimensional illustrative example (using Mathematica) .

94 114

6 Some aspects of grid generation 6.1

On uid ow equations expressed in generalized coordinates 126 129

7 Closure 7.1

On-line general references . . . . . . . . . . . . . . . . . . 130 132

References

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

1
1.1

Incompressible Fluid Flow Equations


Introduction
Waves follow our boat as we meander across the lake, and turbulent air currents follow our ight in a modern jet. Mathematicians and physicists believe that an explanation for and the prediction of both the breeze and the turbulence can be found through an understanding of solutions to the Navier-Stokes equations. Although these equations were written down in the 19th Century, our understanding of them remains minimal. The challenge is to make substantial progress toward a mathematical theory which will unlock the secrets hidden in the Navier-Stokes equations. Taken from the Clay Mathematics Institute (http://www.claymath.org/)

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

A main characteristic that differentiate a uid from a solid in that the former can not withstand any attempt to change its shape when at rest. That is, uids at rest can not sustain a shear force. If the uid is in motion, however, it can not only sustain a shear force, but it can also transmit such force. Based on the continuum hypothesis which considers that the physical properties characterizing the state of a uid such as pressure, density, velocity, etc. vary continuously, equations describing the motion of uids can be derived without regarding the behavior of individual molecules (Batchelor 1987; Sherman 1990). Nevertheless, derivations of similar equations based on more fundamental ideas coming from physics can also be obtained (Huan 1987; Chouduri 1998). The later approach is a necessary step to put on better grounds the results obtained under the assumptions of the continuum hypothesis, and, more importantly, it is the road to be follow in situations where the continuum hypothesis assumptions can not be fullled, as for example for ows at very low density.
7 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

1.2

Unsteady Navier-Stokes equations


                 

(1)

1.3

Steady Navier-Stokes equations


       

(2)

    

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

1.4

Navier-Stokes equations in dimensionless form

When dealing with the numerical solution of equations 1, two dimensionless form are commonly encounter in the literature, both , including a dimensionless parameter, the Reynolds number that is used to characterize the ow regimes (Bachelor 1967, Tritton 1992):

1.4.1 Low

uid ow

  

 

(3)


  

 

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

1.4.2 High

uid ow

As a way of referring to the challenge and difculties that the question of global existence and uniqueness of the solution of the Navier Stokes still represent, let me just mention that this problem was declared, in year 2000, to be one of the seven greatest open problems in mathematics at the Clay Mathematics Institute of Cambridge, Massachusetts (http://www.claymath.org/Millennium Prize Problems/). Finally, lets mention that a complete description of a uid ow problem could involve the coupling with other equations like energy conservation (i.e. heat transfer) or auxiliary (phenomenological or constitutive) equations describing the physics of the ow phenomenon under consideration.
10 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

        

 

(4)

 

 

 

An Introduction to Computational Fluid Dynamics

2
2.1

On Computational Fluid Dynamics (CFD)


Why CFD?
As was stated in the previous section, the complexity of nding solutions of Navier Stokes equations is so great that such a problem has been put in the list of the greatest unsolved problems. So, one way of progress in the eld is resorting to the use of numerical methods. That is, CFD is basically a relative new eld of science that includes all the steps involved in simulating a uid ow on the computer . In so, much of the numerical methods applied today were developed during the 1970s and 1980s and the development is still going on, especially in the physical parametrization of the ow models. One should mention, however, that a good high quality CFD code is necessary to get a feeling of what this eld is all about, and without real

11

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

experiments CFD results are doubtful in the sense that one can not be certain weather one is looking at an answer that the mother nature likes and can reproduce. An schematic representation of a CFD problem formulation can be found at http://www.metacomptech.com/cfd++/physics domain.html:

12

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

13

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

2.2

Importance of CFD
Lets rst mention that the investment cost of having a high quality CFD capability are not small, but the total expense is not as great as that of a high quality experimental facility. Current computer technology progress may drop the cost dramatically. CFD is of fundamental importance in the predicting of ow behavior for full scale of number. The nonlinearity of the Navier Stokes equations is the main responsible for the variety of solutions that have been found as , being turbulence one of the most fascinating and intrigued phenomena that still defy explanation.

CFD plays important role in the airplane industry, where planes are designed based on numerical computations of a ow passing any part of the airplane. Other applications involves the ship industry, oil industry, medicine, etc. Moreover, numerical experiments are helping
Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

14

An Introduction to Computational Fluid Dynamics

to understand behavior of various type of ows that can be used to comprehend open theoretical questions related to the existence and uniqueness of a solution of the equations describing the motion of uids. The results obtained from a CFD simulation can be used to analyze existing designs (.i.e. airplanes or automobile shapes) and propose the creation new ones: optimize processes and products; to understand the physics of the phenomena under study and propose new experiments that could help to comprehend features not seen in regular experiments. The ability to simulate ideal conditions is important for understanding the theory behind the model being described. To write good quality CFD code will take some time and a lot of intellectual resources. Nevertheless, it is worthwhile to spend some time on understanding the main aspects of CFD, even when one plans
Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

15

An Introduction to Computational Fluid Dynamics

to use somebody else code to perform our own research or to develop a better understanding on the phenomena of uid ow. Being familiar with the principles of CFD will allow us to comprehend much better the computational results obtained through numerical simulation.

2.3

Steps of a CFD simulation

Once the mathematical model is obtained and the equations discretized according to the numerical methodology (nite difference, nite elements, nite volume, etc.) and coded in a computer program (i.e. FLUENT, FIDAP, FEATFLOW, CFDRC, etc), usually a CFD simulation involves three basic step: 2.3.1 Pre-Processing Basically, in this step the performer of a CFD simulation set up the physical parameters dening the uid(s) and material(s) properties
16 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

involved in the simulation to be carried out. An important and perhaps the most labor intensive part of the model is the design and generation of the grid or mesh where the computations will be carried out. Essentially, the quality of the computational grid and the mathematical model of the physical phenomena being modeled will affect how closely the computer solution can approach reality. 2.3.2 Processing At this level of the CFD simulation, the user usually can write custom User Dened Functions and Subroutines to incorporate special functionality (.i.e. boundary conditions set up) related to the problem at hand and link them with the computational engine (solver) that will actually solve the set of discretized equations.

17

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

2.3.3 Post-Processing In the steps the analysis of the obtained numerical results is carried out, and the user decide whether a new execution of the simulation is required. The results are often presented graphically to assist in visualizing whats happening in the ow domain. 2.3.4 Problems of a CFD simulation Computer simulations are far from being the panacea of all our computational problems. Lets just mention a few problems that one could face whenever doing CFD: Numerical solution may experience instabilities and divergence. Solution, if possible, may be very expensive. Problems with multiple solutions (non-linearities are present) are hard to deal with.
Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

18

An Introduction to Computational Fluid Dynamics

The mathematical model may not be adequate to properly describe the physical situation being simulated. Real experiments are necessary to fully be condent of the numerical results.

Research in computational methods are devoted to nding better and reliable ways to diminishing these and other disadvantages of CFD. Moreover, the role of CFD has become so strong that it can be considered as a third area of uid dynamics. The other two classical elds are experimental and theoretical uid dynamics.

19

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

2.4

Some CFD sample results

20

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

21

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

22

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

23

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

2.4.1 Online CFD sample results Many other examples can be found on the Internet. Some sites are: From Physics of Fluids Journal: http://ojps.aip.org/phf/gallery/index1.jsp From CFD and thermal analysis archive: http://www.itsc.com/movies/ Some FEATFLOW CFD results: http://www.featow.de/album/ Pictures from the book An Album of Fluid Motion by Milton Van Dyke, 1982: http://www.owlnet.rice.edu/ mech372/album/ Gallery of Fluid Dynamics: http://www.eng.vt.edu/uids/msc/gallery/gall.htm Other: http://www.eng.vt.edu/uids/msc/gallery/conden/conden.htm

Some of this sites show pictures of real uid behaviour; others are obtained via CFD simulations.
24 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

At CeCalCULA (http://www.cecalc.ula.ve/) we have available FLUENT and CFRC, two well known CFD software packages, to perform uid dynamics simulations. We are in process of getting involved on a research project to study ow of blood in thin capillaries.

25

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Some aspects of numerical computations


In general, numerical solutions of physical, mathematical, and engineering problems involves complex shapes as computational boundaries (i.e. owelds computations around aircraft, automobiles, buildings, etc) that do not coincide with coordinate lines in physical space.. So, transformations from physical ( , , ) space to a generalized curvilinear coordinates ( , , ) space are introduced such that a PSfrag replacements distorted region in physical space is mapped into a rectangular region in the generalized coordinate space (see gure 3).

Figure 1: From physical ( , , ) to generalized ( , , )

26

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Experience and mathematical demonstrations show that to obtain high accuracy in a computed numerical solution the grid should be orthogonal or near orthogonal. This, however, implies relatively simple boundary shapes for the computational domain and some restrictions on the disposition of the grid points. In fact, the use of generalized coordinates introduces additional terms in the truncation error if the grid is not orthogonal. Nevertheless, departures from orthogonality of can be tolerated. up to One should deal with the convergence of a numerical discretization scheme whenever one get concerned with the circumstances under which the numerical solution will coincide with the true solution. Establishing convergence directly is in general a very difcult matter. Indirectly routes to explore the convergence of a numerical scheme have been devised. One criterion is that:

27

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Consistency

Stability

Convergence

Consistency: implies that the discretization scheme can be reverse to obtain the governing equation(s). Stability: has to do with the algorithm applied to solve the discretized equations. It must be stable. That is, errors do not grow as the as the computation of the solution progress. Lax Equivalence Theorem (time dependent problems): Given a properly posed linear initial value problem and a discretization scheme to it that satises the consistency condition, stability is the necessary and sufcient condition for convergence. From the truncation errors analysis, it is expected to obtain a more accurate solution as the grid size of the computational domain ). becomes smaller (

28

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

To achieve a level of accuracy, sometimes computational efciency requires to solve a higher-order discretization scheme on a coarse grid than a low-order scheme on a ner grid. There are circumstances on which one is only concerned in obtaining a computational solution close to the true solution at some level of accuracy, without worrying about the convergence of the approximation scheme (example are some no convergent series that are commonly use to nd numerical values of some functions, like for instance the error function).

29

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Finite Difference Approximation of Differential Equations


Example: a one dimensional problem

4.1

We would like to nd the numerical solution of: on (5)

subject to: (6a) (6b)

Finite difference approximations of derivatives are found starting from


30 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

     

 



 



An Introduction to Computational Fluid Dynamics

Taylor expansion of

around


:


PSfrag replacements

(7)

The interval 4.1:

 

can be discretized in a set of points as shown in gure


  

   


  

So, Taylor expansion of equation 7 by substituting


31




Figure 2: Discretization of the interval and ,




around , and

are obtained from . The results

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/





(8)

 

  

 


An Introduction to Computational Fluid Dynamics


 











are:

32

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

(9)
   

(10)

   

adding and subtracting equations 8 and 9 one obtains:






An Introduction to Computational Fluid Dynamics




 






 











33

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

 

 
   



  

(11)



An Introduction to Computational Fluid Dynamics

in the case of having a uniform grid, , equations 10 and 11 yields what is called centered nite difference discretization schemes for rst and second order derivatives and having a second order truncation error:
   







Substitution of approximations 12a and 12b in our differential equation 5,


34

   

(12a)










   

 

(12b)





 

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

on page 30, and evaluating each term at




one obtains:


which can be rewritten in the form: (13a) (13b) (13c) (13d) (13e)
 









35




Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

 

 

 

An Introduction to Computational Fluid Dynamics

where and similarly with , , and . Inspection of this equation shows that its evaluation at nodes and introduces two , which can be eliminated by use of the extra unknowns, and boundaries conditions (equations 6a and 6b on page 30) discretized with the and nite difference approximation 12a. Noting that correspond to nodes at which and respectively, the substitution of equation 12a on the boundary conditions, equations 6, and taking the rst ) and last ( ) equations from equation 13 one obtains: (




(14a) (14b) (14c) (14d)

 









 





 
 

   




36

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

After combining this equations one nally gets the full centered nite difference discretization of equation 5 subject to the boundary conditions given by equations 6a and 6b:

(15a) (15b)

   







  


 

are given by equations 13b-13e. The set of where , , , and that can solved numerically using equations 15 are of the form readily available algorithms in many Numerical Analysis texts. If computer efciency is an issue, one will need to use sophisticated algorithms that make use of the structure of the matrix to nd the numerical solution of

  
   

 

 


(15c)

 

 

37

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

such algebraic system of equation very efciently not only in terms of computer time but also in terms of minimizing the intrinsic computational errors. In the case of the example we are looking at, it happens that matrix the banded tridiagonal form:

is of


  

(16)

efcient mathematical algorithms have been devised to nd numerical solutions of systems of equations leading to tridiagonal matrices. In
38 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

 

 

   

An Introduction to Computational Fluid Dynamics

particular, most of them make use of the storage of a matrix such as of equation 16 in what is called tridiagonal storage mode, which means storing the elements of the tridiagonal matrix in three one-dimensional arrays each of length n (the order of the matrix) stored as follows:

sub-diagonal elements diagonal elements super-diagonal elements

(17a) (17b) (17c) (17d)

    

where * means an arbitrary not used element. (in our center CeCalCULA (http://www.cecalc.ula.ve/) we have available the UCSparseLib library (developed for one of ours collaborator), the commercial Mathematical and Statistical Library IMSL and the IBM Engineering and Scientic Subroutine LIbrary (ESSL and PESSL) to perform numerical computations,
39 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

including the use of parallel (hight performance) computations.

4.2

A solved example

Lets apply the theoretical ideas presented in the previous section to nd the numerical solution of (compare with equation 5, on page 30): on

  

with:

(18a)


 

 

40

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

subject to bcs 6, page 30, where: (18b)


 

The exact solution is given by: (18c)




The listing of a Fortran code implementing the solution of this problem, based on the ideas presented in the previous section, is given below. For illustrative purposes it makes use of a subroutine that was written to nd numerical solutions of systems of equations leading to banded tridiagonal matrices (the tridiagonal solver can be found in reference [6]).
#--------# Makefile #--------COMPILER = pgf90 41 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

 








 





 

An Introduction to Computational Fluid Dynamics

SOURCE_FILES = main.f90 \ myFunc/matrix_A.f90 \ myFunc/Eq_rhs_T.f90 \ myFunc/First_Der_Coef_R.f90 \ myFunc/Func_Coef_S.f90 \ NR/tridag.f OBJECTS = main.o \ matrix_A.o \ Eq_rhs_T.o \ First_Der_Coef_R.o \ Func_Coef_S.o \ tridag.o LIBS= FLAGS = #---# NOTE: you must make the white space just before the $(COMPILER) # instruction by hitting the computer TAB keyword. #---exec_file: $(OBJECTS) $(COMPILER) $(FLAGS) $(OBJECTS) -o exec_file $(LIBS) main.o: main.f90

42

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

$(COMPILER) $(FLAGS) -c main.f90 $(LIBS) matrix_A.o: myFunc/matrix_A.f90 $(COMPILER) $(FLAGS) -c myFunc/matrix_A.f90 $(LIBS) Eq_rhs_T.o: myFunc/Eq_rhs_T.f90 $(COMPILER) $(FLAGS) -c myFunc/Eq_rhs_T.f90 $(LIBS) First_Der_Coef_R.o: myFunc/First_Der_Coef_R.f90 $(COMPILER) $(FLAGS) -c myFunc/First_Der_Coef_R.f90 $(LIBS) Func_Coef_S.o: myFunc/Func_Coef_S.f90 $(COMPILER) $(FLAGS) -c myFunc/Func_Coef_S.f90 $(LIBS) tridag.o: NR/tridag.f $(COMPILER) $(FLAGS) -c NR/tridag.f $(LIBS) mclean: rm -rf $(OBJECTS) file.out mrun: exec_file !--------

43

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

!main.f90 !-------PROGRAM FINITE_DIFFERENCE_1D IMPLICIT NONE INTEGER N, AllocateStatus, i, j DOUBLE PRECISION, ALLOCATABLE :: AA(:,:) DOUBLE PRECISION, ALLOCATABLE :: copyAA(:,:), copyRHS(:) DOUBLE PRECISION, ALLOCATABLE :: A(:), B(:), C(:), RHS(:), U(:) DOUBLE PRECISION, ALLOCATABLE :: copyA(:), copyB(:), copyC(:), copyR(:) DOUBLE PRECISION :: Xa, Xb, alpha1, beta1, gamma1, alpha2, beta2, gamma2 DOUBLE PRECISION :: K, X, Sol, H CHARACTER*20 FNAME DOUBLE PRECISION :: PI PI = 4.0D0 * ATAN(1.0D0)

write(*, (5X,A), ADVANCE=NO) How many nodes?: READ (*,*) N ALLOCATE (AA(N,N), STAT = AllocateStatus) IF (AllocateStatus /= 0) STOP " *** NOT ENOUGH MEMORY *** "

44

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

ALLOCATE (copyAA(N,N),copyRHS(N), STAT = AllocateStatus) IF (AllocateStatus /= 0) STOP " *** NOT ENOUGH MEMORY *** " ALLOCATE (A(N),B(N),C(N),RHS(N),U(N), STAT = AllocateStatus) IF (AllocateStatus /= 0) STOP " *** NOT ENOUGH MEMORY *** " ALLOCATE (copyA(N),copyB(N),copyC(N),copyR(N), STAT = AllocateStatus) IF (AllocateStatus /= 0) STOP " *** NOT ENOUGH MEMORY *** " Xa = 0.0D0 xb = -1.0D0 DO WHILE( Xa .GE. Xb ) write(*,(5X,A),ADVANCE=NO) Enter left(Xa) and right(Xb) boundaries: READ (*,*) Xa, Xb END DO !----! write(*,(5X,A),ADVANCE=NO) Enter alpha1, beta1, and gamma1: ! READ (*,*) alpha1, beta1, gamma1 ! write(*,(5X,A),ADVANCE=NO) Enter alpha2, beta2, and gamma2: ! READ (*,*) alpha2, beta2, gamma2 !-----

45

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

alpha1 beta1 gamma1 alpha2 beta2 gamma2

= = = = = =

- K(Xa) 1.0d0 -2.0d0*PI K(Xb) 1.0d0 4.0d0*PI

CALL get_matrix_A(AA,RHS,A,B,C,N,Xa,Xb,alpha1,beta1,gamma1, & alpha2,beta2,gamma2) !saving a copy of A copyAA(1:n,1:n)=AA(1:n,1:n) copyA(1:n)=A(1:n) copyB(1:n)=B(1:n) copyC(1:n)=C(1:n) copyRHS(1:n)=RHS(1:n) ! DO i=1,N ! write (*,20) (AA(i,j), j=1,N) ! end do

! DO i=1,N

46

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

! write (*,22) A(i), B(i), C(i), RHS(i) ! end do

CALL TRIDAG(A,B,C,RHS,U,N) open(10,file="file.out") write (10,18) write (10,19) h = (Xb-Xa)/(N-1) !DO i=1,N DO i=2,N-1 X = DBLE((i-1))*h + Xa !write (*,22) (U(i) - Sol(X)) write (10,23) x, U(i), Sol(X), abs((U(i) - Sol(X))/Sol(X))*100.0d0 !write (10,23) x, U(i), Sol(X), abs((U(i) - Sol(X))/U(i))*100.0d0 end do close(10) 18 format(#,9x, x ,11x,numSol,7x,exactSol,8x,abs(diff)) 19 format(#,9x,---,11x,------,7x,--------,8x,---------) 20 format(6F10.4) 22 format(F16.6)

47

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

23 format(4F15.6) print *, \t\t **** Calling Gnuplot ***** call system("gnuplot < myplot.gnu") DEALLOCATE (A) END PROGRAM FINITE_DIFFERENCE_1D !---------------------------Double Precision FUNCTION SOL(X) IMPLICIT NONE DOUBLE PRECISION X DOUBLE PRECISION PI PI = 4.0D0 * ATAN(1.0D0) SOL = SIN(2.0d0*PI*X) return end !----------------------------

48

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Double Precision FUNCTION K(X) IMPLICIT NONE DOUBLE PRECISION X K = 1.0d0 + X*X*X*X return end !-----------!matrix_A.f90 !-----------SUBROUTINE GET_MATRIX_A(AA,RHS,A1,B1,C1,N,Xa,Xb,alpha1,beta1,gamma1,& alphaN,betaN,gammaN) IMPLICIT NONE INTEGER N, I, J DOUBLE PRECISION :: AA(N,N), RHS(N), A1(N), B1(N), C1(N), Xa, Xb DOUBLE PRECISION :: alpha1, beta1, gamma1, alphaN, betaN, gammaN DOUBLE PRECISION :: X, h, h2, A, B, C, D external A, B, C, D double precision pi pi = 4.0D0 * ATAN(1.0D0)

49

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

h = (Xb - Xa) /(DBLE(N)-1.0D0) h2 = 2.0D0*h AA = 0.0D0 AA(1,1) = (alpha1/h2)*B(Xa,h) + beta1*A(Xa,h) AA(1,2) = (alpha1/h2)*(A(Xa,h) + C(Xa,h)) RHS(1) = (alpha1/h2)*D(Xa) + A(Xa,h)*gamma1 A1(1) = 0.0d0 B1(1) = AA(1,1) C1(1) = AA(1,2) x = Xa + h DO I = 2, N - 1 AA(I,I-1)= A(X,h) AA(I,I)=B(X,h) AA(I,I+1)=C(X,h) RHS(I) = D(X) A1(I) = AA(I,I-1) B1(I) = AA(I,I) C1(I) = AA(I,I+1) x = x + h 50 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

END DO AA(N, N - 1)= (alphaN/h2)*(A(Xb,h) + C(Xb,h)) AA(N,N)= (alphaN/h2)*B(Xb,h) - betaN*C(Xb,h) RHS(N)= (alphaN/h2)*D(Xb) - gammaN*C(Xb,h) A1(N) = AA(N, N - 1) B1(N) = AA(N, N ) C1(N) = 0.0d0 END SUBROUTINE GET_MATRIX_A Double Precision FUNCTION A(X,h) IMPLICIT NONE DOUBLE PRECISION X, h, R External R A = 1.0d0/(h*h) - R(X)/(2.d0*h) return end Double Precision FUNCTION B(X,h)

51

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

IMPLICIT NONE DOUBLE PRECISION X, h, S External S B = -2.0d0/(h*h) - S(X)/(2.d0*h) return end Double Precision FUNCTION C(X,h) IMPLICIT NONE DOUBLE PRECISION X, h, R External R C = 1.0d0/(h*h) + R(X)/(2.d0*h) return end Double Precision FUNCTION D(X) IMPLICIT NONE DOUBLE PRECISION X, T External T

52

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

D = T(X) return end !----------!Eq_rhs_T.f90 !----------! ! u + R(x)*u + S(x)*u = T(x) ! ! Right Hand Side of equation. ! Double Precision FUNCTION T(X) IMPLICIT NONE DOUBLE PRECISION X DOUBLE PRECISION :: a, b, PI PI = 4.0D0 * ATAN(1.0D0) b = 1.0d0 + X*X*X*X a = -8.0d0*PI*X*X*X*COS(2.0d0*PI*X) + 4.0d0*PI*PI*B*SIN(2.0d0*PI*X)

53

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

T = - a/b return end !-------------------!First_Der_Coef_R.f90 !-------------------! ! u + R(x)*u + S(x)*u = T(x) ! ! Coefficient of first derivative ! Double Precision FUNCTION R(X) IMPLICIT NONE DOUBLE PRECISION X R = (4.0d0*X*X*X)/(1.0d0 + X*X*X*X) return end !---------------

54

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

!Func_Coef_S.f90 !--------------! ! u + R(x)*u + S(x)*u = T(x) ! ! Coefficient of function u ! Double Precision FUNCTION S(X) IMPLICIT NONE DOUBLE PRECISION X DOUBLE PRECISION K, D ! K = 0.2d0 ! D = 2.0d0 S = 0.0d0 ! -K/D; return end

c------ctridag.f Fronm Numerical Recipes

55

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

c-------SUBROUTINE TRIDAG(A, B, C, R, U, N) IMPLICIT NONE INTEGER N, NMAx DOUBLE PRECISION A(N), B(N), C(N), R(N), U(N) PARAMETER (NMAx=5000) INTEGER j DOUBLE PRECISION bet, gam(NMAx) IF (B(1).EQ.0.) THEN STOP tridag: rewrite equations END IF bet = B(1) U(1) = R(1)/bet DO j = 2, N gam(j) = C(j-1)/bet bet = B(j) - A(j)*gam(j) IF (bet.EQ.0.) THEN STOP tridag failed END IF U(j) = (R(j)-A(j)*U(j-1))/bet END DO DO j = N - 1, 1, -1 U(j) = U(j) - gam(j+1)*U(j+1) END DO 56 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

RETURN END

#----------# myplot.gnu #----------# # excelent gnuplot site: # http://art.aees.kyushu-u.ac.jp/members/kawano/gnuplot/index-e.html #---# If this does not want to work, take out \ and joint the # lines in one long line #-----------set xlabel "x" set ylabel "y" set title "Finite Difference" plot "file.out" using 1:2 title "Numerical Sol." with lines, \ "file.out" using 1:3 title "Exact Sol." with lines, \ "file.out" using 1:2:4 notitle with yerrorbars !echo "waiting 15 seconds to continue" pause 15

57

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

4.3

Example: a two dimensional problem

A wide variety of physical and engineering problems are posed in terms of second order partial differential equations, being an archetypical example the Poisson equation: (19)
 

which satisfy equation 19 Usually one would like to nd a function region of interest subject to some desired behavior on within some the boundary of the region of interest (boundary conditions). These sort of problems are called boundary value (or stationary solution) problems which together with the so called initial value (or time evolution) problems make a most sensed classication of partial differential equations from a computational point of view. The standard classication of such problems as hyperbolic, parabolic or elliptic is less important because the character of

 

  

58

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

them could, as usually happen, change during computation. Nevertheless, there may be situations where a problem will remains of a particular type during the whole computation. In such cases, one should take advantage of the computational techniques developed for that particular case. Finite difference discretizations have also been developed to nd numerical solution of two (and higher) dimensional boundary value problems, by adapting the equations obtained in the one dimensional case to handle the respective higher dimensional case. In the case of of 2D partial differential equations, approximations of relevant derivatives in uniform grids are

59

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

written in the form: (20a) (20b) (20c) (20d) (20e)

 

 

being the generalized (also called logical) computational domain a rectangular grid:

 

 

 

 

 

60

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

. . .

i,j+1 i-1,j i,j i,j-1 i+1,j

Using equations 20, Poisson equation 19 can be written in discretized form


61 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

Figure 3: Example of the discretization of a 2D region

  

An Introduction to Computational Fluid Dynamics

as: (21a)

By means of the transformation equation 21 can be rewritten in matrix form:




The boundary points, where either


62







(21b) (21c) (see reference [6]), (22a) (22b) (22c) (22d)




 

  

 

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/


 




 

 

or its derivative are specied, are

An Introduction to Computational Fluid Dynamics

dened by: (23a) (23b) (23c) (23d)


 

 

  

63

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

5
5.1

Finite Element Method (FEM)


Intuitive introduction: the area of a circle
. . .


Figure 4: Finite element aproximation of the area of a circle

i,j-1 i,j+1 i+1,j i-1,j i,j

64

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

A few words are in order: The domain of interest can be discretized, depending of its shape, into a mesh of only one type of elements or into one of more than one type of elements. In general, some shapes (or combination of shapes) will represent the domain of interest more closely than others. When using more than one type of element in the representation of the domain, each kind should be isolated and its properties developed. Sources of error can be attributed to: errors due to the approximation of the domain; errors due to the approximation of the solution; error due to numerical computation. The accuracy (difference between the true solution and the FEM solution) and convergence (accuracy as the number of elements in the mesh is increased) of the nite element solution depends on the element used and the problem being solved.
Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

65

An Introduction to Computational Fluid Dynamics

5.2

Generalities
FEM are casted into the broad class of numerical methods known as weighted residual methods, which assumes that numerical solution of problems in science and engineering can be represented in the form:


(24)

is chosen to satisfy the boundary and initial where are unknown coefcients, and are known conditions; analytic functions, often referred to as trial functions. For time-dependent problems, a system of ordinary differential equations will be solved for . For steady problems a system of . algebraic equations will be solved to nd the A conceptual difference emerges here from the nite difference
66 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

methodology, where solution is found at nodal (discrete) points. On a are found, solution is known weighted residual method, once the everywhere in the computational domain. The coefcients

are determined by requiring: ; (25)


 

Where is the residual obtained after substituting equation 24 into the differential equation being solved. By this means, a set of equations for are generated allowing theirs determination. Different choices the denes the particular type of for the weight (test) function weighted residual method being used. The FEM formulation v a the s are chosen from the Galerkin Method is obtained whenever the same family of functions as the approximating (trial) functions of equation 24.

67

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

5.3

Steps of the FEM: a one dimensional model problem

Lets consider the problem of nding numerical solution of (compare with problem 5, on page 30): on

  

As we know this differential equation governs one dimensional steady heat ow as well as other important physical and engineering phenomena like diffusion, elastic bars, laminar (Poiseuille) ow in a pipe, etc. The set of equations 26 is known as the strong formulation of one dimensional heat ow.
68 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

(26)






 





An Introduction to Computational Fluid Dynamics

5.3.1 Formulating the weak form of the problem A version of the FEM formulation starts by establishing what is called the weak or variational formulation of the governing equation (in this case equation 26), which can be obtained by multiplying equation 26 by an weight function and integrating the resulting equation into the arbitrary : interval

(27)

 

 

using:

   

 

(28)

69

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

so, equation 27 can be integrated to obtain:


 

  

 

which is known as the weak (integral or variational) form of the one dimensional steady heat equation. The nite element is formulated based on the weak formulation of the governing equation basically because the weak form involves the use of approximating functions with only need to be differentiable once (the terminology of weak and strong forms is also related to this fact). Also, the order of differentiation of the unknown(s) is lower in the weak form ( needs to be differentiable once) than in the strong form.

(29)

70

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

5.3.2 Choosing approximating functions for the unknown

As we have been talking about, FEM approach involves the splitting into smaller parts (nite elements) the region of interest for which one can establish an approximation for the unknown s, given in this way an elementwise approximation of the unknown function. Some requirements have been lay out to this regards: The approximation must be able to represent an arbitrary constant gradient of the function being approximated. The approximation must be able to represent an arbitrary constant value of the function being approximated. The approximation of the function over element boundaries must be continuous. There are situations on which this requirement is not fullled (Zienkiewicz and Taylor, 1989). In many situations, an expansion of the unknown in terms of a
Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

71

i,j
An Introduction to Computational Fluid Dynamics

polynomial expansion is used for the elementwise approximation. 5.3.2.1 One dimensional lineal elements

The one dimensional domain [ , ] is divided into lineal elements. Consider the element with end points at and . The unknown is

72

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

represented in the form: (30a)





and are known as the element shape In this formulation, functions of element ( ). The representation of the unknown , given by equation 30a, separates the inuence of geometry via the element shape function from the inuence of physics given by the nodal temperatures , . This means that once the geometry of the element is known, the element shape function can be established directly. Equation 30a approximates the

 

(30b) (30c) (30d) (30e)


 

 

 

 

73

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

function as an interpolation, dened by the element shape functions, between the function nodal values. Now, a global shape function is dened in such a way that one global shape function is associated to each nodal point:

74

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

if

in element 1

otherwise if if in element 1 in element 2 (31) if if in element 2 in element 3




 

otherwise

otherwise if in element 3

otherwise

75

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Now one can express the approximation of the function global shape functions:


in terms of the (32)

which can be written in the neat form:


  

(33)

  




76

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

5.3.2.2

One dimensional quadratic elements

Higher order elements can be easily constructed. In this case, the approximation of the unknown will contain terms of higher order than the linear ones. Quadratic elements are constructed with three nodes by

77

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

locating at each end of the element a node (this ensure continuity of ) across neighboring elements) and the third nodal point is located arbitrarily within the element (in practice it is usually located at the middle of the element). Along the element, the unknown is represented in the form:

(34a) (34b) (34c) (34d) (34e)

notice that

 

 

  

 

 

 

 

 

  

 

at nodal point i otherwise

 

78

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

As before, , , and are the element shape functions of element ( ). Also, global shape functions are dened in such a way that one global shape function is associated to each nodal point:

79

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

if

in element 1

otherwise if in element 1

 

otherwise if if in element 1 in element 2 (35)

otherwise if in element 2


otherwise if in element 2


otherwise

 

80

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Now one can express the approximation of the function global shape functions:


in terms of the (36)

which can be written in the neat form:


  




(37)

81

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

5.3.2.3

One dimensional higher order elements

Higher order elements can be introduced by properly numbering the nodes of the element. The element shape function is obtained from the Lagranges interpolation formula:
          

  

      

(38)

   

(n is the order of the element)

5.3.3 Choice of the weight function When nding the weak form formulation of the problem at hand (see equation 29, on page 69), an arbitrary weight function is introduced to get equation 29 and that needs to be determined. A suitable choice of this weight function is obtained by the Galerkin method which (see end of

82

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

section 5.2) is an example of the weighted residual method that requires that the integral of the residual ( ) of approximating an exact solution times the weight function in the region of interest be zero (see equation 25, on page 67). Loosely speaking, the Galerkin method is expressed by saying that weight function = trial function

5.4

Putting all together

As we have seen, the basic steps in the nite element formulation we are using involves three step: Find the weak formulation of the problem. For our model problem 26,

83

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

on page 68, we have found:


 

Make an elementwise approximation over the entire domain of the unknown function, such as: (40)
 

(39)

(see equations 32 and 36 on pages 76 and 81 respectively). Choose the weight function according to the Galerkin method: (41)

84

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

So, to continue with the development of equation 39, well consider the following:

. . .

 

is an arbitrary scalar function ( ), the matrix is Since arbitrary. Inserting equation 42 into equation 39, and using the fact that

(42)

85

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

(43)

An Introduction to Computational Fluid Dynamics

is independent of x, we obtain:

 

or

86

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

  

(44)

An Introduction to Computational Fluid Dynamics

since this expression should hold for arbitrary


matrices, one gets


which is the required nite element formulation. This expression could be written in the more compact familiar form:

(45)

87

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

(46)

Lets note that the symmetry of K is a consequence of the Galerkin method. This fact, together with the applicability of the Galerkin method to any differential equation and the realistic prediction obtained by such approach are the primary reasons for its adoption in the FE formulation. Lets write
88 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

(47) (48)

 

(49)

 

(50)

     

 

         

    

. . .

     

 

explicit expression for equations 46-50:

An Introduction to Computational Fluid Dynamics

   

  

. . .

      

 

. . .

 

89

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

 

(51)

 

 

(52)

. . .


 

 

An Introduction to Computational Fluid Dynamics

 

 

 

90

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

. . .

. . .

An Introduction to Computational Fluid Dynamics

where we have made use of the shape function properties (see equations 34e and 35, on pages 78 and 79 respectively): at nodal point i otherwise ; if in element 1

to continue, now one can make use of the boundary condition of our model problem (equation 26, on page 68), from which we obtain: (53a) (53b)

otherwise

 

 

 

 

 

 

91

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

(54)

and

. . .

 

An Introduction to Computational Fluid Dynamics

where we have used the fact that

Last, for

we obtain,

. . .

92

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/




. . .

(55)

Now, denoting the elements of matrix by , equation 46, using equations 51, 54, and 55, can be written in the form:

! 

 

. . .


    

  

 

 

 

  


 




     

. . .

An Introduction to Computational Fluid Dynamics

 

! 

. . .

 




 

. . .

93

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

. . .

(56)

. . .

An Introduction to Computational Fluid Dynamics

5.5

One dimensional illustrative example (using Mathematica)

By using the ideas of the previous section, lets nd the numerical solution of the one dimensional problem: on

  

with: (57a)


 

94

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

subject to bcs 6, page 30, where:




 

 

the exact solution is given by: (57c)

A Mathematica code implementing previous ideas to solve this problem is as follows:

  


 

(57b)




 
 












95

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

(*-------------------------*) (* PREAMBLE *) (* -------*) RegularForm[x_]:= OutputForm[NumberForm[TableForm[x//N], ExponentFunction-> (If[-1<#<1, Null, #]&), NumberFormat->(If[#3=="", SequenceForm[#1, #3], SequenceForm[#1, "E", #3]]&)]] ; (* -------*) Needs["GraphicsLegend"]; (* -------*) FESavingPlot = Directory[]; (* -------*) (* MySave[name_, plot_] := Display[name,plot]; *) MySave[name_, plot_] := Display[StringJoin["!./psfix_3.0 > ",name],plot]; (* -------*) MySavingPlot[name_, plot_] := Module[{guardar, oldDir}, Clear[guardar]; guardar = Input["\t\t\t Hit 1 + ENTER to save, otherthing to continue "]; If[guardar == 1, oldDir = Directory[]; SetDirectory[FESavingPlot]; MySave[name, plot]; SetDirectory[oldDir] ](* close if *)](* close Module *);

96

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

(* -----------*) (* END PREAMBLE *) (* -----------*) (******************************************* Piece wise functions are best defined using Which[] because the derivative operator D[] knows how to deal with Which[] properly. ********************************************) Clear[Xa, Xb, MainNodes, InternalNodes, TotalNodes, X, x, xx, Nlocal, i, j, f, jj, nglobal, Nglobal, Dlocal, Dglobal, Klocal, MatrixLocal, K1, Kglobal]; Xa = 0.0; Xb = 1.0; MainNodes = Input["How many MAIN (global) nodes (elements = Nnodes-1)? "]; InternalNodes = Input["How many INTERNAL nodes (order of the element)? "]; (*-------------------------------------------------------------------Global nodes are designed by X[i]. INTERNAL nodes by xx[i][j], with [i] representing the node and [j] representing the element. An example of 3 GLOBAL nodes [*] (defining 2 elements) with each element having 2 INTERNAL nodes (.) can be represented as: *----.---.---*---.---.---*

97

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Global elements have same length = (Xb - Xa)/(MainNodes - 1) Internal nodes define internal elements of same length = (X[j+1] - X[j])/(InternalNodes + 1) ---------------------------------------------------------------------*) X[1] = Xa; X[i_] := X[i-1] + (Xb - Xa)/(MainNodes - 1); (** *** Here [i] can go from ONE, xx[1][j] = X[j], to (InternalNodes + 2) *** for which xx[InternalNodes + 1][j] = X[j+1] ***) xx[i_][j_] := X[j] + (i-1)*(X[j+1] - X[j])/(InternalNodes + 1); (*-----------------------------------Which[ InternalNodes != 0, xx[i_][j_] := X[j] + (i-1)*(X[j+1] - X[j])/(InternalNodes + 1), True, xx[i_][j_] := X[j] ](* Close Which *); ---------------------------------------*) (* ------------------------------------------*) (*-------------- LOCAL SHAPE function of node j on element i ----------*) (* ------------------------------------------*)

98

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

(** *** Each element will has (InternalNodes + 2) NODES. The local shape *** function for a particular element, [j] for example, can be labeled as *** Nlocal[1][j][x], Nlocal[2][j][x],...,Nlocal[InternalNodes + 2][j][x] ***) Nlocal[i_][j_][x_] := Module[{a,b,k}, a = 1; b = 1; Do[ Which[ k != i, a = a*(x-xx[k][j]); b = b*(xx[i][j]-xx[k][j]) ], {k,1,InternalNodes + 2}]; Expand[a/b]]; (* ------------------------------------------*) (*-------------GLOBAL SHAPE functions ----------*) (* ------------------------------------------*) (*-** ** The way how this is done below is by counting the local nodes ** and defining a "global" label for each node (1, 2, 3, ..., N) ** ---*)

99

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Nglobal[i_][j_][x_] := Which[ (i == 1 && j != 1), (Hold[Which][ x >= Evaluate[X[j-1]] && x < Evaluate[X[j]], Evaluate[Nlocal[InternalNodes + 2][j-1][x]], x >= Evaluate[X[j]] && x <= Evaluate[X[j+1]], Evaluate[Nlocal[i][j][x]], True, 0 ] /. Hold[Which]->Which), True, (Hold[Which][ x >= Evaluate[X[j]] && x <= Evaluate[X[j+1]], Evaluate[Nlocal[i][j][x]], True, 0] /. Hold[Which]->Which) ](*Close Which *); (* *) (* FORMING GLOBAL SHAPE FUNCTIONS USING GLOBAL NUMERATION OF NODES *) (* --------------------------------------------------------------- *) jj=0; Do[ For[i=1, i<=InternalNodes + 2, i = i + 1, If[ (i == (InternalNodes + 2) && j != (MainNodes-1)), (********* NO GLOBAL FUNCTION FOR THIS NODE ******) (* jj = jj -1 *), jj = jj + 1;

100

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

nglobal[jj][x_] := Evaluate[Nglobal[i][j][x]]; ]; (* This takes care of the increase of jj at the main nodes to avoid a double counting of the Global shape functions at such nodes *) ] (*Close For *), {j,1,(MainNodes-1)}](* Close Do *); (* *) (* -------- DERIVATIVE OF LOCAL and GLOBAL shape functions -------*) (* Here it is better to use equal (=) instead of "colon equal" ( := ) *) (* in the definition of derivatives *) (* *) Dlocal[i_][j_][x_] = Hold[D[ Nlocal[i][j][x],x]]; Dglobal[i_][j_][x_] = Hold[D[Nglobal[i][j][x],x]]; (* "Load vector" for element k. i is the internal node *) (* --------------------------------------------------- *) (* USER INPUT *) (* ---------- *) Clear[lambda, Q1, Akfunc, A1, alfa1, beta1, A2, alfa2, beta2]; lambda := -1.0; Q1[x_] := -((lambda2)*Exp[lambda*x])/(Exp[lambda]-1.0);

101

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Akfunc[x_] := 1.0 ; A1 = -1.; alfa1 = -Exp[lambda] ; beta1 = -(Exp[lambda]-1.0)/lambda; A2 = 0. ; alfa2 = alfa1 ; beta2 = - beta1; Clear[TheBcAtNodeXa, TheBcAtNodeXb]; TheBcAtNodeXa = (alfa1/beta1)*Akfunc[Xa]; TheBcAtNodeXb = (alfa2/beta2)*Akfunc[Xb]; (* Boundary conditions *) (* ------------------- *) Clear[fbcXa, fbcXb, ExactT]; fbcXa = -(A1/beta1)*Akfunc[Xa]; fbcXb = (A2/beta2)*Akfunc[Xb]; ExactT[x_] := (Exp[lambda*x]-1.0)/(Exp[lambda]-1.0); f1[i_][k_] := \ Module[{x}, Integrate[Q1[x]*Nlocal[i][k][x],{x,X[k],X[k+1]}]]; (* Local "Load Vector" Element [i] for element k *) (* --------------------------------------------- *) Do[ Do[ Flocal[i][k] = f1[i][k], {i,1,InternalNodes + 2}] ,{k,1,(MainNodes-1)}];

102

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

(* Local Matrix Element [i,j] for element k *) (* ---------------------------------------- *) Which[ InternalNodes != 0, K1[i_][j_][k_] := Module[{x}, Integrate[Dlocal[i][k][x]*(Akfunc[x])*Dlocal[j][k][x], {x,X[k],X[k+1]}]], True, K1[i_][j_][k_] := Module[{x}, Integrate[ ReleaseHold[Dlocal[i][k][x]]*Akfunc[x]*ReleaseHold[Dlocal[j][k][x]], {x,X[k],X[k+1]}]] ]; (****-----------------------------------------------------------------****) (****-----------------------------------------------------------------****) Do[ Do[ Do[ Klocal[i,j][k] = ReleaseHold[K1[i][j][k]]; If[j != i, (* Using the fact the K matrix is symmetric *) Klocal[j,i][k] = ReleaseHold[K1[i][j][k]]

103

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

] ,{j,i,InternalNodes + 2}] ,{i,1,InternalNodes + 2}]; MatrixLocal[k] = Table[ Table[Klocal[i,j][k],{j,1,InternalNodes + 2}], {i,1,InternalNodes + 2}] ,{k,1,(MainNodes-1)}]; (****-----------------------------------------------------------------**** ** ** To find K_global from K_local one needs to find between which global ** nodes a particular element (to which K_local belong to) is located. ** This is necessary because if for example element j is between global ** nodes Nj, Nj+1, ..., Nk the contribution of the local element J to ** global matrix K is as follows: ** ** K[Nj,Nj] = K[Nj,Nj] + KL[1,1] ** K[Nj,Nj+1] = K[Nj,Nj+1] + KL[1,2] ** .... ..... ...... ** K[Nk,Nk] = K[Nk,Nk] + KL[(Nk-Nj)+1,(Nk-Nj)+1] ** ** The drawing belong may be useful to see the this. ** ** Nj Nj+1 Nj+2 .... Nk ** ------------------------------------------------

104

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

** Nj | KL[1,1] KL[1,2] KL[1,3] .... KL[1,(Nk-Nj)+1] ** Nj+1 | KL[2,2] KL[2,2] KL[2,3] .... KL[2,(Nk-Nj)+1] ** . | . . . . ** . | . . . . ** . | . . . . ** Nk | KL[(Nk-Nj)+1,1] .... KL[(Nk-Nj)+1,(Nk-Nj)+1] ** -----------------------------------------------** ** Now, The total number of (global) nodes is: ** ** TotalGlobalNodes = InternalNodes*NumberOfElements + MainNodes ** = InternalNodes*(MainNodes - 1) + MainNodes ** ** It is not hard to see that element j is found between the ** global nodes: ** ** StartOfElement[j_] := InternalNodes*(j-1) + j ; ** EndOfElement[j_] := StartOfElement[j] + InternalNodes + 1 ; ** ****-----------------------------------------------------------------****) Clear[NumberOfElements, TotalGlobalNodes, TotalElementNodes, StartOfElement, EndOfElement, Kglobal, KcontributionOfElement, FloadContributionOfElement, FLoadGlobal, FloadVector,

105

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

GlobalMatrixK, Ftotal, Temperature, eqs, eq, eq1]; NumberOfElements = MainNodes - 1 ; TotalGlobalNodes = InternalNodes*NumberOfElements + MainNodes ; TotalElementNodes = InternalNodes + 2; StartOfElement[j_] := InternalNodes*(j-1) + j ; EndOfElement[j_] := StartOfElement[j] + InternalNodes + 1 ; (* Initializing Kglobal and FLoadGlobal to Zero *) (* -------------------------------------------- *) Do[ Do[Kglobal[i,j] = 0.0 ,{j,1,TotalGlobalNodes}], {i,1,TotalGlobalNodes}]; Do[FLoadGlobal[i] = 0.0 ,{i,1,TotalGlobalNodes}]; (* Contribution of Element k to Global Load Vector Fload *) (* ----------------------------------------------------- *) FloadContributionOfElement[k_] := Module[{l,m,i}, i = 0; Do[(* l Do *) i = i + 1; FLoadGlobal[l] = FLoadGlobal[l] + Flocal[i][k]; ,{l,StartOfElement[k],EndOfElement[k]}]];

106

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

(* Contribution of Element k to Global Matrix K *) (* -------------------------------------------- *) KcontributionOfElement[k_] := Module[{l,m,i,j}, i = 0; Do[(* l Do *) i = i + 1; j = i - 1; Do[(* m Do *) j = j + 1; Kglobal[l,m] = Kglobal[l,m] + Klocal[i,j][k]; If[ m != l, Kglobal[m,l] = Kglobal[l,m]]; ,{m,l,EndOfElement[k]}]; ,{l,StartOfElement[k],EndOfElement[k]}]]; (* Finding Contribution of each Element to Global Matrix K *) (* ------------------------------------------------------- *) Kglobal[1,1] = Kglobal[1,1] - TheBcAtNodeXa; Kglobal[TotalGlobalNodes,TotalGlobalNodes] = Kglobal[TotalGlobalNodes,TotalGlobalNodes] + TheBcAtNodeXb; Do[ KcontributionOfElement[k],{k,1,NumberOfElements}];

107

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Print["Global_K_Matrix = ",MatrixForm[ GlobalMatrixK = Table[ Table[Kglobal[i,j],{j,1,TotalGlobalNodes}], {i,1,TotalGlobalNodes}]]]; (* Finding Contribution of each Element to Global Fload *) (* ---------------------------------------------------- *) Do[ FloadContributionOfElement[k],{k,1,NumberOfElements}]; Print["F_Load = ",MatrixForm[ FloadVector = Table[ FLoadGlobal[j],{j,1,TotalGlobalNodes}]]]; (* Boundary conditions *) (* ------------------- *) Print["F_boundary = ",MatrixForm[ Fboundary = Flatten[{fbcXa,Table[0,{i,2,TotalGlobalNodes-1}],fbcXb}]]] ; (* --------------- *) Print["F_total = F_boundary + F_Load = ",MatrixForm[ Ftotal = Fboundary + FloadVector ]]; (* --------------- *) Temperature = Table[T[i],{i,1,TotalGlobalNodes}];

108

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

(* --------------- *) eq1 = GlobalMatrixK.Temperature - Ftotal ; (* --------------- *) Do[ eq[i] = eq1[[i]] == 0, {i,1,TotalGlobalNodes}]; (* --------------- *) Clear[Tnodes]; Print[" "]; Print[" Tnodes = ", Tnodes = Flatten[ Solve[Table[eq[i] ,{i,1,TotalGlobalNodes}], Table[T[i],{i,1,TotalGlobalNodes}]] ]]; (* --------------- *) Print[" "]; (* --------------- *) Clear[FEsolofT]; FEsolofT[x_] := Sum[nglobal[i][x]*T[i],{i,1,TotalGlobalNodes}] /. Tnodes ; Print[" FEsolofT[x] = ", FEsolofT[x] ]; Print[" ExactT[x] = ", ExactT[x] ]; (* --------------- *) Clear[t1,t2,TITLE];

109

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

t1=ToString[StringForm[ "Finite Element Solution using 1 Main",MainNodes]]; t2=ToString[StringForm[ " Nodes and 1 Internal Nodes ", InternalNodes]]; TITLE = StringJoin[t1," \n ",t2]; FEplot = Show[Plot[{Evaluate[FEsolofT[x]],Evaluate[ExactT[x]]},{x,Xa,Xb}, PlotRange -> All, AxesLabel -> {"x","Temperature"}, (* PlotLabel -> TITLE, *) PlotStyle -> {{RGBColor[0, 0, 1], AbsoluteThickness[2]}, {RGBColor[1, 0, 0], Dashing[{.02}], AbsoluteThickness[2]} }, PlotLegend -> {"Finite Element Solution", "Exact Solution"}, LegendPosition -> {-1, -1.2}, LegendSize -> {1.7, .5}, DisplayFunction -> Identity ](* close Plot *), Frame -> True, FrameTicks -> False (* no tick marks around the frame *), FrameLabel -> {"", "", TITLE,""}, DisplayFunction -> $DisplayFunction, AxesOrigin -> {0,0}];

110

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

(* SAVING THE PLOT *) (* --------------- *) Print["\t \t *** Saving Finite Element solution Plot *** "]; MySavingPlot["FEplot.ps", FEplot]; InputString["\t \t \t Hit Return to continue "]; (* --------------- *) CLear[xval, ExactTAtval, FEsolAtval, RelativeError, Ttitles, values, table ]; xval = Table[Random[Real,{Xa,Xb}],{50}]; ExactTAtval = Map[ExactT,xval]; FEsolAtval = Map[FEsolofT,xval]; RelativeError = Abs[(ExactTAtval-FEsolAtval)/ExactTAtval]; (*-------------------------*) pairstoBeplot = MapThread[List,{xval,RelativeError}]; Clear[t1,t2,TITLE]; t1=ToString[StringForm["Relative Error using 1 Main",MainNodes]]; t2=ToString[StringForm["Nodes and 1 Internal Nodes ", InternalNodes]]; TITLE = StringJoin[t1," \n ",t2]; ErrorPlot = Show[ ListPlot[pairstoBeplot, Prolog -> AbsolutePointSize[4], AxesOrigin -> {0,0}, DisplayFunction -> Identity ](* Close ListPlot *), 111 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Frame -> True, FrameLabel -> {"x", "Abs[(ExatT-FEsolofT)/ExactT]", TITLE,""}, DisplayFunction -> $DisplayFunction, AxesOrigin -> {0,0}]; (* SAVING THE PLOT *) (* --------------- *) Print["\t \t *** Saving Relative Error Plot *** "]; MySavingPlot["ErrorPlot.ps",ErrorPlot]; InputString["\t \t \t Hit Return to continue "]; (* --------------- *) (* Take the comments to print the values in a table *) (* ---------Ttitles = { " x ", " FEsolofT ", " ExactT ", "Rel. Error" }; values = { xval, FEsolAtval, ExactTAtval, RelativeError}; Print[table = RegularForm[TableForm[ MapThread[List, Table[{Part[Ttitles,i],Part[values,i]},{i,1,4}]] ]]]; ---------- *)

At CeCalCULA (http://www.cecalc.ula.ve/) we have available ABAQUS, an engineering simulation software to perform FE computations of
112 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

problems ranging from relatively simple linear analyses to the most challenging nonlinear simulations. The community currently using this software are faculty member of the Universidad de Los Andes and other researchers throughout the country.

113

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Some aspects of grid generation


The numerical computation of elds involving complex geometries implies computational boundaries that do not coincide with coordinate lines in physical space. Here are a few examples:

114

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

i-1,j
An Introduction to Computational Fluid Dynamics

i,j

115

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

116

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

117

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Dealing with such difculty is done by using a mapping or transformation from physical ( , , ) space to a generalized curvilinear coordinates ( , , ) space such that a distorted region in physical space is mapped into a rectangular region in the generalized coordinate space (see gure 3, on page 26). The existence of a unique single valued relationship among the coordinates is dened by the Jacobian ( ) of the transformation. That is,

The transformation is unique if


118

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

, and its inverse can be uniquely

(58)

An Introduction to Computational Fluid Dynamics

obtained: ; ;
  

The elements of

and

(59)

are related by:

119

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

; ;

; ;

This equations are useful to evaluate numerically the Jacobian ( ) whenever is necessary based on the generalized coordinate grid. On the other hand, derivatives in the physical ( , , ) coordinates are related to derivatives in the generalized ( , , ) curvilinear coordinates by a relation of the form:

(60)

120

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

(61)

Complications introduced by the use of generalized coordinates include to nd the form of the governing equations in the generalized coordinates. For example, Laplaces equation in two dimensional ( , ) physical coordinates has the form:

(62)

In two dimensional ( , ) generalized coordinates this equation takes


   

121

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

the form: (63)


where (64a) (64b) (64c)




In case the ( , ) generalized coordinates are orthogonal, which means


  

  

122

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

and

, then equation 63 becomes: (65)

 

if in addition the transformation is conformal, then the and ) applies given Cauchy-Riemann conditions ( and equation 65 becomes:

 

which is an equation structurally no more complex than the one in ( , ) physical coordinates, equation 62. When an analytical mapping between the ( , , ) physical coordinates and the ( , , ) curvilinear coordinates is not available, the transformation parameters , , , and so on, must be computed

(66)

    

123

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

numerically, usually using the same discretization scheme as the one used to discretize the derivative terms in the governing equations. That is, if the latter are discretized using a nite difference scheme, the former are discretized using the same corresponding formulae. For instance, if working with a centered nite discretization scheme, in 2D one could have:

124

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics


recall that the governing equations are discretized in the ( , ) domain,

(67)
  

125

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

which usually corresponds to a uniform rectangular grid. The inverse parameters ( , , etc.) are then obtained by means of relations 60, on page 119.

6.1

On uid ow equations expressed in generalized coordinates

Assuming the grid in the physical domain does not change with time, the Continuity Equation Fletcher, vol. 2, pages 64-69 gives general formulae for transforming rst and second two dimensional general partial differential equations to generalized ( , ) coordinates. He then goes on and applies the formulae to uid ow equations, obtaining for the continuity

126

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

equation in generalized coordinates: (68a) (68b)



 

while for the x-momentum equation of incompressible viscous ow, expressed in nondimensional form, he obtains: (69a) (69b)
 

  

127

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

 

in and in the last set of equations Lets mention that terms like could introduce an error if signicant grid stretching is permitted, leading to a reduction in the accuracy of the computed solution. In the case of high ow problems, however, this terms does not usually have a large effect. The implementation of generalized nite difference schemes is not more difcult than the implementation of the nite volume method and produces solutions of comparable accuracy.

128

(69c)

(69d)

 

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Closure

Let me rst thanks very much to any one of you for being a participant of this Workshop. I do not expect to have covered the expectations you may have had about the impressive and growing subject of Computational Fluid Dynamics in this short course. However, it is my hope to have keep, or even better increase, your motivation on this wonderful eld, so you can go ahead and start a carefully reading of many of good sources on CFD, a few of them are included in the reference section. In there you will nd precise pointers to the various tools available to assist you with the numerical solution of a wide range of mathematical problems. These tools are widely available on nearly all computer platforms.

129

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

7.1

On-line general references

In addition to the references listed at the end of this document and to the online CFD examples listed on section 2.4.1, I am listing here some online resources that could be helpful in going further in the study of Computational Fluid Dynamics: CFD-ONLINE: http://www.cfdonline.com/ Online CFD Books: http://www.eng.warwick.ac.uk/staff/cts/cfdbook/ http://www.crs4.it/HTML/int book/NumericalMethods/int book.html http://www.rzg.mpg.de/ bds/numerics/cfdlectures.html http://people.nas.nasa.gov/ pulliam/mypapers/vki notes/vki notes.html

130

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

Grid Generation: http://gid.cimne.upc.es/


http://www-users.informatik.rwth-aachen.de/ roberts/meshgeneration.html http://www-dinma.univ.trieste.it/ nirftc/research/easymesh/easymesh.html

http://wwwdinma.univ.trieste.it/ nirftc/research/easymesh/easymesh.html Books with web sites: Wesseling, P. (2000). Principles of Computational Fluid Dynamics, Springer. http://dutita0.twi.tudelft.nl/nw/users/wesseling/cfdbook.html Ferziger, J. H. & Peric, M. (1999). Computational Methods for Fluid Dynamics, Springer. ftp://ftp.springer.de/pub/technik/peric/ Pozrikidis, C. (1997). Introduction to Theoretical and Computational Fluid Dynamics, Oxford. http://stokes.ucsd.edu/pozrikidis/TCFD/
131 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

References
[1] Batchelor, G. K. (1967), An introduction to uid dynamics, Cambridge Univ. Press. [2] Fletcher, C. A. J. (1991), Computational techniques for uid dynamics, 2nd ed., vol. 1 & 2, Springer-Verlag. [3] Ganzha, V. G. & Vorozhtsov, E. V. (1996), Numerical solutions for partial differential equations, CRC Press. [4] Gerald, C. F. & Wheatley , P. O. (1994), Applied numerical analysis, 5th ed., Wesley. [5] Ottosen, N. S. & Peterson, H. (1992), Introduction to the nite element method, Prentice Hall. [6] Press, W. H. et al. (1992), Numerical recipes in fortran, 2nd ed., Cambridge University Press. [7] Reddy, J. N. (1984), An introduction to the nite element method, McGraw-Hill. [8] Sokolnikoff, I. S. (1964), Tensor analysis: Theory and applications to geometry and mechanics of continua, Wiley.
132 Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

An Introduction to Computational Fluid Dynamics

[9] Zienkiewicz, O. C. & Taylor, R. L. (1989), The nite element method, 4th ed., vol. 1 & 2, McGraw-Hill.

133

Sergio Rojas: http://www.cecalc.ula.ve/ sergio/

You might also like