偏微分方程计算初步

偏微分方程计算初步

基本张量表达

在计算流体力学领域数学符号是理解和导出公式的关键部分。不管是人工推导还是计算机执行,在计算偏微分方程之前都需要掌握一些数学计算符号。本文中主要介绍一些必要的数学符号。通常一种场,例如标量,矢量以及一些经典的已知矩阵都可以用张量代表。因此,数值模拟可以说就是在处理n阶的张量 T n T^n Tn。为了更加清楚的理解这一点,我们做出如下定义:
0阶张量 T 0 T^0 T0:= C C C
一阶张量 T 1 T^1 T1:= a ⃗ \vec a a
二阶张量 T 2 T^2 T2:=3*3的矩阵,张量T
三阶张量 T 3 T^3 T3:= T i j k T_{ijk} Tijk

基本导数定义:

两个函数相加的导数等于函数导数的和:
∂ ( f 1 + f 2 ) ∂ t = ∂ f 1 ∂ t + ∂ f 2 ∂ t \frac{\partial{(f_1+f_2)}}{\partial{t}}=\frac{\partial{f_1}}{\partial{t}}+\frac{\partial{f_2}}{\partial{t}} t(f1+f2)=tf1+tf2
∂ ( f 1 − f 2 ) ∂ t = ∂ f 1 ∂ t − ∂ f 2 ∂ t \frac{\partial{(f_1-f_2)}}{\partial{t}}=\frac{\partial{f_1}}{\partial{t}}-\frac{\partial{f_2}}{\partial{t}} t(f1f2)=tf1tf2
两个导数相乘的导数等于分别对两个函数单独求导的和:
∂ ( f 1 f 2 ) ∂ t = f 1 ∂ f 2 ∂ t + f 2 ∂ f 1 ∂ t \frac{\partial{(f_1 f_2)}}{\partial{t}}=f_1\frac{\partial{ f_2}}{\partial{t}}+ f_2\frac{\partial{f_1}}{\partial{t}} t(f1f2)=f1tf2+f2tf1
∂ ( f 1 f 2 f 3 ) ∂ t = f 1 ∂ f 2 f 3 ∂ t + f 2 f 3 ∂ f 1 ∂ t = f 1 f 2 ∂ f 3 ∂ t + f 1 f 3 ∂ f 2 ∂ t + f 2 f 3 ∂ f 1 ∂ t \frac{\partial{(f_1 f_2 f_3)}}{\partial{t}}=f_1\frac{\partial{f_2 f_3}}{\partial{t}}+f_2 f_3\frac{\partial{f_1}}{\partial{t}}=f_1f_2\frac{\partial{ f_3}}{\partial{t}}+f_1 f_3\frac{\partial{f_2}}{\partial{t}}+f_2 f_3\frac{\partial{f_1}}{\partial{t}} t(f1f2f3)=f1tf2f3+f2f3tf1=f1f2tf3+f1f3tf2+f2f3tf1
一个常数C与函数的乘的导数:
∂ ( C f 1 f 2 ) ∂ t = C f 1 ∂ f 2 ∂ t + C f 2 ∂ f 1 ∂ t \frac{\partial{(Cf_1 f_2)}}{\partial{t}}=Cf_1\frac{\partial{ f_2}}{\partial{t}}+C f_2\frac{\partial{f_1}}{\partial{t}} t(Cf1f2)=Cf1tf2+Cf2tf1

爱因斯坦求和约定

爱因斯坦求和约定就是省略求和符号。在流体动力学中,符号系统多种多样。最长的也是最简明的是笛卡尔形式。这种形式的表示可以使用爱因斯坦求和约定写成更为简单的形式。设一个函数在笛卡尔坐标下可以表示为如下所示的形式。
∂ f ∂ x + ∂ f ∂ y + ∂ f ∂ z = ∑ i ∂ f ∂ x i = ∂ f ∂ x i {\frac{\partial{f}}{\partial{x}}}+{\frac{\partial{f}}{\partial{y}}}+{\frac{\partial{f}}{\partial{z}}}=\sum_i {\frac{\partial{f}}{\partial{x_i}}}={\frac{\partial{f}}{\partial{x_i}}} xf+yf+zf=ixif=xif
以上简单的式子并不能很好的体现爱因斯坦求和约定表示方法的优越性。再例如如下所示的式子:
∂ f x f x ∂ x + ∂ f y f x ∂ y + ∂ f z f x ∂ z + ∂ f x f y ∂ x + ∂ f y f y ∂ y + ∂ f z f y ∂ z + ∂ f x f z ∂ x + ∂ f y f z ∂ y + ∂ f z f z ∂ z = ∑ i ∑ j ∂ f j f i ∂ x j = ∂ f j f i ∂ x j {\frac{\partial{f_xf_x}}{\partial{x}}}+{\frac{\partial{f_yf_x}}{\partial{y}}}+{\frac{\partial{f_zf_x}}{\partial{z}}}+ {\frac{\partial{f_xf_y}}{\partial{x}}}+ {\frac{\partial{f_yf_y}}{\partial{y}}}+{\frac{\partial{f_zf_y}}{\partial{z}}}+{\frac{\partial{f_xf_z}}{\partial{x}}}+ {\frac{\partial{f_yf_z}}{\partial{y}}}+{\frac{\partial{f_zf_z}}{\partial{z}}}\\=\sum_i \sum_j {\frac{\partial{f_jf_i}}{\partial{x_j}}}=\frac{\partial{f_jf_i}}{\partial{x_j}} xfxfx+yfyfx+zfzfx+xfxfy+yfyfy+zfzfy+xfxfz+yfyfz+zfzfz=ijxjfjfi=xjfjfi
将式子在笛卡尔坐标系中展开:
∂ ρ u i t + ∂ ρ u i u j x j = ∂ ρ u t + ∂ ρ v t + ∂ ρ w t + ∂ ρ u u x + ∂ ρ u v y + ∂ ρ u w z + ∂ ρ v u x + ∂ ρ v v y + ∂ ρ v w z + ∂ ρ w u x + ∂ ρ w v y + ∂ ρ w w z \frac{\partial{\rho u_i}}{t}+\frac{\partial{\rho u_i u_j}}{x_j}=\frac{\partial{\rho u}}{t}+\frac{\partial{\rho v}}{t}+\frac{\partial{\rho w}}{t}+\frac{\partial{\rho u u}}{x}\\+\frac{\partial{\rho u v}}{y}+\frac{\partial{\rho u w}}{z}+\frac{\partial{\rho v u}}{x}+\frac{\partial{\rho v v}}{y}+\frac{\partial{\rho v w}}{z}+\frac{\partial{\rho w u}}{x}+\frac{\partial{\rho w v}}{y}+\frac{\partial{\rho w w}}{z} tρui+xjρuiuj=tρu+tρv+tρw+xρuu+yρuv+zρuw+xρvu+yρvv+zρvw+xρwu+yρwv+zρww

张量数学计算

使用矢量替代爱因斯坦求和约定是一种常用的公式处理方法。例如如下几个矢量:
a ⃗ = ( a x a y a z ) = ( a 1 a 2 a 3 ) \vec a=\begin{pmatrix} a_x \\ a_y \\ a_z \end{pmatrix}=\begin{pmatrix} a_1 \\ a_2 \\ a_3 \end{pmatrix} a =axayaz=a1a2a3
b ⃗ = ( b x b y b z ) = ( b 1 b 2 b 3 ) \vec b=\begin{pmatrix} b_x \\ b_y \\ b_z \end{pmatrix}=\begin{pmatrix} b_1 \\ b_2 \\ b_3 \end{pmatrix} b =bxbybz=b1b2b3
T = [ T x x T x y T x z T y x T y y T y z T z x T z y T z z ] = [ T 11 T 12 T 13 T 21 T 22 T 23 T 31 T 32 T 33 ] T=\begin{bmatrix} T_{xx}&T_{xy}&T_{xz} \\ T_{yx}&T_{yy}&T_{yz} \\ T_{zx}&T_{zy}&T_{zz}\end{bmatrix}=\begin{bmatrix} T_{11}&T_{12}&T_{13} \\ T_{21}&T_{22}&T_{23} \\ T_{31}&T_{32}&T_{33} \end{bmatrix} T=TxxTyxTzxTxyTyyTzyTxzTyzTzz=T11T21T31T12T22T32T13T23T33
单位矢量和单位阵:
e 1 = e x = ( 1 0 0 ) e_1=e_x=\begin{pmatrix} 1 \\ 0 \\ 0\end{pmatrix} e1=ex=100
e 2 = e y = ( 0 1 0 ) e_2=e_y=\begin{pmatrix} 0 \\ 1 \\ 0\end{pmatrix} e2=ey=010
e 3 = e z = ( 0 0 1 ) e_3=e_z=\begin{pmatrix} 0 \\ 0 \\ 1\end{pmatrix} e3=ez=001
I = [ 1 0 0 0 1 0 0 0 1 ] I=\begin{bmatrix} 1&0&0 \\ 0&1&0 \\ 0&0&1\end{bmatrix} I=100010001
简单操作:
C b ⃗ = ( C b x C b y C b z ) C\vec b=\begin{pmatrix} C b_x \\ C b_y \\ C b_z\end{pmatrix} Cb =CbxCbyCbz
C T = [ C T x x C T x y C T x z C T y x C T y y C T y z C T z x C T z y C T z z ] C T=\begin{bmatrix} C T_{xx}&C T_{xy}&C T_{xz} \\ C T_{yx}&C T_{yy}&C T_{yz} \\C T_{zx}&C T_{zy}&C T_{zz}\end{bmatrix} CT=CTxxCTyxCTzxCTxyCTyyCTzyCTxzCTyzCTzz

内积

内积的基本原理:
a i ⃗ ⋅ b j ⃗ = a b i ⃗ ⋅ j ⃗ = 0 a i ⃗ ⋅ b k ⃗ = a b i ⃗ ⋅ k ⃗ = 0 a j ⃗ ⋅ b k ⃗ = a b j ⃗ ⋅ k ⃗ = 0 a i ⃗ ⋅ b i ⃗ = a b i ⃗ ⋅ i ⃗ = a b a j ⃗ ⋅ b j ⃗ = a b j ⃗ ⋅ j ⃗ = a b a k ⃗ ⋅ b k ⃗ = a b k ⃗ ⋅ k ⃗ = a b a i ⃗ ⋅ b i j ⃗ = a b i ⃗ ⋅ i j ⃗ = a b j ⃗ b i j ⃗ ⋅ a i ⃗ = a b i j ⃗ ⋅ i ⃗ = 0 a\vec i\cdot b\vec j=ab\vec i \cdot\vec j=0\\ a\vec i\cdot b\vec k=ab\vec i \cdot\vec k=0\\ a\vec j\cdot b\vec k=ab\vec j \cdot\vec k=0\\ a\vec i\cdot b\vec i=ab\vec i \cdot\vec i=ab\\ a\vec j\cdot b\vec j=ab\vec j \cdot\vec j=ab\\ a\vec k\cdot b\vec k=ab\vec k \cdot\vec k=ab\\a\vec i\cdot b\vec {ij}=ab\vec i\cdot \vec {ij}=ab\vec j\\b\vec {ij}\cdot a\vec {i}=ab\vec {ij}\cdot \vec {i}=0 ai bj =abi j =0ai bk =abi k =0aj bk =abj k =0ai bi =abi i =abaj bj =abj j =abak bk =abk k =abai bij =abi ij =abj bij ai =abij i =0
ϕ = a ⃗ ⋅ b ⃗ = ( a 1 i ⃗ + a 2 j ⃗ + a 3 k ⃗ ) ⋅ ( b 1 i ⃗ + b 2 j ⃗ + b 3 k ⃗ ) = a 1 b 1 + a 2 b 2 + a 3 b 3 = ∑ i = 1 3 a i b i = a i b i \phi=\vec a \cdot \vec b=(a_1\vec i+a_2\vec j+a_3\vec k)\cdot (b_1\vec i+b_2\vec j+b_3\vec k)=a_1b_1+a_2b_2+a_3b_3=\sum_{i=1}^3 a_ib_i=a_ib_i ϕ=a b =(a1i +a2j +a3k )(b1i +b2j +b3k )=a1b1+a2b2+a3b3=i=13aibi=aibi
b ⃗ = a ⃗ ⋅ T = ( a 1 i ⃗ + a 2 j ⃗ + a 3 k ⃗ ) ⋅ ( T 11 i ⃗ i ⃗ + T 12 i ⃗ j ⃗ + T 13 i ⃗ k ⃗ + T 21 j ⃗ i ⃗ + T 22 j ⃗ j ⃗ + T 23 j ⃗ k ⃗ + T 31 k ⃗ i ⃗ + T 32 k ⃗ j ⃗ + T 33 k ⃗ k ⃗ ) = a 1 T 11 i ⃗ + a 1 T 12 j ⃗ + a 1 T 13 k ⃗ + a 2 T 21 i ⃗ + a 2 T 22 j ⃗ + a 2 T 23 k ⃗ + a 3 T 31 i ⃗ + a 3 T 32 j ⃗ + a 3 T 33 k ⃗ = ( 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 ) = ∑ i = 1 3 ∑ j = 1 3 a i T i j e ⃗ j = a i T i j e ⃗ j \vec b=\vec a \cdot T=(a_1\vec i+a_2\vec j+a_3\vec k)\cdot (T_{11}\vec i\vec i+T_{12}\vec i\vec j+T_{13}\vec i\vec k+T_{21}\vec j\vec i+T_{22}\vec j\vec j+T_{23}\vec j\vec k+T_{31}\vec k\vec i+T_{32}\vec k\vec j+T_{33}\vec k\vec k)\\ =a_1T_{11}\vec i+a_1T_{12}\vec j+a_1T_{13}\vec k+a_2T_{21}\vec i+a_2T_{22}\vec j+a_2T_{23}\vec k+a_3T_{31}\vec i+a_3T_{32}\vec j+a_3T_{33}\vec k \\=\begin{pmatrix} a_1T_{11}+ a_2T_{21}+a_3T_{31}\\ a_1T_{12}+a_2T_{22}+a_3T_{32} \\ a_1T_{13}+a_2T_{23}+a_3T_{33}\end{pmatrix}=\sum_{i=1}^3\sum_{j=1}^3{a_iT_{ij}\vec e_j}=a_iT_{ij}\vec e_j b =a T=(a1i +a2j +a3k )(T11i i +T12i j +T13i k +T21j i +T22j j +T23j k +T31k i +T32k j +T33k k )=a1T11i +a1T12j +a1T13k +a2T21i +a2T22j +a2T23k +a3T31i +a3T32j +a3T33k =a1T11+a2T21+a3T31a1T12+a2T22+a3T32a1T13+a2T23+a3T33=i=13j=13aiTije j=aiTije j
b ⃗ = T ⋅ a ⃗ = ( T 11 i ⃗ i ⃗ + T 12 i ⃗ j ⃗ + T 13 i ⃗ k ⃗ + T 21 j ⃗ i ⃗ + T 22 j ⃗ j ⃗ + T 23 j ⃗ k ⃗ + T 31 k ⃗ i ⃗ + T 32 k ⃗ j ⃗ + T 33 k ⃗ k ⃗ ) ⋅ ( a 1 i ⃗ + a 2 j ⃗ + a 3 k ⃗ ) = a 1 T 11 i ⃗ + a 2 T 12 i ⃗ + a 3 T 13 i ⃗ + a 1 T 21 j ⃗ + a 2 T 22 j ⃗ + a 3 T 23 j ⃗ + a 1 T 31 j ⃗ + a 2 T 32 j ⃗ + a 3 T 33 j ⃗ = ( a 1 T 11 + a 2 T 12 + a 3 T 13 a 1 T 21 + a 2 T 22 + a 3 T 23 a 1 T 31 + a 2 T 32 + a 3 T 33 ) = ∑ i = 1 3 ∑ j = 1 3 a i T j i e ⃗ i = a i T j i e ⃗ i \vec b= T\cdot \vec a=(T_{11}\vec i\vec i+T_{12}\vec i\vec j+T_{13}\vec i\vec k+T_{21}\vec j\vec i+T_{22}\vec j\vec j+T_{23}\vec j\vec k+T_{31}\vec k\vec i+T_{32}\vec k\vec j+T_{33}\vec k\vec k)\cdot (a_1\vec i+a_2\vec j+a_3\vec k)\\=a_1T_{11}\vec i+a_2T_{12}\vec i+a_3T_{13}\vec i+a_1T_{21}\vec j+a_2T_{22}\vec j+a_3T_{23}\vec j+a_1T_{31}\vec j+a_2T_{32}\vec j+a_3T_{33}\vec j\\=\begin{pmatrix} a_1T_{11}+a_2T_{12}+a_3T_{13}\\ a_1T_{21}+a_2T_{22}+a_3T_{23} \\ a_1T_{31}+a_2T_{32}+a_3T_{33}\end{pmatrix}=\sum_{i=1}^3\sum_{j=1}^3{a_iT_{ji}\vec e_i}=a_iT_{ji}\vec e_i b =Ta =(T11i i +T12i j +T13i k +T21j i +T22j j +T23j k +T31k i +T32k j +T33k k )(a1i +a2j +a3k )=a1T11i +a2T12i +a3T13i +a1T21j +a2T22j +a3T23j +a1T31j +a2T32j +a3T33j =a1T11+a2T12+a3T13a1T21+a2T22+a3T23a1T31+a2T32+a3T33=i=13j=13aiTjie i=aiTjie i

外积

方法取自:Tobias Holzmann《Mathematics, Numerics, Derivations and OpenFOAM》

你可能感兴趣的:(数值模拟)