# A waveguide with a ridge The wave that a metal pipe with a ridge carries first: the lowest mode of its cross section that is not constant. ```python import sympy as sp import pdemagic as pm from pdemagic import curves x, y = sp.symbols("x y", real=True) k = sp.Symbol("k") field = sp.Function("field")(x, y) wall = curves.Polygon( (0, 0), (2, 0), (2, 1), (1.25, 1), (1.25, 0.4), (0.75, 0.4), (0.75, 1), (0, 1) ) ridged = pm.Problem( sp.Eq(-pm.laplacian(field), k * field), domain=pm.Region(x, y, wall), boundary=sp.Eq(pm.normal_derivative(field), 0), eigenvalue=(k, 2), ) pm.solve(ridged).plot(state=1) ``` ## What it shows An eigenproblem on a shape: $-\nabla^2 u = k\,u$ on the cross section of the pipe, with no slope on the wall. `eigenvalue=(k, 2)` asks for the lowest two modes. The lowest of all is the constant, with the eigenvalue zero, so the picture shows the next one, `state=1`. It has one sign in the left chamber and the other in the right, and it changes in the gap under the ridge. Its eigenvalue is 1.03. Without the ridge it would be $(\pi/2)^2 \approx 2.47$: a ridge lowers the frequency from which the pipe carries waves. ## What pdemagic decided The planner chose the modes of the shape on spectral elements (`element_modes`). A mode has a singularity at the two corners of the ridge that point into the pipe, and the elements shrink towards each of them in 18 layers: 2256 quadrilaterals in all. The degree was raised until the two eigenvalues stood still to $10^{-9}$ of their size. The modes are given on 129 by 65 points. ## More - [Modes of cavities, drums and waveguides](../topics/modes.md) - [Ask for more modes](../howto/ask-for-more-modes.md) - [The modes of a shape](../methods/element-modes.md) - [What is solved on shapes in the plane](../ref/equations-regions.md)