A very long beam with a quadratic cross-section $0\le x\le L$, $0\le y\le L$ lies on a plane with a temperature of 0 degrees. The other surfaces of the beam are in contact with air which holds 10 degrees temperature. Determine the stationary temperature distribution in the beam, assuming it is of infinite length $-\infty\le z\le \infty$.
The solution:
I am sure that there are two ways to solve this, one using the heat equation, and one using the Laplace equation.
The heat equation requires a time-dimension, which is not given, however they term "stationary" says it all. $\frac{\partial}{\partial t}=0$. So the heat equation for this should be:
$$\nabla^2 u=0$$
which in fact becomes a Laplace equation, where $u=u(x,y,z)$.
There is a problem with ansatz, it is not easy to make an ansatz here, but I shall try. Consider that the x and y dimensions at the origin are both in contact with a zero-temperature surface and a 10-degree temperature air, then we could consider both to be non-zero at the origin, if we use Kelvin degrees. So we assume both are cosinoid, and therefore have the ansatz:
$$u(x,y,z)=\cos\frac{n\pi}{L}x\cos\frac{m\pi}{L}y\cdot u(z)$$
The operator is then:
$$\nabla^2\bigg(\cos\frac{n\pi}{L}x\cos\frac{m\pi}{L}y\cdot u(z)\bigg):=-\frac{\cos\frac{m\pi x}{L}\cos\frac{n\pi x}{L}\big(\pi^2(m^2+n^2)\big)}{L^2}u(z) -u_{zz} $$ This gives
Insert in the PDE:
$$u_{zz} +\frac{\cos\frac{m\pi x}{L}\cos\frac{n\pi x}{L}(\pi^2(m^2+n^2)\big)}{L^2}u(z) =0$$
Let $$f(x,y)=\frac{\cos\frac{m\pi x}{L}\cos\frac{n\pi x}{L}\big(\pi^2(m^2+n^2)\big)}{L^2}$$, then we have the "solution":
$$u(z)=C_1\cos (f(x,y)\cdot z)+C_2\sin(f(x,y)\cdot z)$$
Insert in the original ansatz and expand:
$$u(x,y,z)=\cos\frac{n\pi}{L}x\cos\frac{m\pi}{L}y\cdot \big(C_1\cos \bigg(\frac{\cos\frac{m\pi x}{L}\cos\frac{n\pi x}{L}\big(\pi^2(m^2+n^2)\big)}{L^2}\cdot z\bigg)+C_2\sin\bigg(\frac{\cos\frac{m\pi x}{L}\cos\frac{n\pi x}{L}\big(\pi^2(m^2+n^2)\big)}{L^2}\cdot z\bigg)$$
Looking only at a level curve of $u(x,y,z)$, with $z=0$, it looks like this
But the function $u(x,y,z)$ is weird, because each time a level curve is made with x or y dimension equal to zero, then the z-term becomes 1.
In fact, considering a similar ODE problem:
$$y''+\cos xy'=0$$ gives a rather exotic solution, so solving the given PDE must be impossible, analytically.
Does anyone have an idea on how to solve this problem?
Thanks




The BVP is well posed and the solution may be represented as an infinite sum. The mistake is in the ansatz $u(x,y)=u(y)\sin(n\pi x/L)$, because the BCs at $x=0$ and $x=L$ are non-homogeneous.
Let $u(x,y)=v(x,y)+C$, with $C=10$. Now $v$ also satisfies Laplace's equation in the square but with the simpler BCs
$$\tag{1} v(x,0)=-C\qquad,\qquad v(x,L)=v(0,y)=v(L,y)=0 $$
Solving (1) by separation of variables $v(x,y)=X(x)Y(y)$ is straightforward see eg here . The result is
$$\tag{2} v(x,y)=\sum\limits_{n=1}^\infty c_n\sin(n\pi x/L)\sinh(n\pi-n\pi y/L)\\ c_n=\frac{2}{L\sinh(n\pi)}\int\limits_0^L dx \ \sin(n\pi x/L)v(x,0) $$
With $v(x,0)=-C$ we find
$$\tag{3} c_n=-\frac{2C}{n\pi \sinh(n\pi)}\left(1-(-1)^n\right) $$
Inserting (3) into (2) we have
$$\tag{4} v(x,y)=-4C\sum\limits_{n=1,3,5\cdots}\frac{\sinh(n\pi-n\pi y/L)}{n\pi\sinh(n\pi)}\sin(n\pi x/L) $$
Before plotting, it's useful to switch to dimensionless variables. Define $\chi=x/L$, $\eta=y/L$, $\phi=u/C$. The BVP is now posed on $0<\chi<1$, $0<\eta<1$, with BCs $\phi=1$ and $\phi=0$. The solution is
$$\tag{5} \phi(\chi,\eta)=1-\sum\limits_{n=1,3,5,\cdots} \frac{4 \sinh(n\pi-n\pi \eta)}{n\pi \sinh(n\pi)}\sin(n\pi \chi) $$
Here is a plot of the $n=1$ term (left) and the partial sum to $11$ terms (right)