Heat in a shape¶
A plate in the shape of an ellipse with a hole, warmed at one end: the heat flows around the hole, and nothing leaves.
import sympy as sp
import pdemagic as pm
from pdemagic import curves
x, y, t = sp.symbols("x y t", real=True)
T = sp.Function("T")(x, y, t)
rim = curves.Ellipse((0, 0), (1.5, 1))
hole = curves.Circle((0.3, 0), 0.5)
plate = pm.Problem(
sp.Eq(T.diff(t), pm.laplacian(T)),
domain=pm.Region(x, y, rim, hole),
time=(t, 0, 0.5),
initial={T: sp.exp(-8 * ((x + 1) ** 2 + y**2))},
boundary=sp.Eq(pm.normal_derivative(T), 0),
)
plan = pm.plan(plate)
plan.method.degree = 4
pm.solve(plate, plan).plot(time=0.15)
What it shows¶
The heat equation on a region of your own: what two closed curves bound, an ellipse and a circle inside it, which is a hole. The condition gives the slope along the normal, and makes it zero: the rim and the edge of the hole are insulated. The plate starts with a warm spot at its left end. The picture shows it at \(t = 0.15\), when the heat has reached the hole and passes it on both sides. Behind the hole the plate is still cold. No heat is lost: the integral of the temperature over the plate stays what it was, to twelve digits.
What pdemagic decided¶
The planner chose exact propagation in the modes of the shape
(element_propagator): the plate is cut into 60 quadrilaterals, the
modes come from one dense eigenproblem, and each of the 21 recorded
times is exact in time. That eigenproblem takes eight times as long for
twice the points, so the plan lowers the degree of the polynomials from
the planner’s 6 to 4, which is nine times faster. The solution that is
drawn then differs from the one at the degree 6 in its fifth digit. It
is given on 129 by 86 points over the rectangle that holds the plate.