CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

C++ or Fortran

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   December 2, 2003, 09:20
Default C++ or Fortran
  #1
berke cagil
Guest
 
Posts: n/a
I need an advise about programing languages. We want to develop a code that has h and p adaptivity capabilities for multiphase flows. I see that most of the people uses C++ programing language. I have been using F90. It seems possible to write such a code by using F90(It is possible to construct stuctures and pointers in F90). Is it cpu time that makes people to use C++ or is there any other reason. Thank you in advance.

Berke
  Reply With Quote

Old   December 2, 2003, 09:24
Default Re: C++ or Fortran
  #2
RAG
Guest
 
Posts: n/a
Sir can u give me any CFD project.I'm in net now
  Reply With Quote

Old   December 2, 2003, 09:50
Default Re: C++ or Fortran
  #3
S. S. Mudathir
Guest
 
Posts: n/a
Hi all, Last year there was a long discussion threat concerning programming languages. It is really useful; I suggest you have a look there.
  Reply With Quote

Old   December 2, 2003, 09:59
Default Re: C++ or Fortran
  #4
RAG
Guest
 
Posts: n/a
sir may i kow about u.Plz read previous mail
  Reply With Quote

Old   December 2, 2003, 10:59
Default Re: C++ or Fortran
  #5
cfd dude
Guest
 
Posts: n/a
If you ask 20 readers of this forum you'll get 20 different opinions on which language is "best".

Your time is best spent writing in the language with which you and your colleagues are most familiar.
  Reply With Quote

Old   December 3, 2003, 06:01
Default Re: C++ or Fortran
  #6
imasimas@hotmail.com
Guest
 
Posts: n/a
I am just an engineer struggling to learn more about this tough decipline called CFD. About the project I suggest you seek one of the automotive manufacturers at INDIA, as far as I know they do experiments for the new designs of the cars, you can take one profile of the aerodynamic bodies they have, run a CFD analysis using one of your software and run a comparison with the actual readings from their experiments.
  Reply With Quote

Old   December 3, 2003, 06:16
Default Re: C++ or Fortran
  #7
S. S. Mudathir
Guest
 
Posts: n/a
I am just an engineer struggling to learn more about this tough decipline called CFD. About the project I suggest you seek one of the automotive manufacturers at INDIA, as far as I know they do experiments for the new designs of the cars, you can take one profile of the aerodynamic bodies they have, run a CFD analysis using one of your software and run a comparison with the actual readings from their experiments.
  Reply With Quote

Old   December 3, 2003, 08:29
Default Re: C++ or Fortran
  #8
versi
Guest
 
Posts: n/a
The data strcture of h-adaptation is well suited for C++.
  Reply With Quote

Old   December 3, 2003, 11:33
Default Re: C++ or Fortran
  #9
zz
Guest
 
Posts: n/a
That's bad that in C all arrays must begin with zero index, it is much uncomfortably. In fortran array can begin with any integer (positive, negative or zero).
  Reply With Quote

Old   December 3, 2003, 21:47
Default Re: C++ or Fortran
  #10
Goicox
Guest
 
Posts: n/a
Well, both lenguages are very good.

Fortran 90, is easier to use than C++. However C++ is more powerful and flexible.

If you are planning to develop a CFD code, I feel that Fortran 90 is good enough. Fortran supports pointers and dynamic memory allocation. For both languages, you should study first data structures and algorithms for develop a really GOOD CFD code.
  Reply With Quote

Old   December 4, 2003, 05:39
Default Re: C++ or Fortran
  #11
Steve
Guest
 
Posts: n/a
Any half-decent C or C++ programmer can emulate arrays that can use negative indices.
  Reply With Quote

Old   December 4, 2003, 07:49
Default Re: C++ or Fortran
  #12
Des Aubery
Guest
 
Posts: n/a
I also understand that Fortran lends itself to being parallelised rather well... an advantage for many applications...

Regards,

Des Aubery... (adTherm Technology - www.adtherm.com - info@adtherm.com)
  Reply With Quote

Old   December 4, 2003, 07:49
Default Re: C++ or Fortran
  #13
Jonno
Guest
 
Posts: n/a
I agree with Steve

There is to my knowledge nothing that Fortran can do that C++ can't. C++ is the superior of the two languages while Fortran is on the path of extinction. I cannot believe that their is still serious development using Fortran outside of the CFD community.

Get with the future...get with progress...go with C++. Don't waste your time with the past.

In ten years time, i'll predict that most commercial CFD codes will have made the shift from Fortran to CFD so there is no use in wasting time learning Fortran.

  Reply With Quote

Old   December 4, 2003, 10:50
Default Re: C++ or Fortran
  #14
Tom
Guest
 
Posts: n/a
Actually, as far as numerical analysis is concerned, FORTRAN is the superior language. After all this is what it is designed for. C/C++ are better than FORTRAN for other problems (i.e. writing windows type applications).
  Reply With Quote

Old   December 4, 2003, 17:24
Default Re: C++ or Fortran
  #15
Jim Park
Guest
 
Posts: n/a
Some of the comments above have twisted the original questions, which were:

"We want to develop a code that has h and p adaptivity capabilities for multiphase flows. It seems possible to write such a code (that has h and p adaptivity capabilities for multiphase flows by using F90(It is possible to construct stuctures and pointers in F90)."

The questioner already knows F90 - so he's not asking which he should learn. He's essentially asking if it's worth the extra trouble to learn another language!

At this point, to him, the question is - can I get back the time it costs to learn a new language for a job I can do in a language I already know? In other words, should I spend my time as a student of fluids or as a student of programming? Of course, the answer depends the future benefit (if any) to the questioner of knowing C++.

"Is it cpu time that makes people to use C++ or is there any other reason?" - I have no personal experience, but have seen benchmarks that show C++ a slow second to F90 for numerical work. Some careful searching with Google should resolve that question.
  Reply With Quote

Old   December 4, 2003, 23:47
Default Re: C++ or Fortran
  #16
Goicox
Guest
 
Posts: n/a
Well, Jonno, you are probably a C/C++ fanatic, however, let me tell you that in the CFD world what is needed, among other things, is a really FAST CFD code. C++ is a powerful language, but it was designed and re - designed to fit general needs, this is, to fit needs for people outside of the CFD world.

For example C++, includes pointer, dynamic memory allocation, inline functions, etc, etc. But lacks one of the most important thing in CFD "a strong flotating point support".

In the other hand Fortran, has a lot of advantages that fit really good in the CFD world. I believe you probably had used an old version of it such as, Fortran 77, which is not very flexible, however, its running times outperforms most of new compilers such as: C, C++, Java of course, and Fortran 90.

Some of the mayor limitations of Fortran 77 have been eliminated in F90, and new options were included. Making of it more flexible for complex aplications, like the one posted "Berke Cagil". I suggest for any person who believes that Fortran is a bad language, to please review the new improvements and the simplicity behind the fortran standard and if you do not agree with this please explain, WHY the Fortran standard has change so little in time ?.

By the way, you are probably rigth when you said that "In ten years time, i'll predict that most commercial CFD codes will have made the shift from Fortran to CFD so there is no use in wasting time learning Fortran." However, I believe that the core of these applications will be written in FORTRAN not in C/C++ or any other modern language such as Java. This is not a silly statement it is happening now a days.

On last word, and this is a question, if C++ is a good language why Java is now taking its place ?. Let me tell you that programers like Java more than C++ !!

Regards, Goicox
  Reply With Quote

Old   December 5, 2003, 02:47
Default Re: C++ or Fortran
  #17
Jonno
Guest
 
Posts: n/a
Very valid points Goicox!

Java is an purely object oriented platform and in my opinion not as suitable for number crunching than a mix between OOP and structured programming.

Java is trying to function purely on objects, which simplifies the structure of complex codes but at a cost!

The great thing about Java is its portability to different computational platforms, GUI wise.

  Reply With Quote

Old   December 5, 2003, 13:09
Default Re: C++ or Fortran
  #18
E. David Huckaby
Guest
 
Posts: n/a
With the appropriate library/optimizations C++ can become competitive with Fortran in terms of computational speed.

See for example: http://www.oonumerics.org/blitz/benchmarks/

These are a few years old, but I suspect that improvements to compilers should have closed the gap between using C++ arrays and f77 as well as the gap between f90 and f77.

Dave

  Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fortran Compiler-CFX12.1 Araz CFX 12 November 2, 2014 13:46
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++? Zi-Wei Chiou Main CFD Forum 35 September 26, 2001 09:34


All times are GMT -4. The time now is 23:44.