Heat that spreads¶
Two hot spots in the plane, a quarter of the way through the time span: each has widened, and they begin to merge.
import sympy as sp
import pdemagic as pm
x, y, t = sp.symbols("x y t", real=True)
T = sp.Function("T")(x, y, t)
hot_spots = sp.exp(-((x - 1.5) ** 2) - y**2) + sp.exp(-((x + 1.5) ** 2) - y**2)
cooling = pm.Problem(
sp.Eq(T.diff(t), pm.laplacian(T) / 2),
domain=pm.FreeSpace(x, y),
time=(t, 0.0, 1.0),
initial={T: hot_spots},
)
pm.solve(cooling).plot(time=0.25)
What it shows¶
The heat equation, \(T_t = \tfrac12\nabla^2 T\), in the whole plane. The
problem names its time, the time span and the state at the start, and
there is no box to choose and no boundary condition to invent. Each
spot widens and sinks, and the plane between them warms up where the
two overlap. time=0.25 picks the recorded time that is drawn. Without
it the last one is drawn, when the two have nearly become one.
What pdemagic decided¶
The planner chose exact propagation in Fourier space
(fourier_propagator). The equation is not stepped: each of the 21
recorded times is exact in time, however far away it is. The box
reaches to about \(\pm 12\) along x and \(\pm 10.5\) along y, far enough
to hold the heat at the end of the time span, with 128 by 112 points.