User Tools

Site Tools download | documentation | database | movies | studygroup

Channelflow is a software system for numerical analysis of the incompressible Navier-Stokes flow in rectangular geometries, written in C++. The core engine of channelflow is a spectral CFD 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.

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

This website is set up as a wiki to encourage collaborative maintenance and discussion. Please register and login to make changes. You can experiment with the dokuwiki system in this playground. Check out the example of latex encoding there and this outline of dokuwiki syntax.


Command-line utilities

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

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, DNS algorithms, 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 nonhomogeneous 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 email. Its support website is currently transitioning from the GNU Savannah project-management system to The old Savannah website is here.
  • 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: 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.


  1. L. Kleiser and U. Schuman, “Treatment of incompressibility and boundary conditions in 3-D numerical spectral simulations of plane channel flows,” in Proc. 3rd GAMM Conf. Numerical Methods in Fluid Mechanics, ed. E. Hirsch (1980)
  2. Canuto, Hussaini, Quarteroni, and Zang, “Spectral Methods in Fluid Dynamics,” Springer-Verlag (1998)
  3. R. Peyret, “Spectral Methods for Incompressible Flows,” Springer-Verlag (2002)
  4. D. Viswanath, “Recurrent motions within plane Couette turbulence,” J. Fluid Mech. 580 (2007), arXiv:/physics/0604062
  5. M. Frigo and S.G. Johnson, “The Design and Implementation of FFTW3,” Proceedings of the IEEE 93 (2) (2005)

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; it nows serves as the primary platform for numerical research in plane Couette dynamics at the Center for Nonlinear Science in the Georgia Tech School of Physics. I know of about 10-20 other active users of channelflow. As of 2008 (release 1.3.x), channelflow contains utilities for computing equilibria, periodic orbits, and linear stability modes for plane Couette flow. 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 Fortran 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.

Channelflow releases are available as tar.gz files from the download page.


Would you be interested in helping improve channelflow? Here's a list of possible development projects. Please contact me and I'll help get you started.


The channelflow website is hosted on a wiki in order to encourage discussion and collaborative maintenance of documentation. Not all the structure for this is in place yet.

In the meantime, if you have comments, questions, or suggestions regarding channelflow, please email me. If you're interested in helping with development, –anything from minor improvements to major enhancements– please email me. · Last modified: 2010/02/02 07:55 (external edit)