User Tools

Site Tools


Channelflow is a software system for numerical analysis of the incompressible Navier-Stokes flow in channel geometries, written in C++. The core engine of Channelflow is a spectral CFD1) algorithm for integrating the Navier-Stokes equations. This engine drives a number of higher-level algorithms that (for example) compute equilibria, traveling waves, and periodic orbits of Navier-Stokes. Channelflow provides these algorithms in an easy-to-use, flexible, and intelligible form by using relatively modern software design. Channelflow consists of a software library for rapid, high-level development of spectral CFD codes and a set of predefined executable programs that perform common tasks involving CFD. Channelflow is customized for Fourier x Chebyshev x Fourier expansions appropriate for rectangular geometries with periodic boundary conditions in two directions and rigid walls in the remaining direction.

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

If you use channelflow in your research, please cite it in your publications.


2018-09-24 channelflow-2.0 release. After several years in development channelflow-2.0 is out. The core additional feature is parallelization via MPI. Along with this come numerous extensions in the equations of motion and numerical algorithms. channelflow-2.0 was developed from channelflow-1.5 by a team of collaborators at Max-Planck Institute for Dynamics and Self-Organization, Göttingen, University of Marburg, École Polytechnique Fédérale de Lausanne, and the University of New Hampshire. There are also changes in the support infrastructure, including a switch from subversion to git source-code control and a new website and discussion forum.

We're still working out the best arrangements for the support infrastructure, so for the time being this website and will both remain up and running.

2015-06-29 channelflow-1.5.1 release. Fixed bug in Newton-Krylov-hookstep search algorithm that caused failed searches in some cases. This bug was introduced in channelflow-1.5.0 during conversion to Eigen libraries.

2015-06-22 channelflow-1.5.0 release. Converted channelflow source code to use Eigen3 for linear algebra instead of Octave. Removal of the problematic Octave dependency allows for a simpler build structure: all library code is in channelflow/ directory and all executable utilities are in programs/. Advanced utilities such as findsoln, contuinuesoln, and arnoldi should compile easily on most platforms, due to the simplicity and widespread availability of Eigen packages.

Old News


Command-line utilities

Channelflow includes about thirty predefined command-line utility programs that perform the most common calculations in our research, such as

  • couette.cpp, time integration for plane Couette flow
  • diffop.cpp, apply a differential operator on input field u and save result, e.g. ∇u, ∇·u, ∇2u, ∇xu, etc.
  • findsoln.cpp, computing equilibria, traveling waves, and periodic orbits
  • arnoldi.cpp, computing linear stability of exact solutions
  • fieldprops.cpp, output basic properties of fields
  • changegrid.cpp, transferring fields to finer/coarser grids

Most utilities read in one or more velocities fields from disk, operate on them according to command-line options, print some output, and save resulting fields to disk.

Flexible object-oriented programming

Channelflow is written as a C++ class library. The classes act as building blocks for expressing particular channel-flow simulations and associated data analysis, and underneath these, the mathematical structures needed to perform the calculations. Channelflow provides classes for representing Chebyshev expansions, Fourier x Chebyshev x Fourier expansions, DNS2), and a number of differential equations. Each class has automatic memory management and a set of high-level elemental operations, so that auxiliary data fields and computations can be added to a program with a few lines of code.

In channelflow, even the DNS algorithm is an object. This greatly increases the flexibility of DNS computations. For example, a DNS can be reparameterized and restarted multiple times within a single program, multiple independent DNS computations can run side-by-side within the same program, and DNS computations can run as small components within a larger, more complex computations. As a result, comparative calculations that formerly required coordination of several programs through shell scripts and saved data files can be done within single program.

The following programs illustrate how channelflow's libraries can function as a high-level, Matlab-like language for CFD research. Each defines an initial condition and a base flow, configures a DNS algorithm method, runs a time-stepping loop, and produces output, in about a hundred lines of code. Note: these example codes are written for maximum simplicity and are not intended for production runs.

  • couette.cpp, a plane Couette simulation (75 lines)
  • couette2.cpp, illustration of variable time-stepping, velocity field IO, simple statistics (86 lines)
  • channel.cpp, a pressure-driven channel flow (150 lines)
  • walllaw.cpp, verification of the “law of the wall” (190 lines) and a matlab script walllaw.m for plotting the results

Organized, readable library code

Channelflow uses object-oriented programming and data abstraction to maximize the organization and readability of its library code. Channelflow defines about a dozen C++ classes that act as abstract data types for the major components of spectral channel-flow simulation. Each class forms a level of abstraction in which a set of mathematical operations are performed in terms of lower-level abstractions, from time-stepping equations at the top to linear algebra at the bottom. The channelflow library code thus naturally reflects mathematical algorithm, both in overall structure and line-by-line. One can look at any part of the code and quickly understand what role it plays in the overall algorithm. One can learn the algorithm in stages, either top-down or bottom-up, by focusing on one level of abstraction at a time.

Other features

Channelflow is also

  • Configurable: For example, channelflow's DNS algorithms implement a variety of time-stepping schemes, external constraints, and methods of calculating nonlinear terms.
  • Extendable: The library code is structured to take small-scale extensions such as additional time-stepping schemes. Channelflow's object-oriented, modular structure allows channelflow simulations to be embedded as small components within larger, more complex computations.
  • Moderately general: Channelflow provides elemental algebraic and differential operators for its mathematical classes, so that most quantities of interest can be calculated with a few lines of code. However, Channelflow is not general regarding geometry: it works only with rectangular geometries with two periodic and one inhomogeneous direction.
  • Verifiable: The source distribution contains a test suite that verifies the correct behavior of major classes.
  • Documented: The Channelflow User's Manual contains annotated program examples, discussion of design, an overview of the main classes from a user's perspective, and a review of the mathematical algorithm. Other documentation is under development.
  • Supported: Channelflow is currently supported by its author via this website.
  • Fast: Channelflow is as fast as comparable Fortran codes
  • Free: Channelflow is free software. It is licensed under the GNU GPL version 2 and available for download.


Channelflow's CFD core algorithm uses spectral discretization in spatial directions (Fourier x Chebyshev x Fourier), finite-differencing in time, and primitive variables (3d velocity and pressure) to integrate the incompressible Navier-Stokes equations. The algorithm is based on Kleiser and Schuman's primitive-variables formulation, which uses a Chebyshev tau method for enforcement of the no-slip conditions and influence-matrix and tau-correction algorithms to determine the pressure. Channelflow generalizes this algorithm in several ways, as described in the Channelflow User's Manual. Channelflow's generalizations include

  • Seven semi-implicit time-stepping algorithms: semi-implicit backwards differentiation of orders 1-4, two 2nd-order Runge-Kutta schemes, and the classic 2nd-order Crank-Nicolson Adams-Bashforth algorithm.
  • Computation of the nonlinear term in seven forms: skew-symmetric, rotational, convection, divergence, alternating convection/divergence, or linearized about the base flow.
  • Enforcement of pressure-gradient or mean-velocity constraints, either constant or time-varying.
  • Integration of total or fluctuating velocity fields.
  • Arbitrary base-flow profiles U(y).
  • Dealiased or aliased collocation calculations.

The algorithms for computing invariant solutions for plane Couette flow were developed by Divakar Viswanath. These algorithms combine a “hookstep” trust-region modification of the classic Newton search with Krylov-subspace methods for solving the Newton-hookstep equations, and use Arnoldi iteration for linear stability analysis.

Channelflow uses the elegant and powerful FFTW library for its Fourier transforms. See Channelflow documentation and References for more on the numerical algorithms.

Development status

Channelflow began in 1999 as a part of my Ph.D. research in Theoretical and Applied Mechanics at Cornell University. It has been under active development since. Its DNS algorithms are verified as correct by the test suite: correct integration of Orr-Sommerfeld eigenfunctions, Poiseuille flow, and sinusoidal disturbances to Poiseuille flow. Channelflow has also been verified against independent codes in the computation of equilibria, eigenvalues, and periodic orbits of plane Couette flow. Channelflow's test suite is not exhaustive, so some inessential utility functions might still contain errors.

Discussion forums

The channelflow website is hosted on a wiki in order to encourage discussion and collaborative maintenance of documentation. The main channelflow discussion forums are

A few other related discussion forums are also hosted here:

Under development

These sections of the wiki are under development and will remain here until they're ready to replace the handwritten-html versions from the old website.

NSF notices

This material is based upon work supported by the National Science Foundation under Grant No. 0807574.

Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

Computational Fluid Dynamics
Direct Numerical Simulation: i.e. a numerical integration algorithm for Navier-Stokes that resolves all scales of the flow
start.txt · Last modified: 2018/09/24 09:18 by gibson