# gradient calculation of cell centered finite volume method

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

 May 3, 2011, 06:06 gradient calculation of cell centered finite volume method #1 New Member   Jianguo Join Date: May 2011 Posts: 9 Rep Power: 8 I am solving Euler equations using cell centered finite volume MUSCL method. The computational domain is discretized into a triangular mesh. I need to calculate the flow variable gradient at cell center of each triangular element using least-square method. I don't know how to calculate the gradient in cell which has one or two edges on physical boundary, such as solid wall, inflow or outflow boundary. For a cell which has two edges on boundary, how can I calculate the gradient? There is only one cell which has a common edge with this cell. For least-square method, three neighboring cells are needed. Any one can give some suggestion. Your help is greatly appreciated.

 May 3, 2011, 06:41 #2 Super Moderator     Praveen. C Join Date: Mar 2009 Location: Bangalore Posts: 263 Blog Entries: 6 Rep Power: 11 You have to add other cells to the stencil. For example, find all cells which share a vertex with the boundary cell and use them also for least squares.

 November 5, 2012, 03:38 I have a same question #3 Member   Dokeun, Hwang Join Date: Apr 2010 Posts: 71 Rep Power: 9 Now I'm writing a code to calculate a gradient on a cell which contacts physical boundary such as wall, in/outlet. Question is Do I have to use dummy(ghost) cells to calculate the gradient on a cell? For example a cell is near by wall at its one face. Then ghost cell is defined as mirrored with the cell at the contact face and has a value according to the wall(temp, pressure and so on)

 November 6, 2012, 02:06 one source #4 Member   Dokeun, Hwang Join Date: Apr 2010 Posts: 71 Rep Power: 9 I found a source code using least squares approach for a reconstruction in www.cfdbooks.com(ossan2deuler). In this code, dummy cell data wasn't involved for computing lsq matrix.

 November 6, 2012, 03:31 #5 Super Moderator     Praveen. C Join Date: Mar 2009 Location: Bangalore Posts: 263 Blog Entries: 6 Rep Power: 11 Some people do use dummy cell data in the least squares. It can improve the accuracy, since the stencil is more centered by including ghost cells. If you dont include the ghost cells, the stencil is one sided and it will have less accuracy. dokeun likes this.

 November 6, 2012, 05:58 #6 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 3,492 Rep Power: 40 I am not sure to get the real question... At second order of accuracy you can use the linear shape function in a 2D triangle of vertex i,j,k, hence: f(x,y) = Ni *fi + Nj* fj + Nk*fk then you can calculate df/dx df/dy analytically. If you are close to a frontier where Dirichlet values are not prescribed but Neumann condition are in effect then you can prescribe the components of the gradient and always solve for the shape functions. Second degre shape function can be built by sequential application of linear function on 6-node Lagrangian simplex. I don't know if I was of some help...

November 10, 2012, 17:20
#7
Senior Member

Join Date: Aug 2011
Posts: 271
Rep Power: 9
Quote:
 Originally Posted by FMDenaro I am not sure to get the real question... At second order of accuracy you can use the linear shape function in a 2D triangle of vertex i,j,k, hence: f(x,y) = Ni *fi + Nj* fj + Nk*fk then you can calculate df/dx df/dy analytically. I don't know if I was of some help...
Hi Filippo
What you advise would be a kind of mixed CV-FEM method mix between FVM and FEM.One can indeed tackle the problem like that,but I'm not sure it is what they want to do..
In a simpler way,one can also use Gauss theorem to compute the gradientin cell center....In this case no need of ghost cells...

November 10, 2012, 17:24
#8
Senior Member

Join Date: Aug 2011
Posts: 271
Rep Power: 9
Quote:
 Originally Posted by FMDenaro I am not sure to get the real question... At second order of accuracy you can use the linear shape function in a 2D triangle of vertex i,j,k, hence: f(x,y) = Ni *fi + Nj* fj + Nk*fk then you can calculate df/dx df/dy analytically. I don't know if I was of some help...

Hi Filippo
What you advise would be a kind of mixed CV-FEM method mix between FVM and FEM.One can indeed tackle the problem like that,but I'm not sure it is what they want to do..
In a simpler way,one can also use Gauss theorem to compute the gradientin cell center....In this case no need of ghost cells...

November 10, 2012, 17:32
#9
Senior Member

Join Date: Aug 2011
Posts: 271
Rep Power: 9
Quote:
 Originally Posted by FMDenaro I am not sure to get the real question... At second order of accuracy you can use the linear shape function in a 2D triangle of vertex i,j,k, hence: f(x,y) = Ni *fi + Nj* fj + Nk*fk then you can calculate df/dx df/dy analytically. I don't know if I was of some help...

Hi Filippo
What you advise would be a kind of mixed CV-FEM method mix between FVM and FEM.One can indeed tackle the problem like that,but I'm not sure it is what they want to do..
In a simpler way,one can also use Gauss theorem to compute the gradientin cell center....In this case no need of ghost cells...

 November 10, 2012, 18:22 #10 New Member   Mijail Febres Join Date: May 2010 Posts: 4 Rep Power: 9 You may use vertex neighbours to increase the stencil for gradient calculation. In my implementation, on bc's cella, i use bc's faces as they were actual neighbours for gradient calculations. I'm pretty sure that someone more experienced may have another opinion, but for me, at least on bc's, faces values must be included.

November 12, 2012, 00:13
Green Gauss Method...
#11
New Member

Vinayender
Join Date: Jul 2009
Location: India
Posts: 24
Rep Power: 10
In general, for gradients computations, two popular methods used are least square and Greeen Gauss Method. Green Gauss Method is aways more robust than Least Square ( to best of my knowledge)

In Green Gauss Method, you may calculate the gradients of a cell at its cell center by using the variable values on its faces.
Attached picture is self explainator for implementing this method. But for theory behid that you can always refer any good Engineering Mathematics book.

Quote:
 Originally Posted by zhengjg I am solving Euler equations using cell centered finite volume MUSCL method. The computational domain is discretized into a triangular mesh. I need to calculate the flow variable gradient at cell center of each triangular element using least-square method. I don't know how to calculate the gradient in cell which has one or two edges on physical boundary, such as solid wall, inflow or outflow boundary. For a cell which has two edges on boundary, how can I calculate the gradient? There is only one cell which has a common edge with this cell. For least-square method, three neighboring cells are needed. Any one can give some suggestion. Your help is greatly appreciated.
Attached Images
 Green Gauss.jpg (42.0 KB, 91 views)
__________________
Thanks ,
Vinayender

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post Scott2 Main CFD Forum 1 August 16, 2010 20:24 gaottino OpenFOAM Native Meshers: blockMesh 7 July 19, 2010 14:11 Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00 prapanj Main CFD Forum 3 November 28, 2006 18:11 superfool Main CFD Forum 4 October 21, 2006 14:37

All times are GMT -4. The time now is 03:51.