CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   gradient calculation of cell centered finite volume method (http://www.cfd-online.com/Forums/main/87934-gradient-calculation-cell-centered-finite-volume-method.html)

zhengjg May 3, 2011 06:06

gradient calculation of cell centered finite volume method
 
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.

praveen May 3, 2011 06:41

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.

dokeun November 5, 2012 03:38

I have a same question
 
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)

dokeun November 6, 2012 02:06

one source
 
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.

praveen November 6, 2012 03:31

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.

FMDenaro November 6, 2012 05:58

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

leflix November 10, 2012 17:20

Quote:

Originally Posted by FMDenaro (Post 390526)
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...

leflix November 10, 2012 17:24

Quote:

Originally Posted by FMDenaro (Post 390526)
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...

leflix November 10, 2012 17:32

Quote:

Originally Posted by FMDenaro (Post 390526)
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...

Mijail November 10, 2012 18:22

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.

vinayender November 12, 2012 00:13

Green Gauss Method...
 
1 Attachment(s)
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 (Post 306065)
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.



All times are GMT -4. The time now is 02:38.