The full 3-D incompressible Navier–Stokes equations are nonlinear because fluid convects its own momentum (). Yet in hydrodynamic journal bearings, microfluidic lab-on-a-chip slits, and extrusion dies, unidirectional parallel geometry forces identically, yielding exact analytical Navier–Stokes solutions that every incompressible CFD solver must reproduce before tackling separated vortices. In this lecture we analyze combined shear- and pressure-driven planar Couette–Poiseuille flow (navier_stokes.poiseuille_couette_exact), pinpoint adverse-pressure backflow and exact wall-shear force balance, and verify transient Rayleigh–Stokes channel startup (impulsive_couette_exact) against Crank–Nicolson time marching across real engineering fluids in constants.FLUIDS_DB.
Learning objectives¶
Reduce the 2-D incompressible Navier–Stokes equations for unidirectional parallel channel flow () and derive
navier_stokes.poiseuille_couette_exact.Prove the control-volume wall-shear balance , pure Poiseuille relation (), and adverse-pressure backflow criterion.
Verify
navier_stokes.impulsive_couette_exactagainst early-time Rayleigherfcboundary-layer similarity and late-time fundamental Fourier relaxation .Compare explicit FTCS diffusive stability () against unconditionally stable Crank–Nicolson tridiagonal time stepping (
grids_fvm.solve_tridiagonal) for channel and Poiseuille startup.
Time: about 60 min
try: # use the installed package, or the copy in this repository
import engcfd
except ImportError:
import pathlib, subprocess, sys
for _root in [pathlib.Path.cwd(), *pathlib.Path.cwd().parents]:
if (_root / "engcfd" / "__init__.py").exists():
sys.path.insert(0, str(_root))
break
else: # on Google Colab: install from GitHub
subprocess.run([sys.executable, "-m", "pip", "install", "-q",
"git+https://github.com/ktwyw/engcfd.git"], check=True)
import engcfd
import inspect
import numpy as np
import matplotlib.pyplot as plt
from engcfd import (burgers_riemann, constants, convection_diffusion, elliptic_multigrid, grids_fvm,
lattice_boltzmann, navier_stokes, tvd_advection)
from engcfd.plotting import label_panels, panel_label, use_style
use_style()
def show_source(obj):
"""Return the source code of a library function or class."""
return inspect.getsource(obj)
def heading(text):
print(f"\n{text}\n" + "=" * len(text))1. Parallel-Flow Navier–Stokes Reduction & Combined Couette–Poiseuille Flow¶
Consider incompressible Newtonian flow () between infinite parallel plates at (stationary, ) and (translating at ) under constant axial pressure gradient . Continuity with impermeable walls and axial invariance gives , so vanishes identically. In steady state:
Integrating twice gives navier_stokes.poiseuille_couette_exact:
Defining the dimensionless Poiseuille-to-Couette ratio (), so with :
Wall Shear Stress & Exact Force Balance: Evaluating at and yields:
Backflow Onset () & Zero Net Flow (): Under an adverse pressure gradient (), bottom wall shear vanishes at (incipient flow reversal ) and net volumetric flow rate vanishes at .
Pure Poiseuille Limit (): Parabolic profile with centerline maximum .
heading("Demonstration 1: Combined Couette-Poiseuille Regimes, Backflow Onset & Wall-Shear Balance")
H_ch = 0.010 # 10 mm gap [m]
mu_oil = constants.FLUIDS_DB["engine_oil_313K"]["mu_Pa_s"]
U_lid_ch = 1.2 # [m/s]
y_ch = np.linspace(0.0, H_ch, 201)
pi_values = [-3.0, -1.5, -1.0, 0.0, 1.0, 2.5]
print(f"{'Pi [-]':>7s} | {'dP/dx [Pa/m]':>13s} | {'u_mean [m/s]':>13s} | {'tau_bot [Pa]':>13s} | {'tau_top [Pa]':>13s} | {'Force Resid':>12s}")
print("-" * 86)
fig, ax = plt.subplots(figsize=(7.2, 4.2))
for pi_v in pi_values:
dp_dx = -pi_v * (2.0 * mu_oil * U_lid_ch) / (H_ch ** 2)
pc = navier_stokes.poiseuille_couette_exact(y_ch, H=H_ch, mu=mu_oil, dP_dx=dp_dx, U_top=U_lid_ch)
force_res = abs((pc["tau_bottom"] - pc["tau_top"]) - (-H_ch * dp_dx))
print(f"{pi_v:7.2f} | {dp_dx:13.2f} | {pc['u_mean']:13.5f} | {pc['tau_bottom']:13.4f} | {pc['tau_top']:13.4f} | {force_res:12.2e}")
assert force_res < 1e-11
if np.isclose(pi_v, -3.0):
assert np.isclose(pc["flow_rate_per_width"], 0.0, atol=1e-14)
assert np.min(pc["u"]) < -0.15 * U_lid_ch
if np.isclose(pi_v, -1.0):
assert np.isclose(pc["tau_bottom"], 0.0, atol=1e-12)
assert np.min(pc["u"]) >= -1e-15
if pi_v < -1.0:
assert np.min(pc["u"]) < 0.0 and pc["tau_bottom"] < 0.0
ax.plot(pc["u"] / U_lid_ch, y_ch / H_ch, lw=2.0, label=f"$\\Pi = {pi_v:+.1f}$")
# Pure Poiseuille identity u_max == (3/2) * u_mean and Darcy friction factor f_D * Re_{D_h} == 96:
pois_only = navier_stokes.poiseuille_couette_exact(y_ch, H=H_ch, mu=mu_oil, dP_dx=-2400.0, U_top=0.0)
assert np.isclose(np.max(pois_only["u"]), 1.5 * pois_only["u_mean"], rtol=1e-14, atol=1e-14)
rho_oil = constants.FLUIDS_DB["engine_oil_313K"]["rho_kg_m3"]
Dh = 2.0 * H_ch
Re_Dh = rho_oil * pois_only["u_mean"] * Dh / mu_oil
f_darcy = 2400.0 * Dh / (0.5 * rho_oil * (pois_only["u_mean"] ** 2))
assert np.isclose(f_darcy * Re_Dh, 96.0, rtol=1e-13, atol=1e-13)
ax.axvline(0.0, color="black", ls=":", lw=1.2)
ax.set_xlabel(r"Normalized Velocity $u(y) / U_{\mathrm{top}}$ [-]")
ax.set_ylabel("Normalized Channel Height $y / H$ [-]")
ax.set_title("Planar Couette-Poiseuille Velocity Profiles Across $\\Pi$")
ax.legend(fontsize=8.5)
Demonstration 1: Combined Couette-Poiseuille Regimes, Backflow Onset & Wall-Shear Balance
=========================================================================================
Pi [-] | dP/dx [Pa/m] | u_mean [m/s] | tau_bot [Pa] | tau_top [Pa] | Force Resid
--------------------------------------------------------------------------------------
-3.00 | 15120.00 | -0.00000 | -50.4000 | 100.8000 | 0.00e+00
-1.50 | 7560.00 | 0.30000 | -12.6000 | 63.0000 | 0.00e+00
-1.00 | 5040.00 | 0.40000 | 0.0000 | 50.4000 | 0.00e+00
0.00 | -0.00 | 0.60000 | 25.2000 | 25.2000 | 0.00e+00
1.00 | -5040.00 | 0.80000 | 50.4000 | 0.0000 | 0.00e+00
2.50 | -12600.00 | 1.10000 | 88.2000 | -37.8000 | 0.00e+00

Figure 11.1. Steady Couette–Poiseuille velocity profiles for six values of the dimensionless pressure gradient . Negative gives back-flow near the stationary wall.
What Demonstration 1 shows. Every curve satisfies to . At , the velocity profile arrives vertically tangent to the bottom wall (), and for an adverse pressure gradient drives near-wall reverse backflow () while the moving upper lid drags fluid forward near , canceling to zero net discharge at .
2. Finite-Volume Verification of Momentum Diffusion (fvm_diffusion_1d_steady)¶
Steady parallel momentum is identical in mathematical form to 1-D steady heat conduction with conductivity and volumetric source . We solve Couette–Poiseuille flow via grids_fvm.fvm_diffusion_1d_steady on uniform and boundary-stretched meshes (tanh_stretched_grid_1d), verifying exact FVM momentum-flux conservation.
heading("Demonstration 2: Conservative FVM Momentum Solve vs Exact Couette-Poiseuille")
dp_fvm = 1800.0 # Adverse pressure gradient [Pa/m]
U_top_fvm = 1.5
for mesh_kind, xf in [
("Uniform (N=60)", grids_fvm.uniform_fvm_grid_1d(0.0, H_ch, 60)["x_faces"]),
("Tanh-Stretched (N=60)", grids_fvm.tanh_stretched_grid_1d(0.0, H_ch, 60, beta_cluster=1.8)["x_faces"]),
]:
fvm_sol = grids_fvm.fvm_diffusion_1d_steady(
xf, k_cells=mu_oil, q_source=-dp_fvm, bc_left=("dirichlet", 0.0), bc_right=("dirichlet", U_top_fvm)
)
exact_sol = navier_stokes.poiseuille_couette_exact(fvm_sol["x_centers"], H=H_ch, mu=mu_oil, dP_dx=dp_fvm, U_top=U_top_fvm)
max_u_err = float(np.max(np.abs(fvm_sol["phi"] - exact_sol["u"])))
# Note: in fvm_diffusion_1d_steady, face_fluxes = -mu * du/dy = -tau
tau_bot_fvm = -float(fvm_sol["face_fluxes"][0])
tau_top_fvm = -float(fvm_sol["face_fluxes"][-1])
cv_balance = abs((tau_bot_fvm - tau_top_fvm) - (-H_ch * dp_fvm))
print(f"{mesh_kind:23s} | max |u_FVM - u_exact| = {max_u_err:.3e} m/s | CV force balance = {cv_balance:.2e} Pa")
assert max_u_err < 2.5e-3
assert cv_balance < 1e-10 and fvm_sol["max_cell_balance_residual"] < 1e-10
Demonstration 2: Conservative FVM Momentum Solve vs Exact Couette-Poiseuille
============================================================================
Uniform (N=60) | max |u_FVM - u_exact| = 2.976e-05 m/s | CV force balance = 3.15e-12 Pa
Tanh-Stretched (N=60) | max |u_FVM - u_exact| = 1.073e-04 m/s | CV force balance = 1.80e-12 Pa
What Demonstration 2 shows. Even on a non-uniformly stretched grid, conservative FVM telescoping forces the difference between bottom and top wall shear stresses to balance the total pressure force to rounding error ().
3. Rayleigh–Stokes Impulsively Started Channel (impulsive_couette_exact)¶
Now consider a quiescent fluid between plates at when at the bottom wall impulsively accelerates to while :
Two asymptotic regimes illuminate the physics of momentum diffusion ():
Early-Time Rayleigh Boundary Layer (, ): Before vorticity reaches , Equation (3.1) matches Stokes’s first problem on a semi-infinite half-space: .
Late-Time Viscous Relaxation (): Higher harmonics decay as , leaving the fundamental mode with viscous relaxation timescale .
heading("Demonstration 3: Impulsively Started Couette Flow — Early Rayleigh erfc vs Late Mode-1 Decay")
import math
H_ic = 1.0
nu_ic = 0.10
U_w = 1.0
y_ic = np.linspace(0.0, H_ic, 201)
y_inner = y_ic[1:-1] # Strictly inside (0, H) where Fourier sine series has no boundary jump
# 1. Early-time Fo = nu*t/H^2 = 0.004: compare impulsive_couette_exact against Rayleigh semi-infinite erfc:
t_early = 0.004 * (H_ic ** 2) / nu_ic
u_ic_early = navier_stokes.impulsive_couette_exact(y_inner, t=t_early, H=H_ic, nu=nu_ic, U_wall=U_w, n_modes=120)
u_rayleigh = np.array([U_w * math.erfc(yv / (2.0 * math.sqrt(nu_ic * t_early))) for yv in y_inner])
err_rayleigh = float(np.max(np.abs(u_ic_early - u_rayleigh)))
print(f"Early time (Fo = 0.004): max |Channel - Rayleigh erfc| = {err_rayleigh:.3e}")
assert err_rayleigh < 1e-6
# 2. Late-time mid-plane relaxation u(H/2, t): note sin(n*pi/2) = 0 for n=2, so n=1 dominates to O(exp(-9*pi^2*Fo))
tau_1 = (H_ic ** 2) / ((np.pi ** 2) * nu_ic)
fo_late = np.array([0.12, 0.20, 0.30, 0.45])
for fo_v in fo_late:
tv = fo_v * (H_ic ** 2) / nu_ic
u_mid = float(navier_stokes.impulsive_couette_exact(np.array([0.5 * H_ic]), t=tv, H=H_ic, nu=nu_ic, U_wall=U_w)[0])
deficit_num = 0.5 * U_w - u_mid
deficit_m1 = (2.0 * U_w / np.pi) * np.exp(-tv / tau_1)
rel_err_m1 = abs(deficit_num - deficit_m1) / deficit_m1
print(f"Fo = {fo_v:4.2f} | 0.5*U - u(H/2) = {deficit_num:.6e} | Mode-1 formula = {deficit_m1:.6e} | rel diff = {rel_err_m1:.2e}")
assert rel_err_m1 < 1e-3
fig, ax = plt.subplots(figsize=(7.2, 4.1))
for fo_plot in [0.004, 0.02, 0.06, 0.15, 0.40]:
tv_p = fo_plot * (H_ic ** 2) / nu_ic
u_p = np.concatenate([[U_w], navier_stokes.impulsive_couette_exact(y_inner, t=tv_p, H=H_ic, nu=nu_ic, U_wall=U_w), [0.0]])
ax.plot(u_p, y_ic, lw=1.9, label=f"$\\mathrm{{Fo}} = \\nu t/H^2 = {fo_plot:.3f}$")
ax.plot(U_w * (1.0 - y_ic / H_ic), y_ic, "k--", lw=1.8, label="Steady Linear Couette ($\\mathrm{Fo} \\to \\infty$)")
ax.set_xlabel("Velocity $u(y, t) / U_{\\mathrm{wall}}$ [-]")
ax.set_ylabel("Height $y / H$ [-]")
ax.set_title("Rayleigh-Stokes Impulsive Channel Startup")
ax.legend(fontsize=8.5)
Demonstration 3: Impulsively Started Couette Flow — Early Rayleigh erfc vs Late Mode-1 Decay
============================================================================================
Early time (Fo = 0.004): max |Channel - Rayleigh erfc| = 4.478e-16
Fo = 0.12 | 0.5*U - u(H/2) = 1.947651e-01 | Mode-1 formula = 1.947701e-01 | rel diff = 2.56e-05
Fo = 0.20 | 0.5*U - u(H/2) = 8.843357e-02 | Mode-1 formula = 8.843357e-02 | rel diff = 4.62e-08
Fo = 0.30 | 0.5*U - u(H/2) = 3.295989e-02 | Mode-1 formula = 3.295989e-02 | rel diff = 1.72e-11
Fo = 0.45 | 0.5*U - u(H/2) = 7.499607e-03 | Mode-1 formula = 7.499607e-03 | rel diff = 3.35e-15

Figure 11.2. Start-up of Couette flow after the wall is set in motion: velocity profiles at five Fourier numbers and the steady linear profile.
What Demonstration 3 shows. At , momentum has penetrated only from the lower plate, agreeing with Rayleigh’s unbounded half-space erfc similarity solution to . By (), viscous shear spans the full gap and relaxes exponentially onto the linear steady Couette profile .
4. Crank–Nicolson at Large Fourier Steps ¶
On fine boundary-layer grids, explicit parabolic marching requires (constants.fourier_mesh_number), which forces small time steps . We step past the explicit stability barrier () using the A-stable, second-order Crank–Nicolson tridiagonal scheme via grids_fvm.solve_tridiagonal.
heading("Demonstration 4: Crank-Nicolson Implicit Time Marching Beyond Explicit Limit (r = 1.6 > 0.5)")
def crank_nicolson_impulsive_couette(n_nodes: int, H: float, nu: float, dt: float, n_steps: int, U_wall: float = 1.0) -> dict:
"""Integrate u_t = nu*u_yy from u(y,0)=0 with u(0,t)=U_wall, u(H,t)=0 via Crank-Nicolson + Thomas solver."""
y = np.linspace(0.0, H, n_nodes)
dy = y[1] - y[0]
r = constants.fourier_mesh_number(nu, dt, dy)
u = np.zeros(n_nodes, dtype=float)
u[0] = U_wall # Impulsive wall BC at t = 0+
m_in = n_nodes - 2
lower = np.full(m_in - 1, -0.5 * r, dtype=float)
upper = np.full(m_in - 1, -0.5 * r, dtype=float)
diag = np.full(m_in, 1.0 + r, dtype=float)
for _ in range(n_steps):
rhs = (1.0 - r) * u[1:-1] + 0.5 * r * (u[:-2] + u[2:])
rhs[0] += 0.5 * r * U_wall # Implicit left Dirichlet contribution at n+1
u[1:-1] = grids_fvm.solve_tridiagonal(lower, diag, upper, rhs)
return {"y": y, "u": u, "r_fourier": r}
cn_run = crank_nicolson_impulsive_couette(n_nodes=81, H=1.0, nu=0.10, dt=0.0025, n_steps=400, U_wall=1.0)
u_ex_cn = navier_stokes.impulsive_couette_exact(cn_run["y"][1:-1], t=1.0, H=1.0, nu=0.10, U_wall=1.0, n_modes=120)
err_cn = float(np.max(np.abs(cn_run["u"][1:-1] - u_ex_cn)))
print(f"Crank-Nicolson mesh Fourier number r = {cn_run['r_fourier']:.2f} (> 0.5 explicit limit)")
print(f"Max |u_CN - u_exact| at t = 1.0 s = {err_cn:.3e}")
assert cn_run["r_fourier"] > 1.5 and err_cn < 2e-4
Demonstration 4: Crank-Nicolson Implicit Time Marching Beyond Explicit Limit (r = 1.6 > 0.5)
============================================================================================
Crank-Nicolson mesh Fourier number r = 1.60 (> 0.5 explicit limit)
Max |u_CN - u_exact| at t = 1.0 s = 9.308e-06
Inside the algorithm¶
Even at ( larger than the explicit FTCS blow-up limit ), Crank–Nicolson needs one tridiagonal solve per step and matches impulsive_couette_exact to .
Below we inspect navier_stokes.poiseuille_couette_exact and navier_stokes.impulsive_couette_exact, and verify exponential series convergence with mode count n_modes.
Check against the library¶
heading("Inside the Algorithm: navier_stokes.poiseuille_couette_exact & impulsive_couette_exact")
print(show_source(navier_stokes.poiseuille_couette_exact))
print(show_source(navier_stokes.impulsive_couette_exact))
y_test = np.linspace(0.05, 0.95, 50)
u_ref_200 = navier_stokes.impulsive_couette_exact(y_test, t=0.30, H=1.0, nu=0.10, n_modes=200)
for m_cnt in [5, 15, 40, 80]:
u_m = navier_stokes.impulsive_couette_exact(y_test, t=0.30, H=1.0, nu=0.10, n_modes=m_cnt)
trunc_err = float(np.max(np.abs(u_m - u_ref_200)))
print(f"n_modes = {m_cnt:3d} | max |u_m - u_200| = {trunc_err:.3e}")
assert float(np.max(np.abs(navier_stokes.impulsive_couette_exact(y_test, t=0.30, H=1.0, nu=0.10, n_modes=80) - u_ref_200))) < 1e-15
Inside the Algorithm: navier_stokes.poiseuille_couette_exact & impulsive_couette_exact
======================================================================================
def poiseuille_couette_exact(
y: np.ndarray,
H: float,
mu: float,
dP_dx: float,
U_top: float = 0.0,
) -> dict:
"""Analytical laminar planar Couette-Poiseuille velocity profile u(y), shear stress, and flow rate on [0, H]."""
if H <= 0.0 or mu <= 0.0:
raise ValueError("Channel height H and dynamic viscosity mu must be > 0.")
yg = np.asarray(y, dtype=float)
u_prof = float(U_top) * (yg / H) - (float(dP_dx) / (2.0 * float(mu))) * yg * (H - yg)
q_flow = 0.5 * float(U_top) * H - (float(dP_dx) * (H**3)) / (12.0 * float(mu))
tau_bot = float(mu) * (float(U_top) / H - (float(dP_dx) * H) / (2.0 * float(mu)))
tau_top = float(mu) * (float(U_top) / H + (float(dP_dx) * H) / (2.0 * float(mu)))
return {
"u": u_prof,
"flow_rate_per_width": float(q_flow),
"u_mean": float(q_flow / H),
"tau_bottom": float(tau_bot),
"tau_top": float(tau_top),
}
def impulsive_couette_exact(
y: np.ndarray,
t: float,
H: float,
nu: float,
U_wall: float = 1.0,
n_modes: int = 80,
) -> np.ndarray:
"""Exact Fourier sine-series startup velocity u(y, t) for impulsively started wall u(0,t)=U_wall, u(H,t)=0."""
if t <= 0.0 or H <= 0.0 or nu <= 0.0:
raise ValueError("Require t > 0, H > 0, and nu > 0.")
yg = np.asarray(y, dtype=float)
steady = U_wall * (1.0 - yg / H)
transient = np.zeros_like(yg)
for n in range(1, n_modes + 1):
kn = n * np.pi / H
transient += (1.0 / n) * np.sin(kn * yg) * np.exp(-nu * (kn**2) * t)
return steady - (2.0 * U_wall / np.pi) * transient
n_modes = 5 | max |u_m - u_200| = 2.530e-06
n_modes = 15 | max |u_m - u_200| = 0.000e+00
n_modes = 40 | max |u_m - u_200| = 0.000e+00
n_modes = 80 | max |u_m - u_200| = 0.000e+00
Exercises¶
Worked solutions are in 11_solutions.ipynb. The cell below the list is a short self-check to start from.
Verify a result. Compute the exact mid-plane startup timescale across all 10 fluids in
constants.FLUIDS_DBfor , and verify viaimpulsive_couette_exactthat to across every fluid.Find how it fails. Verify
poiseuille_couette_exactandimpulsive_couette_exactraiseValueErroron non-positive , and demonstrate viaconstants.von_neumann_advection_diffusion_ampand time marching that explicit FTCS at suffers Nyquist blow-up while Crank–Nicolson remains bounded.Implement it yourself. Implement both
exact_startup_poiseuille(y, t, H, mu, rho, dP_dx)(odd-harmonic Fourier sine series) andstartup_poiseuille_cn(n_nodes, H, mu, rho, dP_dx, dt, n_steps)(Crank–Nicolson withgrids_fvm.solve_tridiagonal) for startup pressure-driven channel flow from rest. Verify agreement to across and convergence ontopoiseuille_couette_exactas .
heading("Self-check for the exercises")
pc_chk = navier_stokes.poiseuille_couette_exact(np.linspace(0.0, 1.0, 21), H=1.0, mu=0.5, dP_dx=-6.0, U_top=0.0)
assert np.isclose(np.max(pc_chk["u"]), 1.5 * pc_chk["u_mean"], atol=1e-14)
assert np.isclose(pc_chk["tau_bottom"] - pc_chk["tau_top"], 6.0, atol=1e-14)
print("Poiseuille u_max = 1.5*u_mean and wall-shear force balance verified")
print("All checks passed.")
Self-check for the exercises
============================
Poiseuille u_max = 1.5*u_mean and wall-shear force balance verified
All checks passed.