CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Coding 2d incompressible Navier Stokes (http://www.cfd-online.com/Forums/main/6663-coding-2d-incompressible-navier-stokes.html)

 Simon October 6, 2003 08:56

Coding 2d incompressible Navier Stokes

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.

Re: Coding 2d incompressible Navier Stokes

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.

 Simon October 6, 2003 09:15

Re: Coding 2d incompressible Navier Stokes

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.

Re: Coding 2d incompressible Navier Stokes

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.

 Simon October 6, 2003 09:42

Re: Coding 2d incompressible Navier Stokes

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.

 Jim Park October 6, 2003 10:13

Re: Coding 2d incompressible Navier Stokes

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!

 anindya October 6, 2003 11:06

Re: Coding 2d incompressible Navier Stokes

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

 Simon October 6, 2003 11:11

Re: Coding 2d incompressible Navier Stokes

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

Thanks, Simon.

 Praveen October 6, 2003 12:09

Re: Coding 2d incompressible Navier Stokes

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

 cfd dude October 6, 2003 12:12

Re: Coding 2d incompressible Navier Stokes

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

 ryoga October 6, 2003 12:35

Re: Coding 2d incompressible Navier Stokes

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 non-commercial 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

coding navier stokes equation

i am looking for discretisation and implementation method for navier stokes equation if any one has some idea ..
pls answer to this post ..

 H.Rahnama July 6, 2012 05:04

Having problem to creat MPEG!!!

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.

"

 cfdnewbie July 6, 2012 07:21

Quote:
 Originally Posted by H.Rahnama (Post 370059) 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. "

 meangreen July 18, 2012 18:17

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 N-S 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...

Quote:
 Originally Posted by adi.k (Post 370014) i am looking for discretisation and implementation method for navier stokes equation if any one has some idea .. pls answer to this post ..

 hilllike July 20, 2012 04:24

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)

 All times are GMT -4. The time now is 23:50.