
[Sponsors] 
March 6, 2009, 15:53 
Re: C++ Vs Fortran

#41 
Guest
Posts: n/a

c++ is analogous to "english"
fortran is analogous to the local dielect languange in my hometown in china so, which one to choose for scientific computing??? 

March 6, 2009, 19:57 
Re: C++ Vs Fortran

#42 
Guest
Posts: n/a

These last two comments are absolutely asinine. Who cares if IEEE "discriminates" against us "poor CFD people"? I've got a job to do (as I assume the original poster does) and my selfesteem doesn't hang on what others say about FORTRAN. I use it because I know it better, so I can get my job done faster  which is the most important metric for the original poster.


March 7, 2009, 07:23 
Re: C++ Vs Fortran

#43 
Guest
Posts: n/a

since you have a large project to do, and you have many years experience , fortran is the first choise.
since your code is for the computation, both language will do the same thing. you can find a lot of code written in fortran to do the cfd 

March 21, 2009, 09:57 

#44 
Member
Join Date: Mar 2009
Posts: 62
Rep Power: 10 
Both Fortran and C++ are suitable for developing a large CFD code.
Besides today you can call Fotran from a C++ function or vice versa in a straightforward manner. In the end all it matters is how familiar are you with one of this languages. 

March 24, 2009, 18:02 

#45 
New Member
samaneh
Join Date: Mar 2009
Location: Iran
Posts: 1
Rep Power: 0 
i dont have so experience in CFD ! but my well educated proff perefer Fortran!


March 24, 2009, 21:18 

#46 
Senior Member

I think that some statements about the Fortan are really unfair.
Actually, all the old bad things about the Fortran (which also promoted the bad, and very illogical indeed, programming style) have been, more or less, removed while keeping the language almost the same. It's probably not suited for graphics (not at all) but, all you need in CFD is an input file and, even for the more advanced codes on the programming side (unstructured mesh commercial solvers), it is a simple text file and there is no way in which any different compiled language can be better than the Fortran in simply treating the numerical data as it happens in CFD codes. 

March 24, 2009, 21:55 

#47 
Member
Join Date: Mar 2009
Posts: 62
Rep Power: 10 
Fortran is fine for basic CFD, I did my fair share of coding in Fortran 77 and Fortran 90.
But when you need more complicated data structures like a linked list or advanced string operation facility, C++ with STL is far more easy to use. In Fortran you will need to build from scratch a lot data structures. I'm sure you can develop a CFD code using only good old arrays but when you need to interpret/read an unstructured mesh you will really appreciate a linked list. I know you can implement any "modern" data structures in Fortran 90  95  2003 but I bet nobody is happy when he must implement this. The other face of the coin is that in Fortran you already have implemented a lot of good mathematical routines and in C/C++ aparently not. Well nowdays you have a lot Open Source mathematical subroutines in C/C++ like GSL, FFTW .... From a modern perspective I will always recomand to simply use C++ for new codes and if you already have good, tested, old Fortran routines simply link these with your C++ code. 

March 25, 2009, 05:58 

#48 
New Member
Join Date: Mar 2009
Posts: 27
Rep Power: 10 
I would like to see objectoriented CFD codes and application of rigorous unit testing and version control.


March 27, 2009, 14:09 
Matlab

#49 
New Member
john mckelliget
Join Date: Mar 2009
Posts: 7
Rep Power: 10 
Folks,
I know that interpreted MATLAB is about a thousand times slower than a compiled C or FORTRAN program. How does a compiled MATLAB program stack up, speedwise? 

April 1, 2009, 08:26 

#50  
New Member
Join Date: Mar 2009
Posts: 4
Rep Power: 10 
Quote:
Quote:


April 1, 2009, 14:26 

#51 
Member
Join Date: Mar 2009
Posts: 62
Rep Power: 10 
I've used gfortran (for compiling Fortran code),gcc (for C code and g++(for C++) and I've called Fortran from C/C++ and viceversa without a problem.
You have to be sure that you use compatible compilers (GNU in my case or you can always use the Intel Fortran and C++ compilers for the same job). I never said these is simple, you have to do a lot of checking because Fortran and C "thinks" differently (e.g. array storing order) but in the end it will work if you are determined to do that. If you develop a new code from scratch and you know both C/C++ and Fortran I will advise you to use C++. Matlab  is simply not well suited for serious CFD (it will work well for simple proof of concept 1D applications). If you will have a large code think only at the bunch of m code you will have for each function. Other thing  how much memory uses your Matlab only for running his interpretor (start Matlab and check how much RAM he uses) ? How long will take you to load into Matlab a 50MB file with numbers ? . Paul 

April 1, 2009, 14:28 

#52 
Member
Join Date: Mar 2009
Posts: 62
Rep Power: 10 
And in the end a small question  how much are you willing to pay for a Matlab parallel edition (I suppose you will have to buy a license for each computer node you intend to use)?


April 4, 2009, 04:26 
We checked it befor ! speed of Fortran and C++

#53 
New Member
Asghar
Join Date: Apr 2009
Posts: 16
Rep Power: 10 
There are several major problems with using C, for numerical programming. Mainly, the languages were designed for systems programming, not high precision, efficient number crunching and mathematical calculations.
in our search, we have not found any reason why FORTRAN should not be used for numeric programming. In contrast we have find that in some issues FORTRAN is more powerful than C in scientific and numerical programming specially in computational FORTRAN and C have been compared, and their strengths and weaknesses with respect to scientific programming have been identified, the languages are evaluated on their performance. for example in + &  & * & / fortran is faster in integer power computation fortran is faster A^2 in noninteger power C is faster A^2.33 in if endif control C is faster in do for loop C is faster in reading of data fortran is faster in writing of data C is faster 

June 26, 2009, 07:47 

#54 
New Member
Join Date: Mar 2009
Posts: 27
Rep Power: 10 
See this answer:
Basically C/C++ can be as fast as Fortran as long as you carefully use the restrict keyword when defining pointers to arrays. http://stackoverflow.com/questions/1...thanc/499392 

February 10, 2012, 17:33 
plzz help me.

#55 
New Member
crane
Join Date: Jul 2011
Posts: 7
Rep Power: 8 
Dear all;
I am a super beginner in programming but i am super enthusiastic to know how to write codes.I know fundamental concepts of CFD.I wonder if any one knows of some books or sites which includes writing codes with c++ using CFD concepts.The only experience I had was writing code for lid driven cavity and it hasn't converge.It is like a dream for me write codes different problems!!!!!!!!!I am ready to do whatever it costs! your answers are immensely appreciated in advance best, Doorna 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Fortran CompilerCFX12.1  Araz  CFX  13  March 27, 2017 05:37 
Intrinsic Procedure 'ISNAN' in GNU FORTRAN 77  hawk  Main CFD Forum  1  April 12, 2005 22:13 
visual fortran  Monica  Main CFD Forum  1  August 28, 2004 20:45 
Fortran77 or Fortran 90  Swapnil  CFX  2  November 26, 2002 16:16 
Why Favoring Fortran over C/C++?  ZiWei Chiou  Main CFD Forum  35  September 26, 2001 09:34 