Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

10. The augmented Lagrangian method for Bingham flow in a square duct

In a plane channel the momentum balance gives the position of the yield surface directly, yp=τy/Gy_p = \tau_y / G. In a duct of square cross-section it does not: the yielded and unyielded regions are part of the solution. A plug moves in the centre, and the fluid in the four corners is at rest. A plane channel flows at any Bingham number Bn=τy/(GH)\mathrm{Bn} = \tau_y/(G H) below 1, while a square duct stops at Bncrit=22+π≈0.5302\mathrm{Bn}_{\mathrm{crit}} = \frac{2}{2 + \sqrt{\pi}} \approx 0.5302, a result of Mosolov and Miasnikov (1965).

The flow minimizes a functional that is not differentiable where the rate of strain is zero. The augmented Lagrangian method (reviewed by Dean, Glowinski and Guidoboni, 2007; the same algorithm is known in optimization as the alternating direction method of multipliers, ADMM) splits the minimization into a linear Poisson problem and a local step with a solution in closed form, and needs no regularization. This lecture derives the method and applies it to the square duct.

Learning objectives

  1. Write Bingham flow in a duct as a minimization problem and derive the three steps of the augmented Lagrangian method: a Poisson problem solved with the discrete sine transform, a shrinkage step, and an update of the multiplier (viscoplastic_admm.solve_2d_duct_bingham_admm).

  2. Check the Newtonian limit (Bn=0\mathrm{Bn} = 0) against the series solution for a square duct, Q≈0.562308Q \approx 0.562308.

  3. Compute the central plug and the stagnant corners at Bn=0.32\mathrm{Bn} = 0.32.

  4. Check that the flow stops at Bncrit=2/(2+π)\mathrm{Bn}_{\mathrm{crit}} = 2/(2 + \sqrt{\pi}) (MOSOLOV_SQUARE_DUCT_BN_CRIT).

Time: about 60 min

1. The augmented Lagrangian method and its three steps

The axial velocity u(x,y)u(x, y) of steady Bingham flow in a square duct Ω=[−H,H]2\Omega = [-H, H]^2, with u=0u = 0 on the walls, is the unique minimizer of a convex functional that is not differentiable where the rate of strain vanishes:

min⁡u∈H01(Ω)∫Ω[ηp2∥∇u∥22+τy∥∇u∥2−G u]dx dy\min_{u \in H_0^1(\Omega)} \int_\Omega \left[\frac{\eta_p}{2}\lVert\nabla u\rVert_2^2 + \tau_y\lVert\nabla u\rVert_2 - G\,u\right]dx\,dy

The augmented Lagrangian method introduces the rate of strain as a separate field, d=∇u\mathbf{d} = \nabla u, with a multiplier λ\boldsymbol{\lambda}, which is the stress, and a penalty parameter r>0r > 0. The nonlinearity is then separated from the differential operator, and each iteration has three steps:

  1. Velocity. Solve the linear problem −(ηp+r)∇h2uk+1=G−∇h⊤(λk−r dk)-(\eta_p + r)\nabla_h^2 u^{k+1} = G - \nabla_h^\top(\boldsymbol{\lambda}^k - r\,\mathbf{d}^k), which has constant coefficients, with one two-dimensional discrete sine transform.

  2. Rate of strain. At each point, without regularization:

s=λk+r ∇huk+1,dk+1=1rmax⁡ ⁣(0,  1−τy∥s∥2)s\mathbf{s} = \boldsymbol{\lambda}^k + r\,\nabla_h u^{k+1}, \qquad \mathbf{d}^{k+1} = \frac{1}{r}\max\!\left(0,\; 1 - \frac{\tau_y}{\lVert\mathbf{s}\rVert_2}\right)\mathbf{s}
  1. Multiplier. λk+1=λk+r(∇hurelk+1−dk+1)\boldsymbol{\lambda}^{k+1} = \boldsymbol{\lambda}^k + r(\nabla_h u_{\mathrm{rel}}^{k+1} - \mathbf{d}^{k+1}).

Wherever ∥s∥2≤τy\lVert\mathbf{s}\rVert_2 \leq \tau_y, the second step sets dk+1\mathbf{d}^{k+1} to exactly zero: this is how the method represents unyielded material.

The first test is the Newtonian case, τy=0\tau_y = 0 (Bn=0\mathrm{Bn} = 0), on [−1,1]2[-1, 1]^2 with G=1G = 1 and ηp=1\eta_p = 1, for which the flow rate is known as a series:

QBoussinesq=16 G H412 ηp[1−192π5∑m=0∞tanh⁡((2m+1)π/2)(2m+1)5]≈0.5623081Q_{\mathrm{Boussinesq}} = \frac{16\,G\,H^4}{12\,\eta_p}\left[1 - \frac{192}{\pi^5}\sum_{m=0}^\infty \frac{\tanh\bigl((2m+1)\pi/2\bigr)}{(2m+1)^5}\right] \approx 0.5623081

Demonstration 1: Newtonian flow in a square duct against the series solution
============================================================================
Grid 16x16 | ADMM Q = 0.5611207 | series solution = 0.5623081 | rel err = 2.112e-03
Grid 32x32 | ADMM Q = 0.5619917 | series solution = 0.5623081 | rel err = 5.626e-04
Grid 64x64 | ADMM Q = 0.5622256 | series solution = 0.5623081 | rel err = 1.466e-04
Observed spatial convergence order p = 1.99 (expected 2nd-order Q1 accuracy ~ 2.0)
<Figure size 1122x440 with 3 Axes>

Figure 10.1. (a) Newtonian velocity from the discrete sine transform solver. (b) Relative error of the flow rate against the series solution for a square duct; the fitted order is 1.99.

What Demonstration 1 shows. The discrete operator ∇h⊤∇h\nabla_h^\top \nabla_h, inverted with the sine transform, reproduces the flow rate of the series solution to 0.015 % on a grid of 64×6464\times 64 cells, with second-order convergence.


2. Yielded and unyielded regions in a square duct

The second test has a yield stress, at Bn=τyGH=0.32\mathrm{Bn} = \frac{\tau_y}{G H} = 0.32 (nx=36, ny=36, r_aug=0.14). In a square duct the shear stress vanishes at the centre (0,0)(0, 0) and also at the four corners (±H,±H)(\pm H, \pm H). The solution therefore has five unyielded regions, in which ∥d∥2=0\lVert\mathbf{d}\rVert_2 = 0:

  • a plug in the centre, which moves at the largest velocity, and

  • four stagnant regions in the corners, which are attached to the walls and do not move.


Demonstration 2: Bingham flow in a square duct at Bn = 0.32
===========================================================
Bingham number Bn = 0.32 | flow rate Q = 0.13869 | unyielded area frac = 0.305
Central floating plug arrested? True | wall midpoint yielded? True | 4 corners arrested? [True, True, True, True]
<Figure size 1144x473 with 3 Axes>

Figure 10.2. Bingham flow in a square duct from the augmented Lagrangian method. (a) Axial velocity. (b) Magnitude of the rate of strain d\mathbf{d}; the white contour bounds the central plug, and the corners are also unyielded.

What Demonstration 2 shows. Without any threshold on the viscosity, the method gives the moving plug in the centre and the four stagnant regions in the corners.


3. The critical Bingham number of Mosolov and Miasnikov

As the Bingham number increases, the central plug and the four stagnant regions grow. When they meet at the middle of the walls, the flow stops everywhere. Mosolov and Miasnikov (1965) showed by a variational argument that the yield surface at this point consists of four quarter circles of radius R∗=2H2+πR_* = \frac{2H}{2 + \sqrt{\pi}} joined by straight segments along the walls, which gives the critical Bingham number

Bncritsquare=22+π≈0.53015890(plane channel: Bncritplanar=1.0)\mathrm{Bn}_{\mathrm{crit}}^{\mathrm{square}} = \frac{2}{2 + \sqrt{\pi}} \approx 0.53015890 \qquad \bigl(\text{plane channel: } \mathrm{Bn}_{\mathrm{crit}}^{\mathrm{planar}} = 1.0\bigr)

Demonstration 3: flow rate against Bingham number and the critical value
========================================================================
Bn = 0.000 (Bn/Bn_crit = 0.000) | flow rate Q = 0.561837 | unyielded frac = 0.0014
Bn = 0.160 (Bn/Bn_crit = 0.302) | flow rate Q = 0.339977 | unyielded frac = 0.0672
Bn = 0.320 (Bn/Bn_crit = 0.604) | flow rate Q = 0.138493 | unyielded frac = 0.2977
Bn = 0.460 (Bn/Bn_crit = 0.868) | flow rate Q = 0.019251 | unyielded frac = 0.6433
Bn = 0.580 (Bn/Bn_crit = 1.094) | flow rate Q = 0.000000 | unyielded frac = 1.0000
Bn = 0.640 (Bn/Bn_crit = 1.207) | flow rate Q = 0.000000 | unyielded frac = 1.0000
<Figure size 1122x440 with 2 Axes>

Figure 10.3. (a) Flow rate against the Bingham number; it vanishes near the limit 2/(2+π)≈0.5302/(2+\sqrt{\pi}) \approx 0.530 (dashed). (b) Fraction of the cross-section that is unyielded.

What Demonstration 3 shows. Above Bncrit≈0.5302\mathrm{Bn}_{\mathrm{crit}} \approx 0.5302, solve_2d_duct_bingham_admm returns flow_rate == 0.0 and unyielded_area_fraction == 1.0; there is no creep below the yield stress.


4. The penalty parameter and convergence

The parameter mm of the Papanastasiou model changes the equations that are solved. The penalty parameter raugr_{\mathrm{aug}} of the augmented Lagrangian method does not: the iteration converges to the same solution for every raug>0r_{\mathrm{aug}} > 0, and the parameter affects only the number of iterations. Convergence is fastest when the primal residual, ∥∇hu−d∥2\lVert\nabla_h u - \mathbf{d}\rVert_2, and the dual residual, raug∥dk+1−dk∥2r_{\mathrm{aug}}\lVert\mathbf{d}^{k+1} - \mathbf{d}^k\rVert_2, decrease at similar rates.


Demonstration 4: convergence for several values of the penalty parameter
========================================================================
r_aug = 0.08 | converged Q = 0.221541 | iterations to 1e-5 = 2054 | residual after 4000 = 1.01e-06
r_aug = 0.22 | converged Q = 0.221541 | iterations to 1e-5 =  748 | residual after 4000 = 7.73e-07
r_aug = 0.70 | converged Q = 0.221540 | iterations to 1e-5 =  236 | residual after 4000 = 3.84e-07
r_aug = 2.00 | converged Q = 0.221539 | iterations to 1e-5 =   84 | residual after 4000 = 1.17e-07
Physical flow-rate spread across 25x variation in r_aug: 2.431e-06 (r_aug-invariant)
<Figure size 1122x440 with 2 Axes>

Figure 10.4. (a) Larger of the primal and dual residuals against the iteration number for four values of the penalty rr. The flow rate is the same for all four to within 10-5. (b) Number of iterations needed to bring the residual below 10-5: about ten times fewer for the largest penalty than for the smallest.

Inside the algorithm

The function solve_2d_duct_bingham_admm inverts its linear problem exactly with one sine transform because of the way its two discrete operators are defined in viscoplastic_admm.py:

  1. _grad_cell(u) takes the velocities at the nx×nyn_x \times n_y interior nodes and returns the gradients at the (nx+1)×(ny+1)(n_x + 1) \times (n_y + 1) cell centres, from a bilinear interpolation in each cell.

  2. _neg_div_adj(px, py) is the exact transpose ∇h⊤\nabla_h^\top of this operator, ⟨∇hu,p⟩cell=⟨u,−∇h⊤p⟩node\langle \nabla_h u, \mathbf{p}\rangle_{\mathrm{cell}} = \langle u, -\nabla_h^\top \mathbf{p}\rangle_{\mathrm{node}}. The product −∇h⊤∇h-\nabla_h^\top \nabla_h is a symmetric nine-point stencil whose eigenvectors are those of the discrete sine transform.

Check against the package

The cell below prints the source of solve_2d_duct_bingham_admm and checks (1) the adjoint identity to 1e-15, (2) the inversion with the sine transform, with a residual below 1e-14, and (3) the optimality condition of the shrinkage step.


Inside the algorithm: the discrete gradient, its adjoint and the sine transform
===============================================================================
def solve_2d_duct_bingham_admm(
    nx: int = 44,
    ny: int = 44,
    H_half: float = 1.0,
    dpdz_neg: float = 1.0,
    tau_y: float = 0.25,
    eta_p: float = 1.0,
    r_aug: float = 1.0,
    max_iter: int = 350,
    tol: float = 1e-7,
) -> dict:
    """Bingham flow in a square duct with the augmented Lagrangian method; the Poisson step uses the discrete sine transform."""
    if nx < 8 or ny < 8 or H_half <= 0.0 or eta_p <= 0.0 or tau_y < 0.0 or dpdz_neg < 0.0 or r_aug <= 0.0:
        raise ValueError("Invalid parameters for solve_2d_duct_bingham_admm.")

    # Interior nodal velocity u of shape (nx, ny) on [-H_half, +H_half]^2 with u = 0 on all 4 walls:
    hx = (2.0 * float(H_half)) / (nx + 1.0)
    hy = (2.0 * float(H_half)) / (ny + 1.0)
    x_nodes = -float(H_half) + np.arange(1, nx + 1, dtype=float) * hx
    y_nodes = -float(H_half) + np.arange(1, ny + 1, dtype=float) * hy

    # Cell-centered bilinear Q1 gradient (gx, gy) on the (nx + 1, ny + 1) elements:
    # Exact DST-I eigenvalues of -div_cell(grad_cell(u)) on interior nodes (p = 1..nx, q = 1..ny):
    th_x = math.pi * np.arange(1, nx + 1, dtype=float) / (nx + 1.0)
    th_y = math.pi * np.arange(1, ny + 1, dtype=float) / (ny + 1.0)
    sx2 = np.sin(0.5 * th_x) ** 2
    cx2 = np.cos(0.5 * th_x) ** 2
    sy2 = np.sin(0.5 * th_y) ** 2
    cy2 = np.cos(0.5 * th_y) ** 2
    eig_lap = (4.0 / (hx**2)) * (sx2[:, None] * cy2[None, :]) + (4.0 / (hy**2)) * (cx2[:, None] * sy2[None, :])
    denom_spec = (float(eta_p) + float(r_aug)) * eig_lap

    def _grad_cell(u_in: np.ndarray) -> tuple[np.ndarray, np.ndarray]:
        u_pad = np.pad(u_in, 1, mode="constant", constant_values=0.0)
        gx = 0.5 * ((u_pad[1:, :-1] + u_pad[1:, 1:]) - (u_pad[:-1, :-1] + u_pad[:-1, 1:])) / hx
        gy = 0.5 * ((u_pad[:-1, 1:] + u_pad[1:, 1:]) - (u_pad[:-1, :-1] + u_pad[1:, :-1])) / hy
        return gx, gy

    def _neg_div_adj(px: np.ndarray, py: np.ndarray) -> np.ndarray:
        # Exact algebraic transpose grad_cell^T so grad_cell^T(grad_cell(u)) == -Lap_Q1(u) to 1e-16
        tx = 0.5 * ((px[:-1, :-1] + px[:-1, 1:]) - (px[1:, :-1] + px[1:, 1:])) / hx
        ty = 0.5 * ((py[:-1, :-1] + py[1:, :-1]) - (py[:-1, 1:] + py[1:, 1:])) / hy
        return tx + ty

    u = np.zeros((nx, ny), dtype=float)
    dx = np.zeros((nx + 1, ny + 1), dtype=float)
    dy = np.zeros((nx + 1, ny + 1), dtype=float)
    lam_x = np.zeros_like(dx)
    lam_y = np.zeros_like(dy)

    f_source = np.full((nx, ny), float(dpdz_neg), dtype=float)
    primal_hist: list[float] = []
    dual_hist: list[float] = []

    for _ in range(max_iter):
        # 1. Exact O(N^2 log N) spectral velocity update: (eta_p + r)*(-Lap u) = dpdz_neg - grad^T(lam - r*d)
        rhs = f_source - _neg_div_adj(lam_x - r_aug * dx, lam_y - r_aug * dy)
        u = _idst1_2d(_dst1_2d(rhs) / denom_spec)
        u = np.maximum(u, 0.0) if dpdz_neg >= 0.0 else u

        # 2. Pointwise isotropic Euclidean soft-thresholding shrinkage for auxiliary strain rate d:
        gx, gy = _grad_cell(u)
        sx = lam_x + r_aug * gx
        sy = lam_y + r_aug * gy
        s_norm = np.hypot(sx, sy)
        shrink = np.maximum(0.0, 1.0 - float(tau_y) / np.maximum(s_norm, 1e-30)) / float(r_aug)
        dx_new = shrink * sx
        dy_new = shrink * sy

        # 3. Glowinski-Dean dual multiplier update (with over-relaxation alpha = 1.5):
        rx = gx - dx_new
        ry = gy - dy_new
        gx_rel = 1.5 * gx - 0.5 * dx
        gy_rel = 1.5 * gy - 0.5 * dy
        lam_x = lam_x + r_aug * (gx_rel - dx_new)
        lam_y = lam_y + r_aug * (gy_rel - dy_new)

        p_res = float(math.sqrt(np.mean(rx**2 + ry**2)))
        d_res = float(r_aug * math.sqrt(np.mean((dx_new - dx) ** 2 + (dy_new - dy) ** 2)))
        dx, dy = dx_new, dy_new
        primal_hist.append(p_res)
        dual_hist.append(d_res)
        if max(p_res, d_res) < tol:
            break

    raw_d = np.hypot(dx, dy)
    d_mag = np.where(raw_d <= 1e-8, 0.0, raw_d)
    # Integrate velocity over [-H, H]^2 using exact bilinear element average:
    u_pad = np.pad(u, 1, mode="constant", constant_values=0.0)
    u_cell = 0.25 * (u_pad[:-1, :-1] + u_pad[1:, :-1] + u_pad[:-1, 1:] + u_pad[1:, 1:])
    q_flow = float(np.sum(u_cell) * hx * hy)
    bn = float(tau_y / (dpdz_neg * H_half)) if dpdz_neg > 0.0 else math.inf

    return {
        "x": x_nodes,
        "y": y_nodes,
        "u": u,
        "d_mag": d_mag,
        "unyielded_mask": d_mag == 0.0,
        "unyielded_area_fraction": float(np.mean(d_mag == 0.0)),
        "flow_rate": q_flow,
        "bingham_number": bn,
        "mosolov_bn_crit": MOSOLOV_SQUARE_DUCT_BN_CRIT,
        "primal_res_hist": np.array(primal_hist),
        "dual_res_hist": np.array(dual_hist),
    }

Discrete adjoint identity error |<grad u, p> - <u, grad^T p>| = 8.527e-14
Exact DST-I Q1 Poisson inversion error max |u_rec - u|        = 2.776e-15

Exercises

Worked solutions are in 10_solutions.ipynb. The cell below the list is a short self-check to start from.

  1. Verify a result. A region with rounded corners of radius RR inside a square duct of half-width HH has the area A=4H2−(4−π)R2A = 4H^2 - (4 - \pi)R^2 and the perimeter P=8H−2(4−π)RP = 8H - 2(4 - \pi)R. Maximize Φ(R)=AHP=4H2−(4−π)R2H [8H−2(4−π)R]\Phi(R) = \frac{A}{H P} = \frac{4H^2 - (4 - \pi)R^2}{H\,[8H - 2(4 - \pi)R]} over 0≤R≤H0 \le R \le H to obtain R∗=2H2+πR_* = \frac{2H}{2 + \sqrt{\pi}} and Bncrit=22+π≈0.530159\mathrm{Bn}_{\mathrm{crit}} = \frac{2}{2 + \sqrt{\pi}} \approx 0.530159, and explain why the square (R=0R=0) and the inscribed circle (R=HR=H) both give Φ=0.50\Phi = 0.50.

  2. Find how it fails. For H=1.0H = 1.0, τy=0.58\tau_y = 0.58, ηp=1.0\eta_p = 1.0 and G=1.0G = 1.0 (Bn=0.58\mathrm{Bn} = 0.58), compare the flow rate estimated from the plane-channel formula, 2HQ1D2 H Q_{\mathrm{1D}}, with the result of the two-dimensional solver for the square duct (r_aug=2.0). Compute the smallest pressure gradient at which the duct flows, Gmin⁡=τy/(H Bncrit)G_{\min} = \tau_y / (H\,\mathrm{Bn}_{\mathrm{crit}}), and check that there is flow at G=1.35G = 1.35.

  3. Implement it yourself. Write solve_1d_channel_bingham_admm(nx, H_half, dpdz_neg, tau_y, eta_p, r_aug), the augmented Lagrangian method for a plane channel without regularization: a Poisson problem solved with the discrete sine transform, followed by the shrinkage step for the strain rate. Compare the velocity and the flow rate with buckingham_reiner_exact_1d for τw=2.0\tau_w = 2.0 and τy=0.7\tau_y = 0.7, and check that the velocity is zero for τw=0.8 τy\tau_w = 0.8\,\tau_y.


Self-check for the exercises
============================
All checks passed.