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 · 13. Spinodal decomposition and coarsening in two dimensions

School of Engineering, Nazarbayev University

Worked solutions to the three exercises of Lecture 13. 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. On a 48×4848\times 48 box (Lx=Ly=48.0L_x = L_y = 48.0), evaluate characteristic_domain_size_2d on c(x,y)=0.5+0.1cos⁡(2πmx/Lx)cos⁡(2πmy/Ly)c(x,y) = 0.5 + 0.1\cos(2\pi m x/L_x)\cos(2\pi m y/L_y) for m∈{2,3,6}m \in \{2, 3, 6\} to verify Ld=Lx/(2 m)L_d = L_x / (\sqrt{2}\,m) to 10-13, and verify ginzburg_landau_free_energy_2d on a uniform field c≡0.30c \equiv 0.30 equals LxLyWc02(1−c0)2L_x L_y W c_0^2(1 - c_0)^2.


Exercise 1: Analytical Verification of 2-D Structure-Factor Length Scale & Uniform Free Energy
==============================================================================================
Mode m=2 | computed L_d = 16.9705627485 | exact L/(sqrt(2)*m) = 16.9705627485
Mode m=3 | computed L_d = 11.3137084990 | exact L/(sqrt(2)*m) = 11.3137084990
Mode m=6 | computed L_d = 5.6568542495 | exact L/(sqrt(2)*m) = 5.6568542495
Uniform c=0.30: F_2d = 254.01600000 vs exact Lx*Ly*f(c0) = 254.01600000

Explanation. By trigonometric product-to-sum identities, cos⁡(kmx)cos⁡(kmy)\cos(k_m x)\cos(k_m y) concentrates 100% of its non-zero Fourier power at the four symmetric wavevectors (±km,±km)(\pm k_m, \pm k_m), each of magnitude ∣k∣=2 km=2π2 m/Lx|\mathbf{k}| = \sqrt{2}\,k_m = 2\pi\sqrt{2}\,m / L_x. Hence ⟨k⟩=2π2 m/Lx\langle k \rangle = 2\pi\sqrt{2}\,m / L_x and Ld=2π/⟨k⟩=Lx/(2 m)L_d = 2\pi / \langle k \rangle = L_x / (\sqrt{2}\,m) identically.


Exercise 2

Problem. Verify that cahn_hilliard_2d_spectral raises ValueError on a 1-D input array, and demonstrate on a 32×3232\times 32 field (W=8.0,κ=0.05,M=1.0W = 8.0, \kappa = 0.05, M = 1.0) that an overly aggressive step Δt=1.0\Delta t = 1.0 violates Lyapunov monotonicity (ΔF>0\Delta\mathcal{F} > 0), whereas Δt=0.005\Delta t = 0.005 maintains ΔF≤0\Delta\mathcal{F} \leq 0 everywhere.


Exercise 2: 2-D Shape Guard & Nonlinear Semi-Implicit Time-Step Overshoot Audit
===============================================================================
Oversize dt = 1.000: single-step delta F = +3.9291e+01 (Lyapunov VIOLATED)
Resolved dt = 0.005: max 10-step delta F = -6.9567e-02 (Strictly dissipative)

Explanation. Although implicit treatment of +Mκk4+M\kappa k^4 removes the Δx4\Delta x^4 high-kk stiffness, the chemical driving force −Mk2f′(cn)^-M k^2 \widehat{f'(c^n)} is still evaluated explicitly. When Δt≫κ/(MW2)\Delta t \gg \kappa / (M W^2), composition overshoots the [0,1][0, 1] wells into the steep quartic walls (c<0c < 0 or c>1c > 1), injecting spurious free energy (ΔF>0\Delta\mathcal{F} > 0). Always monitor np.diff(res['free_energies']) <= 0 as a physics-based step-size diagnostic.


Exercise 3

Problem. Implement circularly_averaged_structure_factor(field, Lx, Ly, n_bins=14) to compute radially averaged SAXS intensity (kcenters,Srad)(k_{\mathrm{centers}}, S_{\mathrm{rad}}), and verify on a 48×4848\times 48 spinodal simulation (t=10t = 10 vs t=90t = 90) that the scattering ring peak shifts to smaller kk as domains coarsen.


Exercise 3: Implement It Yourself — Radially Averaged SAXS Structure Factor Peak Shift
======================================================================================
SAXS Guinier/spinodal ring peak: k_peak(t=10) = 0.841 -> k_peak(t=90) = 0.393 [1/grid]
Peak scattering intensity      : S_max(t=10)  = 5653.3 -> S_max(t=90)  = 15123.7

Summary. Just as observed in synchrotron time-resolved SAXS experiments on decomposing alloys, the spinodal scattering ring sharpens, intensifies, and migrates radially inward toward k→0k \to 0 (kpeak↓  ⟺  Ld=2π/kpeak↑k_{\mathrm{peak}} \downarrow \iff L_d = 2\pi/k_{\mathrm{peak}} \uparrow) as nanoscale domains coarsen.