Toothpaste, cement paste, waxy crude oil and polymer gels flow only when the shear stress exceeds a yield stress. In the Bingham and Herschel–Bulkley models the rate of strain is zero below the yield stress, so the apparent viscosity is infinite there and a general flow solver cannot use the models directly. A common remedy is the regularization of Papanastasiou (1987), , which is smooth at zero shear rate.
The regularized fluid has no yield stress: below it flows slowly, at a rate of order , where the Bingham fluid is at rest. Increasing reduces this error and makes the equations stiffer. This lecture derives the exact solutions of Bingham flow in a channel and in a pipe, and measures the error of the regularization against them.
Learning objectives¶
Derive the exact velocity profiles, plug widths and flow rates of a Bingham fluid in a plane channel and in a pipe (
viscoplastic_admm.buckingham_reiner_exact_1d).Compare the regularized profiles of
viscoplastic_admm.papanastasiou_1d_channelwith the exact ones for between 10 and 1000.Show that below the yield stress the regularized model flows at the rate , which is of order .
Relate the error of the flow rate to the stiffness of the regularized equations as increases.
Time: about 60 min
try: # use the installed package, or the copy in this repository
import engcomprheo
except ImportError:
import pathlib, subprocess, sys
for _root in [pathlib.Path.cwd(), *pathlib.Path.cwd().parents]:
if (_root / "engcomprheo" / "__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/engcomprheo.git"], check=True)
import engcomprheo
import inspect
import math
import numpy as np
import matplotlib.pyplot as plt
from engcomprheo import (brownian_chains, constants_benchmarks, entangled_tubes, mesoscopic_suspensions_dpd,
microrheology_rheoml, shear_banding_instabilities, tensors_kinematics,
viscoelastic_fvm_2d, viscoplastic_admm)
from engcomprheo.plotting import label_panels, log_ticks, panel_label, use_style
use_style()
trapezoid = getattr(np, "trapezoid", None) or np.trapz # NumPy 2 renamed trapz to trapezoid
def show_source(obj):
"""Return the source code of a function or class of the package."""
return inspect.getsource(obj)
def heading(text):
print(f"\n{text}\n" + "=" * len(text))1. Exact Bingham flow in a channel and in a pipe¶
A Bingham material does not deform where the magnitude of the shear stress is at most the yield stress, , and flows with the plastic viscosity where it is larger:
Under a pressure gradient the momentum balance gives a shear stress that is linear in the transverse coordinate: in a plane channel , and in a pipe of radius . Let be the ratio of the yield stress to the wall stress. For there is no flow. For the material near the centre, or , moves as a rigid plug:
| Geometry | Wall stress | Half-width or radius of the plug | Flow rate |
|---|---|---|---|
| Plane channel | |||
| Pipe | (Buckingham–Reiner) |
heading("Demonstration 1: exact Bingham profiles in a plane channel and in a pipe")
y_slit = np.linspace(-1.0, 1.0, 201)
r_pipe = np.linspace(0.0, 1.0, 121)
slit_yielded = viscoplastic_admm.buckingham_reiner_exact_1d(y_slit, dpdz_neg=2.0, H_or_R=1.0, tau_y=0.7, eta_p=1.0, geometry="planar")
slit_arrest = viscoplastic_admm.buckingham_reiner_exact_1d(y_slit, dpdz_neg=0.6, H_or_R=1.0, tau_y=0.7, eta_p=1.0, geometry="planar")
pipe_yielded = viscoplastic_admm.buckingham_reiner_exact_1d(r_pipe, dpdz_neg=4.0, H_or_R=1.0, tau_y=0.7, eta_p=1.0, geometry="pipe")
print(f"Planar slit (tau_w=2.0 > tau_y=0.7): plug y_p = {slit_yielded['plug_half_width']:.3f}, flux Q = {slit_yielded['flow_rate']:.5f}")
print(f"Planar slit (tau_w=0.6 < tau_y=0.7): plug y_p = {slit_arrest['plug_half_width']:.3f}, flux Q = {slit_arrest['flow_rate']:.5f} (no flow)")
print(f"Circular pipe (tau_w=2.0 > tau_y=0.7): plug r_p = {pipe_yielded['plug_half_width']:.3f}, flux Q = {pipe_yielded['flow_rate']:.5f}")
# Verify exact flat velocity inside [-y_p, +y_p] and exact zero velocity below yield:
plug_mask = np.abs(y_slit) <= slit_yielded["plug_half_width"] - 1e-12
assert np.max(np.abs(np.diff(slit_yielded["velocity"][plug_mask]))) < 1e-15
assert np.all(slit_arrest["velocity"] == 0.0) and slit_arrest["flow_rate"] == 0.0
xi_sweep = np.linspace(0.0, 1.25, 126)
q_norm_slit = [
viscoplastic_admm.buckingham_reiner_exact_1d(np.array([0.0]), dpdz_neg=2.0, H_or_R=1.0, tau_y=2.0 * x, eta_p=1.0, geometry="planar")["flow_rate"] / (4.0 / 3.0)
for x in xi_sweep
]
q_norm_pipe = [
viscoplastic_admm.buckingham_reiner_exact_1d(np.array([0.0]), dpdz_neg=4.0, H_or_R=1.0, tau_y=2.0 * x, eta_p=1.0, geometry="pipe")["flow_rate"] / (math.pi / 2.0)
for x in xi_sweep
]
assert np.all(np.array(q_norm_slit)[xi_sweep >= 1.0] == 0.0)
assert np.all(np.array(q_norm_pipe)[xi_sweep >= 1.0] == 0.0)
fig, axes = plt.subplots(1, 2, figsize=(10.2, 4.0))
axes[0].plot(slit_yielded["velocity"], y_slit, color="#2166AC", lw=2.3, label=r"Yielded ($\tau_w = 2.0, y_p = 0.35$)")
axes[0].plot(slit_arrest["velocity"], y_slit, "k--", lw=2.0, label=r"Sub-yield ($\tau_w = 0.6 < \tau_y$, $u \equiv 0$)")
axes[0].axhspan(-0.35, 0.35, color="#d4e6f1", alpha=0.55, label="Exact rigid plug ($\\dot{\\gamma} \\equiv 0$)")
axes[0].set_xlabel("Axial velocity $u(y)$")
axes[0].set_ylabel("Channel coordinate $y / H$")
axes[0].set_title(r"Velocity in a plane channel")
axes[0].legend(fontsize=8, loc="upper center", bbox_to_anchor=(0.5, -0.17), ncol=1)
axes[1].plot(xi_sweep, q_norm_slit, color="#2166AC", lw=2.2, label=r"Planar slit $1 - \frac{3}{2}\xi + \frac{1}{2}\xi^3$")
axes[1].plot(xi_sweep, q_norm_pipe, color="#C0392B", lw=2.2, label=r"Circular pipe $1 - \frac{4}{3}\xi + \frac{1}{3}\xi^4$")
axes[1].axvline(1.0, color="black", ls=":", lw=1.3, label=r"No flow at $\xi = \tau_y/\tau_w = 1$")
axes[1].set_xlabel(r"Dimensionless yield ratio $\xi = \tau_y / \tau_w$")
axes[1].set_ylabel(r"Normalized flux $Q / Q_{\mathrm{Newtonian}}$")
axes[1].set_title(r"Flow rate against $\tau_y/\tau_w$")
axes[1].legend(fontsize=8)
label_panels(fig)
plt.show()
Demonstration 1: exact Bingham profiles in a plane channel and in a pipe
========================================================================
Planar slit (tau_w=2.0 > tau_y=0.7): plug y_p = 0.350, flux Q = 0.66192
Planar slit (tau_w=0.6 < tau_y=0.7): plug y_p = 1.000, flux Q = 0.00000 (no flow)
Circular pipe (tau_w=2.0 > tau_y=0.7): plug r_p = 0.350, flux Q = 0.84562

Figure 9.1. Exact Bingham solutions. (a) Velocity profile for a wall stress above the yield stress, with its plug (shaded), and zero velocity for a wall stress below it. (b) Flow rate divided by the Newtonian value against the ratio of yield stress to wall stress, for a plane channel and a pipe; both are zero for a ratio of 1 or more.
What Demonstration 1 shows. In the Bingham model the edge of the plug, , is where reaches zero with the finite curvature , and the flow rate is exactly zero for .
2. The Papanastasiou regularization¶
To obtain a stress that is a smooth function of the shear rate, which a general flow solver requires, Papanastasiou (1987) introduced a parameter with the dimension of time:
The regularized stress increases monotonically from zero, with the finite initial slope . The shear rate in a channel is then zero at the centreline alone, and the rigid plug is replaced by a region in which the velocity profile is curved.
heading("Demonstration 2: regularized profiles against the exact plug for several values of m")
y_d2 = np.linspace(-1.0, 1.0, 161)
exact_d2 = viscoplastic_admm.buckingham_reiner_exact_1d(y_d2, dpdz_neg=2.0, H_or_R=1.0, tau_y=0.8, eta_p=1.0, geometry="planar")
m_values = [8.0, 30.0, 150.0, 800.0]
cols_m = ["#C0392B", "#E08214", "#2E8B57", "#2166AC"]
fig, axes = plt.subplots(1, 2, figsize=(10.2, 4.0))
axes[0].plot(exact_d2["velocity"], y_d2, "k-", lw=2.5, label="Exact Bingham ($y_p = 0.40$)")
exact_gdot = np.maximum(0.0, 2.0 * np.abs(y_d2) - 0.8)
axes[1].plot(y_d2, exact_gdot, "k-", lw=2.5, label="Exact $\\dot{\\gamma}(y)$ ($0$ on $[-0.4, 0.4]$)")
plug_core_mask = (np.abs(y_d2) > 0.02) & (np.abs(y_d2) <= 0.38)
vel_errors = []
for mv, col in zip(m_values, cols_m):
pap = viscoplastic_admm.papanastasiou_1d_channel(y_d2, dpdz_neg=2.0, H_half=1.0, tau_y=0.8, eta_p=1.0, m_reg=mv)
v_err = float(np.max(np.abs(pap["velocity"] - exact_d2["velocity"])))
core_leak_gdot = float(np.max(pap["apparent_shear_rate"][plug_core_mask]))
vel_errors.append(v_err)
print(f"m = {mv:6.1f} | max |u_Pap - u_exact| = {v_err:.5f} | max shear rate inside the core = {core_leak_gdot:.5f}")
assert core_leak_gdot > 0.0 # Never truly zero inside (0, y_p]
axes[0].plot(pap["velocity"], y_d2, "--", lw=1.8, color=col, label=f"Papanastasiou $m = {mv:.0f}$")
axes[1].plot(y_d2, pap["apparent_shear_rate"], "--", lw=1.8, color=col, label=f"$m = {mv:.0f}$")
assert vel_errors[0] > vel_errors[1] > vel_errors[2] > vel_errors[3]
axes[0].set_xlabel("Velocity $u(y)$")
axes[0].set_ylabel("Channel coordinate $y / H$")
axes[0].set_title(r"Velocity")
axes[0].legend(fontsize=8)
axes[1].axvspan(-0.4, 0.4, color="#eaecee", alpha=0.7)
axes[1].set_xlabel("Channel coordinate $y / H$")
axes[1].set_ylabel(r"Apparent shear rate $\dot{\gamma}(y)$")
axes[1].set_title(r"Shear rate")
axes[1].legend(fontsize=8, loc="upper center", bbox_to_anchor=(0.5, -0.17), ncol=3)
label_panels(fig)
plt.show()
Demonstration 2: regularized profiles against the exact plug for several values of m
====================================================================================
m = 8.0 | max |u_Pap - u_exact| = 0.05000 | max shear rate inside the core = 0.16452
m = 30.0 | max |u_Pap - u_exact| = 0.01333 | max shear rate inside the core = 0.06473
m = 150.0 | max |u_Pap - u_exact| = 0.00267 | max shear rate inside the core = 0.01658
m = 800.0 | max |u_Pap - u_exact| = 0.00050 | max shear rate inside the core = 0.00338

Figure 9.2. Papanastasiou regularization in a plane channel for four values of , against the exact Bingham solution. (a) Velocity. (b) Shear rate: the regularized model shears inside the plug (shaded).
What Demonstration 2 shows. Even at the regularized solution of papanastasiou_1d_channel has a non-zero strain rate everywhere in the core . A yield surface defined by a threshold then depends on the threshold and on (Frigaard and Nouar, 2005).
3. Creep of the regularized model below the yield stress¶
The most serious error of the regularization appears when the wall stress is below the yield stress. Consider a channel loaded to : the Bingham material does not move, . In the regularized model the shear rates are small, the expansion applies, and the material flows as a Newtonian fluid of viscosity :
heading("Demonstration 3: creep below the yield stress at a wall stress of 0.8 tau_y")
tau_y_d3, eta_p_d3, H_d3 = 1.0, 1.0, 1.0
G_sub = 0.8 * tau_y_d3 / H_d3 # Wall stress = 0.8 * tau_y < tau_y
exact_sub = viscoplastic_admm.buckingham_reiner_exact_1d(np.linspace(-1.0, 1.0, 41), dpdz_neg=G_sub, H_or_R=H_d3, tau_y=tau_y_d3, eta_p=eta_p_d3)
assert np.all(exact_sub["velocity"] == 0.0)
m_grid = np.geomspace(10.0, 1.0e4, 13)
u_creep_center, gdot_creep_wall, gdot_asymp = [], [], []
y_probe = np.array([0.0, H_d3])
for mv in m_grid:
p_sub = viscoplastic_admm.papanastasiou_1d_channel(y_probe, dpdz_neg=G_sub, H_half=H_d3, tau_y=tau_y_d3, eta_p=eta_p_d3, m_reg=mv)
u_creep_center.append(float(p_sub["velocity"][0]))
gdot_creep_wall.append(float(p_sub["apparent_shear_rate"][1]))
gdot_asymp.append(p_sub["subyield_creep_rate_at_0p8_tauy"])
u_creep_center = np.array(u_creep_center)
gdot_creep_wall = np.array(gdot_creep_wall)
gdot_linear_tangent = np.array(gdot_asymp)
# Exact transcendental large-m root of 1 - exp(-m * gdot_w) == 0.8 is gdot_w = -ln(1 - 0.8) / m = ln(5) / m:
gdot_exact_trans = math.log(5.0) / m_grid
slope_m = float(np.polyfit(np.log(m_grid[m_grid >= 200.0]), np.log(u_creep_center[m_grid >= 200.0]), 1)[0])
print(f"Exact Bingham velocity at tau_w = 0.8*tau_y : {np.max(exact_sub['velocity']):.1f} (identically zero)")
print(f"Papanastasiou creep u(0) at m = 20 : {u_creep_center[1]:.4e} | at m = 10^4: {u_creep_center[-1]:.4e}")
print(f"Asymptotic log-log slope d(ln u_creep)/d(ln m): {slope_m:+.4f} (exact theory = -1.0000)")
assert abs(slope_m - (-1.0)) < 0.015
assert np.allclose(gdot_creep_wall[m_grid >= 500.0], gdot_exact_trans[m_grid >= 500.0], rtol=0.02)
assert np.all(gdot_creep_wall[m_grid >= 500.0] > 1.9 * gdot_linear_tangent[m_grid >= 500.0])
fig, ax = plt.subplots(figsize=(7.4, 4.1))
ax.loglog(m_grid, gdot_creep_wall, "ro-", lw=2.0, ms=5, label=r"Root-solved wall creep rate $\dot{\gamma}_w$")
ax.loglog(m_grid, gdot_exact_trans, "k--", lw=1.6, label=r"Exact asymptote $-\ln(1-0.8)/m = \ln(5)/m$")
ax.loglog(m_grid, gdot_linear_tangent, "g:", lw=1.6, label=r"Zero-rate tangent $0.8\tau_y / (\eta_p + m\tau_y)$")
ax.loglog(m_grid, u_creep_center, "bs-", lw=2.0, ms=5, label=r"Centreline creep velocity $u_{\mathrm{Pap}}(0)$")
ax.set_xlabel(r"Papanastasiou regularization parameter $m$ [s]")
ax.set_ylabel("Motion below the yield stress")
ax.set_title(r"Motion below the yield stress ($\tau_w = 0.8\,\tau_y$)")
ax.legend(fontsize=8)
plt.show()
Demonstration 3: creep below the yield stress at a wall stress of 0.8 tau_y
===========================================================================
Exact Bingham velocity at tau_w = 0.8*tau_y : 0.0 (identically zero)
Papanastasiou creep u(0) at m = 20 : 2.9520e-02 | at m = 10^4: 5.9748e-05
Asymptotic log-log slope d(ln u_creep)/d(ln m): -0.9978 (exact theory = -1.0000)

Figure 9.3. Wall shear rate and centreline velocity of the Papanastasiou model at a wall stress below the yield stress, against . Both decrease as ; the exact Bingham values are zero.
What Demonstration 3 shows. The creep is of order , so it could be made negligible with a very large . Section 4 shows the cost: in a flow solver, the ratio of the largest to the smallest viscosity is .
4. Error of the flow rate against stiffness¶
Where the material should be unyielded (), the slope of the regularized stress, which enters the Jacobian of a Newton iteration, is . In the yielded layers near the walls the slope is about . The ratio of the two grows linearly with :
heading("Demonstration 4: error of the flow rate against stiffness")
m_pareto = np.geomspace(5.0, 1000.0, 12)
y_q = np.linspace(-1.0, 1.0, 201)
ex_q = viscoplastic_admm.buckingham_reiner_exact_1d(y_q, dpdz_neg=2.0, H_or_R=1.0, tau_y=1.0, eta_p=1.0, geometry="planar")
rel_q_err, cond_ratio = [], []
for mv in m_pareto:
p_q = viscoplastic_admm.papanastasiou_1d_channel(y_q, dpdz_neg=2.0, H_half=1.0, tau_y=1.0, eta_p=1.0, m_reg=mv)
q_pap = float(trapezoid(p_q["velocity"], y_q))
rel_q_err.append(abs(q_pap - ex_q["flow_rate"]) / ex_q["flow_rate"])
cond_ratio.append(1.0 + mv * 1.0 / 1.0)
rel_q_err = np.array(rel_q_err)
cond_ratio = np.array(cond_ratio)
product_invariant = rel_q_err[-4:] * cond_ratio[-4:]
print(f"m = {m_pareto[0]:6.1f} -> relative flux err = {100*rel_q_err[0]:6.2f}%, stiffness ratio = {cond_ratio[0]:7.1f}")
print(f"m = {m_pareto[-1]:6.1f} -> relative flux err = {100*rel_q_err[-1]:6.3f}%, stiffness ratio = {cond_ratio[-1]:7.1f}")
print(f"Asymptotic (error * stiffness) product on large m: {product_invariant.round(3).tolist()}")
assert rel_q_err[-1] < 1.5e-3 and cond_ratio[-1] > 1000.0
assert np.max(product_invariant) / np.min(product_invariant) < 1.12
fig, ax = plt.subplots(figsize=(7.4, 4.1))
sc_plot = ax.scatter(cond_ratio, 100.0 * rel_q_err, c=np.log10(m_pareto), cmap="viridis", s=65, zorder=4)
ax.plot(cond_ratio, 100.0 * rel_q_err, "k-", lw=1.3, alpha=0.6)
ax.set_xscale("log")
ax.set_yscale("log")
plt.colorbar(sc_plot, ax=ax, label=r"$\log_{10}(m)$")
ax.set_xlabel(r"Tangent viscosity condition ratio $\kappa_{\mathrm{constit}} = 1 + m\tau_y/\eta_p$")
ax.set_ylabel("Relative volumetric flux error [%]")
ax.set_title(r"Flow-rate error against viscosity ratio")
plt.show()
Demonstration 4: error of the flow rate against stiffness
=========================================================
m = 5.0 -> relative flux err = 22.45%, stiffness ratio = 6.0
m = 1000.0 -> relative flux err = 0.086%, stiffness ratio = 1001.0
Asymptotic (error * stiffness) product on large m: [0.9, 0.891, 0.88, 0.865]

Figure 9.4. Relative error of the flow rate of the Papanastasiou model against the ratio of its largest to its smallest viscosity, ; the colour is . The error falls only as fast as the ratio grows.
Inside the algorithm¶
The function viscoplastic_admm.papanastasiou_1d_channel solves, at each point, with Newton’s method. The function is increasing and concave: , and . The iteration starts from , which is a lower bound of the root, and converges to rounding error in fewer than 8 iterations for any value of .
Check against the package¶
The cell below prints the source of papanastasiou_1d_channel, repeats the calculation with a vectorized Newton iteration and Simpson’s rule in NumPy, and checks that the residual of the equation is below 1e-14 at every point and that the profile approaches that of buckingham_reiner_exact_1d as increases.
heading("Inside the algorithm: the root solver of the regularized model")
print(show_source(viscoplastic_admm.papanastasiou_1d_channel))
def standalone_papanastasiou_rates(tau_abs: np.ndarray, tau_y: float, eta_p: float, m_reg: float) -> np.ndarray:
"""Vectorized NumPy Newton solver for eta_p * g + tau_y * (1 - exp(-m * g)) == tau_abs."""
g = np.maximum(tau_abs / (eta_p + m_reg * tau_y), np.maximum(0.0, (tau_abs - tau_y) / eta_p))
for _ in range(25):
em = np.exp(-np.minimum(700.0, m_reg * g))
res = eta_p * g + tau_y * (1.0 - em) - tau_abs
jac = eta_p + m_reg * tau_y * em
g = np.maximum(0.0, g - res / jac)
return np.where(tau_abs <= 1e-15, 0.0, g)
y_in = np.linspace(-1.0, 1.0, 101)
tau_in = 2.4 * np.abs(y_in)
g_vec = standalone_papanastasiou_rates(tau_in, tau_y=0.9, eta_p=1.2, m_reg=250.0)
lib_in = viscoplastic_admm.papanastasiou_1d_channel(y_in, dpdz_neg=2.4, H_half=1.0, tau_y=0.9, eta_p=1.2, m_reg=250.0)
eq_residual = float(np.max(np.abs(1.2 * g_vec + 0.9 * (1.0 - np.exp(-250.0 * g_vec)) - tau_in)))
diff_lib = float(np.max(np.abs(g_vec - lib_in["apparent_shear_rate"])))
print(f"Max constitutive residual = {eq_residual:.3e} | max |vectorized - package| = {diff_lib:.3e}")
assert eq_residual < 1e-14
assert diff_lib < 1e-13
Inside the algorithm: the root solver of the regularized model
==============================================================
def papanastasiou_1d_channel(
y_grid: np.ndarray,
dpdz_neg: float = 2.0,
H_half: float = 1.0,
tau_y: float = 0.5,
eta_p: float = 1.0,
m_reg: float = 100.0,
) -> dict:
"""Velocity profile of the Papanastasiou-regularized Bingham model in a plane channel, from a root solve at each point."""
y = np.asarray(y_grid, dtype=float).ravel()
if H_half <= 0.0 or eta_p <= 0.0 or tau_y < 0.0 or m_reg <= 0.0 or dpdz_neg < 0.0:
raise ValueError("Invalid parameters for papanastasiou_1d_channel.")
tau_abs = float(dpdz_neg) * np.abs(y)
gdot = np.zeros_like(y)
# Solve eta_p * g + tau_y * (1 - exp(-m * g)) == tau_abs via safeguarded Newton on each point:
for idx, t_val in enumerate(tau_abs):
if t_val <= 1e-15:
gdot[idx] = 0.0
continue
g = max(t_val / (eta_p + tau_y * m_reg), max(0.0, (t_val - tau_y) / eta_p))
for _ in range(40):
em = math.exp(-min(700.0, m_reg * g))
f_val = eta_p * g + tau_y * (1.0 - em) - t_val
df = eta_p + tau_y * m_reg * em
step = f_val / df
g = max(0.0, g - step)
if abs(step) <= 1e-14 * (1.0 + g):
break
gdot[idx] = g
# Integrate du/dy = -sign(y) * gdot(y) inward from walls y = +/- H_half using dense grid interpolation:
y_dense = np.linspace(0.0, H_half, 401)
tau_d = float(dpdz_neg) * y_dense
gd_dense = np.zeros_like(y_dense)
for idx, t_val in enumerate(tau_d):
g = max(t_val / (eta_p + tau_y * m_reg), max(0.0, (t_val - tau_y) / eta_p))
for _ in range(35):
em = math.exp(-min(700.0, m_reg * g))
g = max(0.0, g - (eta_p * g + tau_y * (1.0 - em) - t_val) / (eta_p + tau_y * m_reg * em))
gd_dense[idx] = g
# Cumulative integral from wall H_half inward:
dy_d = y_dense[1] - y_dense[0]
u_from_center = np.zeros_like(y_dense)
u_from_center[:-1] = np.cumsum(0.5 * (gd_dense[:-1] + gd_dense[1:])[::-1])[::-1] * dy_d
u_prof = np.interp(np.abs(y), y_dense, u_from_center)
# Sub-yield creep velocity when wall stress tau_w = 0.8 * tau_y (exact Bingham velocity == 0.0):
g_creep_wall = (0.8 * tau_y) / (eta_p + m_reg * tau_y) if tau_y > 0.0 else 0.0
return {
"y": y,
"velocity": u_prof,
"apparent_shear_rate": gdot,
"subyield_creep_rate_at_0p8_tauy": float(g_creep_wall),
}
Max constitutive residual = 2.220e-16 | max |vectorized - package| = 1.804e-16
Exercises¶
Worked solutions are in 09_solutions.ipynb. The cell below the list is a short self-check to start from.
Verify a result. Check the Buckingham–Reiner flow rate in a pipe, with the ratio of the yield stress to the wall stress, by numerical integration of for . Compare the fraction of the cross-section occupied by the plug in a pipe and in a plane channel at the same .
Find how it fails. A layer of gel between vertical walls (, , ) is loaded by its own weight, , so that the wall stress is . A Bingham fluid does not move under this load. Compute the displacement of the centreline after that the Papanastasiou regularization predicts for .
Implement it yourself. Write
herschel_bulkley_planar_exact(y_grid, dpdz_neg, H_half, tau_y, K_hb, n_hb)in NumPy from the exact velocity profile of a Herschel–Bulkley fluid, , in a plane channel. Check that (1) it agrees withbuckingham_reiner_exact_1dfor , (2) the velocity is zero when , and (3) for the assumed parametersCARBOPOL_EVP() the plug has the expected width.
heading("Self-check for the exercises")
assert np.all(slit_arrest["velocity"] == 0.0) and slit_arrest["flow_rate"] == 0.0
assert vel_errors[0] > vel_errors[1] > vel_errors[2] > vel_errors[3]
assert abs(slope_m - (-1.0)) < 0.015
assert eq_residual < 1e-14 and diff_lib < 1e-13
print("All checks passed.")
Self-check for the exercises
============================
All checks passed.