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

C++ or Fortran

Register Blogs Community New Posts Updated Threads Search

Like Tree36Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 27, 2018, 04:58
Default
  #21
Senior Member
 
Join Date: Oct 2017
Location: United States
Posts: 233
Blog Entries: 1
Rep Power: 9
TurbJet is on a distinguished road
Quote:
Originally Posted by AeroSonic View Post
Thank you all

i think i am going to go with C++ , i see many says it is more use-able , more editable .

my question , should i work on Windows or Linux ?
I strongly suggest u to work on Linux, either on ur personal pc or on workstations in ur lab (if there is any) on maybe on clusters.

If u can see yourself working in the field of CFD in the future, this is the only way to go, since you are gonna work on clusters at some point, and most of them are with Linux (or maybe Unix? I am not sure about this one).
AeroSonic likes this.

Last edited by TurbJet; September 28, 2018 at 00:34.
TurbJet is offline   Reply With Quote

Old   September 27, 2018, 05:59
Default
  #22
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
I see a different perspective. As a professor, I would ask to my student if he want to be only a programmer! Working in CFD is not be only a good programmer, this is the last step of a path.

A good programmer can find easily a job in several fields if he knows Java, perhaps... Fortran or C++ depends also on what you want to program. HPC is an environment where Fortran is still largely used. On the other hand object-based programming is possible also in Fortran now. Then one should have care about the great advances in GPU-based programming.


So my answer is to think first about if programming will be only a tool or a final goal for you.
sbaffini and AliE like this.
FMDenaro is offline   Reply With Quote

Old   September 27, 2018, 06:27
Default
  #23
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
I see a different perspective. As a professor, I would ask to my student if he want to be only a programmer! Working in CFD is not be only a good programmer, this is the last step of a path.

A good programmer can find easily a job in several fields if he knows Java, perhaps... Fortran or C++ depends also on what you want to program. HPC is an environment where Fortran is still largely used. On the other hand object-based programming is possible also in Fortran now. Then one should have care about the great advances in GPU-based programming.


So my answer is to think first about if programming will be only a tool or a final goal for you.

i think it will be a tool for me , i am looking to be a code developer , i am looking forward to work in the simulation field as a programmer , so my aim isnt a code to solve one problem ( even if it is Big one ) .
AeroSonic is offline   Reply With Quote

Old   September 27, 2018, 06:31
Default
  #24
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by TurbJet View Post
I strongly suggest u to work on Linux, either on ur personal pc or on workstations in ur lab (if there is any) on maybe on clusters. If u can see yourself working in the field of CFD in the future, this is the only way to go, since you are gonna work on clusters at some point, and most of them are with Linux (or maybe Unix? I am not sure about this one).
thank you for your advice
AeroSonic is offline   Reply With Quote

Old   September 27, 2018, 06:32
Default
  #25
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
Linux hands down... I can't think of a single library or relevant development tool that is available in Windows and not Linux.
Thank you
i am not familiar with linux but i will learn

any OS u recommend ? Ubuntu ? Mint ?
AeroSonic is offline   Reply With Quote

Old   September 27, 2018, 06:44
Default
  #26
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by AeroSonic View Post
i think it will be a tool for me , i am looking to be a code developer , i am looking forward to work in the simulation field as a programmer , so my aim isnt a code to solve one problem ( even if it is Big one ) .



In CFD field we can generalize two general jobs, research & development (academy and industry) and engineering-applied job, basically be an end-user of some commercial (or sometimes open source) code.
The former requires often much more than being a good programmer and is a path that often requires a PhD training. The latter requires no or few programming job (just using some C++ knowledge for UDF functions).

OpenFOAM can be a challenge for the requirement of being a good C++ programmer but only if you want do develop your own model.
Again, a good programmer (Fortran or C++) can also be a person that has no knowledge at all of CFD.
FMDenaro is offline   Reply With Quote

Old   September 27, 2018, 06:49
Default
  #27
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
In CFD field we can generalize two general jobs, research & development (academy and industry) and engineering-applied job, basically be an end-user of some commercial (or sometimes open source) code.
The former requires often much more than being a good programmer and is a path that often requires a PhD training. The latter requires no or few programming job (just using some C++ knowledge for UDF functions).

OpenFOAM can be a challenge for the requirement of being a good C++ programmer but only if you want do develop your own model.
Again, a good programmer (Fortran or C++) can also be a person that has no knowledge at all of CFD.
after i get my Master Degree , i will look for a PhD degree .
so i think i will go first for the academic path beside that i looking to be a good programmer .

i still think in both language , C++ or Fortran , but i think i am started to be more close to C++ as many says that it will learn me to be a part of a big system , and some said no one writes good fortran codes , it is ugly to reuse or to edit it .

what do you recommend me , linux or windows ?
AeroSonic is offline   Reply With Quote

Old   September 27, 2018, 06:54
Default
  #28
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by AeroSonic View Post
after i get my Master Degree , i will look for a PhD degree .
so i think i will go first for the academic path beside that i looking to be a good programmer .

i still think in both language , C++ or Fortran , but i think i am started to be more close to C++ as many says that it will learn me to be a part of a big system , and some said no one writes good fortran codes , it is ugly to reuse or to edit it .

what do you recommend me , linux or windows ?

Linux. I used to install CentOS but I don't know if at present you can find some better project.
AeroSonic likes this.
FMDenaro is offline   Reply With Quote

Old   September 27, 2018, 07:07
Default
  #29
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by AeroSonic View Post
Thank you
i am not familiar with linux but i will learn

any OS u recommend ? Ubuntu ? Mint ?
Ubuntu usually is my first choice, but CentOS is what you find on most clusters. The former makes everything relatively easy, but not the latter.
sbaffini is offline   Reply With Quote

Old   September 27, 2018, 07:17
Default
  #30
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15
Santiago is on a distinguished road
Quote:
Originally Posted by AeroSonic View Post
thank you for your informative reply
i am looking for a speed program beside a language that gives me a chance while searching for a PhD degree .
someone told me that acceptance may depend on the language you use , if they use C++ , they will need someone who knows C++.
so i am looking also for wide-usage beside speed .

what do you think about the part " fortran makes me a bad programmer " ?
Fortan certainly makes you a bad programmer if your intention is web development...

All this comments comparing/saying that fortran/C is dead, and C++ is the panacea, speak of the ineptitude of the commenter in PROGRAMMING FOR CFD.

If someone tells me that implementing a parallel structured grid solver in pure C++, instead of FORTRAN/C, is better, clearly doesnt know what he's talking.

The origin of this "debate" came with the emergence of OpenFOAM and other all-purpose open libraries for CFD. It created an aurea of "superior morality" for C++, without actual evidence that supports it
sbaffini, FMDenaro, AliE and 2 others like this.
Santiago is offline   Reply With Quote

Old   September 27, 2018, 07:40
Default
  #31
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Please note that knowing Fortran doesn't prevent you from actually knowing other languages.

Knowing both is probably the most productive choice in the long run.

Like having a boat and a car. Use one for water and the other for land. Not really an headache matter here.

Just choose which one to pick up first.
arjun, FMDenaro and AeroSonic like this.
sbaffini is offline   Reply With Quote

Old   September 27, 2018, 08:39
Default
  #32
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by Santiago View Post
Fortan certainly makes you a bad programmer if your intention is web development...

All this comments comparing/saying that fortran/C is dead, and C++ is the panacea, speak of the ineptitude of the commenter in PROGRAMMING FOR CFD.

If someone tells me that implementing a parallel structured grid solver in pure C++, instead of FORTRAN/C, is better, clearly doesnt know what he's talking.

The origin of this "debate" came with the emergence of OpenFOAM and other all-purpose open libraries for CFD. It created an aurea of "superior morality" for C++, without actual evidence that supports it

if you are going to advise me directly , which language would you recommend ?
as i said i will start from scratch and i am free to choose .
i dont know anything about fortran , just small things about c++.
i am looking for a long run career , not just a problem for master or PhD .
time for learning isnt a problem i still have a time .
AeroSonic is offline   Reply With Quote

Old   September 27, 2018, 08:40
Default
  #33
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
Please note that knowing Fortran doesn't prevent you from actually knowing other languages.

Knowing both is probably the most productive choice in the long run.

Like having a boat and a car. Use one for water and the other for land. Not really an headache matter here.

Just choose which one to pick up first.
thank you very much , i am going to learn both in shaa Allah .
so if i am your student , what will you recommend , c++ or fortran ?
AeroSonic is offline   Reply With Quote

Old   September 27, 2018, 08:50
Default
  #34
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by AeroSonic View Post
so in long run , and for editing , modifying , C++ is better ?
but isnt worrying to think about , that company like ansys use fortran inside its product ? it is like people still using it , and modify it .

i am sorry if i ask much , but i really want to be sure about my decision

Ansys has many softwares and most of them are C++ or C based. For example CFX is fortran based and Fluent is C based. It is very likeky that CFX is fading away.

Adapco came out fortran based starCD to move to C++ based Starccm+ exactly for the reasons i mentioned. In fact the fact that Fluent is C based put Ansys at big disadvantage compared to Starccm+ in terms of development for various physics.

I chose C++ the same reason for Wildkatze and in 2 to 3 years you can see the amount of features it presents is pretty good. I can't even dream of fraction of development with FORTRAN.

I personally would never chose fortran as language for development for any of my projects.
AeroSonic likes this.
arjun is offline   Reply With Quote

Old   September 27, 2018, 08:52
Default
  #35
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by sbaffini View Post
Please note that knowing Fortran doesn't prevent you from actually knowing other languages.

Knowing both is probably the most productive choice in the long run.

Like having a boat and a car. Use one for water and the other for land. Not really an headache matter here.

Just choose which one to pick up first.

I actually code in fortran for others if I am required to code for their projects. I don't care much because it is another language. Not my choice but i don't say i can't do because of language.

I just code in any language that is requirement at that time.
sbaffini and AeroSonic like this.
arjun is offline   Reply With Quote

Old   September 27, 2018, 08:54
Default
  #36
Senior Member
 
Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15
Santiago is on a distinguished road
Quote:
Originally Posted by AeroSonic View Post
if you are going to advise me directly , which language would you recommend ?
as i said i will start from scratch and i am free to choose .
i dont know anything about fortran , just small things about c++.
i am looking for a long run career , not just a problem for master or PhD .
time for learning isnt a problem i still have a time .
It boils down to which kind of grid you're planning to use. Depending on the choice, programming should be focused towards OOP (object oriented) or Procedural.

Modern fortran, and C, support OOP, classes, inheritance, polymorphism. It is certainly the case that C++ is somewhat richer in this aspect and, to some level, the standard library is efficient. You'll be better served using linked lists for the description of the grid topology if the comprising elements are polyhedra. Cell-to-face associations are easily made through pointers which, for the languages just listed, are available.

If you plan to do a structured solver, you may be better served with languages that support array operations DIRECTLY. In C you'll have to play a bit with pointer arithmetics, whereas in fortran is ready to go. In the case of C++ you have to use libraries which will reduce the performance and will make the code unnecesarily complex...
AeroSonic likes this.
Santiago is offline   Reply With Quote

Old   September 27, 2018, 08:55
Default
  #37
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by AeroSonic View Post
thank you very much , i am going to learn both in shaa Allah .
so if i am your student , what will you recommend , c++ or fortran ?
In your first post you stated that you knew some MATLAB. In this case there is no real choice here, you should go Fortran first.

But now I read you know some C++. In this case you should go C++ first.

It is that simple, because both are more than capable of everything you need to work in computational physics at any sophistication level.

The single real point against Fortran today is availability of free compilers under Windows and their coupling with MPI. Everything is easily doable but it all leaves you with that strange feeling of a hack instead of a fresh out of the box solution as it is under linux.
AeroSonic likes this.
sbaffini is offline   Reply With Quote

Old   September 27, 2018, 13:18
Default
  #38
Senior Member
 
andy
Join Date: May 2009
Posts: 270
Rep Power: 17
andy_ is on a distinguished road
Quote:
Originally Posted by AeroSonic View Post
after i get my Master Degree , i will look for a PhD degree .
so i think i will go first for the academic path beside that i looking to be a good programmer .

i still think in both language , C++ or Fortran , but i think i am started to be more close to C++ as many says that it will learn me to be a part of a big system , and some said no one writes good fortran codes , it is ugly to reuse or to edit it .

what do you recommend me , linux or windows ?
Is the CFD program you are going to write as part of your MSc course the main project or is it coursework in support of the taught element? Will you teach yourself the language or is there a decent intensive module available for the language?

Mastering C++ and HPC Fortran is an appropriate task as part of a CFD PhD but much less so as part of a CFD MSc especially if you need to teach yourself the language and even more so if it is only needed to support the taught element.

If you have used matlab as part of your undergraduate course then Fortran will require the least amount of effort to support your MSc studies. C will require more effort but if you intend to use C++ as part of your PhD studies then it might be the better choice. The problem with C++ is that it's poor design requires one to learn a great deal more than what the statements do if you are to avoid writing poor programs. This can be done but it takes time and experience which you won't have on a typical intensive CFD MSc where the objective is to learn about CFD and not programming in a difficult language.

PS. An operating system isn't particularly important in itself but what packages are available can be. If you are familiar with Windows and the programs and libraries you need for the CFD MSc are available then I would be tempted to leave learning about Linux for a PhD when there will be more time for this type of learning.
AeroSonic likes this.

Last edited by andy_; September 27, 2018 at 13:26. Reason: PS
andy_ is offline   Reply With Quote

Old   September 28, 2018, 12:26
Default
  #39
Member
 
AeroSonic's Avatar
 
Yusuf Elbadry
Join Date: Sep 2018
Posts: 65
Rep Power: 7
AeroSonic is on a distinguished road
Many thanks to all of you
really i got many information from you

I will start my journey to learn C++ and how to deal with Linux , i am looking far as i see that C++ will be a better choice in the future .

You are very helpful and very informative , thanks again !!
AeroSonic is offline   Reply With Quote

Old   September 28, 2018, 12:47
Default
  #40
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by AeroSonic View Post
Many thanks to all of you
really i got many information from you

I will start my journey to learn C++ and how to deal with Linux , i am looking far as i see that C++ will be a better choice in the future .

You are very helpful and very informative , thanks again !!



As CFD is your main goal as student, try to learn C++ directly coding simple standard numerical test used in CFD: advection-difusion equation in FD and FV methods, iterative methods, time integration and so on.


When you get quite ready, you could try to understand how OpenFOAM works for solving the NS equations. An interesting reading in this case would be
https://www.google.it/imgres?imgurl=...CpIQ_B0IiAEwCg
AeroSonic likes this.
FMDenaro is offline   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
User fortran to input/output file in a parallel run doublestrong CFX 5 March 31, 2017 08:15
Fortran Compiler-CFX12.1 Araz CFX 13 March 27, 2017 05:37
CFD Code Conversion from Intel Fortran to GNU Fortran pitto Main CFD Forum 4 August 4, 2016 14:51
Using Fortran with CFX: How to connect Fortran to CFX? l.te CFX 0 October 21, 2012 11:42
visual fortran Monica Main CFD Forum 1 August 28, 2004 20:45


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