This section presents some essential vector/tensor algebra and calculus concepts that the reader should be familiar with to understand this site’s contents.
Algebraic operators
Before starting, it is worth revising some algebraic operators relative to vectors and tensors which are crucial to understand further sections. Let us take the following types of variables as example:
- Example of scalar:
$\begin{equation*}
\xi
\end{equation*}$
- Example of vector:
$\begin{align*}
\vec v & = \begin{bmatrix}
v_{1} \\
v_{2} \\
v_{3}
\end{bmatrix}
\end{align*}$
- Example of tensor:
$\begin{align*}
\mathbf{T} & = \begin{bmatrix}
T_{11} & T_{12} & T_{13} \\
T_{21} & T_{22} & T_{23} \\
T_{31} & T_{32} & T_{33} \\
\end{bmatrix}
\end{align*}$
Scalar product
The scalar or dot product of two vectors of same length equals the sum (scalar) of their components product one by one:
$\begin{equation*}
\vec v \cdot \vec w = v_1 w_1 + v_2 w_2 + v_3 w_3
\end{equation*}$
It is an indicator of how parallel two vectors are:
$\begin{matrix}
\text{if} & \vec v \parallel \vec w & \rightarrow & |\vec v \cdot \vec w| = & |\vec v| |\vec w|\\
\text{if} & \vec v \perp \vec w & \rightarrow & |\vec v \cdot \vec w| = & 0 \\
\end{matrix}$
Vector product
The vector or cross product of two vectors of same length is the determinant of the matrix formed by those vectors and the unit vectors in $x$, $y$ and $z$ ($\vec i$, $\vec j$ and $\vec k$, respectively):
$\begin{align*}
\vec v \times \vec w & = \det \begin{vmatrix}
v_{1} & v_{2} & v_{3} \\
w_{1} & w_{2} & w_{3} \\
\vec i & \vec j & \vec k \\
\end{vmatrix} = \ldots \\
& \\
& = v_1 w_2 \vec k + v_2 w_3 \vec i + v_3 w_1 \vec j –
(v_3 w_2 \vec i + v_2 w_1 \vec k + v_1 w_3 \vec j)
\end{align*}$
It is an indicator of how perpendicular two vectors are:
$\begin{matrix}
\text{if} & \vec v \parallel \vec w & \rightarrow & |\vec v \cdot \vec w| = & 0\\
\text{if} & \vec v \perp \vec w & \rightarrow & |\vec v \cdot \vec w| = & |\vec v| |\vec w|\\
\end{matrix}$
Tensor product
The vector or cross product of two vectors of same length is equal to a tensor formed by component-to-component products as follows.
$\begin{align*}
\vec v \otimes \vec w & = \begin{bmatrix}
v_1 w_1 & v_1 w_2 & v_1 w_3 \\
v_2 w_1 & v_2 w_2 & v_2 w_3 \\
v_3 w_1 & v_3 w_2 & v_3 w_3 \\
\end{bmatrix}
\end{align*}$
Note the following identity holds: $ \vec v \otimes \vec w = \vec v \vec w^T $.
Nabla operator
The nabla operator $(\vec \nabla)$ is a simplified way to express a series of operations involving physical quantities changing in space. These variables can be of scalar $(\xi)$, vector $(v)$ or tensor $(\mathbf{T})$ nature.
As nabla is associated with the representation of change in space of the accompanying variables, its components are the partial derivatives $\frac{\partial}{\partial x}$, $\frac{\partial}{\partial y}$ and $\frac{\partial}{\partial z}$. So, from a mathematical standpoint, the nabla operator corresponds to the vector:
$\begin{equation*}
\vec \nabla = \begin{bmatrix}
\frac{\partial}{\partial x} \\
\frac{\partial}{\partial y} \\
\frac{\partial}{\partial z} \\
\end{bmatrix}
\end{equation*}$
We will now discuss how this useful symbol will appear referring to different operators. It is crucial to pay attention to details, as a simple variation in the symbols accompanying will completely change the nabla operator meaning.
Note that nabla refers to the operators discussed above, only the vector dimensions will no longer be $1$, $2$ and $3$, but $x$, $y$ and $z$.
The nabla operator can indicate three operators:
- Gradient ($\vec \nabla$)
- Divergence ($\vec \nabla \cdot$)
- Curl ($\vec \nabla \times$)
Gradient
The gradient of a scalar variable represents its rate of change in space:
$\begin{equation*}
\vec \nabla \xi = \text{grad} (\xi) = \begin{bmatrix}
\frac{\partial \xi}{\partial x} \\
\frac{\partial \xi}{\partial y} \\
\frac{\partial \xi}{\partial z} \\
\end{bmatrix}
\end{equation*}$
E.g. the pressure gradient $\vec \nabla p$ represents the rate of change of pressure as the observer moves throughout a fluid body.
Divergence
The divergence of a vector variable is the dot product of nabla and the vector and represents its tendency to increase or decrease its radial component as the observer moves closer or farther:
$\begin{equation*}
\vec \nabla \cdot \vec v = \text{div} (\vec v) = \begin{bmatrix}
\frac{\partial \vec v_x}{\partial x} \\
\frac{\partial \vec v_y}{\partial y} \\
\frac{\partial \vec v_z}{\partial z} \\
\end{bmatrix}
\end{equation*}$
E.g. the divergence of velocity $(\vec \nabla \vec U)$ represents the tendency of flow to converge to or to diverge from the point considered:
- Divergence: $(\vec \nabla \cdot \vec U > 0)$
- Convergence: $(\vec \nabla \cdot \vec U < 0)$
Following this example, an imaginary fluid source will have a positive divergence of velocity, whereas a sink will present a negative divergence of velocity.
It goes without saying that, in fluid mechanics, velocity plays a central role and its divergence will appear often among CFD models. Actually, it will in virtually all important equations for a very simple reason:
When multiplied by a scalar property ($\xi), the divergence of velocity represents its instant rate of change caused by the the fact that this property is carried by the flow from and to the considered point, a.k.a. advection.
This can be demonstrated through dimensional analysis. For the sake of simplicity, let units be those of the S.I. and assume that $\xi$ units are $\Xi$:
$\begin{equation*}
\vec \nabla [\frac{1}{m}] \cdot \vec U [\frac{m}{s}] ~ \xi [\Xi] = [\frac{\Xi}{s}]
\end{equation*}$
Curl
The curl of a vector variable is the cross product of nabla and the vector ($\vec \nabla \times \vec v$) and represents its tendency to increase or decrease its tangential component as the observer moves closer or farther:
$\begin{align*}
\vec \nabla \times \vec v &= \text{curl} (\vec v) = \det \begin{vmatrix}
\frac{\partial}{\partial x} & \frac{\partial}{\partial y} & \frac{\partial}{\partial z} \\
v_{1} & v_{2} & v_{3} \\
\vec i & \vec j & \vec k \\
\end{vmatrix} = \ldots \\
& \\
&= \frac{\partial \vec v_y}{\partial x} \vec k + \frac{\partial \vec v_z}{\partial y} \vec i + \frac{\partial v_x}{\partial z} \vec j –
(\frac{\partial v_y}{\partial z} \vec i + \frac{\partial v_x}{\partial y} \vec k + \frac{\partial v_z}{\partial x} \vec j)
\end{align*}$
E.g. the curl of velocity $\vec \nabla \times \vec U $ represents the tendency of flow to rotate counter-clockwise ($\vec \nabla \times \vec U > 0$) or clockwise ($\vec \nabla \times \vec U < 0$) around the point considered.
As stated above, velocity plays a central role in fluid mechanics and its curl will appear often among CFD model equations. As it is accounts for flow rotationality, it is also known as vorticity:
$\zeta = \vec \nabla \times \vec U$
All these operators are abstract complex and can be difficult to understand without being able to picture their graphical representation in Euclidean geometry. Readers are encouraged to view this excellent video from Youtube channel 3Blue1Brown [1] explaining some of the concepts discussed above:
Conservation law
This concept will be applied to the derivation of virtually all properties in computational fluid dynamics that is conserved, such as mass, momentum, kinetic energy, diluted substances, thus being of the utmost importance. The name might look frightening, but readers will see that the ideas behind the conservation law are extremely simple.
The key concept to understand the material derivative is, obviously, conservation. Therefore, the conservation law will only appear when we work with conserved variables, such as energy, but not to non-conserved quantities, such as velocity.
The principle behind all further discussion is:
Any conserved quantity within a control volume is equal to its initial value plus the balance between external inputs and outputs and internal sources and sinks.
This statement is axiomatic for conserved variables in open systems. But let us try to put it in simpler words using an example: picture a city.
The population (conserved quantity) in this city (control volume) after a certain period equals its population at the beginning (initial value)…
+ people moving into the city (input)
– people moving out elsewhere (output)
+ births (source)
– deaths (sink)
Mathematically, we can express the balance of a generic conserved property $\xi$ on a control volume or mathematical domain $\Omega$ surrounded by a surface $S$ as follows:
$ \int_\Omega \frac{\partial \xi}{\partial t} d\Omega = -\oint_S \vec F \cdot d\vec S + \int_\Omega Q_V d\Omega + \oint_S \vec Q_S \cdot d\vec S $
Let us analyze this expression term by term:
>>> Local derivative
$\int_\Omega \frac{\partial \xi}{\partial t} d\Omega$
This time partial derivative represents the overall variation of the quantity $\xi$ within the domain ($\Omega$) due to any of the causes discussed below.
>>> Advection/diffusion derivative
$\oint_S \vec F \cdot d\vec S$
This surface integral represents fluxes of $\xi$ quantity ($\vec F$) through the domain’s surface ($S$). Note that the negative symbol appears because the convention dictates that surface vectors point outwards, so what leaves the domain is positive and vice versa. The difference between advective and diffusive transport will be discussed at the end of this section.
>>> Surface sources and sinks
$\oint_S \vec Q_S \cdot d\vec S$
This terms represents the sum of sources increasing and sinks decreasing the quantity $\xi$ within the domain $\Omega$ whose magnitude is proportional to its surface. Take momentum as an example of $\xi$: a surface sink would be the momentum loss caused by viscous friction, which is clearly proportional to the surface $S$ surrounding the domain $\Omega$.
>>> Body sources and sinks
$\int_\Omega Q_V d\Omega$
Analogously, this terms represents the sum of sources increasing and sinks decreasing the quantity $\xi$ within the domain $\Omega$ whose magnitude is proportional to its volume. Again, take momentum as an example of $\xi$: a body source would be the momentum increment caused by the gravitational force, which is clearly proportional to the volume (assuming this is proportional to mass) enclosed within $\Omega$.
Integral/differential form of the conservation law
Readers may not be aware of this nuance, but what we have seen constitutes the so-called integral form of the conservation law (the term is pretty self-explanatory). Let us try to rearrange the former equation in order to put it in simpler and more functional terms.
To do so, we need to apply Gauss Theorem (the surface integral of a flux is equal to the volume integral of the divergence of this flux) to the surface integrals to express them as volume integrals like the rest of terms:
$ \begin{equation}
\frac{\partial}{\partial t}\int_\Omega \xi d\Omega = -\int_\Omega \vec \nabla \cdot \vec F d\Omega + \int_\Omega \vec \nabla \cdot \vec Q_S d\Omega + \int_\Omega Q_V d\Omega
\end{equation}$
Now that all terms are integrals on $\Omega$, we can get rid of them by assuming that the equation will be applicable and valid to any point within the domain $\Omega$. This constitutes the so-called differential form of the conservation law (note that some terms have been moved from one side of the equality to the other for convenience):
$ \begin{equation*}
\frac{\partial \xi}{\partial t} + \vec \nabla \cdot \vec F = \vec \nabla \cdot \vec Q_S + Q_V
\end{equation*}$
Material derivative
The left-hand side of the previous equation is often referred to as the material or total derivative, often expressed as a differential equation using $D$ (or $d$) instead of $\partial$):
$ \begin{equation*}
\frac{D \xi}{Dt} = \frac{\partial \xi}{\partial t} + \vec \nabla \cdot \vec F
\end{equation*}$
In other words:
The material derivative represents the total variation of a quantity along time due to its internal variation (local derivative) and the flux of this quantity with the exterior of the control volume (convective derivative).
It can be deduced from the conservation law described above that this variation can only be due to surface and volume sources/sinks. It is extremely important that this reasoning is perfectly understood before facing the derivation of equations which CFD is based on, as they all originate at the application of the conservation law to a given variable.
Advection and diffusion
We already know that flow can transport a certain property $(\xi)$ in two manners, by advection and by diffusion. Therefore, we can decompose the advection/diffusion term stated above into:
$ \begin{equation*}
\vec \nabla \cdot \vec F = \vec \nabla \cdot \vec F_A + \vec \nabla \cdot \vec F_D
\end{equation*}$
>>> Advection
Advective transport of a property refers to the quantity of this property carried by a fluid in motion, i.e. due to velocity. We saw that this contribution is mathematically represented by the product of the divergence of velocity and the property in question, so:
$ \begin{equation*}
\vec \nabla \cdot \vec F_A = \vec \nabla \cdot (\vec U \xi)
\end{equation*}$
Note that not all properties are subjected to advection. E.g., in still fluids, $\vec U = 0$, so advection does not take place.
It is important to clarify that certain bibliographic sources were refer to this phenomenon as “convection” and it is true that there is certain ambiguity among sources . Here, we will adopt the following criterion:
- Advection: flow transport caused by fluid motion, whatever motivates it.
- Convection: flow transport caused by fluid motion due to density differences.
>>> Diffusion
Diffusive transport of a property refers to the quantity of this property transported by molecular agitation. This phenomenon is well represented by the Law of Fick:
$ \begin{equation*}
\vec \nabla \cdot \vec F_D = -\vec \nabla \cdot (\lambda \vec \nabla \xi)
\end{equation*}$
Where $\lambda$ is the diffusivity coefficient and $\vec \nabla \xi$ is the property gradient described above in this section.
Note that not all properties are subjected to diffusion. E.g., in immiscible fluids in contact, $\lambda = 0$, so diffusion does not take place.
General form of the conservation law
The conservation law in their most general way can be stated as follows:
>>> Scalar property
In most cases, properties are of scalar nature ($m$, $k$, $T$…), so the general form of the conservation law will be what we derived above:
$ \boxed{\begin{equation*}
\frac{\partial \xi}{\partial t} +
\vec \nabla \cdot (\vec U \xi) =
\vec \nabla \cdot (\lambda \vec \nabla \xi) +
\vec \nabla \cdot \vec Q_S +
Q_V
\end{equation*}}$
>>> Vector property
Certain properties, such as momentum $(m \vec U)$, show vector nature. In this case, some minor modifications need to be done to the general form of the conservation law:
$ \boxed{\begin{equation*}
\frac{\partial \vec v}{\partial t} +
\vec \nabla \cdot (\vec U \otimes \vec v) =
\vec \nabla \cdot (\lambda \vec \nabla \times \vec v) +
\vec \nabla \cdot \mathbf{Q_S} +
\vec Q_V
\end{equation*}}$
Note that scalar variables are now vectors and, consistently, vectors become tensors. The demonstration of this transformation as well as further considerations on this topic, can be found in most CFD manuals, such as Hirsch’s [2].
Also note that the last two equations will be the starting point to obtain most of the equations discussed in other sections.
It is crucial that readers are familiar with the meaning and derivation of the conservation law before facing any further discussion on CFD modeling.
References
[1] 3Blue1Brown (Youtube channel): https://www.youtube.com/watch?v=rB83DpBJQsE
[2] Hirsch