A sample of a viscoelastic material with a stress left in it by an earlier deformation rests on a turntable. It rotates as a rigid body and does not deform, so the stress measured in axes fixed to the sample can only relax. A constitutive equation written with the partial time derivative of the stress predicts something else: a shear stress that oscillates with the rotation. Such an equation is not frame indifferent.
This lecture introduces time derivatives that are frame indifferent: the upper-convected, lower-convected and corotational derivatives, and the Gordon–Schowalter family that contains all three. It then treats finite strain (the deformation gradient and the Finger tensor) and shows that the Lodge integral over the history of strain and the upper-convected Maxwell equation are the same model.
Learning objectives¶
Test whether a time derivative of a tensor is frame indifferent under a superimposed rotation , with
tensors_kinematics.audit_frame_indifference.Write the upper-convected (), corotational () and lower-convected () derivatives as members of the Gordon–Schowalter family, and check in steady shear.
Compute the deformation gradient , the Finger tensor , the right Cauchy–Green tensor and their invariants in simple shear and in uniaxial extension.
Show that the Lodge integral and the upper-convected Maxwell equation give the same stress.
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. Frame indifference and superimposed rigid rotations¶
A constitutive equation relates the stress to the history of deformation, and the relation must not depend on the motion of the observer. Consider a change of frame that rotates and translates in time,
where is the skew-symmetric spin tensor of the rotating observer, . A symmetric second-order tensor is called objective, or frame indifferent, if it transforms as . The stress is objective. Its partial time derivative is not: differentiating in time, and transforming the velocity gradient , gives
The terms with depend on the observer. They can be removed by combining the time derivative with the velocity gradient. The velocity gradient is split as into the rate-of-deformation tensor , which is objective (), and the vorticity tensor , which contains the spin of the frame (). Gordon and Schowalter (1972) introduced the effective velocity gradient , in which the slip parameter lies between 0 and 2, and the derivative
Two dimensionless groups appear throughout the book. The Weissenberg number is the ratio of the relaxation time of the polymer to the time scale of the flow. The Deborah number is the ratio of to the time of observation or of the process. The demonstration below tests the convected derivatives and the partial time derivative for increasing rates of rotation of the observer.
heading("Demonstration 1: frame indifference of time derivatives in a rotating frame")
A_sample = np.array([[2.4, 0.7, -0.2], [0.7, 1.1, 0.3], [-0.2, 0.3, 0.9]])
L_sample = np.array([[0.2, 1.8, -0.4], [-0.3, -0.1, 0.5], [0.1, -0.2, -0.1]])
dA_sample = np.array([[0.3, -0.2, 0.1], [-0.2, 0.4, -0.1], [0.1, -0.1, -0.2]])
operators = {
"Upper-convected (xi=0)": lambda A, L, dA: tensors_kinematics.convected_derivatives(A, L, dA, xi_slip=0.0)["upper_convected"],
"Gordon-Schowalter (xi=0.35)": lambda A, L, dA: tensors_kinematics.convected_derivatives(A, L, dA, xi_slip=0.35)["gordon_schowalter"],
"Corotational (xi=1)": lambda A, L, dA: tensors_kinematics.convected_derivatives(A, L, dA, xi_slip=1.0)["corotational"],
"Lower-convected (xi=2)": lambda A, L, dA: tensors_kinematics.convected_derivatives(A, L, dA, xi_slip=2.0)["lower_convected"],
"Partial dA/dt": lambda A, L, dA: dA,
}
omega_vals = np.linspace(0.25, 5.0, 20)
err_curves = {name: [] for name in operators}
for name, fn in operators.items():
for om in omega_vals:
res = tensors_kinematics.audit_frame_indifference(fn, A_sample, L_sample, dA_sample, theta_rad=0.72, omega_spin=float(om))
err_curves[name].append(max(res["discrepancy_frobenius"], 1e-16))
for name in operators:
res_ref = tensors_kinematics.audit_frame_indifference(operators[name], A_sample, L_sample, dA_sample, theta_rad=0.65, omega_spin=2.3)
print(f"{name:30s} | passed={str(res_ref['objective_passed']):5s} | ||D* - Q D Q^T||_F = {res_ref['discrepancy_frobenius']:.3e}")
assert max(err_curves["Upper-convected (xi=0)"]) < 1e-12
assert max(err_curves["Gordon-Schowalter (xi=0.35)"]) < 1e-12
assert max(err_curves["Corotational (xi=1)"]) < 1e-12
assert max(err_curves["Lower-convected (xi=2)"]) < 1e-12
assert err_curves["Partial dA/dt"][-1] > 5.0
fig, axes = plt.subplots(1, 2, figsize=(10.5, 3.8))
for name, vals in err_curves.items():
ls = "--" if "Partial" in name else "-"
lw = 2.2 if "Partial" in name else 1.8
axes[0].semilogy(omega_vals, vals, linestyle=ls, linewidth=lw, label=name)
axes[0].set_xlabel(r"Rate of rotation of the frame $\omega_{\mathrm{spin}}$ [rad/s]")
axes[0].set_ylabel(r"Departure from frame indifference $\|\mathcal{D}_t^* - \mathbf{Q}\mathcal{D}_t\mathbf{Q}^\top\|_F$")
axes[0].set_title(r"Objectivity error against observer spin")
axes[0].legend(fontsize=8)
cd_xi0 = tensors_kinematics.convected_derivatives(A_sample, L_sample, dA_sample, xi_slip=0.0)
cd_xi1 = tensors_kinematics.convected_derivatives(A_sample, L_sample, dA_sample, xi_slip=1.0)
cd_xi2 = tensors_kinematics.convected_derivatives(A_sample, L_sample, dA_sample, xi_slip=2.0)
interp_errs = [
np.linalg.norm(cd_xi0["gordon_schowalter"] - cd_xi0["upper_convected"]),
np.linalg.norm(cd_xi1["gordon_schowalter"] - cd_xi1["corotational"]),
np.linalg.norm(cd_xi2["gordon_schowalter"] - cd_xi2["lower_convected"]),
]
assert max(interp_errs) < 1e-14
xi_grid = np.linspace(0.0, 2.0, 41)
gs_fro = [
np.linalg.norm(tensors_kinematics.convected_derivatives(A_sample, L_sample, dA_sample, xi_slip=float(x))["gordon_schowalter"], ord="fro")
for x in xi_grid
]
axes[1].plot(xi_grid, gs_fro, color="#2166AC", lw=2.0, label=r"$\|\mathcal{D}_{\xi}\mathbf{A}\|_F$")
axes[1].scatter([0.0, 1.0, 2.0], [gs_fro[0], gs_fro[20], gs_fro[-1]], color="#C0392B", zorder=5, label=r"$\xi = 0$, 1 and 2")
axes[1].set_xlabel(r"Gordon–Schowalter slip parameter $\xi$")
axes[1].set_ylabel(r"Norm of the derivative $\|\mathcal{D}_{\xi}\mathbf{A}\|_F$ [1/s]")
axes[1].set_title(r"Norm of the Gordon–Schowalter derivative against $\xi$")
axes[1].legend(fontsize=8.5)
label_panels(fig)
plt.show()
Demonstration 1: frame indifference of time derivatives in a rotating frame
===========================================================================
Upper-convected (xi=0) | passed=True | ||D* - Q D Q^T||_F = 8.368e-16
Gordon-Schowalter (xi=0.35) | passed=True | ||D* - Q D Q^T||_F = 5.692e-16
Corotational (xi=1) | passed=True | ||D* - Q D Q^T||_F = 7.705e-16
Lower-convected (xi=2) | passed=True | ||D* - Q D Q^T||_F = 1.201e-15
Partial dA/dt | passed=False | ||D* - Q D Q^T||_F = 6.324e+00

Figure 0.1. (a) Frobenius norm of the difference between a rate operator evaluated in a spinning frame and the rotated operator of the fixed frame. The four convected derivatives agree to rounding error; the partial time derivative does not. (b) Norm of the Gordon–Schowalter derivative of one test tensor as goes from 0 (upper convected) through 1 (corotational) to 2 (lower convected).
2. The slip parameter and the normal stress ratio ¶
The derivative is frame indifferent for every between 0 and 2, to rounding error () in the demonstration. Frame indifference therefore does not select the derivative; the physics of the material does.
| Derivative | Picture | in steady shear | |
|---|---|---|---|
| Upper-convected | 0 | the polymer strands deform with the fluid | 0 |
| Gordon–Schowalter | 0.1 to 0.4 | the strands slip partially relative to the fluid | -0.05 to -0.20 |
| Corotational | 1 | the strands rotate with the fluid and are not stretched by it | |
| Lower-convected | 2 | -1 |
Consider steady simple shear, , of the Johnson–Segalman model with one mode, . In steady flow the equation is algebraic, and its solution gives the viscometric functions in terms of :
Measured second normal stress differences of polymer melts and solutions are negative and small compared with . This corresponds to small values of , close to the upper-convected derivative, and excludes the lower-convected derivative, for which .
heading("Demonstration 2: viscometric functions in steady shear and N2/N1 = -xi/2")
def solve_steady_js_from_operator(wi: float, xi: float, eta_p: float = 1.0, lam: float = 1.0) -> tuple[float, float, float]:
"""Assemble the linear 3x3 steady system [tau_xx, tau_yy, tau_xy] directly from convected_derivatives."""
gdot = wi / lam
L = np.array([[0.0, gdot, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])
basis = [
np.array([[1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]),
np.array([[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]),
np.array([[0.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0]]),
]
M = np.zeros((3, 3), dtype=float)
for col, B_k in enumerate(basis):
op = B_k + lam * tensors_kinematics.convected_derivatives(B_k, L, xi_slip=xi)["gordon_schowalter"]
M[:, col] = [op[0, 0], op[1, 1], op[0, 1]]
rhs = np.array([0.0, 0.0, eta_p * gdot], dtype=float)
txx, tyy, txy = np.linalg.solve(M, rhs)
return float(txy), float(txx - tyy), float(tyy)
xi_sweep = np.linspace(0.0, 2.0, 25)
ratios_w1 = []
ratios_w3 = []
for xi_val in xi_sweep:
_, n1_1, n2_1 = solve_steady_js_from_operator(wi=1.0, xi=float(xi_val))
_, n1_3, n2_3 = solve_steady_js_from_operator(wi=3.0, xi=float(xi_val))
ratios_w1.append(n2_1 / n1_1)
ratios_w3.append(n2_3 / n1_3)
assert np.allclose(ratios_w1, -0.5 * xi_sweep, atol=1e-13)
assert np.allclose(ratios_w3, -0.5 * xi_sweep, atol=1e-13)
print(f"Max |N2/N1 - (-xi/2)| at Wi=1.0: {np.max(np.abs(np.array(ratios_w1) + 0.5 * xi_sweep)):.2e}")
print(f"Max |N2/N1 - (-xi/2)| at Wi=3.0: {np.max(np.abs(np.array(ratios_w3) + 0.5 * xi_sweep)):.2e}")
wi_grid = np.linspace(0.05, 5.0, 100)
fig, axes = plt.subplots(1, 2, figsize=(10.5, 3.8))
axes[0].plot(xi_sweep, -0.5 * xi_sweep, "k-", lw=2.0, label=r"Exact $-\xi / 2$")
axes[0].plot(xi_sweep, ratios_w1, "o", ms=5, color="#2166AC", label=r"Computed ($\mathrm{Wi}=1$)")
axes[0].plot(xi_sweep[::2], ratios_w3[::2], "s", ms=5, color="#E08214", label=r"Computed ($\mathrm{Wi}=3$)")
axes[0].set_xlabel(r"Slip parameter $\xi$")
axes[0].set_ylabel(r"Normal stress ratio $N_2 / N_1$")
axes[0].set_title(r"Normal-stress ratio $N_2 / N_1 = -\xi / 2$")
axes[0].legend(fontsize=8)
for xi_case, col in [(0.0, "#2166AC"), (0.2, "#2E8B57"), (1.0, "#C0392B")]:
txy_vals = [solve_steady_js_from_operator(float(w), xi_case)[0] for w in wi_grid]
axes[1].plot(wi_grid, txy_vals, lw=2.0, color=col, label=rf"$\xi = {xi_case:.1f}$")
axes[1].set_xlabel(r"Weissenberg number $\mathrm{Wi} = \lambda\dot{\gamma}$")
axes[1].set_ylabel(r"Dimensionless polymeric shear stress $\tau_{xy}\lambda / \eta_p$")
axes[1].set_title(r"Shear stress of the Johnson–Segalman model")
axes[1].legend(fontsize=8.5)
label_panels(fig)
plt.show()
Demonstration 2: viscometric functions in steady shear and N2/N1 = -xi/2
========================================================================
Max |N2/N1 - (-xi/2)| at Wi=1.0: 1.11e-16
Max |N2/N1 - (-xi/2)| at Wi=3.0: 1.11e-16

Figure 0.2. Steady shear of the Johnson–Segalman model. (a) The ratio computed with the convected-derivative operator at two Weissenberg numbers, against . (b) Dimensionless polymer shear stress against : for it passes through a maximum.
3. Finite strain: the deformation gradient, the Finger tensor and the Cauchy–Green tensor¶
A differential constitutive equation uses the instantaneous rate of deformation. An integral constitutive equation uses the finite deformation between a reference position and the current position , described by the deformation gradient . The deformation gradient is not objective (), so a stress is built from the Finger tensor or its inverse:
In incompressible flow () the invariants of behave differently in simple shear with strain and in uniaxial extension with Hencky strain :
Simple shear, . The two invariants are equal, , and grow as the square of the strain. The principal axis of stretch rotates from towards the flow direction, at the angle .
Uniaxial extension, . The first invariant, , grows exponentially and faster than the second, . A material line along the axis of extension stays aligned with it.
heading("Demonstration 3: strain invariants in shear and in extension")
gam_grid = np.linspace(0.0, 3.5, 71)
eps_grid = np.linspace(0.0, 1.6, 71)
i1_sh, i2_sh, theta_deg_sh = [], [], []
for g in gam_grid:
F_sh = np.array([[1.0, float(g), 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
fcg = tensors_kinematics.finger_cauchy_green_tensors(F_sh)
assert fcg["incompressible"]
i1_sh.append(fcg["I1"])
i2_sh.append(fcg["I2"])
evals, evecs = np.linalg.eigh(fcg["B_finger"][:2, :2])
v_max = evecs[:, int(np.argmax(evals))]
if v_max[0] < 0:
v_max = -v_max
theta_deg_sh.append(math.degrees(math.atan2(abs(v_max[1]), abs(v_max[0]))))
i1_uni, i2_uni = [], []
for ep in eps_grid:
F_uni = np.diag([math.exp(ep), math.exp(-0.5 * ep), math.exp(-0.5 * ep)])
fcg_u = tensors_kinematics.finger_cauchy_green_tensors(F_uni)
assert fcg_u["incompressible"]
i1_uni.append(fcg_u["I1"])
i2_uni.append(fcg_u["I2"])
assert np.allclose(i1_sh, 3.0 + gam_grid**2, atol=1e-12)
assert np.allclose(i1_sh, i2_sh, atol=1e-12)
assert i1_uni[-1] > 1.8 * i2_uni[-1]
print(f"Simple shear gamma=2.0 -> I1={3.0 + 4.0:.3f}, principal angle={theta_deg_sh[40]:.2f} deg")
print(f"Uniaxial Hencky eps=1.6 -> I1={i1_uni[-1]:.3f}, I2={i2_uni[-1]:.3f} (I1/I2 = {i1_uni[-1]/i2_uni[-1]:.2f})")
fig, axes = plt.subplots(1, 2, figsize=(10.5, 3.8))
axes[0].plot(gam_grid, i1_sh, color="#2166AC", lw=2.2, label=r"Simple shear $I_1 = I_2 = 3 + \gamma^2$")
axes[0].plot(eps_grid * 2.0, i1_uni, color="#C0392B", lw=2.2, label=r"Uniaxial $I_1(2\varepsilon)$")
axes[0].plot(eps_grid * 2.0, i2_uni, "--", color="#E08214", lw=2.0, label=r"Uniaxial $I_2(2\varepsilon)$")
axes[0].set_xlabel(r"Strain measure ($\gamma$ or $2\varepsilon$)")
axes[0].set_ylabel(r"Principal invariants $I_1, I_2$")
axes[0].set_title(r"Invariants of the Finger tensor")
axes[0].legend(fontsize=8)
exact_theta = np.where(gam_grid < 1e-12, 45.0, np.degrees(0.5 * np.arctan(2.0 / np.maximum(gam_grid, 1e-12))))
axes[1].plot(gam_grid[1:], exact_theta[1:], "k-", lw=2.0, label=r"Exact $\frac{1}{2}\arctan(2/\gamma)$")
axes[1].plot(gam_grid[1::4], theta_deg_sh[1::4], "o", color="#2E8B57", ms=5, label="Principal axis of the Finger tensor")
axes[1].axhline(0.0, color="gray", ls=":", lw=1.0)
axes[1].set_xlabel(r"Shear strain $\gamma$")
axes[1].set_ylabel("Angle of the principal stretch to the flow [degrees]")
axes[1].set_title(r"Principal stretch direction in simple shear")
axes[1].legend(fontsize=8.5)
label_panels(fig)
plt.show()
Demonstration 3: strain invariants in shear and in extension
============================================================
Simple shear gamma=2.0 -> I1=7.000, principal angle=22.50 deg
Uniaxial Hencky eps=1.6 -> I1=24.936, I2=9.947 (I1/I2 = 2.51)

Figure 0.3. (a) First and second invariants of the Finger tensor in simple shear, where , and in uniaxial elongation, where grows as . (b) Angle between the principal stretch direction and the flow direction in simple shear, from the eigenvectors of and from .
4. The Lodge integral and the upper-convected Maxwell equation¶
Finite strain and the upper-convected derivative are connected. The relative Finger tensor measures the deformation between a past time and the current time , and at fixed its upper-convected derivative vanishes, . For this reason the Lodge integral
is the solution of the upper-convected Maxwell equation with . One point needs care when the flow starts from rest at . Material that was at rest for all has experienced the whole deformation since the start. The integral over therefore contributes the term , which is added to the integral over . The demonstration compares the two forms for the parameter set BOGER_PIB of constants_benchmarks.BENCHMARK_FLUIDS_DB (assumed values).
heading("Demonstration 4: the Lodge integral against the upper-convected Maxwell equation")
boger = constants_benchmarks.BENCHMARK_FLUIDS_DB["BOGER_PIB"]
eta_p = boger["eta_p_Pas"]
lam = boger["lam_s"]
G0 = eta_p / lam
gdot = 4.0 # Wi = lam * gdot = 1.8
t_eval = np.linspace(0.0, 2.0, 201)
L_sh = np.array([[0.0, gdot, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])
ucm_diff = tensors_kinematics.integrate_homogeneous_constitutive(
lambda _t: L_sh, t_eval, lam=lam, eta_p=eta_p, eta_s=0.0, model="oldroyd_b", formulation="log_psi"
)
tau_xy_lodge = np.zeros_like(t_eval)
n1_lodge = np.zeros_like(t_eval)
n1_missing_tail = np.zeros_like(t_eval)
for idx, tv in enumerate(t_eval):
if tv == 0.0:
continue
s_quad = np.linspace(0.0, tv, 241) # elapsed age s = t - t' in [0, t]
B_12 = gdot * s_quad
B_11_m1 = (gdot * s_quad) ** 2
weights = (G0 / lam) * np.exp(-s_quad / lam)
int_xy = float(trapezoid(weights * B_12, s_quad))
int_n1 = float(trapezoid(weights * B_11_m1, s_quad))
F_0t = np.array([[1.0, gdot * tv, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
B_0t = tensors_kinematics.finger_cauchy_green_tensors(F_0t)["B_finger"]
tail_factor = G0 * math.exp(-tv / lam)
tau_xy_lodge[idx] = int_xy + tail_factor * B_0t[0, 1]
n1_lodge[idx] = int_n1 + tail_factor * (B_0t[0, 0] - B_0t[1, 1])
n1_missing_tail[idx] = int_n1
txy_ucm = ucm_diff["tau_p_hist"][:, 0, 1]
n1_ucm = ucm_diff["tau_p_hist"][:, 0, 0] - ucm_diff["tau_p_hist"][:, 1, 1]
err_txy = float(np.max(np.abs(tau_xy_lodge - txy_ucm)))
err_n1 = float(np.max(np.abs(n1_lodge - n1_ucm)))
print(f"BOGER_PIB (lam={lam} s, eta_p={eta_p} Pa*s, Wi={lam*gdot:.2f}):")
print(f" Max |tau_xy(Lodge) - tau_xy(UCM)| = {err_txy:.3e} Pa")
print(f" Max |N1(Lodge) - N1(UCM)| = {err_n1:.3e} Pa")
assert err_txy < 5e-3 and err_n1 < 2e-2
assert np.max(np.abs(n1_missing_tail - n1_ucm)) > 1.5 # Omitting (-inf, 0) history tail causes large error
fig, axes = plt.subplots(1, 2, figsize=(10.5, 3.8))
axes[0].plot(t_eval, txy_ucm, "k-", lw=2.2, label="Upper-convected Maxwell equation")
axes[0].plot(t_eval[::10], tau_xy_lodge[::10], "o", color="#2166AC", ms=5, label="Lodge integral")
axes[0].set_xlabel("Time $t$ [s]")
axes[0].set_ylabel(r"Shear stress $\tau_{xy}(t)$ [Pa]")
axes[0].set_title(r"Shear stress in start-up ($\mathrm{Wi} = 1.8$)")
axes[0].legend(fontsize=8.5)
axes[1].plot(t_eval, n1_ucm, "k-", lw=2.2, label="Upper-convected Maxwell $N_1(t)$")
axes[1].plot(t_eval[::10], n1_lodge[::10], "s", color="#2E8B57", ms=5, label="Complete Lodge integral")
axes[1].plot(t_eval, n1_missing_tail, "--", color="#C0392B", lw=1.8, label=r"Truncated integral ($t' \in [0, t]$ only)")
axes[1].set_xlabel("Time $t$ [s]")
axes[1].set_ylabel(r"First normal stress difference $N_1(t)$ [Pa]")
axes[1].set_title(r"First normal stress difference")
axes[1].legend(fontsize=8)
label_panels(fig)
plt.show()
Demonstration 4: the Lodge integral against the upper-convected Maxwell equation
================================================================================
BOGER_PIB (lam=0.45 s, eta_p=1.8 Pa*s, Wi=1.80):
Max |tau_xy(Lodge) - tau_xy(UCM)| = 9.904e-04 Pa
Max |N1(Lodge) - N1(UCM)| = 2.610e-03 Pa

Figure 0.4. Start-up of shear for the polymer contribution of the fluid BOGER_PIB (assumed parameters). (a) Shear stress from the upper-convected Maxwell equation and from the Lodge integral. (b) First normal stress difference; the integral restricted to (dashed) omits the fluid elements that were at rest before the flow started and is too low.
Inside the algorithm¶
The cell below prints the source of tensors_kinematics.convected_derivatives and tensors_kinematics.audit_frame_indifference. The function audit_frame_indifference constructs a rotation and a spin , transforms , and to the rotating frame, and returns the norm , which is zero for a frame-indifferent derivative .
Check against the package¶
The demonstrations used rotations in the plane. The check below repeats the test for a rotation about an arbitrary axis, , built with Rodrigues’ formula, and an independent spin vector , both written in NumPy; the result agrees with the package to rounding error ().
heading("Inside the algorithm: the Gordon-Schowalter derivative by hand, and a rotation in three dimensions")
print(show_source(tensors_kinematics.convected_derivatives))
print(show_source(tensors_kinematics.audit_frame_indifference))
def skew3(v: np.ndarray) -> np.ndarray:
return np.array([[0.0, -v[2], v[1]], [v[2], 0.0, -v[0]], [-v[1], v[0], 0.0]], dtype=float)
axis = np.array([0.3, -0.7, 0.65], dtype=float)
axis /= np.linalg.norm(axis)
K = skew3(axis)
theta_3d = 1.15
Q_3d = np.eye(3) + math.sin(theta_3d) * K + (1.0 - math.cos(theta_3d)) * (K @ K)
Omega_3d = skew3(np.array([1.7, -2.4, 0.9]))
xi_test = 0.28
L_eff = L_sample - xi_test * 0.5 * (L_sample + L_sample.T)
gs_scratch = dA_sample - L_eff @ A_sample - A_sample @ L_eff.T
gs_pkg = tensors_kinematics.convected_derivatives(A_sample, L_sample, dA_sample, xi_slip=xi_test)["gordon_schowalter"]
A_st = Q_3d @ A_sample @ Q_3d.T
L_st = Q_3d @ L_sample @ Q_3d.T + Omega_3d
dA_st = Q_3d @ dA_sample @ Q_3d.T + Omega_3d @ A_st - A_st @ Omega_3d
gs_st = tensors_kinematics.convected_derivatives(A_st, L_st, dA_st, xi_slip=xi_test)["gordon_schowalter"]
err_3d_obj = float(np.linalg.norm(gs_st - Q_3d @ gs_pkg @ Q_3d.T, ord="fro"))
print(f"NumPy against package Gordon-Schowalter residual: {np.linalg.norm(gs_scratch - gs_pkg):.3e}")
print(f"Full 3-D Rodrigues SO(3) objectivity discrepancy : {err_3d_obj:.3e}")
assert np.allclose(gs_scratch, gs_pkg, atol=1e-14)
assert np.allclose(Q_3d @ Q_3d.T, np.eye(3), atol=1e-14)
assert err_3d_obj < 1e-13
Inside the algorithm: the Gordon-Schowalter derivative by hand, and a rotation in three dimensions
==================================================================================================
def convected_derivatives(
A: np.ndarray,
L_grad_u: np.ndarray,
dA_dt: np.ndarray | None = None,
xi_slip: float = 0.0,
) -> dict:
"""Corotational, upper-convected, lower-convected and Gordon-Schowalter derivatives of a tensor (L_ij = du_i/dx_j)."""
A_mat = np.asarray(A, dtype=float)
L_mat = np.asarray(L_grad_u, dtype=float)
if A_mat.ndim != 2 or A_mat.shape[0] != A_mat.shape[1] or L_mat.shape != A_mat.shape:
raise ValueError("Require square matching 2-D tensors A and L_grad_u.")
if not (0.0 <= xi_slip <= 2.0):
raise ValueError("Gordon-Schowalter slip parameter xi_slip must lie in [0, 2].")
rate_dt = np.zeros_like(A_mat) if dA_dt is None else np.asarray(dA_dt, dtype=float)
D = 0.5 * (L_mat + L_mat.T)
W = 0.5 * (L_mat - L_mat.T)
corot = rate_dt - (W @ A_mat - A_mat @ W)
upper = rate_dt - L_mat @ A_mat - A_mat @ L_mat.T
lower = rate_dt + L_mat.T @ A_mat + A_mat @ L_mat
L_eff = L_mat - float(xi_slip) * D
gs = rate_dt - L_eff @ A_mat - A_mat @ L_eff.T
return {
"D": D,
"W": W,
"corotational": corot,
"upper_convected": upper,
"lower_convected": lower,
"gordon_schowalter": gs,
}
def audit_frame_indifference(
rate_operator_fn: Callable[[np.ndarray, np.ndarray, np.ndarray], np.ndarray],
A: np.ndarray,
L_grad_u: np.ndarray,
dA_dt: np.ndarray,
theta_rad: float = 0.65,
omega_spin: float = 2.3,
) -> dict:
"""Test whether a time derivative D_t(A, L, dA_dt) transforms as Q D_t Q^T under the change of frame x* = Q(t)x."""
A_m = np.asarray(A, dtype=float)
L_m = np.asarray(L_grad_u, dtype=float)
dA_m = np.asarray(dA_dt, dtype=float)
d = A_m.shape[0]
c, s = math.cos(theta_rad), math.sin(theta_rad)
Q = np.eye(d, dtype=float)
Q[:2, :2] = np.array([[c, -s], [s, c]])
Omega_f = np.zeros((d, d), dtype=float)
Omega_f[:2, :2] = np.array([[0.0, -omega_spin], [omega_spin, 0.0]]) # dQ/dt = Omega_f @ Q
# Under x* = Q(t) x: A* = Q A Q^T, L* = Q L Q^T + Omega_f, dA*/dt = Q (dA/dt) Q^T + Omega_f A* - A* Omega_f
A_star = Q @ A_m @ Q.T
L_star = Q @ L_m @ Q.T + Omega_f
dA_star = Q @ dA_m @ Q.T + Omega_f @ A_star - A_star @ Omega_f
op_unrot = rate_operator_fn(A_m, L_m, dA_m)
op_star = rate_operator_fn(A_star, L_star, dA_star)
expected_star = Q @ op_unrot @ Q.T
err = float(np.linalg.norm(op_star - expected_star, ord="fro"))
return {
"objective_passed": err < 1e-10,
"discrepancy_frobenius": err,
"op_star": op_star,
"expected_star": expected_star,
}
NumPy against package Gordon-Schowalter residual: 0.000e+00
Full 3-D Rodrigues SO(3) objectivity discrepancy : 1.429e-15
Exercises¶
Worked solutions are in 00_solutions.ipynb. The cell below the list is a short self-check to start from.
Verify a result. Check numerically, for between 0 and 2 and between 0.1 and 6, that (1) the Gordon–Schowalter derivative is the weighted mean of the upper- and lower-convected derivatives, and (2) the steady shear solution of the Johnson–Segalman model satisfies and .
Find how it fails. A sample with the initial stress and the relaxation time rests without deformation () on a turntable that rotates at . Integrate in the laboratory frame (a) the equation with a partial time derivative, , and (b) the upper-convected Maxwell equation . For each, compute the shear stress in axes that rotate with the sample.
Implement it yourself. Write a NumPy solver of the Lodge integral for a shear rate that is piecewise constant: for and for , with and . Use the accumulated strain in the relative deformation gradient , and compare the stresses with
tensors_kinematics.integrate_homogeneous_constitutive.
heading("Self-check for the exercises")
atlas_00 = [entry for entry in constants_benchmarks.RHEO_ATLAS_DB if entry["lecture"] == "00"]
assert len(atlas_00) == 2
assert err_txy < 5e-3 and err_n1 < 2e-2
assert err_3d_obj < 1e-13
print("All checks passed.")
Self-check for the exercises
============================
All checks passed.