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 leastsquare 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 leastsquare method, three neighboring cells are needed. Any one can give some suggestion. Your help is greatly appreciated. 
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.

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

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.

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 6node Lagrangian simplex. I don't know if I was of some help... 
Quote:
What you advise would be a kind of mixed CVFEM 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... 
Quote:
Hi Filippo What you advise would be a kind of mixed CVFEM 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... 
Quote:
Hi Filippo What you advise would be a kind of mixed CVFEM 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... 
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. 
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:

All times are GMT 4. The time now is 17:43. 