# General CFD FAQ

### From CFD-Wiki

(→What is the difference between FEM, FVM and FDM?) |
m (Corrected spelling mistakes) |
||

Line 11: | Line 11: | ||

=== What is the difference between FEM, FVM and FDM? === | === What is the difference between FEM, FVM and FDM? === | ||

Describe differences between the finite volume method, the finite element method and the finite difference method... | Describe differences between the finite volume method, the finite element method and the finite difference method... | ||

- | Finite volume method is based on the integral form of the pde governing the flow physics | + | Finite volume method is based on the integral form of the pde governing the flow physics i.e., conservation of mass, momentum and energy. In other words the pde are written in a form which can be solved for a given finite volume. The computational domain is discretized into finite volumes and then for every volume the governing equations are solved. That is the reason we always come across the fluxes and their estimation in FVM. The basic advantage of this method over FDM is it does not require grid in computational domain and the mathematical effort to convert the given mesh in to structured numerical grid internally is completely avoided. The FVM equations can be solved using implicit, explicit, semi-implicit or relaxation technique. |

- | + | ||

+ | In FVM the values of field variables are stored at cell centroids and the corresponding values at vertices are obtained using interpolation. FDM uses differential form of the equation and pde are solved at the vertices of the cell. In a given pde the derivatives are simply written in numerical form for every cell and solutionn to these equations can be obtained by implict, explicit, semi-implicit or relaxation technique. In FVM as well as FDM we know the field variables at the cell centroids or cell vertices, we really do not know the variation of field variables between two cell centroids or vertices. It is our assumption during interpolation to go for linear or quadratic variation. On the conrary in FEM the variation between two nodal points is known apriori and using this variation itself the FEM equations are formulated. They are essentially solved using Matrix method. | ||

=== How do i count the number of floating point operations in an algorithm?=== | === How do i count the number of floating point operations in an algorithm?=== |

## Revision as of 05:09, 23 December 2005

This FAQ is empty. This is just a suggestion on how to structure it. Please feel free to add questions and answers here!

## Contents |

## Physics

### What is the Reynolds decomposition?

The Reynolds decomposition is used to separate the scales in a turbulent flow and resolve the velocity field (or any other scalar field) as the sum of an average component and a fluctuating component. The time average of the fluctuating field is identically zero.

### What is the difference between the Reynolds decomposition and LES filtering?

The Reynolds decomposition separates the velocity field into an average component and a fluctuating component. **The time average of the fluctuating component is identically zero**. In LES, a filtering operation is performed to decompose the velocity field into a *filtered* velocity field and a *filtered residual* field. The crucial difference between both methods is

- The filtered velocity field is a
**random variable**while the average field (Reynolds) is not - The time average of the residual field is generally
**nonzero**while it is identically zero for fluctuating component in the Reynolds decomposition.

## Numerics

### What is the difference between FEM, FVM and FDM?

Describe differences between the finite volume method, the finite element method and the finite difference method... Finite volume method is based on the integral form of the pde governing the flow physics i.e., conservation of mass, momentum and energy. In other words the pde are written in a form which can be solved for a given finite volume. The computational domain is discretized into finite volumes and then for every volume the governing equations are solved. That is the reason we always come across the fluxes and their estimation in FVM. The basic advantage of this method over FDM is it does not require grid in computational domain and the mathematical effort to convert the given mesh in to structured numerical grid internally is completely avoided. The FVM equations can be solved using implicit, explicit, semi-implicit or relaxation technique.

In FVM the values of field variables are stored at cell centroids and the corresponding values at vertices are obtained using interpolation. FDM uses differential form of the equation and pde are solved at the vertices of the cell. In a given pde the derivatives are simply written in numerical form for every cell and solutionn to these equations can be obtained by implict, explicit, semi-implicit or relaxation technique. In FVM as well as FDM we know the field variables at the cell centroids or cell vertices, we really do not know the variation of field variables between two cell centroids or vertices. It is our assumption during interpolation to go for linear or quadratic variation. On the conrary in FEM the variation between two nodal points is known apriori and using this variation itself the FEM equations are formulated. They are essentially solved using Matrix method.

### How do i count the number of floating point operations in an algorithm?

First of all, write down your algorithm as pseudocode. Now simply count the number of operations that the algorithm is performing (per iteration of course). all operations: addition, subtraction, multiplication, and division count the same, i.e. **1 flop**.

This is not exact since multiplication includes several additions, and division includes several multiplications... But it seems reasonable to assume that on average, all operations are counted in the same manner.

Here is an example (just for illustration):

for i = 0 to P

for n = 1 to N (number of elements in array)

B(n) = a(n)*a(n-1) - 2*c(n) + 3

next n

next i

For each **n** there are 2 multiplications, one subtraction, and one addition resulting in **four** operations. For all **N** there are **4N** operations. This is the the order of the algorithm. In this example, its is O(4N) or simply O(N) (constants do not count).

For all iterations, there are 4N(P+1) operations. (remember, when starting the loop from zero to p, there are p+1 steps).