CFD Online Logo CFD Online URL
Home > Forums > Main CFD Forum

Software Language for Coding CFD

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

LinkBack Thread Tools Display Modes
Old   September 13, 2013, 02:06
Default Software Language for Coding CFD
New Member
Vijai Sookrah
Join Date: Sep 2013
Posts: 1
Rep Power: 0
vsookrah is on a distinguished road
Hi All,

I am a new member to the CFD-Online Forums. I am a mechanical engineer and I have just started my Masters in Mechanical Engineering at the University of Toronto. I am taking a CFD course where our professor has allowed us to choose a software language to code our CFD projects in. We will not be using commercial software packages for this as we will develop the method for solving CFD problems from scratch. Each project will build upon the previous project and eventually we will solve a basic 2-D Navier Stokes problem. As I said above, we choose the language we would like to code in.

So, me being a ME with little coding background and the last time I really had to code anything was back in 1st year (7year ago), I am kind of in a tough spot. Our Professor suggested FORTRAN, or C/C++ and he also discouraged the use of MATLAB, which I am okay with because I know its not the greatest, while it is good. I am familiar with C++, but that was 7 years ago. That being said, I have read that FORTRAN is the best language to code in for CFD, especially for homemade code like this.

This leads me to why Im posting here. I would like to know if you have anyone can help me start using FORTRAN and if you have any ideas or comments on the language choice.
vsookrah is offline   Reply With Quote

Old   September 13, 2013, 09:42
Senior Member
Jonas T. Holdeman, Jr.
Join Date: Mar 2009
Location: Knoxville, Tennessee
Posts: 113
Rep Power: 11
Jonas Holdeman is on a distinguished road
The words "CFD course" and "from scratch" beg for Matlab. The first means you have a limited time to produce results. With Matlab you have a complete, integrated development, debugging, equation-solving, and visualization system working for you. I would suggest that you work out each problem in Matlab, get it working, and then translate to C++ or Fortran to show your instructor. "From scratch" is not exactly that. I assume you would be using solver and visualization packages or libraries in the higher languages. The question is, do you want to spend your time developing CFD algorithms or mucking around with programming details?
Jonas Holdeman is offline   Reply With Quote

Old   September 13, 2013, 10:56
Join Date: Jul 2013
Posts: 49
Rep Power: 6
Alex C. is on a distinguished road
Matlab looks also to me a really good development tool for starting use. With reasonable mesh size, calculation will be fast (especially for 1D and 2D case), even though the coding language is not itself fast.

Just make sure every feature that are unique to matlab are only used for debugging and are not involved in the algorithms you use, in order to avoid having translating issues.
Alex C. is offline   Reply With Quote

Old   September 15, 2013, 13:36
New Member
Join Date: May 2013
Posts: 12
Rep Power: 6
levivad is on a distinguished road
I would also suggest Matlab. When I took several similar courses it was a huge advantage being able to compare a linear equation solver I wrote to the correct solutions found in Matlab using A\b. The ability to test the code by replacing my routines with ones i know are correct saves hours of debugging.
levivad is offline   Reply With Quote

Old   September 15, 2013, 17:30
Senior Member
Join Date: Mar 2010
Posts: 557
Rep Power: 13
cfdnewbie is on a distinguished road
As a grad student, my professor gave us exactly the same task: Writing a 2D NS solver (Finite volume) from scratch and running it for 2D problems. He made us use Fortran or C, and while I realize that it is not as comfortable as Matlab, I would still start in Fortran. It gives you the speed you need, is not too difficult and arcane, and will prepare you for bigger codes to come. If you do use C or Fortran, just write a simple text-based export to Matlab and use the nice plotting features it has to do contour plots / line plots or animations.

Matlab is great for 1D schemes and playing around with the basic concepts, but beyond one dimension can become to slow to bear.

Another option would be to use Matlab and include C parts where you need the speed.

All the best!
cfdnewbie is offline   Reply With Quote

Old   September 15, 2013, 19:34
Senior Member
John Chawner
Join Date: Mar 2009
Location: Fort Worth, Texas, USA
Posts: 260
Rep Power: 11
jchawner is on a distinguished road
If your professor discouraged the use of Matlab, don't do it.

Then begin writing code in the language you're more comfortable with: C/C++ or Fortran.
John Chawner / /
on Twitter: @jchawner
jchawner is offline   Reply With Quote


c++, fortran

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
CFD Software Recommendation 1150GSA Main CFD Forum 3 September 2, 2009 15:46
What is the optimal (economically and user friendly) CFD software for my application? Rame Main CFD Forum 0 August 10, 2009 05:30
Student looking for CFD software Chris Main CFD Forum 6 January 21, 2005 04:20
Free UK seminars: ANSYS CFD software Gavin Butcher CFX 0 November 23, 2004 10:13
ASME CFD Symposium Chris Kleijn Main CFD Forum 0 August 22, 2001 06:41

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