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

The computer language for CFD

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 30, 2002, 06:47
Default The computer language for CFD
  #1
Ringo
Guest
 
Posts: n/a
Here I have a little confusing about choosing a good computer language for CFD coding. I heard from some people say that FORTRAN is better (especially Math People), but I was also told that there is no much difference of the resulted code whether you use C or Fortran. In fact, CS person always insists on the later. What do you think? I hope I can get a answer before I start the new coding. Would anyway want to dicuss this?

Thanks in advance ...
  Reply With Quote

Old   August 30, 2002, 09:15
Default Re: The computer language for CFD
  #2
Axel Rohde
Guest
 
Posts: n/a
I have used Visual Basic for the last ten years for writing my CFD code, and I am quite happy with it. The compiler has all sorts of speed optimization options which you can use. When it comes to compiling math operations, it is just as fast (or slow) as any other language these days. If you really need speed, write your solver subroutines in assembly, where you can leave intermediate results on the math coprocessor. I have occasionally linked VB with assembly coded DLL's to get the best of both worlds. Setting up the GUI with VB is easier than in any other language.

If you run Windows, try MS Visual Studio, which includes VB and C++. Then compare for yourself! If you are an academic user, you can get a 90% discount on Visual Studio and only pay $90 for it. I would stay away from Fortran. It is a language of the past, only in use to support the old code from the 70's and for engineers who cannot be retrained.

  Reply With Quote

Old   August 30, 2002, 10:02
Default Re: The computer language for CFD
  #3
pp
Guest
 
Posts: n/a
CFD code with VB??

You are wright GUI with VB is easier then in any other language. But solver in VB, I cant belive it.

Who want to write own subroutines in assambly??

About Fortran: 2(CFX, STAR-CD) of big 3 CFD solvers (CFX, Fluent, STAR-CD) are writen in FORTRAN!!!!!!!!!!!!!!!! No one is writen in VB. Thay didnt think about this.

About porting: Could you port your VB CFD solver on any UNIX machine (SGI, HP, Linux etc.)???

Anyway Ringo, the best choice is to write your CFD code in C or C++ (F90 is also a good choice).

Regards, pp
  Reply With Quote

Old   August 30, 2002, 10:25
Default Re: The computer language for CFD
  #4
greg
Guest
 
Posts: n/a
Fortran is not the language of the past. It is used in a significant portion of the development work that I am involved in or aware of. There is a move to C and C++ by many of the younger engineers and programmers who learned these languages in college. But limiting yourself to one language is, in my opinion, a mistake. If you really want to keep your options open, you should learn both C and Fortran 90, as both of those languages will be used quite a bit for the foreseeable future. That at least is what I see happening in my part of the development arena.
  Reply With Quote

Old   August 30, 2002, 10:39
Default Re: The computer language for CFD
  #5
Jim Park
Guest
 
Posts: n/a
Ringo,

This particular question has come up previously. You might want to search the cfd-online archives for C++.

I think you'll find that there passionate advocates for C/C++, passionate advocates for Fortran, and folks who come down squarely in the middle!

My vote is for Fortran, not because it's superior in general, but because I know it.

Axel's choices (assembly and VB) are probably unique, but these clearly match his skills and his personal economic balance between development time and calculation time over the life of his codes.

Your mileage may vary.
  Reply With Quote

Old   August 30, 2002, 10:47
Default Re: The computer language for CFD
  #6
Axel Rohde
Guest
 
Posts: n/a
"CFD code with VB?? You are right GUI with VB is easier then in any other language. But solver in VB, I cant believe it."

I have written a 3-D unsteady compressible Navier Stokes code in VB, and it runs about as fast (or slow) as any other time marching code written in C.

"Who wants to write own subroutines in assembly??"

I have written assembly routines since the days of the Commodore 64, and I find it quite simple. For me it is just as much effort as it would be to program in C.

"About Fortran: 2(CFX, STAR-CD) of big 3 CFD solvers (CFX, Fluent, STAR-CD) are written in FORTRAN!!!!!!!!!!!!!!!! No one is written in VB. They didn't think about this."

Most people are reluctant to try something new.

"About porting: Could you port your VB CFD solver on any UNIX machine (SGI, HP, Linux etc.)?"

No, I could not. It only runs on Windows (like I said before).
  Reply With Quote

Old   August 30, 2002, 10:58
Default Re: The computer language for CFD
  #7
Axel Rohde
Guest
 
Posts: n/a
"Axel's choices (assembly and VB) are probably unique, but these clearly match his skills and his personal economic balance between development time and calculation time over the life of his codes."

Right on!!! - I certainly would not recommend VB for a big CFD commercial package, because there are other programming issues involved next to number crunching. For example, calling OpenGL routines is something that currently cannot be done in VB. However, you can call almost any Windows API from VB, which is something most C programmers are not aware of.
  Reply With Quote

Old   August 30, 2002, 11:26
Default Re: F90
  #8
Axel Rohde
Guest
 
Posts: n/a
F90 - I think the name speaks for itself!

Anything in the computer world that is more than 10 years old is a DINOSAUR!!! - Sorry folks, but there is just no other way to put it.
  Reply With Quote

Old   August 30, 2002, 11:44
Default Re: F90
  #9
Joern Beilke
Guest
 
Posts: n/a
But you tell us that you are using VB since more than 10 years... So why do you suggest to use such an old language.

  Reply With Quote

Old   August 30, 2002, 12:13
Default Re: The computer language for CFD
  #10
Peter Attar
Guest
 
Posts: n/a
If you know one language use that to code..no matter what it is. Clear well written code which is maintenable(both by the original coder and by the next developer) is better than spaghetti code which can only be deciphered by the original author and even he/she can't figure it out 2 months after he/she wrote it. For the most part good compilers will make any speed issues mostly irrelevant...the only caveat to this is if you only know Matlab,Maple etc...those codes have large overheads which for the most part can't be done without.

If you don't know a language then I would learn either C or Fortran95(which has a couple of difference than than the older Fortran 90). Both are about as equally fast with perhaps a slight edge to Fortran only because the compilers seem to do a better job of optimizing code but on the other had you can get a good free C compiler(gcc) which is widely used while the only free(and only free for non commercial use) Fortran90/95 compiler at the moment is made by Intel..although others are working on this issue as we speak.

  Reply With Quote

Old   August 30, 2002, 12:27
Default Re: F90
  #11
Axel Rohde
Guest
 
Posts: n/a
Every other year Microsoft comes out with a new version which expands its capabilities. The latest version, Visual Studio.NET, which includes VB.NET (aka VB v7) is vastly improved over VB v1. But even VB v1 had features you could only dream of in F90.
  Reply With Quote

Old   August 30, 2002, 13:14
Default Re: F90
  #12
Joern Beilke
Guest
 
Posts: n/a
About every software comes out with a slightly improved version every year Even F70 or compilers.
  Reply With Quote

Old   August 30, 2002, 13:49
Default Re: The computer language for CFD
  #13
pp
Guest
 
Posts: n/a
Dear Axel,

as you can see all folks are preaty sceptic about your VB-ansambly coupling. You are tolking about oldfeshion FORTRAN (you have fortran 90,95 (numbers presente years)) and sugest VB+ansambly. As you already say, you are working with ansambley since comodore. I think this is more then 20 years (what is that DINOSAUR**2 or if you want VB notation DINOSAUR^2 or if you want C/C++ notation power(DINOSAUR,2.0)).

Did you know way is it called FORTRAN: FORmula TRANslation

About GUI with fortran on PC: visit www.compaq.com/fortran

And finally you can not compile you VB code on any UNIX machine.

Ringo, someone who want to write your own CFD code it must do that with Fortran90/95 or C/C++ with development tools (for GUI) which are CROSS PLATFORM !!!!

I did not want to say that VB is not good but this is not scientific language. It is language for easy creating GUI and I'm using it for that porpouses(on PC).

I vote for C/C++.

Best Regards,

pp
  Reply With Quote

Old   August 30, 2002, 14:04
Default Re: The computer language for CFD
  #14
Jim Park
Guest
 
Posts: n/a
"Fortran90/95 compiler at the moment is made by Intel..although others are working on this issue as we speak."

Actually, Absoft has a Fortran 95 (www.absoft.com). It resides on my hard drive at present. And there's at least one other whose name escapes me ...
  Reply With Quote

Old   August 30, 2002, 14:07
Default Re: The computer language for CFD
  #15
Jim Park
Guest
 
Posts: n/a
"About Fortran: 2(CFX, STAR-CD) of big 3 CFD solvers (CFX, Fluent, STAR-CD) are writen in FORTRAN!!!!!!!!!!!!!!!!"

I believe that Fluent is written in C++.
  Reply With Quote

Old   August 30, 2002, 14:09
Default Re: The computer language for CFD
  #16
Peter Attar
Guest
 
Posts: n/a
It's free?..I have Lahey Fortran 95 at home which I love but it wasn't free although cheap for an academic license.
  Reply With Quote

Old   August 30, 2002, 14:11
Default Re: The computer language for CFD
  #17
andy
Guest
 
Posts: n/a
Since it is Friday afternoon...

The speed advantage of Fortran over C/C++ for numerical work is due to Fortran enforcing the concept of an array. An optimising compiler can then use this extra information to generate more efficient array based machine code instructions.

20 years ago when computers were designed to execute numerical code efficiently the difference between Fortran code and C-type code was substantial. (I say C-type because 20 years ago people simply did not consider writing numerical code in C because of this inefficiency and the much higher cost of computing).

Although this difference still exists today one factor has have served to reduce the gap dramatically: no computers today are designed to efficiently execute numerical code. The CISC Intel microprocessor in a PC is poor at running numerical code (to the point that BASIC runs as fast as C apparently). RISC microprocessors in unix workstations tend to be slightly better but dragging data from memory is still the bottleneck.

This link shows a much abused numerical benchmark running on CISC processors:

http://www.tech-report.com/reviews/2...7/index.x?pg=4

A typical 3D CFD code would be off the scale on the right hand side. If you are using such a computing platform for CFD there is little point giving much weight to performance issues other than trying to avoid poor compilers: all decent compilers with reasonable languages are going to emit code that runs CFD code at pretty much the same speed (even Java probably). One can only hope that things improve in the future but it is hard to be optimistic.

I would recommend keeping it simple and tending towards what the more experienced people around you are using. If you are working alone then the combination of Fortran 77 for numerical routines with a scripting language such as Python or OCAML for the glue should work well in most research environments.

(I am not sure that Axel's comments are meant to be taken seriously since no sensible CFD researcher is going to lock themselves into what is a minority platform for CFD and, with the explosion of unix-type clusters, almost certainly a shrinking one. However, the scripting glue language (BASIC in his case) plus efficient number crunch routines (Intel assembler in his case) is, strangely, something I seem to be endorsing?).

  Reply With Quote

Old   August 30, 2002, 14:23
Default Re: F90
  #18
Axel Rohde
Guest
 
Posts: n/a
I invite you to download my shareware MicroTunnel from my website, www.microcfd.com, and run it for three days. The entire application was written in VB including packaging and deployment. Last year I upgraded the solver to an assembly coded DLL, which took me a week to program (CFD.DLL). If you can create something like is in F70 or F90, then please let me know!
  Reply With Quote

Old   August 30, 2002, 14:52
Default Re: The computer language for CFD
  #19
Axel Rohde
Guest
 
Posts: n/a
Dear 'pp':

"as you can see all folks are pretty skeptic about your VB-ansambly coupling. You are tolking about oldfeshion FORTRAN (you have fortran 90,95 (numbers presente years)) and sugest VB+ansambly. As you already say, you are working with ansambley since comodore. I think this is more then 20 years (what is that DINOSAUR**2 or if you want VB notation DINOSAUR^2 or if you want C/C++ notation power(DINOSAUR,2.0))."

You completely missed my point: If you know how to program one processor in assembly, you can quickly learn how to do it on any other. I have been doing it for quite some time, and I just happen to be very proficient in it. All programs ultimately run in assembly or machine language, so your '20 year old' argument is a lame one!

"Did you know way is it called FORTRAN: FORmula TRANslation"

Yes, I am not moron, but I don't think your formulas (on average) translate any faster in Fortran than they do in VB. Why should a VB compiler be inherently slower? I admit, the first three versions of VB used translated pseudo-code, which is how the language got its reputation for being slow. Have you done a speed comparison of your code using the latest version of both languages and compiling VB to native code with all the speed optimizations enabled?

"About GUI with fortran on PC: visit www.compaq.com/fortran"

I just visited the Compaq Visual Fortran site, and you more than prove my point. Microsoft came up with that idea more than a decade ago. Compaq simply 'copied' the concept, because apparently it was a good one.

"And finally you can not compile you VB code on any UNIX machine."

I don't care for Unix, because 94% of the people who visit my site run a Windows platform according to my web statistics. For such a small market (6%), why should I bother to write a UNIX version of my shareware.

"Ringo, someone who want to write your own CFD code it must do that with Fortran90/95 or C/C++ with development tools (for GUI) which are CROSS PLATFORM !!!!"

Why don't you let the guy choose for himself!?

"I did not want to say that VB is not good but this is not scientific language."

In your opinion, what is not scientific about VB?
  Reply With Quote

Old   August 30, 2002, 14:59
Default Re: The computer language for CFD
  #20
pp
Guest
 
Posts: n/a
Yes, I sa 2 of 3 are writen in FORTRAN. The 3rd one is Fluent.

BR,

pp
  Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparison between C/C++ and Fortran? rick Main CFD Forum 45 September 6, 2011 01:52
Running OpenFoam on a Computer Cluster in the Cloud - cloudnumbers.com Markus Schmidberger OpenFOAM Announcements from Other Sources 0 July 26, 2011 09:18
Open ANSYS12.0 Workbench Project on another computer Andrew FLUENT 2 July 6, 2010 01:20
Transient case running with a super computer microfin FLUENT 0 March 31, 2009 12:20
programming language for CFD, C, C++, FORTRAN,.... hadian Main CFD Forum 15 September 9, 2008 23:19


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