CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   The computer language for CFD (https://www.cfd-online.com/Forums/main/5101-computer-language-cfd.html)

Ringo August 30, 2002 05:47

The computer language for CFD
 
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 ...

Axel Rohde August 30, 2002 08:15

Re: The computer language for CFD
 
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.


pp August 30, 2002 09:02

Re: The computer language for CFD
 
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

greg August 30, 2002 09:25

Re: The computer language for CFD
 
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.

Jim Park August 30, 2002 09:39

Re: The computer language for CFD
 
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.

Axel Rohde August 30, 2002 09:47

Re: The computer language for CFD
 
"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).

Axel Rohde August 30, 2002 09:58

Re: The computer language for CFD
 
"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.

Axel Rohde August 30, 2002 10:26

Re: F90
 
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. :)

Joern Beilke August 30, 2002 10:44

Re: F90
 
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.


Peter Attar August 30, 2002 11:13

Re: The computer language for CFD
 
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.


Axel Rohde August 30, 2002 11:27

Re: F90
 
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.

Joern Beilke August 30, 2002 12:14

Re: F90
 
About every software comes out with a slightly improved version every year :) Even F70 or compilers.

pp August 30, 2002 12:49

Re: The computer language for CFD
 
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

Jim Park August 30, 2002 13:04

Re: The computer language for CFD
 
"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 ...

Jim Park August 30, 2002 13:07

Re: The computer language for CFD
 
"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++.

Peter Attar August 30, 2002 13:09

Re: The computer language for CFD
 
It's free?..I have Lahey Fortran 95 at home which I love but it wasn't free although cheap for an academic license.

andy August 30, 2002 13:11

Re: The computer language for CFD
 
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?).


Axel Rohde August 30, 2002 13:23

Re: F90
 
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!

Axel Rohde August 30, 2002 13:52

Re: The computer language for CFD
 
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?

pp August 30, 2002 13:59

Re: The computer language for CFD
 
Yes, I sa 2 of 3 are writen in FORTRAN. The 3rd one is Fluent.

BR,

pp

Joern Beilke August 30, 2002 14:08

Re: F90
 
Sorry but I dont use Windows at all.

Your solution might be ok in the windows world but I dont know any one who is using windows for cfd calculations.


Jim Park August 30, 2002 14:12

Re: F90
 
"Your solution might be ok in the windows world but I dont know any one who is using windows for cfd calculations."

I do. Glad to meet you!


Jim Park August 30, 2002 14:14

Re: The computer language for CFD
 
Sorry! I didn't read it closely.

Jim Park August 30, 2002 14:20

Re: The computer language for CFD
 
I'm sure having a bad day today. No, Absoft is not "free" - I missed the word entirely. (Didn't know Intel's was either ...). And Leahey is the name I couldn't remember.

pp August 30, 2002 14:21

Re: The computer language for CFD
 
"All programs ultimately run in assembly or machine language, so your '20 year old' argument is a lame one!" Yes, but compiler do that for me.

"Yes, I am not moron," I didn't say that!!!!!

"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." Yes, you are wright but this 6% of UNIX machines are calcualting just now (many of them CFD calculation) and 99.9% of your 94%Windoze machines are using only for surfing. Why????

"In your opinion, what is not scientific about VB" Clearly (moustly) with any language today you can do what you want. But VB is NOT scientific language. Why dont you have VB compiler for CRAY or SGI or ...

Best Regards,

pp

pp August 30, 2002 14:23

Re: The computer language for CFD
 
Only INTEL f90/95 compiler win/linux and C/C++ is for free.

Best Regards,

Pero

pp August 30, 2002 14:29

Re: F90
 
Finally,

Where are you guys til now!!!!!!!!!

Best UNIX wishes, pp


Axel Rohde August 30, 2002 14:31

Re: F90
 
Actually, quite a number of people run CFD on Windows these days. For example the commercial package EFD.Lab, www.efdlab.com, which I endorsed on this site the other day, is EXCLUSIVELY written for Windows. It even interfaces with other MS applications such as Excel for some pre- and post-processing tasks.

EFD.Lab is currently used by over 500 companies worldwide. The company who developed the package in 1999 is headquartered in Frankfurt, Germany. Since you are German, why don't you give them a call to arrange for a free web demo. You might be surprised to find out that running CFD on a Windows platform is not such an odd concept.

pp August 30, 2002 14:41

Re: F90
 
Is EFD.lab writen in VB?

It must be very good if it need MS Exceel for pre end post procesing. Is it also MSPowerPoint and MSWord required for pre-postprocesing?

andy August 30, 2002 14:42

Re: The computer language for CFD
 
There are a range of Fortran compilers available for PCs:

http://www.polyhedron.com/compare.html

(note the scatter on Windows compared with Linux - there seems to be something odd with the Windows results?).

The Intel compiler is freely available but unsupported for Linux - I assume you have to pay on Windows.

The two leading compilers would seem to be Intel (they make the chip) and DEC (bought by Compaq and given a Microsoft name "Visual Fortran" - which seems a curious marketing move to me given how poor the genuine Microsoft product used to be before it was abandoned).

Axel Rohde August 30, 2002 14:55

Re: F90
 
"Is EFD.lab writen in VB?"

I don't know, but I can find out.

"It must be very good if it need MS Exceel for pre end post procesing. Is it also MSPowerPoint and MSWord required for pre-postprocesing?"

EFD.Lab does not NEED any of the MS apps for pre- and post-processing. However, you can export your results (graphs, tables, etc.) directly into an Excel or Word document with a click of a button. This greatly streamlines your report writing.

Regarding the pre-processing, you can create design tables in Excel that change your solid model depending on the control parameters you set. This is very efficient if you want to analyze slightly different versions of your design.

I am currently running EFD.Lab on my Windows XP machine, and it is the most GUI driven package I have seen. I would say anyone can use it after a day of training. Certainly the most intuitive CFD package I have ever encountered.

Peter Rozovski August 30, 2002 15:22

Re: The computer language for CFD
 
Day before yesterday best language for CFD was FORTRAN. Yesterday best languages were Visual FORTRAN or C++. Today best language is JAVA.

OK, I expect a lot of voices "It is so slow!" ,"No libraries!","Practically nobody in CFD world is using it!", etc.

Yes - slow, yes - no libraries to go, yes - very limited number of people are currently using JAVA for CFD/scientific software development.

BUT the reality is that all leading CFD vendors (Fluent, CFD RC, STAR, etxc.) have to support multiple platforms and spend a lot of money and efforts to make versions for 10-20 platforms and dialects of UNIX.

Only JAVA is free from such nightmare.

CFD is object-oriented area - all components (point, grid, geometry, mixture, substance, kinetic model, etc.) - they are objects with properties and methods. Proper CFD software SHOULD use it. That means that CFD developer has to write object-oriented code. That it is easy to do in JAVA.

pp August 30, 2002 15:50

Re: The computer language for CFD
 
Dear Peter,

everything you say is corect, especially that the Java is preaty slow.

The problem is GUI on diferent platforms not solver. You take solver code and compile them but there is a problem with GUI. Very good practice is to develope your GUI with cros platform developers. With thar you can create GUI in one shot for all platforms.

BR,

PP

Pete August 30, 2002 15:53

Continuous Fortran Debugging
 
The majority of people involved in development of CFD techniques have an engineering background. They are not computer science people eager to jump up and learn every new and exotic language that comes out. I'll freely admit I fall into that category myself. You spend enough time in code development without having to rewrite routines every other year in "the latest and greatest language." Surely another one will come along after Java.

At the bigger vendors, the people doing the actual algorithm development are focused on the physics of what they are coding (they are engineers), and the languages of choice are the languages most people were trained in, C and Fortran. These big vendors have a separate CS group that specifically deals with interfacing and platform requirement issues.

There are enough niche markets to choose the route you want to follow. If that route is Fortran, C, Visual Basic, Java, or whatever else, there's enough compiler support and upgrades for each path so that ultimately the "correct" choice is.....

....whatever you know best and work in most efficiently!


Peter Rozovski August 30, 2002 16:06

Re: Continuous Fortran Debugging
 
I spend 15 years with development of non-equlibrium CFD softawe in FORTRAN and can state that change FORTRAN to JAVA is easier than change MacCormack scheme to TVD one...

The main disadvantage of FORTRAN is no real support of objects. For a long years the number of articles about advantages of object-oriented programming were treated as having nothing common with scientific computation. But reality is that good CFD program should be object-oriented.

pp August 30, 2002 16:10

Re: F90
 
"EFD.Lab does not NEED any of the MS apps for pre- and post-processing. However, you can export your results (graphs, tables, etc.) directly into an Excel or Word document with a click of a button. This greatly streamlines your report writing." Yes, from 15days to 14.99999999 days. Maybe you can also drag and drop something.

"Regarding the pre-processing, you can create design tables in Excel that change your solid model depending on the control parameters you set." You can do that in any ASCII procesor (like Notepad).

"This is very efficient if you want to analyze slightly different versions of your design." If you want to do some optimisation then you need again some language to code optimisation rutine which will guide this parameter changing.

"I am currently running EFD.Lab on my Windows XP machine, and it is the most GUI driven package I have seen." Come on Alex, what is a main part of good CFD package: GUI or turbulence models, numerical schemes, discretization etc.

Pete August 30, 2002 16:24

Re: Continuous Fortran Debugging
 
And what advantages has switching to Java given you? Is the solver faster? Was it easier to develop a GUI for users? What tangible impacts does being a code being "object-oriented" have on solver performance? I'm genuinely curious.

One can write modular, easy to maintain routines in just about any language. Again, I believe this debate all comes down to one of personal preference and there is no "correct answer".

Axel Rohde August 30, 2002 16:27

Re: F90
 
"Come on Alex, what is a main part of good CFD package: GUI or turbulence models, numerical schemes, discretization etc."

EFD.Lab has all of the above, at least for my purposes. I would be happy to arrange a free web demo for you. If you want to criticize the package, I think you should take a look at it first before you dismiss it.

andy August 30, 2002 16:30

Re: The computer language for CFD
 
Java is a cut down C++ without an abstraction mechanism suitable for efficient numerical computation (nor does it support efficient arrays). Back in the 70s when Fortran 77 got a few generic functions and ADA was designed it was clear that polymorphic types and generic functions would allow abstraction without impacting numerical efficiency (what C++ confusingly calls templates). The same is true today. Until Java sorts this out no sensible author of numerical software is going to consider Java.

The time taken to "port" Fortran numerical code from one platform to another is usually zero seconds. For C/C++ (a platform dependent language by design) it is going to take longer but the time is usually irrelevant for numerical code which typically has minimal dependencies outside ANSI/POSIX.

The input processing and output processing is somewhat different and a few years ago a few companies did use/promote Java but they do not seem to be around now. Perhaps there is a connection? Do you have any evidence that porting CFD software to a variety of platforms requires significant resources? I suspect Windows might be a bit of a problem given Microsoft's business model but I would assume a CFD company could handle this without too much of a problem.

I would contest that CFD is a problem that maps well to an object-orientated model (unlike, say, a window system which does). CFD typically has a small set of conceptual types and a small structured set of operations. The baggage associated with object-orientation would appear to be unnecessary (although it does tend to make the inexperienced programmer think about interfaces more than they would using, say, C or Fortran 77).

However, I would suggest that what can work well conceptually for CFD are functional languages but, unfortunately, their inefficiency on current designs of hardware would seems to prevent their adoption for serious number crunching.


andy August 30, 2002 16:53

Re: Continuous Fortran Debugging
 
I too am curious what it is about java objects that you find useful for CFD beyond, say, the module/type system found in Fortran 90/95?



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