Homogenization: From CA to PDE
This chapter builds the rigorous bridge between the cellular automaton models of Module 3 and the PDE continuum of Module 2. Through Taylor expansion and two-scale homogenization, we show that a discrete CA neighbourhood average converges to the diffusion equation—and we quantify how heterogeneity in urban fabric affects the effective diffusion coefficient.
1. Taylor Expansion of the CA Update
Consider a CA on a square lattice with spacing \(\varepsilon\). The state at cell \(\mathbf{x}\) is updated by a weighted average over neighbours:
$$\rho^{n+1}(\mathbf{x}) = \frac{\sum_k w_k\,\rho^n(\mathbf{x} + \varepsilon\,\boldsymbol{\delta}_k)}{\sum_k w_k}$$
where \(\boldsymbol{\delta}_k\) are the neighbour offsets (including the cell itself with \(\boldsymbol{\delta}_0 = \mathbf{0}\)) and \(w_k\) are the weights. Now Taylor-expand each term:
$$\rho(\mathbf{x} + \varepsilon\boldsymbol{\delta}_k) = \rho + \varepsilon\,\boldsymbol{\delta}_k \cdot \nabla\rho + \frac{\varepsilon^2}{2}\,\boldsymbol{\delta}_k^T\,\nabla^2\!\rho\;\boldsymbol{\delta}_k + O(\varepsilon^3)$$
Summing over all neighbours with weights, the first-order terms vanish by symmetry (equal weights in opposite directions). The leading correction is second-order:
$$\rho^{n+1} = \rho^n + \frac{\varepsilon^2}{2}\,\frac{\sum_k w_k\,|\boldsymbol{\delta}_k|^2}{\sum_k w_k}\,\nabla^2\rho + O(\varepsilon^4)$$
Identifying the time step \(\Delta t = 1\) and defining the effective diffusion coefficient:
$$D = \frac{\varepsilon^2}{2}\,\frac{\sum_k w_k\,|\boldsymbol{\delta}_k|^2}{\sum_k w_k}$$
For a standard 5-point stencil (von Neumann neighbourhood with uniform weights \(w_k = 1\) for the 4 neighbours and \(w_0 = 0\) for the centre), each neighbour has \(|\boldsymbol{\delta}_k|^2 = 1\), so:
$$D = \frac{\varepsilon^2}{2}\cdot\frac{4 \times 1}{4} = \frac{\varepsilon^2}{2}$$
For the “spread” CA where \(w_0 = 1\) (include self) with 4 neighbours: \(D = \varepsilon^2 \cdot 4/(2 \cdot 5) = 2\varepsilon^2/5\). More generally, \(D = \varepsilon^2 \cdot \text{spread} / 4\) for the standard neighbourhood with equal weights, recovering the diffusion equation \(\partial_t \rho = D\nabla^2\rho\).
2. Two-Scale Expansion and the Cell Problem
When the diffusion coefficient varies periodically at the fine scale—representing heterogeneous urban fabric (residential vs. commercial vs. industrial zones)—we introduce two spatial variables:
- Slow variable: \(\mathbf{x}\) (city scale)
- Fast variable: \(\mathbf{y} = \mathbf{x}/\varepsilon\) (neighbourhood/block scale)
The diffusion equation with periodic coefficients is:
$$\frac{\partial \rho}{\partial t} = \nabla \cdot \bigl[D(\mathbf{x}/\varepsilon)\,\nabla\rho\bigr]$$
Expanding \(\rho = \rho_0(\mathbf{x},t) + \varepsilon\,\rho_1(\mathbf{x},\mathbf{y},t) + \varepsilon^2\,\rho_2 + \cdots\) and collecting powers of \(\varepsilon\), the leading-order problem yields the cell problem:
$$\nabla_{\mathbf{y}} \cdot \bigl[D(\mathbf{y})\,(\nabla_{\mathbf{y}}\chi_j + \mathbf{e}_j)\bigr] = 0$$
where \(\chi_j(\mathbf{y})\) is the corrector(periodic in \(\mathbf{y}\)). The effective (homogenised) diffusion tensor is:
$$D_{ij}^* = \frac{1}{|Y|}\int_Y D(\mathbf{y})\,\bigl(\delta_{ij} + \partial_{y_i}\chi_j\bigr)\,d\mathbf{y}$$
A fundamental bound from homogenization theory:
$$D^* \leq \langle D \rangle = \frac{1}{|Y|}\int_Y D(\mathbf{y})\,d\mathbf{y}$$
Heterogeneity always retards effective diffusion (and hence urban sprawl). The effective diffusivity is bounded above by the arithmetic mean and below by the harmonic mean. For a city with alternating high- and low-permeability zones, sprawl is slower than a naive average would predict.
3. Convergence: CA Resolution Study
We verify that the CA converges to the PDE as \(\varepsilon \to 0\) by running simulations at 4 resolutions and measuring the error against the analytic diffusion solution. The convergence rate should be \(O(\varepsilon^2)\).
CA-to-PDE Convergence and Homogenization
PythonClick Run to execute the Python code
Code will be executed with Python 3 on the server
4. Fortran: Gauss-Seidel for the Cell Problem
In 2D, the cell problem \(\nabla_y \cdot [D(y)(\nabla_y \chi + \mathbf{e}_j)] = 0\) must be solved numerically. Gauss-Seidel iteration is the standard approach for this elliptic PDE.
program cell_problem
! Solve 2D cell problem for homogenization
! nabla_y . [D(y) (nabla_y chi + e_1)] = 0
! on unit cell Y = [0,1]^2 with periodic BC
implicit none
integer, parameter :: N = 64
real(8) :: chi(N,N), D_coeff(N,N), rhs(N,N)
real(8) :: dy, residual, tol, Dstar
integer :: i, j, ip, im, jp, jm, iter, max_iter
dy = 1.d0 / N
tol = 1.d-8
max_iter = 50000
! Heterogeneous D(y): checkerboard pattern
do i = 1, N
do j = 1, N
if (mod((i-1)/(N/4) + (j-1)/(N/4), 2) == 0) then
D_coeff(i,j) = 2.0d0 ! high-permeability zone
else
D_coeff(i,j) = 0.5d0 ! low-permeability zone
end if
end do
end do
! RHS = -d/dy_1 [D(y)] (for e_1 direction)
do i = 1, N
do j = 1, N
ip = mod(i, N) + 1; im = mod(i-2+N, N) + 1
rhs(i,j) = -(D_coeff(ip,j) - D_coeff(im,j)) / (2.d0*dy)
end do
end do
! Gauss-Seidel iteration
chi = 0.d0
do iter = 1, max_iter
residual = 0.d0
do i = 1, N
do j = 1, N
ip = mod(i, N) + 1; im = mod(i-2+N, N) + 1
jp = mod(j, N) + 1; jm = mod(j-2+N, N) + 1
! D averaged at half-points
real(8) :: De, Dw, Dn, Ds, chi_new
De = 0.5d0*(D_coeff(i,j) + D_coeff(ip,j))
Dw = 0.5d0*(D_coeff(i,j) + D_coeff(im,j))
Dn = 0.5d0*(D_coeff(i,j) + D_coeff(i,jp))
Ds = 0.5d0*(D_coeff(i,j) + D_coeff(i,jm))
chi_new = (De*chi(ip,j) + Dw*chi(im,j) + &
Dn*chi(i,jp) + Ds*chi(i,jm) + &
dy*dy*rhs(i,j)) / (De + Dw + Dn + Ds)
residual = residual + (chi_new - chi(i,j))**2
chi(i,j) = chi_new
end do
end do
residual = sqrt(residual / (N*N))
if (residual < tol) exit
end do
! Compute D* = <D(1 + d chi/dy_1)>
Dstar = 0.d0
do i = 1, N
do j = 1, N
ip = mod(i, N) + 1; im = mod(i-2+N, N) + 1
Dstar = Dstar + D_coeff(i,j) * &
(1.d0 + (chi(ip,j) - chi(im,j))/(2.d0*dy))
end do
end do
Dstar = Dstar / (N*N)
write(*,'(A,I6,A,E12.4)') 'Converged in ', iter, &
' iterations, residual = ', residual
write(*,'(A,F10.6)') 'Effective D* = ', Dstar
write(*,'(A,F10.6)') 'Arithmetic <D> = ', sum(D_coeff)/(N*N)
end program cell_problemThe Bridge
This chapter completes the loop: Module 3's cellular automaton is shown to be a discrete approximation of Module 2's diffusion PDE, with an effective diffusion coefficient that depends on the urban microstructure. Homogenization theory provides the exact relationship, and the convergence rate \(O(\varepsilon^2)\) confirms the accuracy of the continuum approximation even at coarse resolutions.