
[Sponsors] 
October 6, 2003, 08:56 
Coding 2d incompressible Navier Stokes

#1 
Guest
Posts: n/a

I've been using commercial CFD codes for several years now, but my interest has got me to a point where I want to truly understand what's going on. I reckon the best way to do this is to try and code it for myself.
I think that maybe a good place to start may be coding something (relatively) simple, like 2d incompressible Navier Stokes. Can anyone recommend suitable reading material (books, papers, online sources) to help me with this, in particular relating to programming the numerics? Also, does anyone have any preference for programming language (should I be looking at FORTRAN, C++ or anything else?). Thank you, Simon. 

October 6, 2003, 09:08 
Re: Coding 2d incompressible Navier Stokes

#2 
Guest
Posts: n/a

I think the quickest way to get known with cfd is to study An Introduction to Computational Fluid Dynamics (The finite volume method) by Versteeg & Malalasekera
because it has categorized subjects in cfd and brought usefull and meaningful examples.i.e 1D example of code and so so I recommend you to study this book and go through with it step by step. 

October 6, 2003, 09:15 
Re: Coding 2d incompressible Navier Stokes

#3 
Guest
Posts: n/a

Thank you, I have the book you mentioned and agree it has some excellent examples of 1 and 2D conduction. Of particular interest to me is the chapter on the use of the SIMPLE algorithm for steady state flows.
Where I am having difficulty is actually implementing this in Fortran, I was wondering whether anyone has any examples of ways to do this, or can direct me to suitable reading material. 

October 6, 2003, 09:35 
Re: Coding 2d incompressible Navier Stokes

#4 
Guest
Posts: n/a

IT IS REALY USEFUL TO SOLVE A 2D HEAT TRANSFER PROBLEM BEFORE GETTING INTO FLOW PROBLEM.ACTUALLY TO WARM UP WITH FORTRAN AND SO
Actually the first code that i implemented was 2D SIMPLE by which i solved cavity square to validate it. I wrote it by Fortran.you know at first it is somehow hard.but it gets easy after a while because you will understand all things you want to manipulate. anyway first try to discritisize the equations and understand from where those equations in book come from.it realy helps . secondly try to divide your program into usefull subroutines to avoid making a big program. follow the flowchart of simple in book you should undrestand all interpolation as well as formula in that section. for applying boundary condition there is a chapter where u can find useful hint. again be sure that at first it seems rather hard but you will find it more intresting when you get result. 

October 6, 2003, 09:42 
Re: Coding 2d incompressible Navier Stokes

#5 
Guest
Posts: n/a

I will do as you suggest, and try a 2d heat transfer problem as given in the book. I can solve this on paper, but I will have to improve my FORTRAN skills before I programme.
I will look for a good book on programming with Fortran and try to find a Fortran compiler. Thank you, Simon. 

October 6, 2003, 10:13 
Re: Coding 2d incompressible Navier Stokes

#6 
Guest
Posts: n/a

This may start a bit of discussion, BUT
I'd recommend using FORTRAN, especially since it appears that you have access to that language already. I don't know enough C (++ or otherwise) to compare. But the snippits of C code that appear here from time to time sure appear to take a lot of keystrokes to say anything! Moreover, C++ hasn't been around for too long, so it is possible that you'll have more luck finding utilities (linear algebra, graphics, etc) in Fortran. Watch this space for differing opinions! 

October 6, 2003, 11:06 
Re: Coding 2d incompressible Navier Stokes

#7 
Guest
Posts: n/a

Look at the book by Peric. It has a website with fortran codes in 1,2 and 3d.


October 6, 2003, 11:11 
Re: Coding 2d incompressible Navier Stokes

#8 
Guest
Posts: n/a

Could you give me the book title please ?, as I'm not sure which book you mean.
Thanks, Simon. 

October 6, 2003, 12:09 
Re: Coding 2d incompressible Navier Stokes

#9 
Guest
Posts: n/a

Here is the link to the source codes ftp://ftp.springer.de/pub/technik/peric/


October 6, 2003, 12:12 
Re: Coding 2d incompressible Navier Stokes

#10 
Guest
Posts: n/a

I sense Pandora's box being opened yet again, Jim ....


October 6, 2003, 12:35 
Re: Coding 2d incompressible Navier Stokes

#11 
Guest
Posts: n/a

Simon,
Since you have already started coding in FORTRAN, I recommend that you continue with it. I do suggest that you try to use FORTRAN 90 (or above) since, in my opinion, it has many features that make it better than FORTRAN 77. The one disadvantage is that unless you are willing to spend a lot of money, it may be difficult to find a FORTRAN 90/95 compiler. Intel does offer a noncommercial version of its ifc compiler free of charge. I would also suggest that if you have the opportunity in the future to try coding in C++. I have coded for many years in FORTRAN, and just recently started coding in C++. Although run times for codes coded in FORTRAN are significantly smaller than C++ counterparts, C++ does offer several advantages. The most important is that the object oriented nature of C++ allows for more code reuse (compared to FORTRAN). Whenever I wanted to try something different with my FORTRAN codes, it usually required a significant amount or recoding or simply developing a new code altogether. However with C++, whenever I wanted to try something new, I was able to reuse a lot of code without having to do a lot of recoding. Ryoga 

July 5, 2012, 21:07 
coding navier stokes equation

#12 
New Member
aditya
Join Date: Jul 2012
Posts: 1
Rep Power: 0 
i am looking for discretisation and implementation method for navier stokes equation if any one has some idea ..
pls answer to this post .. 

July 6, 2012, 05:04 
Having problem to creat MPEG!!!

#13 
New Member
Join Date: Jul 2012
Posts: 2
Rep Power: 0 
Someone help please!
I am getting crazy with this!.................. I can't creat mpeg files with fluent 6.3.26 I get this error : " > "mpeg_encode param1" 'mpeg_encode' is not recognized as an internal or external command, operable program or batch file. Removing frame files ... done. " 

July 6, 2012, 07:21 

#14  
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 11 
Quote:


July 18, 2012, 18:17 

#15 
Member
Casey
Join Date: Jun 2009
Posts: 96
Rep Power: 8 
I think you are starting out too with something too difficult. First try to model the Burger equation, and make sure your able to properly handle the nonlinear term. You will be much more succesful trying to find examples of the berger equation than NS eqn. Once you have modeled the Burger equation, you will be able to easily move to NS. I assume you have modeled the basics of heat transfer with diffusion, the Poisson equation...


July 20, 2012, 04:24 

#16 
Member
Ren/Xingyue
Join Date: Jan 2010
Location: Nagoya , Japan
Posts: 44
Rep Power: 8 
I wrote my first code(3d with free surface) one year ago. It spent me nearly two years and made me try to give up many times. It is very hard for me to find out useful knowledge and sometime get lost in the small topics. CFD is too difficult without a good professor.
Here are my suggestion: Focus on one book; Write the easiest code first (no structure, no free surface, don't need to try some high performance linear solver) 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Steady Incompressible Navier Stokes  selim  CFX  0  October 24, 2007 07:52 
help in coding navier stokes equation  fowzan  Main CFD Forum  2  January 17, 2006 10:20 
Incompressible Navier stokes with source term  mayur  FLUENT  0  August 6, 2004 06:07 
Newbie:Viscoelasticity and Navier stokes equation  Rajil Saraswat  Main CFD Forum  2  June 9, 2003 07:21 
help: I am trying to solve Navier Stokes compressible and viscid flow  Jose Choy  Main CFD Forum  2  May 18, 2000 05:45 