返回主页

张量公式查询

2017.07.23:初级内容适配至课程页面

本文提供常见的张量操作。$p$为标量(如压力)。$\bfU$为矢量,其分量为$u_1$,$u_2$,$u_3$。$\tau$为二阶张量,其分量为$\tau_{11}$,$\tau_{12}$等共9个。

张量基本运算

● 标量的梯度:
\begin{equation} \nabla p = \left[\begin{matrix} \frac{\partial p}{\partial x} \\ \frac{\partial p}{\partial y} \\ \frac{\partial p}{\partial z} \end{matrix} \right] \end{equation}
● 标量的梯度后求散度:
\begin{equation} \nabla \cdot(\nabla p)=\nabla ^2p=\frac{\partial^2p}{\partial x^2}+\frac{\partial^2p}{\partial y^2}+\frac{\partial^2p}{\partial z^2} \end{equation}
● 矢量的内积:
\begin{equation} \mathbf{U} \cdot \mathbf{U} =\bfU^\rT\cdot\bfU= [u_1, u_2, u_3] \left[\begin{matrix} u_1 \\ u_2 \\ u_3 \end{matrix} \right]=u_1u_1+u_2u_2+u_3u_3 \end{equation}
● 矢量的叉乘:
\begin{equation} \mathbf{U} \times \mathbf{U}=\left[ \begin{matrix} u_2u_3-u_3u_2\\ u_3u_1-u_1u_3\\ u_1u_2-u_2u_1\\ \end{matrix} \right] \end{equation}
● 矢量的散度:
\begin{equation} \nabla \cdot \mathbf{U} = \frac{\partial u_1}{\partial x}+\frac{\partial u_2}{\partial y}+\frac{\partial u_3}{\partial z} \end{equation}
● 矢量的梯度:
\begin{equation} \nabla \mathbf{U} = \left[ \begin{matrix} \frac{\partial u_1}{\partial x} & \frac{\partial u_2}{\partial x} & \frac{\partial u_3}{\partial x}\\ \frac{\partial u_1}{\partial y} & \frac{\partial u_2}{\partial y} & \frac{\partial u_3}{\partial y} \\ \frac{\partial u_1}{\partial z} & \frac{\partial u_2}{\partial z} & \frac{\partial u_3}{\partial z}\\ \end{matrix} \right] \end{equation}
● 矢量的梯度后求散度(拉普拉斯):
\begin{equation} \nabla \cdot(\nabla \mathbf{U})= \left[ \begin{matrix} \frac{\partial}{\partial x}\left(\frac{\partial u_1}{\partial x}\right)+\frac{\partial}{\partial y}\left(\frac{\partial u_1}{\partial y}\right)+\frac{\partial}{\partial z}\left(\frac{\partial u_1}{\partial z}\right)\\ \frac{\partial}{\partial x}\left(\frac{\partial u_2}{\partial x}\right)+\frac{\partial}{\partial y}\left(\frac{\partial u_2}{\partial y}\right)+\frac{\partial}{\partial z}\left(\frac{\partial u_2}{\partial z}\right)\\ \frac{\partial}{\partial x}\left(\frac{\partial u_3}{\partial x}\right)+\frac{\partial}{\partial y}\left(\frac{\partial u_3}{\partial y}\right)+\frac{\partial}{\partial z}\left(\frac{\partial u_3}{\partial z}\right)\\ \end{matrix} \right] \end{equation}
● 矢量的双积:
\begin{equation} \mathbf{U}\otimes\mathbf{U}=\mathbf{U}\cdot\mathbf{U}^\rT=\left[ \begin{matrix} u_1 u_1 & u_1 u_2 & u_1 u_3\\ u_2 u_1 & u_2 u_2 & u_2 u_3\\ u_3 u_1 & u_3 u_2 & u_3 u_3 \end{matrix} \right] \end{equation}
● 矢量的旋度:
\begin{equation} \nabla\times\mathbf{U}=\left[ \begin{matrix} \frac{\partial u_3}{\partial y}-\frac{\partial u_2}{\partial z}\\ \frac{\partial u_1}{\partial z}-\frac{\partial u_3}{\partial x}\\ \frac{\partial u_2}{\partial x}-\frac{\partial u_1}{\partial y}\\ \end{matrix} \right] \end{equation}
● 张量的散度:
\begin{equation} \nabla \cdot \tau = \left[\begin{matrix} \frac{\partial\tau_{xx}}{\partial x}+\frac{\partial\tau_{yx}}{\partial y}+\frac{\partial\tau_{zx}}{\partial z} \\ \frac{\partial\tau_{xy}}{\partial x}+\frac{\partial\tau_{yy}}{\partial y}+\frac{\partial\tau_{zy}}{\partial z} \\ \frac{\partial\tau_{xz}}{\partial x}+\frac{\partial\tau_{yz}}{\partial y}+\frac{\partial\tau_{zz}}{\partial z} \end{matrix}\right] \end{equation}
● 张量的双点积:
\begin{equation} \tau:\tau=\tau_{11}\tau_{11}+\tau_{12}\tau_{12}+\tau_{13}\tau_{13}+ \tau_{21}\tau_{21}+\tau_{22}\tau_{22}+\tau_{23}\tau_{23}+ \tau_{31}\tau_{31}+\tau_{32}\tau_{32}+\tau_{33}\tau_{33} \end{equation}
● 张量的迹:
\begin{equation} \mathrm{tr} \left(\tau\right)=\tau_{xx}+\tau_{yy}+\tau_{zz} \end{equation}
● 张量的$\mathrm{symm}$:
\begin{equation} \mathrm{symm} \left(\tau\right)=\frac{\tau+\tau^T}{2} \end{equation}
● 张量的$\mathrm{skew}$:
\begin{equation} \mathrm{skew} \left(\tau\right)=\frac{\tau-\tau^T}{2} \end{equation}
● 张量的$\mathrm{dev}$:
\begin{equation} \mathrm{dev} \left(\tau\right)=\tau-\frac{1}{3}\mathrm{tr}\left(\tau\right)\mathbf{I} \end{equation}
● 张量的$\mathrm{dev}2$:
\begin{equation} \mathrm{dev}2 \left(\tau\right)=\tau-\frac{2}{3}\mathrm{tr}\left(\tau\right)\mathbf{I} \end{equation}
● 张量的$\mathrm{hyd}$:
\begin{equation} \mathrm{hyd} \left(\tau\right)=\frac{1}{3}\mathrm{tr}\left(\tau\right)\mathbf{I} \end{equation}

基本张量操作

\begin{equation} \nabla (\alpha p)=\alpha\nabla p+p\nabla\alpha \end{equation}
\begin{equation} \nabla (\alpha \mathbf{U})=\alpha\otimes\nabla\mathbf{U}+\alpha\nabla\mathbf{U} \end{equation}
\begin{equation} \nabla \cdot(\alpha \mathbf{U})=\alpha\nabla\cdot \mathbf{U}+\mathbf{U} \cdot \nabla\alpha \end{equation}
\begin{equation} \nabla \times (\alpha \mathbf{U})=\alpha\nabla\times \mathbf{U}+\mathbf{U} \times\nabla\alpha \end{equation}
\begin{equation} \nabla(\mathbf{U}\cdot\mathbf{V})=\mathbf{U}\times(\nabla\times\mathbf{V})+\mathbf{V}\times(\nabla\times\mathbf{U})+(\mathbf{U}\cdot\nabla)\mathbf{V}+(\mathbf{V}\cdot\nabla)\mathbf{U} \end{equation}
\begin{equation} \nabla\cdot(\mathbf{U}\times\mathbf{V})=\mathbf{V}\cdot(\nabla\times\mathbf{U})-\mathbf{U}\cdot(\nabla\times\mathbf{V}) \end{equation}
\begin{equation} \nabla\times(\mathbf{U}\times\mathbf{V})=\mathbf{U}(\nabla\cdot\mathbf{V})-\mathbf{V}(\nabla\cdot\mathbf{U})+(\mathbf{V}\cdot\nabla)\mathbf{U}-(\mathbf{U}\cdot\nabla)\mathbf{V} \end{equation}
\begin{equation} \nabla\times(\nabla\times\mathbf{U})=\nabla(\nabla\cdot\mathbf{U})-\nabla^2\mathbf{U} \end{equation}
\begin{equation} (\nabla\times\mathbf{U})\times\mathbf{U}=\mathbf{U}\cdot(\nabla\mathbf{U})-\nabla(\mathbf{U}\cdot\mathbf{U}) \end{equation}
\begin{equation} \nabla\cdot\nabla\mathbf{U}=\nabla(\nabla\cdot\mathbf{U})-\nabla\times(\nabla\times\mathbf{U}) \end{equation}
\begin{equation} \nabla\cdot(\mathbf{U} \mathbf{U})=\nabla\cdot(\mathbf{U} \otimes \mathbf{U})=\mathbf{U} \cdot \nabla \mathbf{U}+\mathbf{U} \nabla \cdot \mathbf{U} \end{equation}
\begin{equation} \nabla\cdot(\alpha \tau)=\tau \nabla \alpha + \alpha \nabla \cdot \tau \end{equation}
\begin{equation} \nabla\cdot(\tau\mathbf{U})=(\nabla\cdot\tau^\mathrm{T})\cdot\mathbf{U}+\tau^\mathrm{T}\cdot\nabla\mathbf{U} \end{equation}
\begin{equation} \mathbf{U}\cdot(\tau\mathbf{V})=\tau\cdot(\mathbf{U}\otimes\mathbf{V})=\tau\cdot(\mathbf{U}\mathbf{V}) \end{equation}
\begin{equation} \mathbf{U}\mathbf{V}:\tau=\mathbf{U}\cdot(\mathbf{V}\cdot\tau) \end{equation}
\begin{equation} \tau:\mathbf{U}\mathbf{V}=(\tau\cdot\mathbf{U})\cdot\mathbf{V} \end{equation}
\begin{equation} \mathrm{tr}\left(\nabla\mathbf{U}\right)=\nabla\cdot\mathbf{U}=\mathrm{tr}\left(\nabla\mathbf{U}^{\mathrm{T}}\right) \end{equation}
\begin{equation} \tau=\frac{1}{2}\left(\tau+\tau^\mathrm{T}\right)+\frac{1}{2}\left(\tau-\tau^\mathrm{T}\right)=\mathrm{symm}\left(\tau\right)+\mathrm{skew}\left(\tau\right) \end{equation}

张量操作小例子

首先我们来看CFD中的不可压缩动量方程:
\begin{equation} \frac{\partial \mathbf{U}}{\partial t}+\nabla \cdot (\mathbf{U}\mathbf{U})=-\nabla \frac{p}{\rho}+\nabla \cdot(\nabla \mathbf{U}) \label{mom} \end{equation}
其中的$\mathbf{U}$为速度矢量,$p$为压力,$\rho$为密度。该方程实际上表示3个方程。一般来讲,CFD文献中通常采用公式(1)的形式(紧凑形式)而并不进行展开。

● 公式(1)的第一项:$\frac{\partial \mathbf{U}}{\partial t}$。因为$\mathbf{U}$为矢量,展开其表示为:
\begin{equation}\label{time} \frac{\partial \mathbf{U}}{\partial t}= \left[ \begin{matrix} \frac{\partial u_1}{\partial t} \\ \frac{\partial u_2}{\partial t} \\ \frac{\partial u_3}{\partial t} \\ \end{matrix} \right] \end{equation}
其中$u_1$表示x方向速度,$u_2$表示y方向速度,$u_3$表示z方向速度。这样拆分之后的方程,即为各个方向的速度针对时间的偏导数。

● 公式(1)的第二项:$\nabla \cdot (\mathbf{U}\mathbf{U})$。$\mathbf{U}\mathbf{U}$是一种简写,完整形式为$\mathbf{U}\otimes \mathbf{U}$,$\otimes$是一个张量运算符称之为dyadic product。针对上面的速度矢量,$\mathbf{U}\mathbf{U}$即:
\begin{equation} \mathbf{U}\mathbf{U}=\mathbf{U} \otimes \mathbf{U}=\left[\begin{matrix} u_1\\ u_2\\ u_3 \end{matrix}\right][u_1, u_2, u_3]=\left[ \begin{matrix} u_1 u_1 & u_1 u_2 & u_1 u_3\\ u_2 u_1 & u_2 u_2 & u_2 u_3\\ u_3 u_1 & u_3 u_2 & u_3 u_3 \end{matrix} \right] \end{equation}
然后我们那讨论$\nabla \cdot$,其也称之为散度(div)算符。对一个矢量(1阶张量)做散度的结果为一个标量(0阶张量),对一个2阶张量做散度的结果为矢量(1阶张量)。因此,对任意$n$阶张量做散度,$\nabla \cdot$,之后的结果为$n-1$阶张量。举例,对一个矢量做散度我们有:
\begin{equation} \nabla \cdot \mathbf{U} = \frac{\partial u_1}{\partial x}+\frac{\partial u_2}{\partial y}+\frac{\partial u_3}{\partial z} \label{cont2} \end{equation}
因此,公式(1)中的第二项$\nabla \cdot (\mathbf{U}\mathbf{U})$即为对一个2阶张量做散度,即为:
\begin{equation}\label{conv} \nabla \cdot \left(\mathbf{U}\mathbf{U}\right) = \nabla \cdot \left[ \begin{matrix} u_1 u_1 & u_1 u_2 & u_1 u_3\\ u_2 u_1 & u_2 u_2 & u_2 u_3\\ u_3 u_1 & u_3 u_2 & u_3 u_3 \end{matrix} \right]=\left[ \begin{matrix} \frac{\partial u_1 u_1}{\partial x}+\frac{\partial u_2 u_1}{\partial y}+\frac{\partial u_3 u_1}{\partial z} \\ \frac{\partial u_1 u_2}{\partial x}+\frac{\partial u_2 u_2}{\partial y}+\frac{\partial u_2 u_2}{\partial z} \\ \frac{\partial u_1 u_3}{\partial x}+\frac{\partial u_2 u_3}{\partial y}+\frac{\partial u_3 u_3}{\partial z} \end{matrix} \right] \end{equation}
● 公式(1)第三项:$\nabla \frac{p}{\rho}$。同样是$\nabla$算子,这一项中没有了$\cdot$符号。$\nabla$我们称之为梯度(grad)。对一个标量(0阶张量)做梯度的结果为一个矢量(1阶张量),对一个矢量做梯度的结果为2阶张量。因此,对任意$n$阶张量做梯度,$\nabla$,之后的结果为$n+1$阶张量。举例,对一个标量,$p$,做梯度我们有:
\begin{equation}\label{p} \nabla p = \left[ \begin{matrix} \frac{\partial p}{\partial x} \\ \frac{\partial p}{\partial y} \\ \frac{\partial p}{\partial z} \\ \end{matrix} \right] \end{equation}
类似的,对一个矢量,$\mathbf{U}$,做梯度我们有:
\begin{equation} \nabla \mathbf{U} = \left[ \begin{matrix} \frac{\partial u_1}{\partial x} & \frac{\partial u_2}{\partial x} & \frac{\partial u_3}{\partial x}\\ \frac{\partial u_1}{\partial y} & \frac{\partial u_2}{\partial y} & \frac{\partial u_3}{\partial y} \\ \frac{\partial u_1}{\partial z} & \frac{\partial u_2}{\partial z} & \frac{\partial u_3}{\partial z}\\ \end{matrix} \right] \end{equation}
● 公式(1)第四项:$\nabla \cdot(\nabla \mathbf{U})$。依据上文的分析,其即为对速度$\mathbf{U}$先做梯度再做散度。$\nabla \cdot \nabla$通常也写为$\nabla^2$,并称为拉普拉斯算子。有了上面的介绍,对这一项展开是很明了的:
\begin{equation}\label{diff} \nabla \cdot(\nabla \bfU)=\nabla \cdot \left[ \begin{matrix} \frac{\partial u_1}{\partial x} & \frac{\partial u_2}{\partial x} & \frac{\partial u_3}{\partial x}\\ \frac{\partial u_1}{\partial y} & \frac{\partial u_2}{\partial y} & \frac{\partial u_3}{\partial y} \\ \frac{\partial u_1}{\partial z} & \frac{\partial u_2}{\partial z} & \frac{\partial u_3}{\partial z}\\ \end{matrix} \right]= \left[ \begin{matrix} \frac{\partial}{\partial x}\left(\frac{\partial u_1}{\partial x}\right)+\frac{\partial}{\partial y}\left(\frac{\partial u_1}{\partial y}\right)+\frac{\partial}{\partial z}\left(\frac{\partial u_1}{\partial z}\right)\\ \frac{\partial}{\partial x}\left(\frac{\partial u_2}{\partial x}\right)+\frac{\partial}{\partial y}\left(\frac{\partial u_2}{\partial y}\right)+\frac{\partial}{\partial z}\left(\frac{\partial u_2}{\partial z}\right)\\ \frac{\partial}{\partial x}\left(\frac{\partial u_3}{\partial x}\right)+\frac{\partial}{\partial y}\left(\frac{\partial u_3}{\partial y}\right)+\frac{\partial}{\partial z}\left(\frac{\partial u_3}{\partial z}\right)\\ \end{matrix} \right] \end{equation}
同理,对一个标量做拉普拉斯操作有:
\begin{equation} \nabla \cdot(\nabla p)=\frac{\partial^2p}{\partial x^2}+\frac{\partial^2p}{\partial y^2}+\frac{\partial^2p}{\partial z^2} \end{equation}
结合方程\eqref{time}、\eqref{conv}、\eqref{p}、\eqref{diff},我们有三个方程。下面仅列出$x$方向:
\begin{equation} \frac{\partial u_1}{\partial t} + \frac{\partial u_1 u_1}{\partial x}+\frac{\partial u_2 u_1}{\partial y}+\frac{\partial u_3 u_1}{\partial z} = -\frac{1}{\rho}\frac{\partial p}{ \partial x} + \frac{\partial}{\partial x}\left(\frac{\partial u_1}{\partial x}\right)+\frac{\partial}{\partial y}\left(\frac{\partial u_2}{\partial y}\right)+\frac{\partial}{\partial z}\left(\frac{\partial u_3}{\partial z}\right) \end{equation}

东岳流体dyfluid.com
勘误、讨论、补充内容请前往CFD中国