CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Is Matlab an appropriate option? (https://www.cfd-online.com/Forums/main/7651-matlab-appropriate-option.html)

Leo June 8, 2004 01:52

Is Matlab an appropriate option?
 
Is Matlab an appropriate option for writing CFD code?

I know its capable of producing fancy graphics. I am not sure whether it can handle data like Fortran or C/C++.

tejas June 8, 2004 02:00

Re: Is Matlab an appropriate option?
 
Is matlab an appropriate option for writing cfd codes.

Jim_Park June 8, 2004 13:07

Re: Is Matlab an appropriate option?
 
I have no personal experience, but have talked to several people who use it.

Their story is:

Matlab's great for developing algorithms and running small problems (as in 2-d or very coarse meshes), but is too slow to run quantitative simulations. For that, they have a graduate student redo the algorithm in Fortran or C++.

Sounds like a 'yes and no', doesn't it?

alex June 8, 2004 13:53

Re: Is Matlab an appropriate option?
 
Great point. In my experience matlab/maple/mathematica and such are great tools in doing graduate research in new cfd algorithm development because of the build-in functions, matrix operations, symbolic manipulations and such. As mentioned above, you are confined to 2d and rather coarse meshes. Efficient algorithm implementation on finer meshes both 2d and 3d would require writing your own code or using some 3rd party stuff, you could still do the data post processing part using matlab though.

noName June 8, 2004 15:56

Re: Is Matlab an appropriate option?
 
I have written several CFD codes over the past few years, and I always found it useful to write the exact same code in MATLAB first and test it on a small case. Matlab offers functions capability, global variables, structures, complex arrays, ease with strings, and whole bunch of built in functions. Once your code is running in MATLAB, it is easy to migrate it to fortran (of course, re-writing it); It surely helps you develop a strong intuition of what's going on, it's easy and fast to visualize data and conduct dynamic tests while the code is running (e.g. divergence free, etc).

There is an old saying in engineering: "If it's possible, MATLAB can do it"

Scott June 19, 2004 14:38

Re: Is Matlab an appropriate option?
 
I agree that MATLAB is great for code development, and has good visualization tools, but has too much overhead for large (3-D) problems.

You may be able to get around this limitation by utilizing FORTRAN subroutines for the numerically intersive parts of your code. If you are using the finite volume method, this will probably be the pressure correction.

MATLAB will let you call FORTRAN subroutines as if they were built-in functions using MEX files. You will require a FORTRAN compiler that is compatible with MATLAB.

Good Luck


All times are GMT -4. The time now is 13:21.