# CFD/MATLAB WizardsHelp Wanted

• MATLAB

## Main Question or Discussion Point

Okay then Here is another one of my ridiculous posts. Yay!

Let's say I want to write my own CFD code in MATLAB. Is does not need to be robust. I want it to be as simple as possible.

It should be able to solve a model that consists of only one, single grid cell.

I know that I will be solving seven equations simultaneously.

I know I need to give boundary conditions. But how many do I need? I have a six-sided grid cell. I am fairly sure that I need more than 1 BC, but less than 6.

I know that I have left out a fair amount of necessary info. I also know that this might be a lot more difficult than I am making it out to be. But I think I could learn a lot even by failing at it.

So what else do I need here? What exactly are the equations?

I know we have x,y,x momentum, Navier-Stokes (I think), some form of turbulence equation (probably k-Epsilon), continuity and Energy. Correct?

What's next?

Anyone who might be interested in joining me in this project, feel free! no experience required--I don't have much!

Casey

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org
minger
1 cell? You really can't have a single cell CFD program. You can start small though. Try writing a quasi-2D solver. Basically, you'll just have a "line" of grid points, each with an associated area. Since its 1D, you'll only need to solve 3 equations.

You'll need:
• A differencing routine (one that can take derivatives both in the main domain, and near the boundaries). I would recommend a central-differencing routine
• If you use a central-differencing routine, then you'll need a routine to add artificial dissipation. Again, both central domain, and near the boundaries
• A time marching routine. I would recommend a Runge-Kutta-style routine for stability.
• Boundary condition routines. These will be the most difficult. Boundary conditions are the biggest pain in the *** for CFD solvers. Start with Thompson-style boundary conditions and specify total pressure and temp at the inflow, and static pressure at the outflow
• Since you're only 1D, you won't be calculating turbulence, so you won't need to worry about it.

Definately start small with a 1D solver. You'd be surprised how much complexity even going to 2D adds. 3D is a whole-nother animal.

I have written finite difference solutions for simple CFD problems before. I would like to help if the offer is still open.

But I think I could learn a lot even by failing at it.
With that attitude, you will go far.

Thanks
Matt

That would be awesome! I will post back tomorrow or later tonight with more details on what I actually know about Fluid mechanics and CFD. It is very little. But I am willing to do a lot of reading on the subject.

Thanks again,
Casey

Sounds great.

Thanks
Matt

...."Computational Fluid Dynamics" by John D. Anderson...
Would you say that this book would be good if I am interested in a 'crash course' in CFD?

I am currently trying to read a book my boss lent me "An Intro To CFD" by Versteeg and Malalasekera and I want to gorge my eyes out.

I realise that no CFD text will be 'easy,' but I believe there has got to be one out there that dives into the concepts a little better as opposed to just being a long list of equations.

I wouldn't say Andersons's book is a crash course. This book will provide a great understand of how and what CFD is. It also provides a down to Earth approach to the mathematics. If you really want to understand CFD start with the Anderson book.

Also, once you get through Anderson you can better understand some of the higher level CFD books.

Thanks
Matt

Last edited:
I wouldn't say Andersons's book is a crash course. This book will provide a great understand of how and what CFD is. It also provides a down to Earth approach to the mathematics. If you really want to understand CFD start with the Anderson book.

Also, once you get through Anderson you can better understand some of the higher level CFD books.

Thanks
Matt
OK great. So it would be a good '1st Book' in CFD for someone with my background?

Yes, it is the first book that I used.

Thanks
Matt

minger
For people just getting started, a slightly quicker (than textbook) is the ARC2D paper put out by Thomas Pulliam. He has the paper on his website (U of Miss. IIRC). Basically, it was one of the first full solvers created, so the paper covers many topics of interest in CFD, particularly useful in describing implicit solver using LDI approaches.

Cool, never heard of that one. Is it a free publication?

Thanks
Matt

Cool, never heard of that one. Is it a free publication?

Thanks
Matt
If either of you guys find it, could you link it here? I am having trouble locating it. If it is the same Thomas Pulliam that is at NASA, a lot of the links are dead.

Minger: Is that U of "Missouri" ? Or "Mississippi" ?

If either of you guys find it, could you link it here? I am having trouble locating it. If it is the same Thomas Pulliam that is at NASA, a lot of the links are dead.

Minger: Is that U of "Missouri" ? Or "Mississippi" ?
Yeah. Every one of his links are dead. Maybe it's a coverup !?!

Yeah, I looked all over, and couldn't get anything other then dead links.

Maybe thats why I never heard of him or his paper. LOL

Thanks
Matt

minger
yea thats the guy...who is at Miss....

Sorry I was thinking of Thompson, who has a terrific book on grid generation located:
http://www.erc.msstate.edu/publications/gridbook/

but I digress. I think I have a copy of it though. Gimme a second. Linky
http://www.eng.utoledo.edu/~mheminge/ARC2D.pdf

Also some personal notes (some 100+ pages of nicely LaTeX'ed notes)
http://www.eng.utoledo.edu/~mheminge/CFD_Notes.pdf [Broken]

Enjoy!

Maybe thats why I never heard of him or his paper. LOL
He's a real important person in the field. Him and Anthony Jameson (http://aero-comlab.stanford.edu/jameson/ look through his website and you'll see [he was solving the 3D Eulers in 1981, multiblock a couple years later!]) come to mind as some of the leading pioneers in CFD.

Last edited by a moderator:
Minger, thanks. I have only written some very crude grid generators. Can't wait to get into the Thompson book.

Thanks
Matt

yea thats the guy...who is at Miss....

Sorry I was thinking of Thompson, who has a terrific book on grid generation located:
http://www.erc.msstate.edu/publications/gridbook/

but I digress. I think I have a copy of it though. Gimme a second. Linky
http://www.eng.utoledo.edu/~mheminge/ARC2D.pdf

Also some personal notes (some 100+ pages of nicely LaTeX'ed notes)
http://www.eng.utoledo.edu/~mheminge/CFD_Notes.pdf [Broken]

Enjoy!

Minger! That's stupendous of you! When I was searching for Pulliam, Google returned an old PF thread you replied to in which you offered up these notes.

I was going to PM you to see if you still had them but now I don't have too!

Thanks!

Last edited by a moderator:
minger
Good luck; the first like 4 chapters just set up the mathematics behind it all. I read and took notes over a bit of it. How much I understood though....

Update:

"Computational Fluid Dynamics" by John D. Anderson
Just ordered text. Got the "international Edition" 'cause I am cheap and fickle.

Great,

You will enjoy the book.

Thanks
Matt