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

comparison of discretization scheme

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 14, 2017, 10:43
Default comparison of discretization scheme
  #1
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
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
alimea is offline   Reply With Quote

Old   December 14, 2017, 12:21
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by alimea View Post
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
FMDenaro is online now   Reply With Quote

Old   December 14, 2017, 12:24
Default
  #3
Member
 
Ravindra Shende
Join Date: Feb 2011
Location: Pune, India
Posts: 45
Rep Power: 15
Ravindra Shende is on a distinguished road
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.
Ravindra Shende is offline   Reply With Quote

Old   December 14, 2017, 14:27
Default
  #4
Senior Member
 
Martin Hegedus
Join Date: Feb 2011
Posts: 500
Rep Power: 19
Martin Hegedus is on a distinguished road
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.
Martin Hegedus is offline   Reply With Quote

Old   December 15, 2017, 08:09
Default
  #5
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by Ravindra Shende View Post
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
thanks for your answer
But some body did it :
http://openfoam.blogfa.com/post/112
alimea is offline   Reply With Quote

Old   December 15, 2017, 08:13
Default
  #6
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by Martin Hegedus View Post
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
alimea is offline   Reply With Quote

Old   December 15, 2017, 12:52
Default
  #7
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by alimea View Post
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???
FMDenaro is online now   Reply With Quote

Old   December 15, 2017, 19:07
Default
  #8
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,754
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Quote:
Originally Posted by alimea View Post
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...
LuckyTran is offline   Reply With Quote

Old   December 16, 2017, 04:34
Default
  #9
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
pure convection or pure diffusion???
Oh! I typed it wrong! my goal was "pure convection".
alimea is offline   Reply With Quote

Old   December 16, 2017, 05:01
Default
  #10
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by alimea View Post
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.
FMDenaro is online now   Reply With Quote

Old   December 16, 2017, 05:12
Default
  #11
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
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?
alimea is offline   Reply With Quote

Old   December 16, 2017, 05:12
Default
  #12
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
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
alimea is offline   Reply With Quote

Old   December 17, 2017, 12:10
Default
  #13
Senior Member
 
Martin Hegedus
Join Date: Feb 2011
Posts: 500
Rep Power: 19
Martin Hegedus is on a distinguished road
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.
Martin Hegedus is offline   Reply With Quote

Old   December 18, 2017, 14:37
Default
  #14
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,754
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Quote:
Originally Posted by alimea View Post
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.
LuckyTran is offline   Reply With Quote

Old   December 19, 2017, 02:21
Default
  #15
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by Martin Hegedus View Post
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
alimea is offline   Reply With Quote

Old   December 19, 2017, 02:36
Default
  #16
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by LuckyTran View Post
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
alimea is offline   Reply With Quote

Old   December 19, 2017, 02:47
Default
  #17
Senior Member
 
Martin Hegedus
Join Date: Feb 2011
Posts: 500
Rep Power: 19
Martin Hegedus is on a distinguished road
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.
Martin Hegedus is offline   Reply With Quote

Old   December 19, 2017, 05:06
Default
  #18
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by Martin Hegedus View Post
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)
alimea is offline   Reply With Quote

Old   December 19, 2017, 05:30
Default
  #19
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,882
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
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?
FMDenaro is online now   Reply With Quote

Old   December 19, 2017, 06:14
Default
  #20
Senior Member
 
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12
alimea is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
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

please tell that your answer is for my which question.
thanks
alimea is offline   Reply With Quote

Reply

Tags
central, discretization, openfoam, unboundedness, upwind


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
comparison of discretization scheme alimea OpenFOAM Running, Solving & CFD 0 December 14, 2017 10:42
Temporal discretization Scheme CoEuler vsammartano OpenFOAM Running, Solving & CFD 0 April 12, 2016 08:06
Discretization Scheme dinesh FLUENT 0 August 31, 2013 05:52
Time discretization scheme HaKu Main CFD Forum 1 June 12, 2011 03:06
MARS discretization scheme raymond Siemens 3 February 1, 2002 06:33


All times are GMT -4. The time now is 14:07.