|
[Sponsors] |
April 19, 2012, 04:12 |
Own Codes
|
#1 |
New Member
Balaji Viswanath
Join Date: Apr 2012
Posts: 1
Rep Power: 0 |
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 |
|
April 19, 2012, 09:45 |
|
#2 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 19 |
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 ? |
|
April 19, 2012, 12:02 |
|
#3 |
New Member
Mazhar Iqbal
Join Date: Mar 2009
Posts: 10
Rep Power: 17 |
I think FORTRAN is the best environment to carry out your own programming. You can visulize your results in any software like TecPlot
|
|
April 20, 2012, 05:23 |
|
#4 |
Senior Member
Join Date: Aug 2011
Posts: 272
Rep Power: 15 |
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. |
|
April 20, 2012, 05:35 |
|
#5 | |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34 |
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 |
||
April 20, 2012, 06:22 |
|
#6 |
Senior Member
Join Date: Aug 2011
Posts: 272
Rep Power: 15 |
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... |
|
April 20, 2012, 08:01 |
|
#7 | |||
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34 |
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:
This probably is bottom line. I feel comfortable with C++ so I use. If someone wants Fortran, I occasionally do program in fortran. But not much. |
||||
April 20, 2012, 09:11 |
|
#8 | |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 19 |
Quote:
|
||
April 20, 2012, 11:40 |
|
#9 |
Senior Member
Join Date: Aug 2011
Posts: 272
Rep Power: 15 |
Thanx DoHander !! it's good to know such stuff about matmul....
|
|
April 20, 2012, 13:34 |
|
#10 | |
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20 |
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! |
||
April 20, 2012, 18:32 |
|
#11 | ||
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 19 |
Quote:
Quote:
|
|||
April 20, 2012, 19:01 |
|
#12 | |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34 |
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. |
||
April 20, 2012, 20:09 |
|
#13 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 19 |
||
April 21, 2012, 03:56 |
|
#14 | ||
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20 |
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:
|
|||
April 21, 2012, 03:58 |
|
#15 | |
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20 |
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. |
||
April 21, 2012, 10:47 |
|
#16 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 19 |
Have a look at some examples of using Python+matplotlib here:
http://matplotlib.sourceforge.net/us...reenshots.html |
|
April 21, 2012, 10:50 |
|
#17 | |
Senior Member
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20 |
Quote:
Thanks a lot, cool stuff! will try to install it! |
||
April 21, 2012, 10:57 |
|
#18 |
Senior Member
Join Date: Nov 2009
Posts: 411
Rep Power: 19 |
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. Last edited by DoHander; April 21, 2012 at 11:25. |
|
Tags |
own coding |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Comparison of CFD Codes | Kerem | Main CFD Forum | 9 | May 9, 2003 04:29 |
help Navier vs Panel codes!!! | bobby | Main CFD Forum | 3 | April 2, 2002 08:55 |
Self-made codes vs. commercial | John Van Workum | Main CFD Forum | 27 | April 1, 2001 21:23 |
New List of Free CFD Codes | Bert Laney | Main CFD Forum | 5 | September 15, 1999 15:24 |
Anyone used Ansys/Flotran - cf. with other codes? | S. Langsford | Main CFD Forum | 3 | October 19, 1998 20:51 |