
[Sponsors] 
July 7, 2005, 01:29 
Cellcentered and Facecentered values

#1 
Guest
Posts: n/a

Hi....
I am working on a flow problem using FVM on nonorthogonal grids. I need to extrapolate the cellcentered values to the facecenter of the computational cell. For the extrapolation, I add the scalar product of the cellcentered gradient and the distance between the facecenter and cellcenter, to the cellcentered value. The cellcentered gradient is calculated using the Gauss Theorem. My problem is, the Gauss Theorem requires the facecentered values to be first available in order to calculate the gradient. Can anyone please help me with this dilemma? Thank you so much. 

July 7, 2005, 05:26 
Re: Cellcentered and Facecentered values

#2 
Guest
Posts: n/a

You might find your solution in the folowing book: Computational Methods For Fluid Dynamics by Ferziger, J. H. & Peric,M.


July 7, 2005, 11:08 
Re: Cellcentered and Facecentered values

#3 
Guest
Posts: n/a

use a least squares approach to compute your gradients


July 7, 2005, 12:45 
Re: Cellcentered and Facecentered values

#4 
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.


July 8, 2005, 00:16 
Re: Cellcentered and Facecentered values

#5 
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 cellcentered 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 nonorthogonal grids? Thank you so much. 

July 8, 2005, 01:10 
Re: Cellcentered and Facecentered values

#6 
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. 

July 8, 2005, 11:43 
Re: Cellcentered and Facecentered values

#7 
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 facecentered values and the current cellcentered values. Thank you so much for your suggestion. 

July 8, 2005, 11:45 
Re: Cellcentered and Facecentered values

#8 
Guest
Posts: n/a

Hi O....
Could you please describe how to use the least squares method? Or is there any easytounderstand books/articles on this approach? Thank you. 

July 8, 2005, 11:47 
Re: Cellcentered and Facecentered values

#9 
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 nonorthogonal grids? Thank you. 

July 8, 2005, 14:59 
Re: Cellcentered and Facecentered values

#10 
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 cellcenters 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.


July 9, 2005, 00:49 
Re: Cellcentered and Facecentered values

#11 
Guest
Posts: n/a

Or you could form a new cell by joining the centroids of the neighbouring cells, and apply GreenGauss theorem on this new cell.


July 9, 2005, 11:53 
Re: Cellcentered and Facecentered values

#12 
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? 

July 10, 2005, 23:08 
Re: Cellcentered and Facecentered values

#13 
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. 

July 11, 2005, 11:58 
Re: Cellcentered and Facecentered values

#14 
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. 

July 12, 2005, 00:47 
Re: Cellcentered and Facecentered values

#15 
Guest
Posts: n/a

Yes. No problem. Think of each velocity component as a scalar quantity.


July 12, 2005, 00:53 
Re: Cellcentered and Facecentered values

#16 
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 facecentered derivatives by averaging four vertices on each face. essentially you're ending up with a larger stencil, but it's more robust.


July 12, 2005, 01:38 
Re: Cellcentered and Facecentered values

#17 
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.


July 13, 2005, 04:38 
Re: Cellcentered and Facecentered values

#18 
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. 

July 13, 2005, 12:17 
Re: Cellcentered and Facecentered values

#19 
Guest
Posts: n/a

Hi Mani....
Thank you very much for your reply. It certainly goes a long way in clearing up this ageold doubts of mine. 

July 13, 2005, 12:50 
Re: Cellcentered and Facecentered values

#20 
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 facecentered value and Q(p) the cellcentered value? Then the expression is an extrapolation from the cellcenter to the facecenter, 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. 

Thread Tools  
Display Modes  


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 