CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Progressing to write my own simple code (https://www.cfd-online.com/Forums/main/69193-progressing-write-my-own-simple-code.html)

 Jonny6001 October 14, 2009 16:58

Progressing to write my own simple code

Hello, I posted on here recently about wanting to write my own cfd code, a very simple one initially then see how it goes from there.

I didnt really know anything about Navier-Stokes equations nor much about continuity and other such equations.I have been looking at the equations and how they are governed. Slowly it is coming together, I have also been looking at how the equations relate to a grid through discretization of the problem and what is solved.

I am trying to take in a huge ammount of information relating to completely different topics in a short time so i find it quite easy to get mixed up. At the moment i'm just picking up little bits everynow and then and slowly they are coming together to what will hopefully be something useful.

I am going to start thinking about writing a very simple code in MATLAB to solve the simplest of problems, but I will also need to learn MATLAB.

Also, how is the easiest way of splitting the domain up in to a grid without the use of ANSA, Gambit or equivalent?

Im sorry if it seems very basic but I dont have anyone to teach me about anything so I have to try and pick it up myself.

This is not my field of expertize at present but I really hope to work in CFD when I am older. Perhaps do a PhD on the subject.

Thanks a lot for any help, very much appreciated.

 NewtonKF October 14, 2009 18:16

Hi Jonny... You see, I built my own code from scratch for my masters, with the help of the Versteg and Malalasekera's book... It is very easy for beginners, presenting all the discretization factors for the finite volume method... Other good book is from Fertziger... In these and many other books, they present how to discretize your geometry in single cells, allowing you to build a code without the need for a mesh generator... Also, you will need some program to visualize the scalar and vector fields. I suggest to you to start directly with a programing language such as C++ or fortran... it will save you some time later when using really big meshes with really complex models... A good initial problem is the Lid Driven Cavity... There are lots of papers about this problem, and when analyzing laminar flows, there are some analytical results....

Good luck...

 Jonny6001 October 14, 2009 18:38

Are you refering to this book?

http://www.amazon.co.uk/Introduction...5559533&sr=1-1

I have the book but loaned it to a friend a while ago, will have to get it back asap then.

How do I go about starting to write Fortran code? I have had a look previously but I'm not too sure how it would work. Would I write my code using a text editor such as Notepad then compile it? Or it there another way to do it?

I am currently running Windows XP, Linux seems to be the OS of choice for Fortran. I might switch over to Linux at a later stage but I dont think its necessary for the simple cases I hope to solve initially. What do people think?

I have another more powerful machine that I use for complex design work but switching this to Linux would mean software such as UGS and CATIA wouldn't run.

Regards

 NewtonKF October 14, 2009 18:49

Yes, this is the book I've used... About the language, I use C++ not fortran... you see, for C++, in Windows XP, there are lots of environments like Visual Studio, Dev-C++, etc... I think there is a free version of Visual Studio from Microsoft... And yes, you can use initially your Machine with Windows, but for large projects, I suggest the linux OS... it works better when you need lots of memory...

Good luck...

 Jonny6001 October 16, 2009 17:25

Thanks for taking the time to reply.