Finite difference for computing gradients at face in finite volume code

I am working on a 3-D problem using the finite volume method (FVM). I came across a problem dealing with the computation of gradients at a face.

The geometry that I'm working with is discretized into cells. Every face is aligned with one of the three cartesian axes. The specific FVM that I am using computes cell-averaged values. At each face, I am interested in computing the face gradients in all 3 directions, i.e., $\frac{du}{dx}$, $\frac{du}{dy}$, $\frac{du}{dz}$. I use a simple central finite difference scheme to compute the gradients, i.e.,

$$\frac{du}{dy} = \frac{u_{i+1}-u_{i-1}}{2\Delta y}$$

However, this formula appears to be problematic for this problem. For example, if we consider a face parallel to the y-axis and z-axis, it's normal would be in the x-axis. The 2 bounding cells share this face and have centroids at, say, (0,0,0) and (1,0,0). The face centroid is at (0.5,0,0). Using the above formula and these 2 cells, this would give $\Delta y=\Delta z = 0$, making the above formula undefined for the gradients in the y and z directions.

Is this method simply inappropriate for this geometry? What could be used as an alternative?

• My understanding of finite volume method is that the equations are formulated in terms of flux entering and exiting the faces (this is based around the divergence theorem). This should be the quality you want? – boyfarrell Mar 6 '18 at 21:15
• du/dy means the variation of u in the y-direction, no matter which surfaces you are in, we always can find the variation of u in the y-direction. it has nothing to do with the normal vector. – ztdep Oct 30 '18 at 23:34

2 Answers

I am not sure what are referring to when you say face gradients. But I will tell you how I would compute a gradient at any point in space.

You have a set of values for some quantity $\{u_i\}$ corresponding to some set of points in space $\{x_i\}$. You can build a polynomial that interpolates locally $N_p$ points of the set, say $$u(x)=\sum_{k=1}^{N_p}{u_k \phi_k(x)}$$

Where $\{\phi_k(x)\}$ is the interpolant basis, and $\phi_k(x_i)=\delta_{ik}$ and therefore $u(x_i)=u_i$

Therefore you can approximate the gradient as $$\vec{grad}\,u(x)=\sum_{k=1}^{N_p}{u_k \vec{grad}\,\phi_k(x)}$$

If you want to compute the face gradient: $$\vec{Grad}\,u(x)= [I-\vec{n} \otimes\vec{n}] \vec{grad}\,u(x)$$

You consider a face parallel to the y-axis and z-axis, it's normal would be in the x-axis. I don't think you can draw a face parallel to the y and z-axises simultaneously.

The gradient is a vector, it has three components in x y and z directions. You need to compute the gradient-x, gradient-y, and gradient-z, respectively in these 3 axes.