nsCouette介绍
The Taylor-Couette (TC) set-up is one of the most famous paradigmatic systems for wall-bounded shear flows in general and maybe the most important one if you are interested in rotating shear flows in particular. For understanding the following chapters of this documentation, it might help to acquaint yourself with a bit of crucial terminology and basic concepts of the TC system as well as with the notation we will use throughout this documentation and in the source code of nsCouette.
- 代码来源:
John F. Gibson提出Plane Couette算法 http://channelflow.org/dokuwiki/doku.php?id=docs
https://github.com/epfl-ecps/channelflow
- 参考AVILA课题组:
NONLINEAR DYNAMICS OF MODE COMPETITION IN ANNULAR FLOWS- 2008-MARC AVILA-phd-thesis
Direct Numerical Simulation of Transition to Turbulence and Turbulence Control in Pipe Flow- Baofang Song-phd-thesis
Governing equation and geometry1
Start from N-S function2
The naiver-Stoke model are very similar to the corresponding equation of the Euler equation. The different is additional terms that take into count the effect of internal friction and heat conduction in the fluid.
The momentum equation in this model is of the form of the Cauchy momentum equation:
$\sigma$ is the stress tensor, g contains all the body forces per unit mass.
Write in terms of equation in cylindrical coordinates:
where $vec{e}$ is a right-handed triad of unit vectors.
Material Derivative
Cauchy stress tensor3
其中,$\sigma$ is the tensor.
one term for example:
The final result, expressed as a tensor, is
Thus,
最后, 可以简化stress term$\nabla \cdot \sigma$ in N-S equation:3
带入上面的公式,
第一项-这里有一大堆整理,参考3
For an incompressible fluid, the term in the square brackets is equal to zero because of continuity equation.
同理,第二项,第三项
Incompressible N-S equation
In may subfields of fluid mechanics, the fluid is often considered to be incompressible, meaning that the density $\rho$ is constant. This assumption satisfied the mass conservation equation to:
Consequently, the bulk viscosity in N-S equation becomes irrelevant, as its terms is zero. For this reason, bulk viscosity is often neglected in fluid mechanics. Still, it relevant in acoustics and high-velocity compressible flow.
同时,2/3那一项也忽略掉。
建立不可压N-S方程, 这里假设$\rho$ is constant
其中,$\vec{u}(\vec{r},t)$ 是速度场, $p^h$ 是hydrodynamic pressure. 雷诺数$Re= \Omega r d/ \nu$, $d= r_0-r_i$, $\eta= r_i / r_o$, the length-to-gap aspect ratio $\Gamma = L_z/d$, $L_z$ 为柱子的高度。
—》由上面的详细推导过程,阐述了 $\nabla \cdot \sigma$的详细推导过程:
因此,公式最终可以整理成不可压的形式为(一些细节和约化参见附录1):
进一步,我们对其作dimensionless处理,通过d约化,$\tau=d^2/\nu$, 和 $\nu^2 / d^2$ 作为空间,时间的计量单位,压力通过$p=p^h / \rho$. 这样上述方程转化为,即为文献1中的公式(3):
- 备注:后续可进一步简化为轴对称,去掉$\theta$ direction. 不再进行赘述。
Numerical simulation
空间离散
- Fourier-Galerkin method: 相当于每个时间步下,都要求解一次方程,算出不同l、n模态或者波数下所对应的r方向的chebshev系数。
- 备注:这里面也许可以做一些文章。稳定性问题判定,通过eigenvalue。
其中, $kz$ 是最小波数, $k\theta$ 是简化的周期数。
将上面的离散形式带入到最终的推导公式,转化到每个(l,n):
其中,非线性项包含$u\cdot u$和$ u^2$项。
接下来做的是解耦径向和周向速度:
带入:
得到:
- finite-difference method in r方向的Chebyshev离散5
Use a standard high-order, central finite-difference method to approximate the radial derivatives.
时间离散格式-Adams-Bashforth back-ward-difference
计算频域的非线性项系数$\hat{N}^i(u)$, 通过3/2-dealiasing rule:
- Do matrix-vector multiplication to calculate $\partial_r\hat{u}^i$ (FD method) - chebfun: diff
- ??Compute dot product in Fourier space to calculate $\partial_\theta \hat{u}^i$ and $\partial_z \hat{u}^i$
- Perform Fourier transform of $\partial_{r,\theta,z}\hat{u}^i$ and $\hat{u}^i$ to obtain the velocity field and all its derivatives in physical space.
- Calculate N^i(u)=u^i\cdot \triangle u^i$.
- Perform inverse Fourier transform to obtain the spectral coefficients $\hat{N}^i(u)$.
Obtain the pressure prediction, $\hat{p}*$: solve the Possion equation, with consistent Neumann boundary condition.
Obtain the velocity prediction, $\hat{u}*$: solve the three three Helmholtz equations
with Dirichlet boundary conditions.
Correct via an intermediate variable $\phi=2\triangle t (\hat{p}^{i+1}-\hat{p}*)/3$. The incompressibility condition $\nabla\cdot \hat{u}^{i+1}=0$ leads to a Possion equation for $\phi$ with homogeneous Neumann boundary conditions:
Compute pressure and velocity correction, $\hat{p}^{i+1}$ and $\hat{u}^{i+1}$:
Go back to step 1
The Navier-Stokes equations are thus advanced in time by solving five systems of linear euqation, of Possion or Helmholtz type, for each Fourier mode.
附录1 :
在柱坐标系下:
令:
因:
得:
最终得到:
Boundary condition
压力项可以用Possion方程进行近似处理:
需要满足一定的边界条件:4
Install
环境:ubuntu 20.04
软件有三个branch,其中nsCouette-gpu 通过GPU计算,支持nivida的cuda-c。
具体操作是,主要需要按照库fftw,hdf5,libblas3, liblapack-dev
1 | $ git clone http://github.com/dfeldmann/nsCouette.git |
nsCouette-gpu环境配置(类似C语言):
1 | # 首先得有Nivida的显卡,安装好cuda环境 |
代码解析
1 | // main.cu 代码 |
1 | // TayC.h 代码块 |
1. A hybrid MPI-OpenMP parallel implementation for pseudo-spectral simulations with application to Taylor-Couette flow ↩
2. The lattice Boltzmann method: Fundamentals and acoustcis ↩
3. https://github.com/demichie/NS_cylindrical/blob/master/NS_.cylindrical.pdf ↩
4. ON PRESSURE BOUNDARY CONDITIONS FOR THE INCOMPRESSIBLE NAVIER-STOKES EQUATIONS* ↩
5. A Practical Guide to Pseudospectral Methods; Cambridge ↩