|
[Sponsors] |
April 23, 2015, 14:58 |
what language is the best for CFD?
|
#1 |
Member
Serguei
Join Date: Mar 2015
Posts: 33
Rep Power: 11 |
People,
what is your opinion, which the programming language the best for CFD software? What are the pluses and minuses for, let say for the top 3? What about C# vs C++ in that sense? |
|
April 23, 2015, 15:13 |
|
#2 |
Member
robo
Join Date: May 2013
Posts: 47
Rep Power: 12 |
(all just opinion)
If you're doing a big development with any kind of HPC component, C/C++ or Fortran. If I was writing a larger, more general purpose code, those are what I would look to. If I was writing a code for smaller problems on a personal computer, or for early stage prototyping or school or what have you, I would use python with the various scientific packages, simply because I find those utilities so helpful and python's syntax very clear and concise. Lots of people would also use Matlab for this purpose, which is fine if you have some way around the cost. I would generally expect someone I was hiring to be proficient in one from both sets: something for scripting and something for HPC. I have very little experience with C# but I thought it was primarily oriented towards easing development for windows apps, which is not a feature I look for in CFD applications. |
|
April 23, 2015, 18:01 |
|
#3 |
Senior Member
Michael Prinkey
Join Date: Mar 2009
Location: Pittsburgh PA
Posts: 363
Rep Power: 25 |
I agree with the above. I will expand a bit. You will never escape Fortran. But, IMO, if you are not doing CFD on a structured mesh, most of the merits of Fortran go away and all of the ugliness and inflexibility remain.
C is fine, but its limited syntax can lead to tedious coding, and it has its own brand of ugliness too, especially if you go too crazy with macros. Of this, I am certainly guilty. C++ on the other hand is potentially wonderful and potentially ruinous. If you use C++, you have to limit your use of many of its wonderful features. It is easy to build really high-level constructs in C++ that lead to horribly performing code. Abstraction is in direct conflict with the expressiveness required for thread-level and SIMD-level parallelism. It only works if you design your data types, functions, classes etc with that lower-level performance in mind--abstractions should only be driven up from the low-level--vector pipelines, cache friendliness, etc. Otherwise, you are just philosophizing. OpenFOAM has already made about the most elegant C++ abstractions for CFD possible. The SIMD- and thread-level parallelism of OpenFOAM do leave a lot to be desired, so it stands as both a crowning achievement and a cautionary tale. Lastly, Python is a wonderful language and numpy and scipy give you a wonderful workshop to quickly prototype. If you are investigating high-level algorithms, start here. You won't get production speed code from it, but you will quickly glean a thorough understanding of what algorithms work the best. If you are a starting a production-level code development project and you already know precisely the algorithms you plan to use, I'd start low-level prototyping in C++ and continuously benchmark to see how much abstraction and syntatic sugar you can included without losing significant performance--again vectorization and thread-level performance--single CPU performance is essentially immaterial now. I will note that I have had some success with operator overloading and using chunks of solution variables to lay out clean vectorization opportunities for the compiler in C++. |
|
April 23, 2015, 18:53 |
|
#4 |
Senior Member
|
I need to say that, unless you are an OO guru looking for very specific stuff, Fortran 2003/2008 has everything you can desire for CFD, is much less verbose than other OO languages and almost identical to MATLAB. Obviously this is s personal opinion.
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Software Language for Coding CFD | vsookrah | Main CFD Forum | 5 | September 15, 2013 19:34 |
CFX basic language | ndabir | CFX | 5 | August 17, 2011 18:43 |
Additional Command Language -in Workbench! | Elvira_Coot | CFX | 11 | July 14, 2011 01:32 |
programming language for CFD, C, C++, FORTRAN,.... | hadian | Main CFD Forum | 15 | September 9, 2008 22:19 |
ALGOR? Its scripting language? Compare to Fluent? | Chris Bailey | Main CFD Forum | 2 | November 16, 2005 16:58 |