A solution of wormlike micelles sheared between two plates at a high enough rate does not shear uniformly. It separates into a band at a low shear rate and a band at a high shear rate, at the same shear stress. The cause is a flow curve that is not monotonic: over a range of shear rates the stress of homogeneous flow decreases with rate, and homogeneous flow is unstable.
A local constitutive equation does not determine the stress at which the two bands coexist; the computed stress depends on the initial condition and on the grid. A stress-diffusion term with a small length selects one stress. This lecture computes non-monotonic flow curves of the Johnson–Segalman model, solves the model with diffusion in one dimension, and treats a two-species model in which the micelles break in the flow. The parameter set WLM_CPYCL is assumed.
Learning objectives¶
Derive the condition for a non-monotonic flow curve of the Johnson–Segalman model (
shear_banding_instabilities.steady_johnson_segalman_curve).Compute shear bands in one dimension with the diffusive Johnson–Segalman model (
solve_1d_diffusive_johnson_segalman) and check that the total stress is uniform.Show that with the selected stress does not depend on the initial condition, and that the fraction of the high-rate band grows linearly with the applied rate.
Compute the breaking of micelles, , and the conservation of in the two-species model of Vasquez, McKinley and Cook (
solve_1d_vcm_wormlike_micelles).
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. Flow curves of the Johnson–Segalman model and the condition ¶
The Johnson–Segalman (1977) model is the Oldroyd-B model with the upper-convected derivative replaced by the Gordon–Schowalter derivative of Lecture 0, with a slip parameter between 0 and 2; the combination is then positive. With slip the polymer is rotated by the flow as well as stretched, and the polymer shear stress in steady homogeneous shear has a maximum:
The derivative with respect to the shear rate is
The flow curve is therefore non-monotonic if and only if and . Where its slope is negative, homogeneous flow is unstable. For the assumed parameter set WLM_CPYCL, , far below .
heading("Demonstration 1: flow curves of the Johnson-Segalman model and the condition beta_s < 1/8")
wlm_db = constants_benchmarks.BENCHMARK_FLUIDS_DB["WLM_CPYCL"]
beta_wlm = wlm_db["eta_s_Pas"] / (wlm_db["G0_Pa"] * wlm_db["lam_s"])
print(f"Parameter set WLM_CPYCL solvent viscosity ratio beta_s = {beta_wlm:.5f} << 1/8 = 0.125")
assert beta_wlm < 0.01
rates_js = np.linspace(0.0, 9.0, 450)
betas_test = [0.03, 0.06, 0.125, 0.20]
colors_js = ["#C0392B", "#E08214", "#2E8B57", "#2166AC"]
fig, ax = plt.subplots(figsize=(7.6, 4.2))
for b_val, col in zip(betas_test, colors_js):
res = shear_banding_instabilities.steady_johnson_segalman_curve(rates_js, G0=1.0, lam=1.0, eta_s=b_val, xi_slip=0.2)
dtau = np.diff(res["tau_total"])
has_neg_slope = bool(np.any(dtau < -1e-9))
print(f"beta_s = {b_val:5.3f} | is_non_monotonic = {str(res['is_non_monotonic']):5s} | spinodal_rates = {res['spinodal_rates']}")
if b_val < 0.125 - 1e-9:
assert res["is_non_monotonic"] is True and has_neg_slope is True
r_lo, r_hi = res["spinodal_rates"]
ax.scatter([r_lo, r_hi], np.interp([r_lo, r_hi], rates_js, res["tau_total"]), color=col, s=45, zorder=5)
else:
assert res["is_non_monotonic"] is False and has_neg_slope is False
ax.plot(rates_js, res["tau_total"], lw=2.1, color=col, label=f"$\\beta_s = {b_val:.3f}$ ({'non-monotonic' if res['is_non_monotonic'] else 'monotonic'})")
ax.set_xlabel(r"Dimensionless shear rate $\mathrm{Wi} = \lambda\dot{\gamma}$")
ax.set_ylabel(r"Dimensionless total shear stress $\Sigma / G_0$")
ax.set_title(r"Flow curves of the Johnson–Segalman model ($\xi = 0.2$)")
ax.legend(fontsize=8)
plt.show()
Demonstration 1: flow curves of the Johnson-Segalman model and the condition beta_s < 1/8
=========================================================================================
Parameter set WLM_CPYCL solvent viscosity ratio beta_s = 0.00192 << 1/8 = 0.125
beta_s = 0.030 | is_non_monotonic = True | spinodal_rates = (1.7771727871437075, 9.158531209843252)
beta_s = 0.060 | is_non_monotonic = True | spinodal_rates = (1.9178121269648343, 6.087917327494465)
beta_s = 0.125 | is_non_monotonic = False | spinodal_rates = None
beta_s = 0.200 | is_non_monotonic = False | spinodal_rates = None

Figure 8.1. Total shear stress against shear rate for four solvent viscosity ratios. For the curve has a maximum and a minimum (circles); for it is monotonic.
What Demonstration 1 shows. Homogeneous flow at a shear rate between and , where , is linearly unstable (Yerushalmi, Katz and Shinnar, 1970).
2. Shear bands in the diffusive Johnson–Segalman model¶
In plane Couette flow without inertia across the gap , the momentum balance requires a total shear stress that is uniform in space, , and the moving wall fixes the average shear rate, . Olmsted, Radulescu and Lu (2000) added a stress-diffusion term with a small length :
The term gives the interface between the bands a width of order and selects one stress at which the bands coexist.
heading("Demonstration 2: shear bands in Couette flow at Wi = 3.0")
djs_sol = shear_banding_instabilities.solve_1d_diffusive_johnson_segalman(
wi_applied=3.0, beta_s=0.05, xi_slip=0.2, l_diff=0.025, ny=36, t_end=40.0, dt=0.04
)
y_g = djs_sol["y"]
gdot_prof = djs_sol["shear_rate_profile"]
u_prof = djs_sol["velocity_profile"]
sigma_local = 0.05 * gdot_prof + djs_sol["tau_xy_profile"]
g_low, g_high = float(np.min(gdot_prof)), float(np.max(gdot_prof))
mean_rate = float(np.mean(gdot_prof))
stress_uniformity = float(np.max(np.abs(sigma_local - djs_sol["total_stress_plateau"])))
print(f"Coexisting shear rates : low band = {g_low:.3f}, high band = {g_high:.3f} (gap average = {mean_rate:.4f} against Wi = 3.0000)")
print(f"Selected stress plateau: Sigma_plat = {djs_sol['total_stress_plateau']:.5f} | spatial uniformity err = {stress_uniformity:.2e}")
print(f"High-rate band fraction: f_high = {djs_sol['high_rate_band_fraction']:.3f}")
assert abs(mean_rate - 3.0) < 1e-12
assert stress_uniformity < 1e-14
assert g_high > 4.0 * g_low
assert 0.15 < djs_sol["high_rate_band_fraction"] < 0.85
fig, axes = plt.subplots(2, 2, figsize=(9.6, 7.6))
axes = axes.ravel()
axes[0].plot(u_prof, y_g, color="#2166AC", lw=2.3, label="Banded $u(y)$")
axes[0].plot(3.0 * y_g, y_g, "k--", lw=1.3, label="Homogeneous Couette")
axes[0].set_xlabel(r"Velocity $u(y)$")
axes[0].set_ylabel(r"Gap coordinate $y / H$")
axes[0].set_title(r"Velocity")
axes[0].legend(fontsize=8)
axes[1].plot(gdot_prof, y_g, color="#C0392B", lw=2.3)
axes[1].axvline(3.0, color="gray", ls=":", lw=1.3, label=r"Applied $\mathrm{Wi}=3.0$")
axes[1].set_xlabel(r"Local shear rate $\dot{\gamma}(y)$")
axes[1].set_title(r"Shear rate")
axes[1].legend(fontsize=8)
axes[2].plot(djs_sol["tau_xy_profile"], y_g, color="#2E8B57", lw=2.0, label=r"Polymer $\tau_{xy}(y)$")
axes[2].plot(0.05 * gdot_prof, y_g, color="#E08214", lw=2.0, label=r"Solvent $\beta_s\dot{\gamma}(y)$")
axes[2].plot(sigma_local, y_g, "k-", lw=2.2, label=r"Total $\Sigma = \mathrm{const}$")
axes[2].set_xlabel("Dimensionless shear stress")
axes[2].set_title(r"Shear stress across the gap")
axes[2].legend(fontsize=7.5)
# Fourth panel: the two bands on the homogeneous flow curve
rates_fc = np.geomspace(0.2, 30.0, 200)
curve_fc = shear_banding_instabilities.steady_johnson_segalman_curve(rates_fc, G0=1.0, lam=1.0, eta_s=0.05, xi_slip=0.2)
axes[3].loglog(rates_fc, curve_fc["tau_total"], color="#6B7280", lw=1.8, label="Homogeneous flow curve")
axes[3].axhline(djs_sol["total_stress_plateau"], color="k", ls="--", lw=1.2, label="Selected plateau stress")
axes[3].plot([g_low, g_high], [djs_sol["total_stress_plateau"]] * 2, "o", color="#C0392B", ms=7, label="Low- and high-rate bands")
axes[3].set_xlabel(r"Shear rate $\lambda\dot{\gamma}$")
axes[3].set_ylabel(r"Total shear stress $\Sigma / G_0$")
axes[3].set_title(r"The two bands on the flow curve")
axes[3].legend(fontsize=7.5, loc="lower right")
label_panels(fig)
plt.show()
Demonstration 2: shear bands in Couette flow at Wi = 3.0
========================================================
Coexisting shear rates : low band = 1.047, high band = 11.240 (gap average = 3.0000 against Wi = 3.0000)
Selected stress plateau: Sigma_plat = 0.80351 | spatial uniformity err = 1.11e-16
High-rate band fraction: f_high = 0.194

Figure 8.2. Diffusive Johnson–Segalman model in plane Couette flow at an average rate (, , 36 cells). (a) Velocity, with the linear profile. (b) Shear rate: about 1.0 in one band and 11.2 in the other. (c) Polymer, solvent and total shear stress; the total is uniform. (d) The two bands on the flow curve of homogeneous flow, at the selected stress.
What Demonstration 2 shows. Across the interface the polymer shear stress falls and the solvent stress rises by the same amount, so that the total stress is uniform to 10-14.
3. The selected stress and the lever rule¶
The two bands coexist in the way a liquid and its vapour do. When the applied average rate is varied between the rates and of the two bands, the rates of the bands and the stress stay the same, and only the fraction of the gap occupied by the high-rate band changes, linearly (the lever rule):
heading("Demonstration 3: the selected stress and the lever rule")
wi_coex = np.array([2.1, 2.8, 3.5, 4.2])
sig_plat_list, f_high_list = [], []
for w_app in wi_coex:
sol_w = shear_banding_instabilities.solve_1d_diffusive_johnson_segalman(
wi_applied=float(w_app), beta_s=0.05, xi_slip=0.2, l_diff=0.025, ny=32, t_end=40.0, dt=0.045
)
sig_plat_list.append(sol_w["total_stress_plateau"])
f_high_list.append(sol_w["high_rate_band_fraction"])
print(f"Applied Wi = {w_app:4.2f} | Sigma_plateau = {sol_w['total_stress_plateau']:.5f} | f_high = {sol_w['high_rate_band_fraction']:.3f}")
sig_plat_arr = np.array(sig_plat_list)
f_high_arr = np.array(f_high_list)
plat_rel_std = float(np.std(sig_plat_arr) / np.mean(sig_plat_arr))
corr_lever = float(np.corrcoef(wi_coex, f_high_arr)[0, 1])
print(f"Plateau relative std across Wi in [2.0, 4.5]: {plat_rel_std:.4e} | lever-rule linearity r = {corr_lever:.4f}")
assert plat_rel_std < 0.015
assert corr_lever > 0.985
assert np.all(np.diff(f_high_arr) > 0.0)
hom_bg = shear_banding_instabilities.steady_johnson_segalman_curve(np.linspace(0.0, 7.5, 300), G0=1.0, lam=1.0, eta_s=0.05, xi_slip=0.2)
fig, axes = plt.subplots(1, 2, figsize=(10.2, 4.0))
axes[0].plot(hom_bg["rates"], hom_bg["tau_total"], "k--", lw=1.6, label="Homogeneous unstable JS curve")
axes[0].plot(wi_coex, sig_plat_arr, "ro-", lw=2.2, ms=6, label="Selected stress $\\Sigma_{\\mathrm{plat}}$ (diffusive model)")
axes[0].set_xlabel(r"Applied gap Weissenberg number $\mathrm{Wi}$")
axes[0].set_ylabel(r"Macroscopic shear stress $\Sigma_{\mathrm{plat}}$")
axes[0].set_title(r"Selected stress against applied rate")
axes[0].legend(fontsize=8)
fit_line = np.poly1d(np.polyfit(wi_coex, f_high_arr, 1))(wi_coex)
axes[1].plot(wi_coex, f_high_arr, "bs", ms=7, label="Simulated $f_{\\mathrm{high}}(\\mathrm{Wi})$")
axes[1].plot(wi_coex, fit_line, "b--", lw=1.8, label=f"Linear lever-rule fit ($r = {corr_lever:.3f}$)")
axes[1].set_xlabel(r"Applied gap Weissenberg number $\mathrm{Wi}$")
axes[1].set_ylabel(r"High-shear band fraction $f_{\mathrm{high}}$")
axes[1].set_title(r"Fraction of the gap at the high rate")
axes[1].legend(fontsize=8)
label_panels(fig)
plt.show()
Demonstration 3: the selected stress and the lever rule
=======================================================
Applied Wi = 2.10 | Sigma_plateau = 0.81474 | f_high = 0.094
Applied Wi = 2.80 | Sigma_plateau = 0.79643 | f_high = 0.188
Applied Wi = 3.50 | Sigma_plateau = 0.79945 | f_high = 0.250
Applied Wi = 4.20 | Sigma_plateau = 0.80334 | f_high = 0.312
Plateau relative std across Wi in [2.0, 4.5]: 8.6371e-03 | lever-rule linearity r = 0.9944

Figure 8.3. (a) The total stress selected at four applied rates lies on a plateau across the non-monotonic part of the flow curve of homogeneous flow (dashed). (b) Fraction of the gap occupied by the high-rate band, with a linear fit.
What Demonstration 3 shows. As in the coexistence of two phases, increasing the applied shear rate from to 4.2 leaves unchanged to within 1 % on this grid of 32 cells, while the high-shear band widens in proportion to the applied rate.
4. A two-species model of wormlike micelles¶
In a solution of wormlike micelles, shear banding is caused by the reversible breaking and recombination of the micelles, , as well as by slip (Vasquez, McKinley and Cook, 2007). The flow increases the breaking rate of the long, entangled micelles (number density ), , and produces short ones (), which contribute little to the viscosity. The total amount of surfactant in the gap is conserved:
heading("Demonstration 4: the two-species model: breaking of micelles and conservation")
vcm_sol = shear_banding_instabilities.solve_1d_vcm_wormlike_micelles(
wi_applied=3.5, cA_eq=0.05, cB_eq=0.8, xi_scission=2.5, eps_short=0.01, beta_s=0.008, l_diff=0.02, ny=28, t_end=20.0, dt=0.015
)
yv = vcm_sol["y"]
monomer_drift = abs(vcm_sol["monomer_total"] - vcm_sol["monomer_initial"])
nA_span = float(np.max(vcm_sol["nA"]) - np.min(vcm_sol["nA"]))
gdot_ratio_vcm = float(np.max(vcm_sol["shear_rate"]) / max(np.min(vcm_sol["shear_rate"]), 1e-6))
print(f"Initial total monomer <n_A + 0.5 n_B> : {vcm_sol['monomer_initial']:.10f}")
print(f"Final total monomer <n_A + 0.5 n_B> : {vcm_sol['monomer_total']:.10f} (drift = {monomer_drift:.3e})")
print(f"Long-chain depletion delta(n_A) : {nA_span:.4f} | shear-rate contrast max/min = {gdot_ratio_vcm:.2f}x")
assert monomer_drift < 1e-9
assert nA_span > 0.15
assert gdot_ratio_vcm > 2.5
# Anti-correlated scission: where shear rate is maximal, long chains n_A are depleted and short chains n_B are enriched
assert np.corrcoef(vcm_sol["shear_rate"], vcm_sol["nA"])[0, 1] < -0.90
assert np.corrcoef(vcm_sol["shear_rate"], vcm_sol["nB"])[0, 1] > 0.90
fig, axes = plt.subplots(1, 2, figsize=(10.2, 4.0))
axes[0].plot(vcm_sol["nA"], yv, color="#2166AC", lw=2.2, label="Long micelles $n_A(y)$")
axes[0].plot(vcm_sol["nB"], yv, color="#C0392B", lw=2.2, label="Short micelles $n_B(y)$")
axes[0].plot(vcm_sol["nA"] + 0.5 * vcm_sol["nB"], yv, "k--", lw=1.6, label=r"Local monomer $n_A + \frac{1}{2}n_B$")
axes[0].set_xlabel("Dimensionless number density")
axes[0].set_ylabel(r"Gap coordinate $y / H$")
axes[0].set_title(r"Number densities")
axes[0].legend(fontsize=8)
axes[1].plot(vcm_sol["shear_rate"], yv, color="#7B4FA3", lw=2.2, label=r"Local shear rate $\dot{\gamma}(y)$")
ax_top = axes[1].twiny()
ax_top.plot(vcm_sol["velocity"], yv, "k:", lw=2.0, label="Velocity $u(y)$")
ax_top.set_xlabel("Velocity $u(y)$")
axes[1].set_xlabel(r"Shear rate $\dot{\gamma}(y)$", color="#7B4FA3")
axes[1].set_title(r"Shear rate and velocity")
label_panels(fig)
plt.show()
Demonstration 4: the two-species model: breaking of micelles and conservation
=============================================================================
Initial total monomer <n_A + 0.5 n_B> : 1.1767766953
Final total monomer <n_A + 0.5 n_B> : 1.1767766953 (drift = 9.615e-14)
Long-chain depletion delta(n_A) : 0.8006 | shear-rate contrast max/min = 57.73x

Figure 8.4. Two-species model of wormlike micelles in plane Couette flow. (a) Number densities of long chains and short chains , and , which is conserved. (b) Shear rate (lower axis) and velocity (upper axis).
Inside the algorithm¶
The functions solve_1d_diffusive_johnson_segalman and solve_1d_vcm_wormlike_micelles treat the diffusion terms implicitly, with shear_banding_instabilities._solve_neumann_diffusion_1d. On a cell-centred grid with zero flux at the walls ( at and ), the rows of the matrix for the two cells at the walls are and the rows for the interior cells are . Every column of this matrix sums to 1, so the implicit step leaves the sum unchanged to rounding error, which the conservation of monomers in the two-species model requires.
Check against the package¶
The cell below prints the source of _solve_neumann_diffusion_1d, constructs the dense matrix in NumPy, and checks the tridiagonal solution and the conservation to 10-14.
heading("Inside the algorithm: the implicit diffusion step with zero-flux boundaries")
print(show_source(shear_banding_instabilities._solve_neumann_diffusion_1d))
n_in = 48
alpha_in = 3.75
M_dense = np.diag(np.full(n_in, 1.0 + 2.0 * alpha_in)) - np.diag(np.full(n_in - 1, alpha_in), 1) - np.diag(np.full(n_in - 1, alpha_in), -1)
M_dense[0, 0] = 1.0 + alpha_in
M_dense[-1, -1] = 1.0 + alpha_in
rng_in = np.random.default_rng(7)
rhs_in = 1.5 + rng_in.normal(0.0, 0.4, size=n_in)
u_thomas = shear_banding_instabilities._solve_neumann_diffusion_1d(rhs_in, alpha_in)
u_dense = np.linalg.solve(M_dense, rhs_in)
col_sum_err = float(np.max(np.abs(np.sum(M_dense, axis=0) - 1.0)))
solve_err = float(np.max(np.abs(u_thomas - u_dense)))
mass_err = abs(float(np.sum(u_thomas) - np.sum(rhs_in)))
print(f"Column-sum conservation error = {col_sum_err:.2e} | Thomas against dense error = {solve_err:.2e} | integral drift = {mass_err:.2e}")
assert col_sum_err < 1e-15
assert solve_err < 1e-14
assert mass_err < 1e-13
Inside the algorithm: the implicit diffusion step with zero-flux boundaries
===========================================================================
def _solve_neumann_diffusion_1d(u_rhs: np.ndarray, alpha_lap: float) -> np.ndarray:
"""Solve (I - alpha_lap * D2) u = u_rhs on a cell-centred grid with zero-flux walls, with the tridiagonal algorithm."""
n = u_rhs.size
if alpha_lap <= 0.0 or n < 3:
return u_rhs.copy()
# Cell-centered zero-flux Neumann Laplacian: boundary rows have [-1, +1], interior rows have [+1, -2, +1]:
diag = np.full(n, 1.0 + 2.0 * alpha_lap, dtype=float)
diag[0] = 1.0 + alpha_lap
diag[-1] = 1.0 + alpha_lap
lower = np.full(n - 1, -alpha_lap, dtype=float)
upper = np.full(n - 1, -alpha_lap, dtype=float)
c_prime = np.zeros(n - 1, dtype=float)
d_prime = np.zeros(n, dtype=float)
c_prime[0] = upper[0] / diag[0]
d_prime[0] = u_rhs[0] / diag[0]
for i in range(1, n):
denom = diag[i] - lower[i - 1] * c_prime[i - 1]
if i < n - 1:
c_prime[i] = upper[i] / denom
d_prime[i] = (u_rhs[i] - lower[i - 1] * d_prime[i - 1]) / denom
x = np.zeros(n, dtype=float)
x[-1] = d_prime[-1]
for i in range(n - 2, -1, -1):
x[i] = d_prime[i] - c_prime[i] * x[i + 1]
return x
Column-sum conservation error = 0.00e+00 | Thomas against dense error = 4.44e-16 | integral drift = 0.00e+00
Exercises¶
Worked solutions are in 08_solutions.ipynb. The cell below the list is a short self-check to start from.
Verify a result. Show that the flow curve of the Johnson–Segalman model is non-monotonic below for every slip parameter between 0 and 2, and that at the inflection is at the shear rate . Check both results with
steady_johnson_segalman_curvefor .Find how it fails. Run
solve_1d_diffusive_johnson_segalmanat , and without stress diffusion () and with , for amplitudes of the initial perturbation (init_perturbation) between 0.01 and 0.18. Compare the spread of the steady total stress in the two cases.Implement it yourself. Write
measure_djs_interface_width(l_diff, ny=96)in NumPy: a solver of the diffusive Johnson–Segalman model in one dimension that returns the width of the interface between the bands, . Evaluate it for , and check that the width is proportional to and that the total stress does not depend on it.
heading("Self-check for the exercises")
assert beta_wlm < 0.01
assert abs(mean_rate - 3.0) < 1e-12 and stress_uniformity < 1e-14
assert plat_rel_std < 0.015 and corr_lever > 0.985
assert monomer_drift < 1e-9 and gdot_ratio_vcm > 2.5
assert solve_err < 1e-14 and mass_err < 1e-13
print("All checks passed.")
Self-check for the exercises
============================
All checks passed.