A wave through a slit

A pulse of sound in a room with a partition: what passes the slit leaves it as a new wave that spreads to all sides.

import sympy as sp
import pdemagic as pm
from pdemagic import curves

x, y, t = sp.symbols("x y t", real=True)
w = sp.Function("w")(x, y, t)
corners = [(0, 0), (0.8, 0), (0.8, 0.6), (1, 0.6), (1, 0), (2.4, 0)]
corners += [(2.4, 1.6), (1, 1.6), (1, 1), (0.8, 1), (0.8, 1.6), (0, 1.6)]

room = pm.Problem(
    sp.Eq(w.diff(t, 2), pm.laplacian(w)),
    domain=pm.Region(x, y, curves.Polygon(*corners)),
    time=(t, 0, 1),
    initial={w: sp.exp(-30 * ((x - 0.4) ** 2 + (y - 0.8) ** 2)), w.diff(t): 0},
    boundary=sp.Eq(pm.normal_derivative(w), 0),
)
plan = pm.plan(room)
plan.method.degree = 6
sound = pm.solve(room, plan)
sound.plot()
film = sound.animate()
The figure that the example above draws. The figure that the example above draws. The figure that the example above draws. The figure that the example above draws.

What it shows

The wave equation on a region that one polygon bounds: a room of 2.4 by 1.6 with a partition that has a slit in the middle. The walls are hard: the slope of the pressure along the normal is zero on all of them. A pulse starts in the left part and spreads as a ring. The picture shows the last recorded time, when the walls of the left part have thrown the ring back and a part of it has passed the slit. Behind the slit it does not go on as a beam: it spreads as half a ring, as if the slit were its source. That is diffraction.

What pdemagic decided

The planner chose exact propagation in the modes of the shape (element_propagator), on 48 quadrilaterals. The modes come from one dense eigenproblem, which takes eight times as long for twice the points, so the plan lowers the degree of the polynomials from the planner’s 8 to 6, which makes the page five times faster. The diagnostic solution_tail is then about \(2\cdot10^{-2}\): enough for a picture, and not for digits. In a problem in time the mesh does not shrink towards the corners of the partition, which costs accuracy there as well.

More