Numerical Methods · Learn

Ritz-Galerkin in 2D

The 1D trial-function trick extends to a plate with almost no new machinery — a single integral becomes a double integral, and that's nearly the whole story. What changes is a subtlety in how you choose trial functions for a problem with more than one direction.

▶ Play the lab📖 Learn the theory

1The problem

A square plate, $-L

$$ \frac{\partial^2\theta}{\partial x^2}+\frac{\partial^2\theta}{\partial y^2}+\frac{\dot E_{gen}}{k}=0,\qquad \theta=0 \text{ on the boundary} $$

By symmetry, it's enough to work on the quadrant $0

2A trial function built for the boundary

Just as $(1-t)$ guaranteed the 1D trial functions vanished at $t=1$, here

$$ \varphi_0(x,y) = (L^2-x^2)(l^2-y^2) $$

is exactly zero along every edge of the plate, for any coefficient placed in front of it. The one-term approximation is $\theta(x,y)\approx a_0\varphi_0(x,y)$, and the Galerkin condition becomes a double integral:

$$ \int_0^L\!\!\int_0^l \left(a_0\,L[\varphi_0] + \frac{\dot E_{gen}}{k}\right)\varphi_0(x,y)\,dx\,dy = 0 $$

where $L[\varphi]=\partial^2\varphi/\partial x^2+\partial^2\varphi/\partial y^2$. Solving this single equation gives a clean closed form:

$$ a_0 = \frac{5\dot E_{gen}}{8k(l^2+L^2)} $$

For the source notes' plate ($\dot E_{gen}=10^6\text{ W/m}^3$, $k=275\text{ W/m·K}$, $L=l=1\text{ m}$), this gives $a_0\approx1136.4$, and the one-term solution is $\theta(x,y)\approx 1136.4(1-x^2)(1-y^2)$.

3Adding a second term — but only in one direction

The source notes extend the trial space with $\varphi_1(x,y) = (L^2-x^2)(l^2-y^2)x^2$ — flexibility in $x$, but none added in $y$. Splitting the combined integral by linearity gives two equations, one testing against $\varphi_0$ and one against $\varphi_1$:

$$ \int_0^L\!\!\int_0^l R(x,y)\,\varphi_i(x,y)\,dx\,dy = 0,\qquad i=0,1 $$

a $2\times2$ linear system in $a_0,a_1$, solved the same way as the 1D case (and the same way the Gauss-Seidel lab solves small systems directly).

4Checking it against an independent method

Rather than trust the algebra alone, this result was checked against a completely separate computation: a fine finite-difference relaxation solve of the exact same Poisson equation, using the same kind of sweep as the 2D Conduction lab. For the source notes' numbers, the finite-difference center value comes out near $1070$. The one-term Ritz-Galerkin value, $1136.4$, is about $6\%$ high; the two-term value, $1099.6$, is about $2.9\%$ high — a real improvement at the center.

▶ In the lab

Toggle between 1 and 2 terms and watch both the error-at-center stat improve and the heatmap lose its diagonal symmetry. Both things are true at once, and the second one is the more interesting lesson. Open the lab →

5The catch: a trial space that doesn't match the problem's symmetry

The true solution of this problem is symmetric under swapping $x$ and $y$ — the plate is square, the boundary conditions are identical in both directions, and the generation term has no preferred direction. But $\varphi_1$ only adds curvature-fitting power in $x$. Checked directly: the two-term approximation gives $\theta(0.5,0)\approx865$ but $\theta(0,0.5)\approx825$ — two values that the true solution requires to be equal, off by about 5% from each other. The center got better. Two symmetric off-axis points got pulled apart. Both are consequences of the same algebra, applied faithfully to a trial space that just doesn't carry the symmetry the true answer has.

The fix, if you wanted one, would be adding a matched $y^2$ term alongside $x^2$ — either as its own coefficient, or recognizing by symmetry that the plate needs $a_1(x^2+y^2)$ as a single combined trial function instead of $x^2$ alone. The source notes don't take this step; it's left here as an explicit, verified observation rather than silently patched, since the lesson — more terms help on average, not everywhere — is worth seeing rather than hiding.

Key takeaways

Worked from the site author's own teaching notes on the Ritz-Galerkin method. References cited there: Optimization by Variational Methods, Morton M. Denn, McGraw-Hill Book Company, 1969; Conduction Heat Transfer, V. Arpaci, Addison-Wesley Publishing Company, 1966.

EngineeringCandy · Learn · the theory behind the playground