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.

Solutions · 3. Stochastic differential equations and FENE dumbbells

Worked solutions to the three exercises of Lecture 3. Each solution is computed here and checked with assert statements against an exact identity or an independent calculation. The first code cell sets up the notebook and runs Demonstration 1 of the lecture without showing its output, because some of the solutions use its variables.

Exercise 1

Problem. Check by numerical quadrature, for bb between 6 and 200, that the equilibrium distribution ψeq(Q)∝(1−Q2/b)b/2\psi_{\mathrm{eq}}(\mathbf{Q}) \propto (1 - Q^2/b)^{b/2} of a FENE dumbbell gives ⟨Q2⟩eq=3bb+5\langle Q^2\rangle_{\mathrm{eq}} = \frac{3b}{b + 5}, and compare with a Brownian dynamics simulation without flow (simulate_dumbbell_bd with L=0\mathbf{L} = \mathbf{0}).


Exercise 1: equilibrium distribution of the FENE dumbbell
=========================================================
Quadrature against 3b/(b+5) max error across b in [6, 200]: 2.243e-14
Zero-flow BD <Q^2>_eq (b=20): 2.4248 against exact 3b/(b+5) = 2.4000
<Figure size 1122x407 with 2 Axes>

Figure S3.1. (a) Radial probability density of the FENE connector at equilibrium for three values of bb, with the Hookean limit. (b) ⟨Q2⟩eq\langle Q^2\rangle_{\mathrm{eq}} by quadrature against 3b/(b+5)3b/(b+5).

Explanation. At equilibrium the probability flux is zero, so that ∇ln⁡ψeq=−F(Q)=−Q1−Q2/b\nabla\ln\psi_{\mathrm{eq}} = -\mathbf{F}(\mathbf{Q}) = -\frac{\mathbf{Q}}{1 - Q^2/b}, which integrates to ψeq(Q)∝(1−Q2/b)b/2\psi_{\mathrm{eq}}(\mathbf{Q}) \propto (1 - Q^2/b)^{b/2}. With u=Q2/bu = Q^2/b the radial integrals are Beta functions, B(5/2,b/2+1)/B(3/2,b/2+1)=3/2b/2+5/2B(5/2, b/2 + 1) / B(3/2, b/2 + 1) = \frac{3/2}{b/2 + 5/2}, and ⟨Q2⟩eq=3bb+5\langle Q^2\rangle_{\mathrm{eq}} = \frac{3b}{b + 5}, which is smaller than the value 3 of a Hookean dumbbell. The quadrature agrees with the formula to 2×10−142\times10^{-14}. The simulation with b=20b = 20 gives 2.425 against 2.400, a difference of 1 % from a finite ensemble and a finite time step.


Exercise 2

Problem. Run the explicit Euler–Maruyama scheme (explicit_unsafe=True) and the semi-implicit scheme (explicit_unsafe=False) for Wi∈{2,5,8,12}\mathrm{Wi} \in \{2, 5, 8, 12\} and Δt∈{0.02,0.05,0.10,0.15}\Delta t \in \{0.02, 0.05, 0.10, 0.15\} with b_ext = 25, n_trajectories = 500 and t_end = 1.8, and count the events in which a connector reaches or exceeds its maximum length, Q≥bQ \geq \sqrt{b}.


Exercise 2: overstretched connectors with the explicit Euler scheme
===================================================================
Total overstretched counts across 16 (Wi, dt) runs -> explicit Euler: 5835, semi-implicit: 0
At (Wi=8, dt=0.10): explicit violations = 541 against semi-implicit = 0
<Figure size 1122x407 with 3 Axes>

Figure S3.2. (a) Number of steps with Q≥bQ \ge \sqrt{b} for the explicit Euler scheme, as log⁡10(count+1)\log_{10}(\text{count} + 1), over the Weissenberg number and the time step; the semi-implicit scheme has none. (b) The factor Q/(1−Q2/b)Q/(1 - Q^2/b) for b=25b = 25 changes sign at Q=bQ = \sqrt{b}.

Explanation. A Gaussian random displacement is unbounded, so an explicit step of any size moves a strongly stretched dumbbell beyond Q=bQ = \sqrt{b} with a non-zero probability. Beyond that length 1−Q2/b1 - Q^2/b is negative and the spring force points outwards. The explicit scheme produces 5835 such events in the 16 runs, 541 of them at Wi=8\mathrm{Wi} = 8 and Δt=0.10\Delta t = 0.10. The semi-implicit scheme produces none: it evaluates the spring force at the new length, and the cubic equation for that length has exactly one root between 0 and b\sqrt{b}. No rejection or reflection of steps is needed.


Exercise 3

Problem. Write a vectorized semi-implicit Brownian dynamics solver for FENE dumbbells in NumPy (b=36b = 36, Wi=5.0\mathrm{Wi} = 5.0, 3000 trajectories, 0≤t≤3.00 \le t \le 3.0), and compare ⟨Q2⟩(t)\langle Q^2\rangle(t), τxy(t)\tau_{xy}(t) and N1(t)N_1(t) with brownian_chains.simulate_dumbbell_bd; the two should agree within 3 %.


Exercise 3: a vectorized semi-implicit solver for FENE dumbbells
================================================================
Steady <Q^2>: this solver=9.445 against engcomprheo=9.477 (rel diff=0.003)
Steady tau_xy: this solver=3.009 against engcomprheo=3.019 (rel diff=0.003)
<Figure size 1122x407 with 2 Axes>

Figure S3.3. A separate vectorized semi-implicit FENE code against the package, with different random numbers. (a) Shear stress. (b) First normal stress difference.

Explanation. All trajectories are advanced together with array operations, and the cubic equation is solved in closed form at a fixed cost for each step. The steady values of ⟨Q2⟩\langle Q^2\rangle (9.445 against 9.477) and of the shear stress (3.009 against 3.019) agree to 0.3 %. The fluctuations that remain on the curves are the statistical error of 3000 trajectories. At low Weissenberg number this error is larger than the stress itself, which is the reason for the control variate of Lecture 4.