Mathematics, Sciences, and Technologies

ODEs 7-5 (PDEs): Laplace Equation in Rectangular Coordinates

,

Motivation of the Laplace Equation

The form of the Laplace Equation

\begin{align}
\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0 \tag{1}
\end{align}

may be motivated in several ways. The first point of view is from the previous heat equation, which is readily generalized as

\begin{align}
\frac{\partial u}{\partial t} = \kappa (\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}) \tag{2}
\end{align}

in a two-dimensional space. Then, as time goes on, \( t \to \infty \), the temperature distribution may reach an equilibrium state so that it does not change anymore. As a result, \( \frac{\partial u}{\partial t} \) becomes zero and (2) leads to (1).

Another point of view is from electrostatics. The Gauss Law for electric charge states that

\begin{align}
\nabla \cdot \vec{E} = \frac{\rho}{\epsilon_0} \tag{3}
\end{align}

where \( \nabla = (\partial_x, \partial_y, \partial_z) \) is the del operator, \( \vec{E} \) is the electric field, \( \rho \) is the local charge density and \( \epsilon_0 \) is the permittivity. The electric field can be expressed as a gradient of the electric potential \( \phi \): \( \vec{E} = -\nabla \phi \). Furthermore, if there is no charge enclosed, \( \rho = 0 \) everywhere, then it becomes

\begin{align}
\nabla \cdot \nabla \phi = \nabla^2 \phi = \frac{\partial^2\phi}{\partial x^2} + \frac{\partial^2\phi}{\partial y^2} + \frac{\partial^2\phi}{\partial z^2} = 0 \tag{4}
\end{align}

the Laplace equation in a three-dimensional space, where the appropriate Laplacian operator in three-dimensional Cartesian coordinates is \( \nabla^2 = \frac{\partial^2}{\partial x^2} + \frac{\partial^2}{\partial y^2} + \frac{\partial^2}{\partial z^2} \).

Solving the Laplace Equation for a Rectangle

We will start from a simpler scenario first. The Laplace equation problem in a two-dimensional rectangular domain may be formulated as follows (see the schematic below):

\begin{align}
\left\{\begin{aligned}
\frac{\partial^2u}{\partial x^2} + \frac{\partial^2u}{\partial y^2} &= 0 \\
u(x,0) &= 0 & & \text{for \( 0 \leq x \leq L\)} \\
u(0,y) &= u(L,y) = 0 & & \text{for \( 0 \leq y \leq H\)} \\
u(x,H) &= f(x) & & \text{for \( 0 \leq x \leq L\)}
\end{aligned}\right. \tag{5}
\end{align}

The B.C.s are all Dirichlet for convenience (Neumann B.C. requires extra care and will only be discussed at the end of the chapter), and only the upper side B.C. can vary as \(f(x)\), while other sides are identically zero.

We now apply the same technique of separation of variables as before, assuming we can write

\begin{align}
u(x,y) = X(x) Y(y) \tag{6}
\end{align}

Substituting this into (5) yields

\begin{align}
X^{\prime\prime}(x) Y(y) + X(x) Y^{\prime\prime}(y) &= 0 \\
\frac{X^{\prime\prime}(x)}{X(x)} &= -\frac{Y^{\prime\prime}(y)}{Y(y)} \tag{7}
\end{align}

Separation of variables then implies that they must be equal to some constant \( -\lambda \), hence

\begin{align}
X^{\prime\prime} + \lambda X &= 0 \tag{8} \\
Y^{\prime\prime} -\lambda Y &= 0 \tag{9}
\end{align}

Due to the B.C.s on the left and right edges being both zero, the solution for (8) will be

\begin{align}
X_n = \sin(\sqrt{\lambda} x) = \sin(\frac{n\pi}{L}x), \lambda = \frac{n^2\pi^2}{L^2}, n = 1,2,\ldots \tag{10}
\end{align}

Meanwhile, the solution for (9) is then

\begin{align}
Y_n = \sinh(\sqrt{\lambda}y) = \sinh(\frac{n\pi}{L}y) \tag{11}
\end{align}

so as to match the bottom side B.C. The entire solution will then be the superposition from all possible \(n\):

\begin{align}
u(x,y) = \sum_{n=1}^{\infty} A_n \sin(\frac{n\pi}{L}x)\sinh(\frac{n\pi}{L}y) \tag{12}
\end{align}

Finally, we incorporate the top side B.C. At \(y = H\),

\begin{align}
u(x,H) = \sum_{n=1}^{\infty} A_n \sin(\frac{n\pi}{L}x)\sinh(\frac{n\pi}{L}H) = f(x) \tag{13}
\end{align}

To find the Fourier coefficients \(A_n\), we project (13) onto the orthogonal sine basis:

\begin{align}
A_n\sinh(\frac{n\pi}{L}H) = \frac{2}{L} \int_0^L f(\xi)\sin(\frac{n\pi}{L}\xi)d\xi \tag{14}
\end{align}

and plugging this back into (12), we have

\begin{align}
u(x,y) = \sum_{n=1}^{\infty} \frac{2}{L} (\int_0^L f(\xi)\sin(\frac{n\pi}{L}\xi)d\xi) \sin(\frac{n\pi}{L}x)\frac{\sinh(\frac{n\pi}{L}y)}{\sinh(\frac{n\pi}{L}H)} \tag{15}
\end{align}

In the general case where all four edges have non-zero B.C.s, we can decompose it into four sub-cases, each of which has only one B.C. specified. Then we can apply the above formula (15) and its variants, and superpose the solutions of the sub-cases to produce the total solution. Particularly, if it is the left B.C. imposed in (5) instead of the top one, \( u(0,y) = g(y) \), then the appropriate form of (15) should look like

\begin{align}
u(x,y) = \sum_{n=1}^{\infty} \frac{2}{H} (\int_0^H g(\xi)\sin(\frac{n\pi}{H}\xi)d\xi) \sin(\frac{n\pi}{H}y)\frac{\sinh(\frac{n\pi}{H}(L-x))}{\sinh(\frac{n\pi}{H}L)} \tag{16}
\end{align}

When a Forcing is Present

If a forcing term is present but all B.C.s are homogeneous, so that now

\begin{align}
\left\{\begin{aligned}
\frac{\partial^2u}{\partial x^2} + \frac{\partial^2u}{\partial y^2} &= f(x,y) \\
u(x,0) &= u(x,H) = 0 & & \text{for \( 0 \leq x \leq L\)} \\
u(0,y) &= u(L,y) = 0 & & \text{for \( 0 \leq y \leq H\)} \\
\end{aligned}\right. \tag{17}
\end{align}

We can borrow the idea from the last tutorial to assume that the particular solution will look like

\begin{align}
u(x,y) = \sum_{n=1}^{\infty} v_n(y) \sin(\frac{n\pi}{L}x) \tag{18}
\end{align}

Substituting this into (17), we obtain

\begin{align}
-\sum_{n=1}^{\infty} \frac{n^2\pi^2}{L^2} v_n(y) \sin(\frac{n\pi}{L}x) + \sum_{n=1}^{\infty} v_n^{\prime\prime}(y) \sin(\frac{n\pi}{L}x) = f(x,y) \tag{19}
\end{align}

By taking orthogonal projections onto the sine basis along the \(x\)-direction, we have

\begin{align}
-\frac{n^2\pi^2}{L^2} v_n(y) + v_n^{\prime\prime}(y) = \frac{2}{L} \int_0^L f(x,y) \sin(\frac{n\pi}{L}x) dx \tag{20}
\end{align}

This is a second-order constant-coefficient ODE with a source term, which can be solved with the technique of Green’s function as explained in this tutorial.

Exercise

Solve the Laplace equation (1) with the B.C.s of

\begin{align}
\left\{\begin{aligned}
u(x,0) &= -\sin(2\pi x/L) \\
u(x,H) &= 0 \\
u(0,y) &= 1 \\
u(L,y) &= y  
\end{aligned}\right. \tag{21}
\end{align}

Answer

We can superpose each solution coming from the four boundaries. The appropriate solution form for the left boundary is (16), while for the right boundary it is

\begin{align}
u(x,y) = \sum_{n=1}^{\infty} \frac{2}{H} (\int_0^H w(\xi)\sin(\frac{n\pi}{H}\xi)d\xi) \sin(\frac{n\pi}{H}y)\frac{\sinh(\frac{n\pi}{H}x)}{\sinh(\frac{n\pi}{H}L)}
\end{align}

and that for the bottom boundary is

\begin{align}
u(x,y) = \sum_{n=1}^{\infty} \frac{2}{L} (\int_0^L f(\xi)\sin(\frac{n\pi}{L}\xi)d\xi) \sin(\frac{n\pi}{L}x)\frac{\sinh(\frac{n\pi}{L}(H-y))}{\sinh(\frac{n\pi}{L}H)}
\end{align}

Note that we don’t have any contribution from the top boundary, which is identically zero. Now we compute the Fourier coefficients for each of the three cases. The right boundary gives

\begin{align}
&\quad \frac{2}{H} \left(\int_0^H \xi \sin(\frac{n\pi \xi}{H}) d\xi \right) \\
&= \frac{2}{H} \left(-\left[\frac{\xi H}{n\pi} \cos(\frac{n\pi \xi}{H})\right]_0^H + \int_0^H \frac{H}{n\pi} \cos(\frac{n\pi \xi}{H}) d\xi \right) \\
&= \frac{2}{H} \left(-\frac{H^2}{n\pi} \cos(n\pi) + \left[\frac{H^2}{n^2\pi^2}\sin(\frac{n\pi \xi}{H})\right]_0^H \right) \\
&= \frac{2}{H} \left(-\frac{H^2}{n\pi} (-1)^n + 0 \right) \\
&= -\frac{2H}{n\pi}(-1)^n
\end{align}

and the left boundary yields

\begin{align}
&\quad \frac{2}{H} \left(\int_0^H \sin(\frac{n\pi \xi}{H}) d\xi \right) \\
&= -\frac{2}{H}\left[\frac{H}{n\pi} \cos(\frac{n\pi \xi}{H})\right]_0^H \\
&= -\frac{2}{n\pi} ((-1)^n -1)
\end{align}

Finally, the bottom boundary is simply the Fourier sine mode when \( n=2 \), which means that the coefficients are \( B_2 = -1 \), and \( B_n = 0 \) for other values of \( n \). The full solution is therefore
\begin{align}
u &= -\sin(\frac{2\pi x}{L}) \frac{\sinh(\frac{2\pi (H-y)}{L})}{\sinh(\frac{2\pi H}{L})} \\
&\quad -\sum_{n = 1}^{\infty} \frac{2H}{n\pi}(-1)^n \frac{\sinh(\frac{n\pi x}{H})}{\sinh(\frac{n\pi L}{H})}\sin(\frac{n\pi y}{H}) \\
&\quad -\sum_{n = 1}^{\infty} \frac{2}{n\pi} ((-1)^n -1) \frac{\sinh(\frac{n\pi (L-x)}{H})}{\sinh(\frac{n\pi L}{H})}\sin(\frac{n\pi y}{H})
\end{align}

Leave a Reply

I’m Benjamin

Welcome to my Mathematical World! Here you can find posts and tutorials related to applied topics like Linear Algebra, Calculus, Differential Equations, and Programming. Feel free to leave comments and suggestions!

Discover more from Benjamin's Maths World

Subscribe now to keep reading and get access to the full archive.

Continue reading