CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   FORTRAN vs. C/C++ in CFD Solvers (

Carlos Manglano December 15, 2008 07:20

FORTRAN vs. C/C++ in CFD Solvers
Hi everyone,

My question is for both, academia and industry people. After several years working with in-house CFD codes, all written in FORTRAN, I want to refresh my basics in CFD code writting (learnt at Univ.) and would like to know if I should stay with F90 or should try out C/C++ since this might be the way forward. I am quite sure F90 is still the standard, and hoping for this to be true, but wanted to be sure.

One more question, what about the solutions visualisation and post-processing tools? VB? or C/C++?

Many thanks in advance,


w December 15, 2008 09:35

Re: FORTRAN vs. C/C++ in CFD Solvers
If you are familiar with F90 programming and you are comfortable with that, then there is no reason to switch languages. C gives you no benefit and the abstraction features in C++ have to be used with care in order not to bloat your code and affect your performance. In theory you can write in C++ with zero overhead but in practice it is always a bit slower or even significantly if you massively use object oriented features. Of course, in times of thousands of PEs for a computational jo,b you should also not count operations too much and see the advantages of abstraction like maintainability and extendability. As for the post-processing: For scientific applications i would never use VB for various reasons: a) it is for "business guys" b-y) see a) ;-) z) it is a proprietary language which is not principally a problem... but you fix yourself too much on a specific platform. I would rather use C++ there.

Hadian December 15, 2008 10:54

Re: FORTRAN vs. C/C++ in CFD Solvers
Hi, maybe these topics help. Hadian

VADIM December 15, 2008 18:08

Re: FORTRAN vs. C/C++ in CFD Solvers
for CFD application in which number of developpers is small and volume of code is not so large, Fortran is very reasonble. So do not bother yours.

regarding to post-process, you can use mixed prog. or wrapping to directly post-process your result on the fly.

Andrew December 15, 2008 20:23

Re: FORTRAN vs. C/C++ in CFD Solvers
I've done pretty large projects in each of those languages and still find F90 the most natural for numerical operations. If kept simple (not too much use of "advanced features") I also find it the easiest to optimize. The advantage of C++ is much more apparent for larger, collaborative codes or where abstraction is one of the key goals (for extensibility). F90 lacks true objects, which is torture in many ways, but the array intrinsics and natural expression of numerics more than make up for it in my view. The user defined types also close part of the gap but you must use them carefully so as not to interfere with optimization. C is the cleanest and most elegant of the three languages in my view, but the lack of conformable arrays, array intrinsics, etc. makes me prefer F90 for numerics. Otherwise I'm a strong advocate of C.

Steve December 16, 2008 06:25

Re: FORTRAN vs. C/C++ in CFD Solvers
There is no language called C/C++. Choose one or the other.

Carlos Manglano December 16, 2008 06:55

Re: FORTRAN vs. C/C++ in CFD Solvers
First of all, I would like to thank all of you for your help, I'm impressed of the fast response my question has found in this forum.

Second of all, Steve, please!!! C/C++ = C or C++ same thing. 4 people understood it before you answered, and you only said that? Anyway, thank you for keeping a sharp eye for little mistakes some people make sometimes which create great deal of confusion.

I'll keep using this forum :) Merry Christmas from Spain!!!


Jonas Holdeman December 16, 2008 12:14

Re: FORTRAN vs. C/C++ in CFD Solvers
You mentioned VB. I read somewhere some time ago that VB is on the way out, and Microsoft is discontinuing support for it, hyping its C sharp language. I haven't done anything in the past couple of years in Java, but I was impressed by some of its capabilities.

w December 16, 2008 12:56

Re: FORTRAN vs. C/C++ in CFD Solvers
Well, actually this is what most people do... write C with a bit of plusplus. You can call that C/C++ if you want, or you just face the challenge to read properly and see what Carlos means when he writes C/C++. But what you do is neither productive not clarifying in any sense.

All times are GMT -4. The time now is 13:30.