Skip to content
๐ŸŽ‰ Welcome to Aerosand!.
00_cfdbIntro

00_cfdbIntro

Important

Visit https://aerosand.cc for the latest updates.

0. Preface

This series aims to help readers smoothly understand the fundamental theories of computational fluid dynamics.

1. Roadmap

Fluid Dynamics

Theoretical equations

Finite Difference Method

Basic concepts and methods of finite difference method.

Finite Volume Method

Basic concepts and methods of finite volume method

2. Mathematical Foundations

2.1. Partial Derivative Calculations

Sum and difference rule

โˆ‚(f+g)โˆ‚x=โˆ‚fโˆ‚x+โˆ‚gโˆ‚x \frac{\partial (f+g)}{\partial x} = \frac{\partial f}{\partial x} + \frac{\partial g}{\partial x}

Product rule

โˆ‚fgโˆ‚x=gโˆ‚fโˆ‚x+fโˆ‚gโˆ‚x \frac{\partial fg}{\partial x} = g\frac{\partial f}{\partial x} + f\frac{\partial g}{\partial x}

Constant

โˆ‚Cfโˆ‚x=Cโˆ‚fโˆ‚x \frac{\partial Cf}{\partial x} = C \frac{\partial f}{\partial x}

2.2. Tensor Notation

Tensor notation, also known as Einstein summation convention, is a concise and accurate mathematical expression form.

Repeated indices imply summation.

For example

โˆ‚ฯ•iโˆ‚xi=โˆ‘iโˆ‚ฯ•iโˆ‚xi=โˆ‚ฯ•1โˆ‚x1+โˆ‚ฯ•2โˆ‚x2+โˆ‚ฯ•3โˆ‚x3,i=1,2,3 \frac{\partial \phi_{i}}{\partial x_{i}} = \sum\limits_{i} \frac{\partial \phi_{i}}{\partial x_{i}} = \frac{\partial \phi_{1}}{\partial x_{1}} + \frac{\partial \phi_{2}}{\partial x_{2}} + \frac{\partial \phi_{3}}{\partial x_{3}},i=1,2,3

Different indices are independent.

For example

โˆ‚uiujโˆ‚xi=โˆ‘iโˆ‚uiujโˆ‚xi=(โˆ‚uxuxโˆ‚x+โˆ‚uyuxโˆ‚y+โˆ‚uzuxโˆ‚zโˆ‚uxuyโˆ‚x+โˆ‚uyuyโˆ‚y+โˆ‚uzuyโˆ‚zโˆ‚uxuzโˆ‚x+โˆ‚uyuzโˆ‚y+โˆ‚uzuzโˆ‚z) \begin{align*} \frac{\partial u_{i}u_{j}}{\partial x_{i}} &= \sum\limits_{i} \frac{\partial u_{i}u_{j}}{\partial x_{i}} \\ &= \begin{pmatrix} \frac{\partial u_{x}u_{x}}{\partial x} + \frac{\partial u_{y}u_{x}}{\partial y} + \frac{\partial u_{z}u_{x}}{\partial z}\\ \frac{\partial u_{x}u_{y}}{\partial x} + \frac{\partial u_{y}u_{y}}{\partial y} + \frac{\partial u_{z}u_{y}}{\partial z}\\ \frac{\partial u_{x}u_{z}}{\partial x} + \frac{\partial u_{y}u_{z}}{\partial y} + \frac{\partial u_{z}u_{z}}{\partial z} \end{pmatrix} \end{align*}

2.3. Tensor Operations

Vector inner product

aโ‹…b=aibi=aTb=a1b1+a2b2+a3b3 \mathbf{a}\cdot \mathbf{b} =a_{i}b_{i} = \mathbf{a}^{T}\mathbf{b} = a_{1}b_{1} + a_{2}b_{2} + a_{3}b_{3}

Vector and tensor inner product

aโ‹…T=aiTij=(a1T11+a2T21+a3T31a1T12+a2T22+a3T32a1T13+a2T23+a3T33) \mathbf{a}\cdot \mathbf{T} = a_{i}T_{ij} = \begin{pmatrix}a_{1}T_{11}+a_{2}T_{21}+a_{3}T_{31} \\ a_{1}T_{12}+a_{2}T_{22}+a_{3}T_{32} \\ a_{1}T_{13}+a_{2}T_{23}+a_{3}T_{33}\end{pmatrix}

Tensor and vector inner product

Tโ‹…a=Tijaj=(T11a1+T12a2+T13a3T21a1+T22a2+T23a3T31a1+T32a2+T33a3) \mathbf{T}\cdot\mathbf{a} = T_{ij}a_{j} = \begin{pmatrix}T_{11}a_{1}+T_{12}a_{2}+T_{13}a_{3} \\ T_{21}a_{1}+T_{22}a_{2}+T_{23}a_{3} \\ T_{31}a_{1}+T_{32}a_{2}+T_{33}a_{3}\end{pmatrix}

Tensor double inner product (dyadic product)

T:S=TijSij=T11S11+T12S12+T13S13+T21S21+T22S22+T23S23+T31S31+T32S32+T33S33 \mathbf{T}:\mathbf{S} = T_{ij}S_{ij} = T_{11}S_{11}+T_{12}S_{12}+T_{13}S_{13}+T_{21}S_{21}+T_{22}S_{22}+T_{23}S_{23}+T_{31}S_{31}+T_{32}S_{32}+T_{33}S_{33}

Vector outer product

aโŠ—b=aibj=(a1b1a1b2a1b3a2b1a2b2a2b3a3b1a3b2a3b3) \mathbf{a} \otimes \mathbf{b} = a_{i}b_{j} = \begin{pmatrix}a_{1}b_{1}&a_{1}b_{2}&a_{1}b_{3} \\ a_{2}b_{1}&a_{2}b_{2}&a_{2}b_{3} \\ a_{3}b_{1}&a_{3}b_{2}&a_{3}b_{3}\end{pmatrix}

2.4. Gradient Calculations

Gradient calculation is a dimension-increasing operation.

Scalar gradient

gradฯ•=โˆ‡ฯ•=โˆ‚ฯ•โˆ‚xi=(โˆ‚ฯ•โˆ‚xโˆ‚ฯ•โˆ‚yโˆ‚ฯ•โˆ‚z) \mathsf{grad}\phi = \nabla\phi = \frac{\partial \phi}{\partial x_{i}} = \begin{pmatrix} \frac{\partial \phi}{\partial x} \\ \frac{\partial \phi}{\partial y} \\ \frac{\partial \phi}{\partial z} \end{pmatrix}

Vector gradient

gradU=โˆ‡U=โˆ‡โŠ—U=โˆ‚biโˆ‚xj=(โˆ‚u1โˆ‚x1โˆ‚u2โˆ‚x1โˆ‚u3โˆ‚x1โˆ‚u1โˆ‚x2โˆ‚u2โˆ‚x2โˆ‚u3โˆ‚x2โˆ‚u1โˆ‚x3โˆ‚u2โˆ‚x3โˆ‚u3โˆ‚x3) \mathsf{grad} \mathbf{U} = \nabla \mathbf{U} = \nabla\otimes \mathbf{U} = \frac{\partial b_{i}}{\partial x_{j}} = \begin{pmatrix} \frac{\partial u_{1}}{\partial x_{1}} & \frac{\partial u_{2}}{\partial x_{1}} & \frac{\partial u_{3}}{\partial x_{1}} \\ \frac{\partial u_{1}}{\partial x_{2}} & \frac{\partial u_{2}}{\partial x_{2}} & \frac{\partial u_{3}}{\partial x_{2}} \\ \frac{\partial u_{1}}{\partial x_{3}} & \frac{\partial u_{2}}{\partial x_{3}} & \frac{\partial u_{3}}{\partial x_{3}} \end{pmatrix}

2.5. Divergence Calculations

Divergence calculation is a dimension-reducing operation.

Vector divergence

divU=โˆ‡โ‹…U=โˆ‚uiโˆ‚xi=โˆ‚u1โˆ‚x1+โˆ‚u2โˆ‚x2+โˆ‚u3โˆ‚x3 div \mathbf{U} = \nabla\cdot \mathbf{U} = \frac{\partial u_{i}}{\partial x_{i}} = \frac{\partial u_{1}}{\partial x_{1}} + \frac{\partial u_{2}}{\partial x_{2}} + \frac{\partial u_{3}}{\partial x_{3}}

Tensor divergence

divT=โˆ‡โ‹…T=โˆ‚Tijโˆ‚xi=(โˆ‚T11โˆ‚x1+โˆ‚T21โˆ‚x2+โˆ‚T31โˆ‚x3โˆ‚T12โˆ‚x1+โˆ‚T22โˆ‚x2+โˆ‚T32โˆ‚x3โˆ‚T13โˆ‚x1+โˆ‚T23โˆ‚x2+โˆ‚T33โˆ‚x3) div \mathbf{T} = \nabla\cdot \mathbf{T} = \frac{\partial T_{ij}}{\partial x_{i}} = \begin{pmatrix} \frac{\partial T_{11}}{\partial x_{1}}+\frac{\partial T_{21}}{\partial x_{2}}+\frac{\partial T_{31}}{\partial x_{3}} \\ \frac{\partial T_{12}}{\partial x_{1}}+\frac{\partial T_{22}}{\partial x_{2}}+\frac{\partial T_{32}}{\partial x_{3}} \\ \frac{\partial T_{13}}{\partial x_{1}}+\frac{\partial T_{23}}{\partial x_{2}}+\frac{\partial T_{33}}{\partial x_{3}} \end{pmatrix}

2.6. Trace of Gradient

Reference gradient calculation

gradU=โˆ‡U=โˆ‡โŠ—U=โˆ‚biโˆ‚xj=(โˆ‚u1โˆ‚x1โˆ‚u2โˆ‚x1โˆ‚u3โˆ‚x1โˆ‚u1โˆ‚x2โˆ‚u2โˆ‚x2โˆ‚u3โˆ‚x2โˆ‚u1โˆ‚x3โˆ‚u2โˆ‚x3โˆ‚u3โˆ‚x3) \mathsf{grad} \mathbf{U} = \nabla \mathbf{U} = \nabla\otimes \mathbf{U} = \frac{\partial b_{i}}{\partial x_{j}} = \begin{pmatrix} \frac{\partial u_{1}}{\partial x_{1}} & \frac{\partial u_{2}}{\partial x_{1}} & \frac{\partial u_{3}}{\partial x_{1}} \\ \frac{\partial u_{1}}{\partial x_{2}} & \frac{\partial u_{2}}{\partial x_{2}} & \frac{\partial u_{3}}{\partial x_{2}} \\ \frac{\partial u_{1}}{\partial x_{3}} & \frac{\partial u_{2}}{\partial x_{3}} & \frac{\partial u_{3}}{\partial x_{3}} \end{pmatrix}

The trace of this gradient calculation is

tr(โˆ‡U)=โˆ‘i=13(โˆ‡U)ii=โˆ‚u1โˆ‚x1+โˆ‚u2โˆ‚x2+โˆ‚u3โˆ‚x3 \begin{align*} \mathrm{tr}(\nabla\mathbf{U}) &= \sum\limits_{i=1}^{3}(\nabla\mathbf{U})_{ii} \\ &= \frac{\partial u_{1}}{\partial x_{1}} + \frac{\partial u_{2}}{\partial x_{2}} + \frac{\partial u_{3}}{\partial x_{3}} \end{align*}

We can see that

โˆ‡โ‹…U=tr(โˆ‡U)=tr((โˆ‡U)T) \nabla\cdot\mathbf{U} = \mathrm{tr}(\nabla\mathbf{U}) = \mathrm{tr}((\nabla\mathbf{U})^{T})

2.6. Mixed Calculations

โˆ‡โ‹…(Uฯ)=Uโ‹…โˆ‡ฯ+ฯโˆ‡โ‹…U \nabla\cdot(\mathbf{U}\rho) = \mathbf{U}\cdot\nabla\rho + \rho\nabla\cdot \mathbf{U} โˆ‡โ‹…(UโŠ—U)=Uโ‹…โˆ‡โŠ—U+Uโˆ‡โ‹…U \nabla\cdot(\mathbf{U}\otimes \mathbf{U}) = \mathbf{U}\cdot\nabla\otimes \mathbf{U} + \mathbf{U}\nabla\cdot \mathbf{U} โˆ‡โ‹…(Tโ‹…U)=T:โˆ‡โŠ—U+Uโ‹…โˆ‡โ‹…T \nabla\cdot(\mathbf{T}\cdot \mathbf{U}) = \mathbf{T}:\nabla\otimes \mathbf{U} + \mathbf{U}\cdot\nabla\cdot \mathbf{T}

2.7. Matrix Decomposition

Any matrix can be decomposed into hydrostatic (mean) and deviatoric (non-mean) parts.

A=Ahyd+Adev \mathbf{A} = \mathbf{A}^{hyd} + \mathbf{A}^{dev}

The magnitude of the hydrostatic part is the sum of diagonal elements, which is also the trace calculation

โˆฃAhydโˆฃ=13tr(A)=13aii |\mathbf{A}^{hyd}| = \frac{1}{3}tr(\mathbf{A}) = \frac{1}{3}a_{ii}

The hydrostatic matrix is

Ahyd=13tr(A)I \mathbf{A}^{hyd} = \frac{1}{3}tr(\mathbf{A})\mathbf{I}

We can also obtain

Adev=Aโˆ’Ahyd=Aโˆ’13tr(A)I \mathbf{A}^{dev} = \mathbf{A} - \mathbf{A}^{hyd} = \mathbf{A} - \frac{1}{3}tr(\mathbf{A})\mathbf{I}

To aid understanding, let’s take a 3D matrix as an example

A=(123320203) \mathbf{A} = \begin{pmatrix} 1&2&3 \\ 3&2&0 \\ 2&0&3 \end{pmatrix}

The trace of this matrix is

tr(A)=1+2+3=6 tr(\mathbf{A}) = 1 + 2 + 3 = 6

The hydrostatic part of this matrix is

Ahyd=13tr(A)I=2I=(200020002)\mathbf{A}^{hyd} = \frac{1}{3}tr(\mathbf{A})\mathbf{I} = 2\mathbf{I} = \begin{pmatrix}2&0&0 \\ 0&2&0 \\ 0&0&2\end{pmatrix}

The deviatoric part of this matrix is

Adev=(โˆ’123300201) \mathbf{A}^{dev} = \begin{pmatrix}-1&2&3 \\ 3&0&0 \\ 2&0&1\end{pmatrix}

2.8. Gauss Theorem

Gauss theorem is also known as the divergence theorem

The flux integral over the volume boundary equals the divergence integral within the volume, i.e.

โˆซโˆ‚VUโ‹…dS=โˆซVโˆ‡โ‹…UdV \int_{\partial{V}} \mathbf{U}\cdot d\mathbf{S} = \int_{V}\nabla\cdot \mathbf{U} dV

3. Recommendations

It is strongly recommended that readers personally derive the theoretical formulas.

Additionally, be aware that theoretical learning and understanding is an iterative process. It is very normal to consult many books for one knowledge point, or to read one book many times.

When encountering difficulties in learning and understanding, it is recommended not to retreat, but to consult widely, actively discuss, and finally form your own output.

References

[1] The Finite Volume Method in Computational Fluid Dynamics, https://link.springer.com/book/10.1007/978-3-319-16874-6

[2] Computational fluid dynamics : the basics with applications, https://searchworks.stanford.edu/view/2989631

[3] Mathematics, Numerics, Derivations and OpenFOAMยฎ, https://holzmann-cfd.com/community/publications/mathematics-numerics-derivations-and-openfoam-free

[4] Notes on Computational Fluid Dynamics: General Principles, https://doc.cfd.direct/notes/cfd-general-principles/

Support us

Tip

Hopefully, the sharing here can be helpful to you.

If you find this content helpful, your comments or donations would be greatly appreciated. Your support helps ensure the ongoing updates, corrections, refinements, and improvements to this and future series, ultimately benefiting new readers as well.

The information and message provided during donation will be displayed as an acknowledgment of your support.

Copyright @ 2026 Aerosand

Last updated on โ€ข Aerosand