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

Cell-centered and Face-centered values

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 7, 2005, 01:29
Default Cell-centered and Face-centered values
  #1
coolblizz
Guest
 
Posts: n/a
Hi....

I am working on a flow problem using FVM on non-orthogonal grids. I need to extrapolate the cell-centered values to the face-center of the computational cell.

For the extrapolation, I add the scalar product of the cell-centered gradient and the distance between the face-center and cell-center, to the cell-centered value. The cell-centered gradient is calculated using the Gauss Theorem.

My problem is, the Gauss Theorem requires the face-centered values to be first available in order to calculate the gradient.

Can anyone please help me with this dilemma?

Thank you so much.

  Reply With Quote

Old   July 7, 2005, 05:26
Default Re: Cell-centered and Face-centered values
  #2
ramp
Guest
 
Posts: n/a
You might find your solution in the folowing book: Computational Methods For Fluid Dynamics by Ferziger, J. H. & Peric,M.
  Reply With Quote

Old   July 7, 2005, 11:08
Default Re: Cell-centered and Face-centered values
  #3
O.
Guest
 
Posts: n/a
use a least squares approach to compute your gradients
  Reply With Quote

Old   July 7, 2005, 12:45
Default Re: Cell-centered and Face-centered values
  #4
Mani
Guest
 
Posts: n/a
Why do you need extrapolation? Interpolation between neighboring cells is not an option? Your dilemma stems from a lack of information. If you have only cell centered values available, you need to make use of information from neighboring cells.
  Reply With Quote

Old   July 8, 2005, 00:16
Default Re: Cell-centered and Face-centered values
  #5
coolblizz
Guest
 
Posts: n/a
Hi....

Thank your so much for your response.

Ramp, I have gone through that book by Peric before, but it only describes how to calculate for the cell-centered gradients. My problem stems from how to find the gradients, which must be available first for the gradient calculation....

O., could you please describe how to use the least squares method?

Mani, yes, I do mean interpolating between neighbouring cells. Can you please tell me how to interpolate between neighbouring cells on non-orthogonal grids?

Thank you so much.
  Reply With Quote

Old   July 8, 2005, 01:10
Default Re: Cell-centered and Face-centered values
  #6
zxaar
Guest
 
Posts: n/a
for gradient calculations, what you do is to store the last calculated gradient in old arrays, like

dUdX_old, etc.

so when you need face values use these _old gradients to calculate the values at the face center.

and once the gradient is done, update these _old gradients with latest values.

this way after iterations, when you reach convergence , these _old values are not much varying and do not create much difference. hope this solves the problem.

  Reply With Quote

Old   July 8, 2005, 11:43
Default Re: Cell-centered and Face-centered values
  #7
coolblizz
Guest
 
Posts: n/a
Hi Zxaar...

Your method seems to make sense, at least it solves the dilemma issue of needing the gradient before finding it. I will try out this method.

Can this method be also applied to interpolating the individual velocity components, before a Riemann procedure on both sides of the cell face is done?

My only worry is the disagreement between the old face-centered values and the current cell-centered values.

Thank you so much for your suggestion.

  Reply With Quote

Old   July 8, 2005, 11:45
Default Re: Cell-centered and Face-centered values
  #8
coolblizz
Guest
 
Posts: n/a
Hi O....

Could you please describe how to use the least squares method? Or is there any easy-to-understand books/articles on this approach?

Thank you.
  Reply With Quote

Old   July 8, 2005, 11:47
Default Re: Cell-centered and Face-centered values
  #9
coolblizz
Guest
 
Posts: n/a
Hi Mani....

Yes, I do mean interpolating between neighbouring cells. Can you please tell me how to interpolate between neighbouring cells on non-orthogonal grids?

Thank you.
  Reply With Quote

Old   July 8, 2005, 14:59
Default Re: Cell-centered and Face-centered values
  #10
Mani
Guest
 
Posts: n/a
Take an average of two neighboring cell centers to define the variables at the face between the cell centers. For higher order approximations you may need to take the distances between face and cell-centers into account, but assuming you have a relatively good grid (aspect ratios not too high), then you would simply take the arithmetic average. This is consistent with a second order scheme.
  Reply With Quote

Old   July 9, 2005, 00:49
Default Re: Cell-centered and Face-centered values
  #11
Praveen
Guest
 
Posts: n/a
Or you could form a new cell by joining the centroids of the neighbouring cells, and apply Green-Gauss theorem on this new cell.
  Reply With Quote

Old   July 9, 2005, 11:53
Default Re: Cell-centered and Face-centered values
  #12
coolblizz
Guest
 
Posts: n/a
Hi Mani....

I am actually doing what you are recommending by taking the average for the face values as a preliminary step. Then I do the extra step of considering the distance between the cell center and face as a further update to the face value.

Just a further question, can interpolating a velocity from cell center to face center be done the same as when interpolating a scalar?
  Reply With Quote

Old   July 10, 2005, 23:08
Default Re: Cell-centered and Face-centered values
  #13
zxaar
Guest
 
Posts: n/a
if you honestly ask me, what would i prefer between the method i told you and between taking simple average of two cells as face value for gradient calculations, i would prefer average of two cells.

the reason is this, earlier my code use to work with the method i mentioned you, but then i observed that my code runs well with sturctured meshes but suddenly diverges with unstructured meshes, for three months i tried everythign but couldn't find any problem. since thre were no problems with the code i wrote.

well then i always used to wonder that same mesh runs well in fluent, the question was why?

i found that the only thing me and fluent do differntly is they take average for gradient calculations and i bother too much (like you) about the face values. so then i wrote new grad function with averages, and yes after that my code has not diverged.

hope this will help.
  Reply With Quote

Old   July 11, 2005, 11:58
Default Re: Cell-centered and Face-centered values
  #14
coolblizz
Guest
 
Posts: n/a
Hi Zxaar....

Thank you very much for the information. Precisely, as what you have said, I have this nagging worry about whether averaging is sufficient. Your findings have put that worry of mine to rest. Thank you so much again.
  Reply With Quote

Old   July 12, 2005, 00:47
Default Re: Cell-centered and Face-centered values
  #15
Mani
Guest
 
Posts: n/a
Yes. No problem. Think of each velocity component as a scalar quantity.
  Reply With Quote

Old   July 12, 2005, 00:53
Default Re: Cell-centered and Face-centered values
  #16
Mani
Guest
 
Posts: n/a
true. this wasn't quite the original question, but it's actually a better way to obtain the derivatives. in this case, the derivatives will be vertex based, not cell centered. you can then obtain face-centered derivatives by averaging four vertices on each face. essentially you're ending up with a larger stencil, but it's more robust.
  Reply With Quote

Old   July 12, 2005, 01:38
Default Re: Cell-centered and Face-centered values
  #17
zxaar
Guest
 
Posts: n/a
mani fluent also gives user and option to use node based gradient (as you just mentioned), and according to them its better to use.
  Reply With Quote

Old   July 13, 2005, 04:38
Default Re: Cell-centered and Face-centered values
  #18
O.
Guest
 
Posts: n/a
Sorry for the somewhat late reply.

To compute the gradient for a cell you can do the following:

Assume your cell has N neighbours and you know the values of your variables in the neigbouring cells, Q(i=1..N), and you also know the value in the cell you want to compute the gradients for Q(p). Assume further that you do have the gradient in the cell dQ/dx and dQ/dy. Now you can compute the values in the neighbouring cells with the help of a Taylor expansion (only linear):

Q'(i) = Q(p) + dQ/dx*(x(i)-x(p) + dQ/dy*(y(i)-y(p))

The values Q and Q' are different, unless Q is a linear function. Now you compute the error squares for all neighbours:

err^2(i) = (Q(i) - Q'(i))^2

and sum them. The sum of all error squares

S = sum(err^2(i),i=1..N)

will be a function of dQ/dx and dQ/dy, the gradients in your cell. To minimise the error square you differentiate S and then you have to solve the following system of equations:

dS/(dQ/dx) = 0 dS/(dQ/dy) = 0

This is a simple set of linear equations and it is easy to solve. Please let me know if this is helpfull. If you want, I can send you a small piece of C++ source code, which does exactly this. The extension to three dimensions is straight forward, just add dQ/dz and that's it.

Cheers, O.
  Reply With Quote

Old   July 13, 2005, 12:17
Default Re: Cell-centered and Face-centered values
  #19
coolblizz
Guest
 
Posts: n/a
Hi Mani....

Thank you very much for your reply. It certainly goes a long way in clearing up this age-old doubts of mine.
  Reply With Quote

Old   July 13, 2005, 12:50
Default Re: Cell-centered and Face-centered values
  #20
coolblizz
Guest
 
Posts: n/a
Hi O....

In your 1st equation, Q'(i) = Q(p) + dQ/dx*(x(i)-x(p) + dQ/dy*(y(i)-y(p)),

is Q'(i) the face-centered value and Q(p) the cell-centered value? Then the expression is an extrapolation from the cell-center to the face-center, am I right? It looks very similar to the method I am using now.

After the minimization of the error squares, are the gradients dQ/dx and dQ/dy the subjects? And I plough these gradients back into the 1st equation to get an update for Q'(i)?

I will be most grateful if you can let me have a copy of the C++ code that you have. I hope it comes with some documentations.

Thank you so much for your help.
  Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use of face centered differences in gradient computation henningh OpenFOAM 2 August 25, 2011 11:41
face and cell centered values danihuso OpenFOAM 0 July 17, 2009 11:01
Face centered or vertex centered tommy CFX 2 November 13, 2008 00:52


All times are GMT -4. The time now is 19:23.