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

Software Language for Coding CFD

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 13, 2013, 03:06
Default Software Language for Coding CFD
  #1
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, 10:42
Default
  #2
Senior Member
 
Jonas T. Holdeman, Jr.
Join Date: Mar 2009
Location: Knoxville, Tennessee
Posts: 128
Rep Power: 18
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, 11:56
Default
  #3
Member
 
Join Date: Jul 2013
Posts: 56
Rep Power: 13
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, 14:36
Default
  #4
New Member
 
Join Date: May 2013
Posts: 12
Rep Power: 13
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, 18:30
Default
  #5
Senior Member
 
cfdnewbie
Join Date: Mar 2010
Posts: 557
Rep Power: 20
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, 20:34
Default
  #6
Senior Member
 
John Chawner
Join Date: Mar 2009
Location: Fort Worth, Texas, USA
Posts: 275
Rep Power: 18
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 / jrc@pointwise.com / www.pointwise.com
Blog: http://blog.pointwise.com/
on Twitter: @jchawner
jchawner is offline   Reply With Quote

Reply

Tags
c++, fortran


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
CFD Software Recommendation 1150GSA Main CFD Forum 3 September 2, 2009 16:46
What is the optimal (economically and user friendly) CFD software for my application? Rame Main CFD Forum 0 August 10, 2009 06: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 07:41


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