- #1

- 7

- 0

## Homework Statement

Solve the Laplace equation in 2D by the method of separation of variables. The problem is to determine the potential in a long, square, hollow tube, where four walls have different potential. The boundary conditions are as follows:

[tex]V(x=0, y) = 0[/tex]

[tex]V(x=L, y) = 0[/tex]

[tex]V(x, y=0) = 0[/tex]

[tex]V(x, y=L) = V_0(x)[/tex]

Formulate a solution in terms of the fourier coefficients, in a way suitable for numerical calculation. Write a computer program that takes any function [itex]V_0(x) [/itex] and calculates [itex] V(x,y)[/itex] inside the square tube.

## Homework Equations

[tex] \nabla^2 V = 0 [/tex]

## The Attempt at a Solution

[tex]\frac{\partial^2V}{\partial x^2} + \frac{\partial^2V}{\partial y^2} = 0[/tex]

Separation of variables

[tex]V(x, y) = A(x)B(y)[/tex]

Laplace becomes

[tex]\frac{1}{A(x)}\frac{\partial^2A(x)}{\partial x^2}+\frac{1}{B(y)}\frac{\partial^2B(y)}{\partial y^2}=0[/tex]

which gives

[tex]\frac{\partial^2A(x)}{\partial x^2}= k^2A(x); \frac{\partial^2B(y)}{\partial y^2}= -k^2B(y) [/tex]

solving the ODE's gives

[tex]A(x)=A\sin{kx}+B\cos{kx}[/tex]

[tex]B(y)=Ce^{ky}+De^{-ky}[/tex]

[tex]V(x,y) = [A\sin{kx}+B\cos{kx}][Ce^{ky}+De^{-ky}][/tex]

Boundary conditions

[itex]V=0 [/itex] when [itex] x=0 \implies B=0.[/itex]

[itex]V=0 [/itex] when [itex] x=L \implies k=n\pi/L : n\in\mathbb{R}[/itex]

[itex]V=0 [/itex] when [itex] y=0 \implies C=-D.[/itex]

which gives

[tex]V(x,y) = A\sin{(\frac{n\pi x}{L})}[e^{\frac{n\pi y}{L}}-e^{-\frac{n\pi y}{L}}][/tex]

Here I think the term with the exponentials look a little fishy, but cant see a mistake so I move on. Laplace equation is linear, so we have

[tex]V(x,y) = \sum_{n=1}^{\infty}C_n\sin{(\frac{n\pi x}{L})}[e^{\frac{n\pi y}{L}}-e^{-\frac{n\pi y}{L}}][/tex]

[tex]V(x,L) = \sum_{n=1}^{\infty}C_n\sin{(\frac{n\pi x}{L})} = V_0(x)[/tex]

To find the fourier coefficients we multiply both sides by [itex]\sin{(n'\pi x/L)}[/itex] and integrate from [itex]0[/itex] to [itex]L[/itex]:

[tex]\sum_{n=1}^{\infty}C_n \int_0^L \sin{(\frac{n'\pi x}{L})}\sin{(\frac{n\pi x}{L})}dx = \int_0^LV_0(x)\sin{(\frac{n'\pi x}{L})}dx[/tex]

Solution to the integral on the left side is

[itex] 0[/itex], if [itex]n \ne n' [/itex]

[itex] L/2[/itex], if [itex]n = n' [/itex]

so the left side reduces to [itex](L/2)C_{n'}[/itex], which implies

[tex]C_n = \frac{2}{L}\int_0^LV_0(x)\sin{(\frac{n\pi x}{L})}dx[/tex]

So the solution to the problem is

[tex]V(x,y) = \sum_{n=1}^{\infty}C_n\sin{(\frac{n\pi x}{L})}[e^{\frac{n\pi y}{L}}-e^{-\frac{n\pi y}{L}}][/tex]

with [itex]C_n[/itex] as above. Correct?

I now want to write a python program that takes any function [itex] V_0(x)[/itex] and calculates [itex] V[/itex] inside the square tube. I first make it dimensionless by introducing [itex]\xi =x/L[/itex] and [itex]\gamma= y/L [/itex] as variables instead of [itex]x, y[/itex].

[tex]V(\xi,\gamma) = \sum_{n=1}^{\infty}C_n\sin{(n\pi \xi)}[e^{n\pi \gamma}-e^{-n\pi \gamma}][/tex]

[tex]C_n = \frac{2}{L}\int_0^1V_0(\xi)\sin{(n\pi \xi)}d\xi[/tex]

Is this correct? Otherwise, where did it all go wrong? And what should I do with the [itex] 2/L [/itex] term in [itex] C_n [/itex]? Maybe I ought to have introduced the new variables at the very beginning? Thanks.