CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Basic questions on CFD theory (http://www.cfd-online.com/Forums/main/93317-basic-questions-cfd-theory.html)

CThib October 11, 2011 14:03

Basic questions on CFD theory
 
Hi all,

I've done beginner level work with CFX and OpenFOAM, but I'm still trying to wrap my head around some of the basic concepts related to how these solvers actually work.
What exactly is going on in the solver when it iterates to find a solution? I realize this question is so dependent on the type of analysis being conducted that it nearly renders the question invalid, but bear with me. Is it 'iterating' in the sense of how any non-linear solver might proceed, e.g., Newton-Raphson iteration in the simplest case or something as sophisticated as Excel's solver, or is the solution at each iteration a valid solution, just not the 'particular' solution requested (as manifested in the tolerance/residual parameters).


I do wish to pursue a Master's degree in this stuff, but until then, does anybody have any advice on how to tackle the theory on your own? I'm struggling with the disconnect between really great material that describes the theory (John Anderson Intro to CFD, CFX modeling guide, this forum), vs the actual, seemingly insurmountable difficulties of, well, actually implementing it in a computer program.

My proficiencies are in programming and use of potential flow codes for large marine structures (AQWA/WAMIT).
Thanks.

CThib

cfdnewbie October 11, 2011 15:21

Hi friend,
what actually goes on inside a program depends on the type of solver you are using, that's true...but the basic concept is almost always the same.

Take the simplest PDE as a model for a fluid flow: linear scalar advection,

du/dt+du/dx=0

You probably know from Andersons book that such a problem is discretized in space and time, and solved in an appropriate way. Discretizing turns the above PDE into an algebraic equation, sth like

(u(n+1)_i-u(n)_i)/delta t =( - u(n)_i+1+u(n)_i) / delta x

where the ns denote the time level, and the is the spatial position.

So what your solver does is solve this equation for u(n+1) (the solution at the next time, or the end time) in an appropriate way. That's the magic behind CFD, and all schemes / models /codes etc differ in the way (accuracy, efficiency, "elegance") they do it.

I hope this helps, if not, just keep asking, I'm happy to answer to the best of my knowledge!

Cfd Newbie

leflix October 11, 2011 19:02

Quote:

Originally Posted by cfdnewbie (Post 327526)

Take the simplest PDE as a model for a fluid flow: linear scalar advection,

du/dt+du/dx=0

Discretizing turns the above PDE into an algebraic equation, sth like

(u(n+1)_i-u(n)_i)/delta t =( - u(n)_i+1+u(n)_i) / delta x

where the ns denote the time level, and the is the spatial position.


Cfd Newbie

Sorry cfdnewbie, but if you start in your example with a discretizing scheme (forward 1st derivative) which is unconditionnally unstable for this well known hyperbolic equation, I'm afraid you will confuse our friend CThib... lol

cfdnewbie October 12, 2011 03:12

Quote:

Originally Posted by leflix (Post 327558)
Sorry cfdnewbie, but if you start in your example with a discretizing scheme (forward 1st derivative) which is unconditionnally unstable for this well known hyperbolic equation, I'm afraid you will confuse our friend CThib... lol


Hey leflix,
I admit my basic cfd course has been a while, but I'm 99.9% sure that an upwind spatial scheme with the Euler time integrator I used is stable for reasonable CFL - a central scheme would be unconditionally unstable, but an upwind is certainly not ;)

Cheers!

leflix October 12, 2011 04:30

Quote:

Originally Posted by cfdnewbie (Post 327592)
I'm 99.9% sure that an upwind spatial scheme with the Euler time integrator I used is stable for reasonable CFL - a central scheme would be unconditionally unstable, but an upwind is certainly not ;)

Cheers!

Hi Cfdnewbie,

you are 100% right about the fact that upwind scheme is stable (under CFL condition) but unfortunately for you the scheme you just proposed to Cthib is not he upwind scheme but the forward scheme. And this one is unconditionally unstable.
I think a simple refresh of your basic CFD courses will be enough ;)

cfdnewbie October 12, 2011 04:59

Bah, you are so right, darn typo! but instead of changing my wonderfully unstable scheme, I 'll change the problem to fit it by changing the direction of the advection... :) no, just kidding. Thanks for correcting me, the scheme should read:


(u(n+1)_i-u(n)_i)/delta t =-(u(n)_i-1+u(n)_i-1) / delta x

so an upwind formulation, not a downwind one....

leflix October 12, 2011 08:08

Quote:

Originally Posted by cfdnewbie (Post 327612)
the scheme should read:


(u(n+1)_i-u(n)_i)/delta t =-(u(n)_i-1+u(n)_i-1) / delta x

so an upwind formulation, not a downwind one....


not exactly again !!! ;)

(u(n+1)_i-u(n)_i)/delta t =-(u(n)_i - u(n)_i-1) / delta x

please cfdnewbie you should take some vacancies :)

no but this is a typo for sure !

cfdnewbie October 12, 2011 12:22

haha, I guess I will let you do the math, and focus more explaining the conceptual ideas :)

leflix October 12, 2011 12:52

ok let's do that ! ;)

CThib October 13, 2011 16:32

Hi friends,

Thank you both for the replies, sorry it took me so long to acknowledge you.

"Upwind" refers to the direction in which the solution propogates?

leflix October 13, 2011 18:32

Hi CThib,

check this post:

http://www.cfd-online.com/Forums/mai...g-schemes.html

as well as:
http://www.cfd-online.com/Wiki/Appro...grids_-_Common

you should understand some stuffs...

CThib October 13, 2011 21:07

Thank you very much leflix, your post in that thread explains it perfectly.

juliom October 17, 2011 08:50

Dear friend.
Remember that CFD softawares, solves the Navier stokes equation, but it uses some scheme to operate the non linearities.
It is very complicate to explain here, but it is not hard to understand. The most importat to say is that, program solve and "standard" type of equation, which has, a transtive part, convective, diffusive and a soruce term, there you have.
In the other hand you have the algorithm to solve it, the normalyy use the TDMA instead of Newtow raphsonj and there a lot of reason to choose it.
I DO recommend you to read the book of patankar or malalasekera before starting yu master degree.
I am finising my master degree on CFD, and before starting it I was working on it. I f you want I can share with you a digital copy of patankar book. from my point of view it is the most omplete an easy to understand.
Good luck, and forgive me for my english mistakes!!!


All times are GMT -4. The time now is 20:05.