Gradient computation
From CFD-Wiki
m (Reverted edit of Tent, changed back to last version by Tsaad) |
m (→Introduction: This also works (prevented line break)) |
||
(4 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
For structured orthogonal grids, the gradient of a scalar at a given control volume centroid can be easily computed using the definition of the derivatives. The case becomes more complicated when general unstructured grids are involved. The usual approach is to make use of Green-Gauss theorem which states that the surface integral of a scalar function is equal to the volume integral (over the volume bound by the surface) of the gradient of the scalar function. <br> | For structured orthogonal grids, the gradient of a scalar at a given control volume centroid can be easily computed using the definition of the derivatives. The case becomes more complicated when general unstructured grids are involved. The usual approach is to make use of Green-Gauss theorem which states that the surface integral of a scalar function is equal to the volume integral (over the volume bound by the surface) of the gradient of the scalar function. <br> | ||
- | <math>\int_{\Omega}\nabla \phi d\Omega = \int_{S} \phi dS </math><br> | + | |
- | Assuming that <math> \nabla \phi </math> is constant over the control volume, the Green-Gauss equation can be rewritten as <br> | + | <math>\int_{\Omega}\nabla \phi\,d\Omega =\,\!\int_{S} \phi\,\hat{n}\,dS </math><br> |
- | <math>\int_{\Omega}\nabla \phi d\Omega =\nabla \phi_P \Omega = \int_{S} \phi dS </math><br> | + | |
- | We next approximate the integral over the surface as a summation of the average scalar value times the surface vector <br> | + | where <math>\hat{n}</math> is the surface normal pointing out from the volume. Assuming that <math> \nabla \phi </math> is constant over the control volume, the Green-Gauss equation can be rewritten as <br> |
- | <math>\nabla \phi_P =\frac {1}{\Omega}\sum_{faces} \phi_f \vec S_f </math><br> | + | |
+ | <math>\int_{\Omega}\nabla \phi\,d\Omega =\nabla \phi_P\,\Omega = \int_{S} \phi\,\hat{n}\,dS </math><br> | ||
+ | |||
+ | We next approximate the integral over the surface as a summation of the average scalar value in each face times the face's surface vector <br> | ||
+ | |||
+ | <math>\nabla \phi_P =\frac {1}{\Omega}\sum_{faces} \phi_f\,\vec S_f </math><br> | ||
+ | |||
The face value <math>\phi_f</math> still needs to be defined. Following are some practical methods to compute the average face value. | The face value <math>\phi_f</math> still needs to be defined. Following are some practical methods to compute the average face value. | ||
== Face value computation == | == Face value computation == | ||
- | As mentioned above, the average value of the scalar at a given face has to be correctly approximated in order to yield a correct computation of the cell gradient. As the FVM uses a cell centered formulation, values at the faces are not readily | + | As mentioned above, the average value of the scalar at a given face has to be correctly approximated in order to yield a correct computation of the cell gradient. As the FVM uses a cell centered formulation, values at the faces are not readily available, they have to be interpolated. There are two main approaches to compute the face value of a scalar |
*'''Cell based''' in which the face value is computed using the values at its straddling cells | *'''Cell based''' in which the face value is computed using the values at its straddling cells | ||
*'''Node based''' in which the face value is computed using the values at its straddling nodes | *'''Node based''' in which the face value is computed using the values at its straddling nodes | ||
Line 36: | Line 42: | ||
<math> \phi _f = {\begin{matrix} {1 \over {N_{fv}}} \end{matrix}} \sum\limits_{i = 1}^{N_{fv}} {\phi _i }</math> <br> | <math> \phi _f = {\begin{matrix} {1 \over {N_{fv}}} \end{matrix}} \sum\limits_{i = 1}^{N_{fv}} {\phi _i }</math> <br> | ||
where Nfv represents the number of '''Vertices''' defining a given face. | where Nfv represents the number of '''Vertices''' defining a given face. | ||
+ | |||
== Note == | == Note == | ||
The above mentioned gradients are sometimes called '''unlimited gradients''' since the face value obtained from them can exceed the bounding cell values. For this reason, for implementing higher order schemes, it becomes important to restrict them, so as not to introduce over and undershoot of variables. | The above mentioned gradients are sometimes called '''unlimited gradients''' since the face value obtained from them can exceed the bounding cell values. For this reason, for implementing higher order schemes, it becomes important to restrict them, so as not to introduce over and undershoot of variables. |
Latest revision as of 13:04, 7 June 2011
Contents |
Introduction
For structured orthogonal grids, the gradient of a scalar at a given control volume centroid can be easily computed using the definition of the derivatives. The case becomes more complicated when general unstructured grids are involved. The usual approach is to make use of Green-Gauss theorem which states that the surface integral of a scalar function is equal to the volume integral (over the volume bound by the surface) of the gradient of the scalar function.
where is the surface normal pointing out from the volume. Assuming that is constant over the control volume, the Green-Gauss equation can be rewritten as
We next approximate the integral over the surface as a summation of the average scalar value in each face times the face's surface vector
The face value still needs to be defined. Following are some practical methods to compute the average face value.
Face value computation
As mentioned above, the average value of the scalar at a given face has to be correctly approximated in order to yield a correct computation of the cell gradient. As the FVM uses a cell centered formulation, values at the faces are not readily available, they have to be interpolated. There are two main approaches to compute the face value of a scalar
- Cell based in which the face value is computed using the values at its straddling cells
- Node based in which the face value is computed using the values at its straddling nodes
Note that these methods are not specific for the computation of the gradient. They can be used in any occasion when the face value is needed.
Cell based methods
We define as the weighing geometric factor between cells P and N
then a simple approximation for the face value can be defined as
This approximation is also known as a weighted interpolation. It is defined by a compact stencil in that only the cells straddling the face are only involved in the interpolation.
A special case arises when the face is situated midway between the two control volumes and the approximation reduces to an arithmetic average
The advantage of this approach is that it is simple to implement. All of the operations involved are face-based and do not require any additional grid connectivity. Furthermore, the procedure can be readily implemented in three dimensions.
From an accuracy point of view, the above relation leads to a second order approximation of only when the segment [PN] and surface Sf are aligned. Thus a second order accurate representation of the gradient is generally not achieved except for this case.
For highly skewed unstructured grids, the accuracy decreases with increasing skewness. In such a case, a correction is added to the above approximation and an iterative procedure is usually needed to find the face value.
Node based methods
The value of can be computed as the mean of the nodes defining the face. This necessitates the estimation of the properties at the nodes. The properties at the nodes are calculated using the weighted average of the properties within the cells defining that node. The weight is taken as the inverse of the distance of the node from the cell center
where v denotes the concerned vertex and the loop is performed over the the cells that define the vertex. Pn is the index of the cell, and is the distance from the vertex to the cell centroid.
Finally, the face value is taken as the arithmetic average of the values at the vertices.
where Nfv represents the number of Vertices defining a given face.
Note
The above mentioned gradients are sometimes called unlimited gradients since the face value obtained from them can exceed the bounding cell values. For this reason, for implementing higher order schemes, it becomes important to restrict them, so as not to introduce over and undershoot of variables.
Return to Numerical Methods