|
[Sponsors] |
October 6, 2003, 09: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, 10: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, 10: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, 10: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, 10: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, 11: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, 12: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, 12: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, 13: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, 13: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, 13: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 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 |
|
July 5, 2012, 22: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, 06: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, 08:21 |
|
#14 | |
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20 |
Quote:
|
||
July 18, 2012, 19:17 |
|
#15 |
Member
Casey
Join Date: Jun 2009
Posts: 98
Rep Power: 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...
|
|
July 20, 2012, 05:24 |
|
#16 |
Member
Ren/Xingyue
Join Date: Jan 2010
Location: Nagoya , Japan
Posts: 44
Rep Power: 16 |
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) |
|
November 29, 2020, 08:09 |
Cprogram using FDM
|
#17 | |
New Member
khaoula
Join Date: Nov 2020
Posts: 6
Rep Power: 5 |
Quote:
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? |
||
November 29, 2020, 08:13 |
3D C code
|
#18 |
New Member
khaoula
Join Date: Nov 2020
Posts: 6
Rep Power: 5 |
[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] |
|
November 29, 2020, 10:25 |
|
#19 | |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,286
Rep Power: 34 |
Quote:
This might be useful: Michael Griebel, Thomas Dornseifer, Tilman Neunhoeffer, Numerical Simulation in Fluid Dynamics, https://people.math.sc.edu/Burkardt/...2d/nast2d.html |
||
November 29, 2020, 12:04 |
|
#20 | |
Senior Member
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8 |
Quote:
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. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Steady Incompressible Navier Stokes | selim | CFX | 0 | October 24, 2007 08: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 07:07 |
Newbie:Viscoelasticity and Navier stokes equation | Rajil Saraswat | Main CFD Forum | 2 | June 9, 2003 08:21 |
help: I am trying to solve Navier Stokes compressible and viscid flow | Jose Choy | Main CFD Forum | 2 | May 18, 2000 06:45 |