|
[Sponsors] |
March 20, 2009, 22:39 |
CFD and programming
|
#1 |
Member
Join Date: Mar 2009
Posts: 62
Rep Power: 17 |
Hello,
I would like to see your opinions about choosing a programming language for CFD. I think that for simple 1D application a language like Matlab, Maple or Mathematica can be used as a starting point, after all when you learn CFD you want to test algorithms and not to became a professional programmer. Same considerations can be applied to the new "managed" languages C# ... For "simple" 2D and 3D applications any compiled language (C/C++, Fortran ...) that allows you to use MPI or OpenMP will do. In the actual stage of computer development I don't think we can use an interpreted language for large applications. Sure the companies that sold Matlab, Maple or Mathematica will claim their software can use efficiently the new multi core architectures. But I ask, has anyone tried to implement for example in Matlab a large CFD code ( a small 2D application can easily have more then 10000 lines of code) ? An advanced CFD application will actually use a combination of interpreted and compiled code in order to remain flexible. What do you think of combinations like Python and C/C++ (Fortran) or (my favorite) Ruby and C/C++ ? |
|
March 20, 2009, 23:19 |
Characteristics of programming language
|
#2 |
New Member
Prakash Ayappan
Join Date: Mar 2009
Posts: 25
Rep Power: 17 |
Hi,
I believe any programmer like to write codes with small size with maximum features. IN that manner C/FORTRAN is a good friend but lacks the visualisation feature. In that manner MATLAB has fantastic visualisation features. But the problem with that it ahs lot of unnecessary components ( with respect to CFD programming) that is needed. Other softwares I dont have any knowledge. I recommend you 1) if you are going to practice/personnel go for CFD. 2) If you are going for writting softwares for another person / party its better to go for C/ FORTRAN |
|
March 20, 2009, 23:36 |
|
#3 |
Member
Join Date: Mar 2009
Posts: 62
Rep Power: 17 |
I don't want to discuss the visualisation part now, only a CFD solver. For visualisation you can always use a free program (Paraview, Gnuplot) or some commercial program (Tecplot, FieldView).
BTW, I've already used Fortran 90 for a medium size 2D CFD solver, and C++ for a 3D version. |
|
March 21, 2009, 09:41 |
|
#4 |
New Member
Prakash Ayappan
Join Date: Mar 2009
Posts: 25
Rep Power: 17 |
Its better to go for C/C++
|
|
March 23, 2009, 03:02 |
Matlab for CFD programing
|
#5 |
New Member
Join Date: Mar 2009
Posts: 4
Rep Power: 17 |
Currently I am using MATLAB for CFD calculations. I solve the 2D and 3D problems with compressible flow with combustion.
Since I didn't have any programing experience in advance I find it very convinient to use a high level programing languange. Using short single line commands gives short programing time. The total calculation time should include the code development time, and high level PL is favorable for codes used by one - four people and for special cases. Codes used by many people and many cases without the need for large modifications favors the fast and efficient PL like C++ and Fortran. MATLAB has also very good debugging and visualization tools. This is my opinion |
|
March 23, 2009, 04:15 |
|
#6 |
Senior Member
|
No offense, but i hardly believe that Matlab could ever be used for any serious CFD code. Matlab is invaluable for some things, as testing new ideas, simple visualizations, etc.
But, why use it for CFD when, with almost the same effort, a much more efficient and fast code could be developed in fortran? Probably, with the new parallel environment, it will be faster, but the brute force computing will still be based on an interpreted language. What size of grids do you usually use for a 3D computation and what is a typical time to solution for such a grid? |
|
March 23, 2009, 08:13 |
Visualisation in Paraview
|
#7 |
New Member
Prakash Ayappan
Join Date: Mar 2009
Posts: 25
Rep Power: 17 |
Dear Renard,
Presently I am doing a 2D-variable duct prblem. I have written codes in C and got the reults in text. Next I like to visualize the results in Paraview. But I dont know how to format the file to give as the input to the paraview. I checked a lot of trainning manuals for the formatting of input file. I startesd with VTK file extension and lot of hard work I didn't get any useful results. So I need your help to give some advice on the formatting of the input file. I want to see the velocity, pressure contour & stream traces. I have attached the problem & the results. Help Me. Thanks in advance. |
|
March 23, 2009, 09:04 |
|
#8 |
Member
Newton KF
Join Date: Mar 2009
Posts: 36
Rep Power: 17 |
Hi Guys,
I'm developing my own code for my masters, and I used C++. My code purpose is to solve 3D NS with LES and combustion models. I'm using something like tecplot to view the variables and I had no bad experience with that. As you can imagine, my problems are in 3M volumes or more, so a fast code is necessary. Today I'm using a king of openMP and is it enough for now, but MPI is better for this size of domain, since it is very difficult to find big SMP machines. I dont think programs like Matlab or Mapple can handle this size of problems... But i've never tested... So, again, if you are thinking about to use 1M or more volumes, I think it is best if you use C++ or fortran.... good luck... |
|
March 23, 2009, 18:20 |
|
#9 |
Member
Join Date: Mar 2009
Posts: 62
Rep Power: 17 |
What was your experience with OpenMP ? I've just start to use it in C++, did you noticed some visible increase in performance versus a single core program ?
Paul |
|
March 23, 2009, 18:41 |
|
#10 |
Member
Newton KF
Join Date: Mar 2009
Posts: 36
Rep Power: 17 |
Dear Paul,
I'm runing my code in a server with 8 cores and it showed a good increase of performance compared to the one core system... As I said before, I'm working with 3M or more volumes, so using openMP or MPI is very important to achieve results in reasonable time. OpenMP is better for loops in the program, it is easy to implement and works fine.. But, if you have a DMP cluster, it is still better to work with MPI. I think, the better choice is to do MPI to interconnect nodes and use OpenMP in those nodes to use multiple cores. Good luck... |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Programming language for ICEM CFD? | Michael B | CFX | 2 | January 11, 2007 09:06 |
Programming knowledges for CFD users | Everton | Main CFD Forum | 3 | September 7, 2006 07:09 |
Programming in CFD | Lam | Main CFD Forum | 7 | May 27, 2004 05:12 |
new CFD Programming Forum | Thinker | Main CFD Forum | 14 | November 19, 2002 16:03 |
Where do we go from here? CFD in 2001 | John C. Chien | Main CFD Forum | 36 | January 24, 2001 21:10 |