CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Coding 2d incompressible Navier Stokes

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 6, 2003, 08:56
Default Coding 2d incompressible Navier Stokes
  #1
Simon
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.
  Reply With Quote

Old   October 6, 2003, 09:08
Default Re: Coding 2d incompressible Navier Stokes
  #2
A.M.Memarzadegan
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.

  Reply With Quote

Old   October 6, 2003, 09:15
Default Re: Coding 2d incompressible Navier Stokes
  #3
Simon
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.
  Reply With Quote

Old   October 6, 2003, 09:35
Default Re: Coding 2d incompressible Navier Stokes
  #4
A.M.Memarzadegan
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.
  Reply With Quote

Old   October 6, 2003, 09:42
Default Re: Coding 2d incompressible Navier Stokes
  #5
Simon
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.
  Reply With Quote

Old   October 6, 2003, 10:13
Default Re: Coding 2d incompressible Navier Stokes
  #6
Jim Park
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!
  Reply With Quote

Old   October 6, 2003, 11:06
Default Re: Coding 2d incompressible Navier Stokes
  #7
anindya
Guest
 
Posts: n/a
Look at the book by Peric. It has a website with fortran codes in 1,2 and 3d.
  Reply With Quote

Old   October 6, 2003, 11:11
Default Re: Coding 2d incompressible Navier Stokes
  #8
Simon
Guest
 
Posts: n/a
Could you give me the book title please ?, as I'm not sure which book you mean.

Thanks, Simon.
  Reply With Quote

Old   October 6, 2003, 12:09
Default Re: Coding 2d incompressible Navier Stokes
  #9
Praveen
Guest
 
Posts: n/a
Here is the link to the source codes ftp://ftp.springer.de/pub/technik/peric/
  Reply With Quote

Old   October 6, 2003, 12:12
Default Re: Coding 2d incompressible Navier Stokes
  #10
cfd dude
Guest
 
Posts: n/a
I sense Pandora's box being opened yet again, Jim ....

  Reply With Quote

Old   October 6, 2003, 12:35
Default Re: Coding 2d incompressible Navier Stokes
  #11
ryoga
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 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
  Reply With Quote

Old   July 5, 2012, 21:07
Default coding navier stokes equation
  #12
New Member
 
aditya
Join Date: Jul 2012
Posts: 1
Rep Power: 0
adi.k is on a distinguished road
i am looking for discretisation and implementation method for navier stokes equation if any one has some idea ..
pls answer to this post ..
adi.k is offline   Reply With Quote

Old   July 6, 2012, 05:04
Unhappy Having problem to creat MPEG!!!
  #13
New Member
 
Join Date: Jul 2012
Posts: 2
Rep Power: 0
H.Rahnama is on a distinguished road
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.


"
H.Rahnama is offline   Reply With Quote

Old   July 6, 2012, 07:21
Default
  #14
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
cfdnewbie is on a distinguished road
Quote:
Originally Posted by H.Rahnama View Post
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.


"
Then post your problem in the correct thread and forum, please, ffs!
cfdnewbie is offline   Reply With Quote

Old   July 18, 2012, 18:17
Default
  #15
Member
 
Casey
Join Date: Jun 2009
Posts: 98
Rep Power: 16
meangreen is on a distinguished road
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 View Post
i am looking for discretisation and implementation method for navier stokes equation if any one has some idea ..
pls answer to this post ..
meangreen is offline   Reply With Quote

Old   July 20, 2012, 04:24
Default
  #16
Member
 
Ren/Xingyue
Join Date: Jan 2010
Location: Nagoya , Japan
Posts: 44
Rep Power: 16
hilllike is on a distinguished road
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)
khaoula louali likes this.
hilllike is offline   Reply With Quote

Old   November 29, 2020, 07:09
Default Cprogram using FDM
  #17
New Member
 
khaoula
Join Date: Nov 2020
Posts: 6
Rep Power: 5
khaoula louali is on a distinguished road
Quote:
Originally Posted by Simon
;26293
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.

Hello, in my project i need to program a C code ( 3D code) using FDM.
Can anyone recommend suitable reading material to help me with this, in particular relating to programming the numerics?
khaoula louali is offline   Reply With Quote

Old   November 29, 2020, 07:13
Question 3D C code
  #18
New Member
 
khaoula
Join Date: Nov 2020
Posts: 6
Rep Power: 5
khaoula louali is on a distinguished road
[QUOTE=khaoula louali;789256
]Hello, in my project i need to program a C code ( 3D code) using FDM.
Can anyone recommend suitable reading material to help me with this, in particular relating to programming the numerics?[ plzzzzzzzzzzzzzzzzzz
QUOTE]
khaoula louali is offline   Reply With Quote

Old   November 29, 2020, 09:25
Default
  #19
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,273
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by khaoula louali View Post
Hello, in my project i need to program a C code ( 3D code) using FDM.
Can anyone recommend suitable reading material to help me with this, in particular relating to programming the numerics?



This might be useful:


Michael Griebel, Thomas Dornseifer, Tilman Neunhoeffer,
Numerical Simulation in Fluid Dynamics,


https://people.math.sc.edu/Burkardt/...2d/nast2d.html
arjun is offline   Reply With Quote

Old   November 29, 2020, 11:04
Default
  #20
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
Quote:
Originally Posted by Simon
;26293
I think that maybe a good place to start may be coding something (relatively) simple, like 2d incompressible Navier Stokes.
No it's not.


You wanna stick with 1D until you get a good understanding of atleast the basics of coding CFD solvers. Try out coding 1D advection, 1D diffusion, 1D convection-diffusion equations and stick with coding 1D solvers for a few months.



Only focus on Finite Difference Method (FDM) of discretization. Even when you go for coding 2D solvers, use FDM for your code.



In 2D, you want to solve the Laplace/Poisson equations first and then go for advanced stuff.


Follow Professor Lorena Barbara's course of "12 steps to Navier-Stokes"


https://lorenabarba.com/blog/cfd-pyt...navier-stokes/


In this course, you study every one of the things I mentioned above.


And finally remember : The fastest way to lean coding CFD solvers, is to take a VERY simple Open Source solver and re-implementing it in your favorite language. You can not simply study the code and understand everything. You have to code it from scratch.

This is what you're doing when you learn how to code Professor Barabara's CFD solvers.


All of this will take at least 6 months (if you want to learn everything in detail.)


Then you can progress for what you actually want to code.
khaoula louali likes this.
aerosayan is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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 09: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


All times are GMT -4. The time now is 19:43.