Exploring Navier Stokes and Rebuilding Channelflow

Authors: John F. Gibson, Eben Quenneville
Status: development

Channelflow is a C++ library developed by John Gibson for simulating incompressible fluid flow in channel geometries. It has been used in many research papers to explore the dynamics of shear flows, including the discovery of exact coherent states and the study of transition to turbulence. However, the C++ codebase has become difficult to maintain and extend over time. I am working on a Julia version of Channelflow, called Channelflow.jl, to make it more accessible and easier to use for researchers in fluid dynamics.

Background

Incompressible Navier-Stokes Equations

Channelflow solves the incompressible Navier-Stokes equations in a channel geometry using spectral methods. The flow is driven by a mean pressure gradient, which we let be pˉx=2ν\bar{p}_{x} = - 2 \nu, in the xx-direction, with constant viscosity ν\nu. We consider the two-dimensional subcase, for ease of implementation. The equations are then written as:

ut+uu=ppˉxe1+ν2uin Ωu=0in Ω\begin{aligned} \frac{\partial \vec{u}}{\partial t} + \vec{u} \cdot \vec{\nabla} \vec{u} &= - \vec{\nabla} p - \bar{p}_{x} \vec{e}_{1} + \nu \nabla^{2} \vec{u} \quad \text{in}~ \Omega\\ \vec{\nabla} \cdot \vec{u} &= 0 \quad \text{in}~ \Omega \end{aligned}

where u=(u,v)T\vec{u} = (u, v)^{T} with uu and vv denoting the velocity components in the xx and yy directions. pp here denotes the actual pressure minus the contribution from the mean pressure gradient. e1\vec{e}_{1} is the unit vector]] in the xx direction. We additionally impose the periodic [[Boundary Conditions]] in xx and no-slip boundary conditions in yy:

u=0ony=±1\vec{u} = \vec{0} \quad \text{on} \quad y = \pm 1

What we mean here is that there is a pressure forcing the fluid down the pipe, in the xx direction. The pressure term in the incompressible Navier Stokes equations can then be simplified slightly, using our special definition of pp. We let u\vec{u} be a column vector representing the velocity components, and enforce natural boundary conditions that the fluid is not flowing along the rigid walls. We often further enforce periodic boundary conditions in xx and zz.

Spectral Methods

For spectral methods, we typically use a Fourier representation in xx and a Chebyshev representation in yy. The latter could be replaced by any of the Jacobi Polynomials. In the more complicated case of three dimensions, we add a Fourier representation in zz. With that in mind, we get the discrete representations in xx of the form

u(x,y,t)=k=Nx2Nx21u^k(y,t)e2πikx/Lx\vec{u}(x, y, t) = \sum\limits_{k=\frac{-N_{x}}{2}}^{\frac{N_{x}}{2} - 1} \hat{\vec{u}}_{k}(y, t)e^{2\pi i kx/L_{x}}

and the pressure as

p(x,y,t)=k=Nx2Nx21p^k(y,t)e2πikx/Lxp(x, y, t) = \sum\limits_{k=\frac{-N_{x}}{2}}^{\frac{N_{x}}{2} - 1} \hat{p}_{k}(y, t)e^{2\pi i kx/L_{x}}

Then, we define the Chebyshev polynomial representations in yy of the form

u^k(y,t)=m=0Nyu~k,m(t)Tm(y)\hat{\vec{u}}_{k}(y, t) = \sum\limits_{m=0}^{N_{y}} \tilde{\vec{u}}_{k,m} (t) T_{m}(y)

and

p^k(y,t)=m=0Nyp~k,m(t)Tm(y)\hat{p}_{k}(y, t) = \sum\limits_{m=0}^{N_{y}} \tilde{p}_{k,m} (t) T_{m}(y)

For all of these, we typically use

xj=jLxNx,j=0,1,,Nx1yj=cosπjNy,j=0,1,,Ny\begin{aligned} x_{j} &= j \frac{L_{x}}{N_{x}}, \quad j = 0, 1, \dots, N_x - 1\\ y_{j} &= \cos{\frac{\pi j}{N_y}}, \quad j = 0, 1, \dots, N_{y} \end{aligned}

where, as usual, LxL_x is the length of the box in the xx direction.

Channelflow

According to the original website,

The main goals of Channelflow are

  • to lower the barrier to entry to numerical research in fluid dynamics
  • to enable creation of short, readable, easily-modified CFD codes
  • to provide easy access to advanced algorithms for computing exact solutions of Navier-Stokes

It was written in C++ by John Gibson, and has been used in many research papers to explore the dynamics of shear flows, including the discovery of exact coherent states and the study of transition to turbulence. However, the C++ codebase has become difficult to maintain and extend over time. I am working on a Julia version of Channelflow, called Channelflow.jl, to make it more accessible and easier to use for researchers in fluid dynamics. For now, follow my progress on GitHub. More updates to come.