# comparison of discretization scheme

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 14, 2017, 09:43 comparison of discretization scheme #1 Senior Member   A. Min Join Date: Mar 2015 Posts: 305 Rep Power: 12 Hi all according to Verstig CFD book (and also Patankar) I want to see the effect of the discretization scheme on the results (especially diffusion error in upwind scheme and unboundedness in central scheme). For this purpose I want to solve the equation of T like: div (phi , T) = 0 (diffusion term should be removed (to see numerical diffusion)) beside the continuity and momentum eqn. in a steady state mood with openfoam(where phi is the flux). I have gotten the result by Upwind scheme, but unfortunately I can't solve the eqn. with central scheme! my solution become diverge. Do you know why? I want to compare the result of two schemes. Thanks

December 14, 2017, 11:21
#2
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,793
Rep Power: 71
Quote:
 Originally Posted by alimea Hi all according to Verstig CFD book (and also Patankar) I want to see the effect of the discretization scheme on the results (especially diffusion error in upwind scheme and unboundedness in central scheme). For this purpose I want to solve the equation of T like: div (phi , T) = 0 (diffusion term should be removed (to see numerical diffusion)) beside the continuity and momentum eqn. in a steady state mood with openfoam(where phi is the flux). I have gotten the result by Upwind scheme, but unfortunately I can't solve the eqn. with central scheme! my solution become diverge. Do you know why? I want to compare the result of two schemes. Thanks
This is an exercise for students, just see the book of Peric & Ferziger to study this issue

 December 14, 2017, 11:24 #3 Member   Ravindra Shende Join Date: Feb 2011 Location: Pune, India Posts: 45 Rep Power: 15 Central difference scheme is unstable for this equation, that is why your solution is diverging. You will have to add diffusion artificially in order to stabilize the scheme and get a converged solution.

 December 14, 2017, 13:27 #4 Senior Member   Martin Hegedus Join Date: Feb 2011 Posts: 500 Rep Power: 19 As a general statement, it will be challenging to compare something to central difference. Central difference requires artificial dissipation and the required amount will depend on things like boundary conditions, time marching, how you start the solution (impulse or gradual start), and the form of dissipation itself. Creating a good central difference methodology will allow you to minimize the amount of artificial dissipation, though you may not get to zero. One option is for you to compare things in 1-D. Depending on what you're doing, you may not need artificial viscosity for central difference. For example, I've been able to get away with zero artificial viscosity for some sub-sonic compressible 1-D Euler runs in conservative form. But that is for 1-D only. 2-D and 3-D are different stories.

December 15, 2017, 07:09
#5
Senior Member

A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
Quote:
 Originally Posted by Ravindra Shende Central difference scheme is unstable for this equation, that is why your solution is diverging. You will have to add diffusion artificially in order to stabilize the scheme and get a converged solution.
Hi
But some body did it :
http://openfoam.blogfa.com/post/112

December 15, 2017, 07:13
#6
Senior Member

A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
Quote:
 Originally Posted by Martin Hegedus As a general statement, it will be challenging to compare something to central difference. Central difference requires artificial dissipation and the required amount will depend on things like boundary conditions, time marching, how you start the solution (impulse or gradual start), and the form of dissipation itself. Creating a good central difference methodology will allow you to minimize the amount of artificial dissipation, though you may not get to zero. One option is for you to compare things in 1-D. Depending on what you're doing, you may not need artificial viscosity for central difference. For example, I've been able to get away with zero artificial viscosity for some sub-sonic compressible 1-D Euler runs in conservative form. But that is for 1-D only. 2-D and 3-D are different stories.
Thank you Martin
My problem is 1D, steady and pure diffusion. somebody has done it before, but I can't get results!
http://openfoam.blogfa.com/post/112

December 15, 2017, 11:52
#7
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,793
Rep Power: 71
Quote:
 Originally Posted by alimea Thank you Martin My problem is 1D, steady and pure diffusion. somebody has done it before, but I can't get results! http://openfoam.blogfa.com/post/112
pure convection or pure diffusion???

December 15, 2017, 18:07
#8
Senior Member

Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,683
Rep Power: 66
Quote:
 Originally Posted by alimea Thank you Martin My problem is 1D, steady and pure diffusion. somebody has done it before, but I can't get results! http://openfoam.blogfa.com/post/112
div (phi , T) = 0 is a pure advection equation. And central differencing does not play happy with this. Pure diffusion on the other hand...

December 16, 2017, 03:34
#9
Senior Member

A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
Quote:
 Originally Posted by FMDenaro pure convection or pure diffusion???
Oh! I typed it wrong! my goal was "pure convection".

December 16, 2017, 04:01
#10
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,793
Rep Power: 71
Quote:
 Originally Posted by alimea Oh! I typed it wrong! my goal was "pure convection".

Again, have a look to the book of Peric and Ferziger. Then, to understand the characteristics of a first and second order FD derivative you can just have a look to the local truncation error in physical and wavenumbers space. That is a classical topi for students in CFD.

December 16, 2017, 04:12
#11
Senior Member

A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
Quote:
 Originally Posted by LuckyTran div (phi , T) = 0 is a pure advection equation. And central differencing does not play happy with this. Pure diffusion on the other hand...
I typed it wrong! my goal was "pure convection".
So, how did he solve that equation?!
It means that we never can solve the pure advection eqn. with central scheme?

December 16, 2017, 04:12
#12
Senior Member

A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
Quote:
 Originally Posted by FMDenaro Again, have a look to the book of Peric and Ferziger. Then, to understand the characteristics of a first and second order FD derivative you can just have a look to the local truncation error in physical and wavenumbers space. That is a classical topi for students in CFD.
Ok
thank you

 December 17, 2017, 11:10 #13 Senior Member   Martin Hegedus Join Date: Feb 2011 Posts: 500 Rep Power: 19 I'm unable to read the language that page is written in and I'm not very good at Openfoam and its terminology. My question is, are you solving for velocity or is it fixed and what you're solving for is an uncoupled transport equation? Given what I saw on that page I'm hesitant to say artificial viscosity is required. Granted, as a general statement, it is required. An underlying assumption for central differencing is that the system is continuous, i.e. (+) and (-) derivatives are equal. Unfortunately, numerically the system is discontinuous, even for a physically continuous system, if there are Taylor series truncation errors. And I'm under the impression that what is shown on that page may be low order, thus little truncation error. Same as with my 1-D problem, channel flow with area change. In that case Area*rho*U is constant at all points. Thus, if it's in conservative form and solving for steady state implicitly, it's zero order. Of course there can always be a bug in your code, but I would suggest initializing your run with the exact answer or your upwind scheme solution, and see where things go. But, again, I have little idea about how Openfoam goes about things, so the solution methodology may introduce higher order noise, in which case bye-bye solution. Edit: when I wrote that (+) and (-) derivatives are equal, I meant forward and backward derivatives.

December 18, 2017, 13:37
#14
Senior Member

Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,683
Rep Power: 66
Quote:
 Originally Posted by alimea I typed it wrong! my goal was "pure convection". So, how did he solve that equation?! It means that we never can solve the pure advection eqn. with central scheme?
What you are trying to do is solve a pure advection equation.

"he" did not solve the pure convection equation. He was solving the full advection-diffusion equation. However, the BC's such that there is no physical diffusion. Notice the BC's in the problem setup. Numerical diffusion stabilizes the problem.

The problem is you are trying to eliminate the diffusion term entirely and solve only the advection part from the governing equations and hence your problem.

December 19, 2017, 01:21
#15
Senior Member

A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
Quote:
 Originally Posted by Martin Hegedus I'm unable to read the language that page is written in and I'm not very good at Openfoam and its terminology. My question is, are you solving for velocity or is it fixed and what you're solving for is an uncoupled transport equation? Given what I saw on that page I'm hesitant to say artificial viscosity is required. Granted, as a general statement, it is required. An underlying assumption for central differencing is that the system is continuous, i.e. (+) and (-) derivatives are equal. Unfortunately, numerically the system is discontinuous, even for a physically continuous system, if there are Taylor series truncation errors. And I'm under the impression that what is shown on that page may be low order, thus little truncation error. Same as with my 1-D problem, channel flow with area change. In that case Area*rho*U is constant at all points. Thus, if it's in conservative form and solving for steady state implicitly, it's zero order. Of course there can always be a bug in your code, but I would suggest initializing your run with the exact answer or your upwind scheme solution, and see where things go. But, again, I have little idea about how Openfoam goes about things, so the solution methodology may introduce higher order noise, in which case bye-bye solution. Edit: when I wrote that (+) and (-) derivatives are equal, I meant forward and backward derivatives.

The velocity is fixed. I'm solving T as a scalar in div(phi,T)=0 where phi is the mass flux (rho*U).

I wrote a code for this problem:
div(phi , T) = 0

for 2D domain:

Fe.Te - Fw.Tw + Fn.Tn - Fs.Ts = 0

rho, U and A in all of the cells are equal. so:
Fe = Fw = Fn = Fs

and :
Te - Tw + Tn - Ts = 0

if we use "upwind" scheme, we have:
Tp-Tw+Tp-Ts=0

and finally:
Tp = 0.5 * (Ts + Tw)

I got good result for the upwind scheme.

but if I want to use "central" scheme:

(Fe - Fw + Fn - Fs) * Tp = Fw*TW - Fe*TE + Fs*TS - Fn*TN

Tp = (Fw*TW - Fe*TE + Fs*TS - Fn*TN) / (Fe - Fw + Fn - Fs)

rho, U and A in all of the cells are equal. so:
Fe = Fw = Fn = Fs
and the denominator of Tp become zero!

Tp = (TW - TE + TS - TN) / (0) !!!!!!

is it correct?
according to what I typed (if it is correct!), we never can use central scheme for pure advection equation. yes?

Thanks

December 19, 2017, 01:36
#16
Senior Member

A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
Quote:
 Originally Posted by LuckyTran What you are trying to do is solve a pure advection equation. "he" did not solve the pure convection equation. He was solving the full advection-diffusion equation. However, the BC's such that there is no physical diffusion. Notice the BC's in the problem setup. Numerical diffusion stabilizes the problem. The problem is you are trying to eliminate the diffusion term entirely and solve only the advection part from the governing equations and hence your problem.
Oh! I think you are right!
some questions:
1- Could you please write the equation that he used? I want to solve this problem
div(phi,T) = ??? (numerical diffusion)

2- As you see in my answer to Martin, I solved this problem with upwind scheme. But I didn't mention Numerical diffusion nor physical diffusion and I could see the numerical diffusion in contour of T. is it wrong? (that I didn't mention Numerical diffusion)

3- I want to find out the concept of "Numerical diffusion" or "false diffusion". I have read Patankar and some other cfd books. but I didn't get that! could you please explain it? or give me a reference to read about it?

Thank you

 December 19, 2017, 01:47 #17 Senior Member   Martin Hegedus Join Date: Feb 2011 Posts: 500 Rep Power: 19 The problem needs to be marched forward in time so that the matrix is not singular. What needs to be solved is: dT/dt + div(T*rho*V) = 0.

December 19, 2017, 04:06
#18
Senior Member

A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
Quote:
 Originally Posted by Martin Hegedus The problem needs to be marched forward in time so that the matrix is not singular. What needs to be solved is: dT/dt + div(T*rho*V) = 0.
but the problem is steady state and when it converges, we have:

Tp = (TW - TE + TS - TN) / (0)

 December 19, 2017, 04:30 #19 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,793 Rep Power: 71 In discrete form, without considering BC.s, you have a system like A.x=0 so, to avoid to get only the solution x=0 what condition do you need?

December 19, 2017, 05:14
#20
Senior Member

A. Min
Join Date: Mar 2015
Posts: 305
Rep Power: 12
Quote:
 Originally Posted by FMDenaro In discrete form, without considering BC.s, you have a system like A.x=0 so, to avoid to get only the solution x=0 what condition do you need?
I think we need:
det (A) should be non-zero

thanks

 Tags central, discretization, openfoam, unboundedness, upwind