CFD and programming
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++ ?
Characteristics of programming language
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
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.
Its better to go for C/C++
Matlab for CFD programing
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
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?
Visualisation in Paraview
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.
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....
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 ?
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.
|All times are GMT -4. The time now is 03:09.|