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

can i use cfd using matlab

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 3 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 27, 2012, 08:30
Default can i use cfd using matlab
  #1
New Member
 
ashraf H
Join Date: Sep 2012
Posts: 1
Rep Power: 0
ashraf80 is on a distinguished road
Dear all

can i use CFD Using MATLAB

if answer is yes ? if u have examples ,books ,thesis

i need to use CFD Using MATLAB for buildings (high rise building)
help me please
ashraf80 is offline   Reply With Quote

Old   September 27, 2012, 10:49
Default
  #2
New Member
 
Join Date: Sep 2012
Posts: 3
Rep Power: 13
juanelo14 is on a distinguished road
Yes you can. I don't know how much experience do you have in Matlab, but you can use fortran codes or C++ codes as a guide, and adapt it to MAtlab.
juanelo14 is offline   Reply With Quote

Old   September 27, 2012, 11:05
Default
  #3
New Member
 
Join Date: Sep 2012
Posts: 3
Rep Power: 13
juanelo14 is on a distinguished road
if you are new with this maybe this book can help you: "Applied Numerical Methods Using MATLAB" Won Y. Yang, Wenwu Cao,Tae-Sang Chung and John Morris.
juanelo14 is offline   Reply With Quote

Old   September 27, 2012, 11:41
Default
  #4
Member
 
Francesco Capuano
Join Date: May 2010
Posts: 81
Rep Power: 15
francesco_capuano is on a distinguished road
What do you think about the performances of Matlab with respect to Fortran or C/C++, for what concerns CFD-related codes? Does it work well in parallel?

I was wondering if a well-written Matlab code can be as fast as (or even faster than) consolidated languages such as Fortran or C.
francesco_capuano is offline   Reply With Quote

Old   September 27, 2012, 12:57
Default
  #5
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

Quote:
I was wondering if a well-written Matlab code can be as fast as (or even faster than) consolidated languages such as Fortran or C.
Short answer: NEVER! Never will MATLAB be faster than any properly code and compiled FORTRAN/C code, in terms of CPU performance and energy efficiency. Unless (a lot of) cheating is involved...


Long and rant'ish answer: I just got give my two (or ten) cents here
I've got plenty of experience coding with MATLAB, FORTRAN, C/C++ and I've even made C mex-files to speed up performance in performance-critical code that was running in MATLAB.

Unless todays MATLAB has super-evolved (it's been 5 years since last time I did any high performance related coding in MATLAB), but the principle should remain the same today:
  • MATLAB was created with fast and intuitive development of working code.
    It has evolved considerably over the years and todays MATLAB should be seriously faster than the first versions of MATLAB... 2... maybe 4 times faster than 15 years ago? I don't know any numbers on this.
    But it will get it's ***** kicked any day by a very well written code in FORTRAN, C or even C++, when it comes to CPU performance. Assuming of course, you've compiled the code properly and have a working binary executable
  • The reason is simple: FORTRAN and C have been created with performance in mind, and ease of use as a second choice... or in other words: FORTRAN and C are higher-level languages than Assembly or even pure machine code.
  • Because if you truly want performance, you've gotta go with Assembly or even pure bare metal machine code
    It'll take you a lot longer to code... and all sanity will escape you... but it'll be faster than anything you've ever seen... on that processor you're using ...
Anyway, you'll find better/more answers out on the Internet about "MATLAB vs C" and/or "MATLAB vs FORTRAN"

The end result is usually always the same:
  • In MATLAB you can code something in a couple of minutes and it will run for several hours.
  • Or you can code in FORTRAN/C in a couple of hours and it will run under a minute ... if not under a second
Last but not least: when it comes to CFD, it all depends on what you need the code to do!? Fast running or fast development?


And then there's always the power factor: if you have only a few of hours to develop the code from scratch, but have a super-computer near by, then by all means, use MATLAB assuming it's already installed and tested on said super-computer...
Of course this also assumes you've got a lot of experience in coding said specific CFD code you're planning on using... because CFD is a mathematical world in it's own right...

Have fun!
Bruno
mb.pejvak, michujo and metmet like this.
__________________
wyldckat is offline   Reply With Quote

Old   September 28, 2012, 04:13
Default
  #6
Member
 
Francesco Capuano
Join Date: May 2010
Posts: 81
Rep Power: 15
francesco_capuano is on a distinguished road
Thank you Bruno, I guess I couldn't hope for a better answer
francesco_capuano is offline   Reply With Quote

Reply


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 in matlab Dougal MCQueen Main CFD Forum 1 December 5, 2003 06:45
Where do we go from here? CFD in 2001 John C. Chien Main CFD Forum 36 January 24, 2001 21:10
ASME CFD Symposium, Atlanta, July 2001 Chris R. Kleijn Main CFD Forum 0 September 13, 2000 04:48
ASME CFD Symposium, Atlanta, July 2001 Chris R. Kleijn Main CFD Forum 0 August 21, 2000 04:49
Which is better to develop in-house CFD code or to buy a available CFD package. Tareq Al-shaalan Main CFD Forum 10 June 12, 1999 23:27


All times are GMT -4. The time now is 02:15.