Own Codes
Dear all,
I used with CFD packages . But I am interested in writing own codes to which i am completely new. pls tell me in what language should I write the code (C, C++.etc). How should I run the code (In what software) and get the results. How should I build a mesh.???? thanks in Advance.// balajiviswanath1991@gmail.com |
If you give more details about what you have in mind you will receive pertinent answers.
Try to reformulate your question, for example: 1. What programming languages do you know well ? 2. What is your deadline for implementing your own CFD code ? 3. What CFD code are we talking about here, how complex will be this ? |
I think FORTRAN is the best environment to carry out your own programming. You can visulize your results in any software like TecPlot
|
I totally agree with Mazhar ! These are the best choices to me, especially with fortran90 or fortran2010 if you are keen on object oriented programming.
Tecplot is also a good software but not free unfortunately. |
Quote:
On the other hand, I completely disagree with him. I think there is a reason that most of modern CFD solvers are written in C++. Take for example Fluent, Starccm+, openFOAM etc etc. I am sure the guys who work on them are no fools. If they have decided to go with c++ instead of fortran then there must be reasons to do so. I personally prefer C++ for many reasons. In the end, choose what you like, if you made wrong choice, you are the only one who is going to pay for it. :-D :-D |
First I think that the solver part of Fluent is programmed in fortran like Star-CD for instance.
I do not mean the language used to program the UDF, nor the language used to program the GUI which is surely programmed in C or C++. The use of C++ was recommended in the past because of the object oriented skill of this language. But now if you really need such stuff for your code, fortran can do it since its 2008 version. But anyway we won't restart here the very old debate "what is the best programming language for CFD codes ?" This question already arised in this forum 15 years ago and the debates were very hot between the pros or cons fortran and C++ users. It sounded that some people received death threat !! ;-) So let's stop with it... I think the best answer is "Do use the language in which you feel the more comfortable and in which your skills are the best !" Because the main task you will have to overtake once your code is written, will be debugging. And debugging a code is first very cumbersome and a very hard task especially when you do not master well the language ... In terms of efficiency I believe (it is my personal and humble opinion) that fortran have some powerfull functions particularly well suitable for scientific computation that are not available in other languages. As first example among many the product of two matrices or product of a matrix and vector... |
Quote:
But then Fluent 4 was original fluent. (which probably was fortran , may be because of that you have this impression of it). From 5.5 or so fluent is not that fluent. From this time fluent acquired Rampant and Rampant became the precursor to modern Fluent. This code I think was in c and not in fortran. I am not sure how the latest versions of fluents are. But last I checked their src files are still in c and not in cpp. StarCCM (not starCD) is definitely in C++. Quote:
Quote:
Quote:
|
Quote:
|
Thanx DoHander !! it's good to know such stuff about matmul....
|
Quote:
I'm wondering if that's a result of your compiler optimisation in combination with your available cache size (in terms of prefetching and such?) .... I find it difficult to generalize statements about the efficiency of routines, since it may or may not strongly dependent of the underlying layers of hard- and software. Just a little comment about the choice of language to use: In commercial codes, I'd tend to object oriented languages, C++ is fine, or use C for the math and couple it with python. If you want to write real number crunching codes, take Fortran. On the real big machines, about 80 to 85% of all software is (still) written in Fortran. Pick the language according to your goals. For starters, Matlab is a perfect playground! |
Quote:
Quote:
|
Its all about algorithm.
If you do exactly same thing with both languages then fortran might just edge out c or c++ on speed. But as soon as you chose a language you might end up doing things little bit differently (for achieving the same goal). So saying that Fortran for speed is not so simple and always true. Quote:
I remember during development of a CFD code, we were supposed to do some kind of all to all communications between processors. Now MPI has some functions that do exactly what I wanted to do. But when that MPI's function tested on Tsubame (Tokyo university's supercomputer) , it was very slow and killed the performance of whole code. Finally I wrote an all to all routine that used MPI's simple send recieve functions and that beat the crap out of that inbuilt implementation. The difference in performance was not even funny. It was like inbuilt call took 1 minute and my call took less than 1 second. |
Quote:
|
Quote:
I think a rather general statement we can agree on is this: Procedural languages (C, Fortran) are better suited for speed than object oriented ones - the latter are somewhat easier to maintain, though. Quote:
|
Quote:
Yes, agreed, we use basic level MPI routines (non block send / receive) and nothing else. We found that everything beyond that doesn't scale as it should, at least on our hardware and our implementation. |
Have a look at some examples of using Python+matplotlib here:
http://matplotlib.sourceforge.net/us...reenshots.html |
Quote:
Thanks a lot, cool stuff! will try to install it! |
If you want a complete Python system for scientific work I would recommend to install at least:
Numpy, Scipy, Matplotlib and IPython. Be careful to match your Python version with the above library versions. |
All times are GMT -4. The time now is 11:45. |